From 3ba49277d994cc1899e6f666ad0ea439a57d1ce7 Mon Sep 17 00:00:00 2001 From: leak Date: Mon, 12 May 2014 19:12:06 +0200 Subject: Add support for Boost 1.55 --- src/server/authserver/CMakeLists.txt | 1 + src/server/worldserver/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+) (limited to 'src') diff --git a/src/server/authserver/CMakeLists.txt b/src/server/authserver/CMakeLists.txt index 4391ac0450a..6d11ce21c00 100644 --- a/src/server/authserver/CMakeLists.txt +++ b/src/server/authserver/CMakeLists.txt @@ -80,6 +80,7 @@ target_link_libraries(authserver ${OPENSSL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${ACE_LIBRARY} + ${Boost_LIBRARIES} ) if( WIN32 ) diff --git a/src/server/worldserver/CMakeLists.txt b/src/server/worldserver/CMakeLists.txt index d1d2ef11848..f6123292343 100644 --- a/src/server/worldserver/CMakeLists.txt +++ b/src/server/worldserver/CMakeLists.txt @@ -177,6 +177,7 @@ target_link_libraries(worldserver ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} + ${Boost_LIBRARIES} ) if( WIN32 ) -- cgit v1.2.3 From 35c2e972076b1f039ab17ddd35f2d08c125ce383 Mon Sep 17 00:00:00 2001 From: leak Date: Tue, 13 May 2014 22:41:59 +0200 Subject: Replace ACE signal handling with Boost --- src/server/authserver/Main.cpp | 44 ++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index d1b2b614037..0ccad3d1d8a 100644 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -26,10 +26,9 @@ #include #include -#include -#include #include #include +#include #include "Common.h" #include "Database/DatabaseEnv.h" @@ -58,21 +57,20 @@ bool stopEvent = false; // Setting it to tru LoginDatabaseWorkerPool LoginDatabase; // Accessor to the authserver database -/// Handle authserver's termination signals -class AuthServerSignalHandler : public Trinity::SignalHandler -{ -public: - virtual void HandleSignal(int sigNum) - { - switch (sigNum) - { - case SIGINT: - case SIGTERM: - stopEvent = true; - break; - } - } -}; +void SignalHandler(const boost::system::error_code& error, int signalNumber) +{ + TC_LOG_ERROR("server.authserver", "SIGNAL HANDLER WORKING"); + if (!error) + { + switch (signalNumber) + { + case SIGINT: + case SIGTERM: + stopEvent = true; + break; + } + } +} /// Print out the usage string for this program on the console. void usage(const char* prog) @@ -170,13 +168,11 @@ extern int main(int argc, char** argv) return 1; } - // Initialize the signal handlers - AuthServerSignalHandler SignalINT, SignalTERM; + boost::asio::io_service io_service; - // Register authservers's signal handlers - ACE_Sig_Handler Handler; - Handler.register_handler(SIGINT, &SignalINT); - Handler.register_handler(SIGTERM, &SignalTERM); + boost::asio::signal_set signals(io_service, SIGINT, SIGTERM); + + signals.async_wait(SignalHandler); #if defined(_WIN32) || defined(__linux__) @@ -259,6 +255,8 @@ extern int main(int argc, char** argv) if (ACE_Reactor::instance()->run_reactor_event_loop(interval) == -1) break; + io_service.run(); + if ((++loopCounter) == numLoops) { loopCounter = 0; -- cgit v1.2.3 From 5a363ee0e1556b58ad1d16ce2b78ae5f92e065ea Mon Sep 17 00:00:00 2001 From: leak Date: Sat, 17 May 2014 20:27:39 +0200 Subject: Replace authserver ACE related code with Boost/C++11 --- cmake/macros/ConfigureBoost.cmake | 15 +- src/server/authserver/Main.cpp | 240 +++-- src/server/authserver/Server/AuthServer.cpp | 40 + src/server/authserver/Server/AuthServer.h | 44 + src/server/authserver/Server/AuthSession.cpp | 915 +++++++++++++++++++ src/server/authserver/Server/AuthSession.h | 85 ++ src/server/authserver/Server/AuthSocket.cpp | 1207 -------------------------- src/server/authserver/Server/AuthSocket.h | 83 -- src/server/authserver/Server/RealmAcceptor.h | 70 -- src/server/authserver/Server/RealmSocket.cpp | 291 ------- src/server/authserver/Server/RealmSocket.h | 80 -- src/server/worldserver/Master.cpp | 1 - 12 files changed, 1215 insertions(+), 1856 deletions(-) create mode 100644 src/server/authserver/Server/AuthServer.cpp create mode 100644 src/server/authserver/Server/AuthServer.h create mode 100644 src/server/authserver/Server/AuthSession.cpp create mode 100644 src/server/authserver/Server/AuthSession.h delete mode 100644 src/server/authserver/Server/AuthSocket.cpp delete mode 100644 src/server/authserver/Server/AuthSocket.h delete mode 100644 src/server/authserver/Server/RealmAcceptor.h delete mode 100644 src/server/authserver/Server/RealmSocket.cpp delete mode 100644 src/server/authserver/Server/RealmSocket.h (limited to 'src') diff --git a/cmake/macros/ConfigureBoost.cmake b/cmake/macros/ConfigureBoost.cmake index 320a7cb30d4..c2cd7c43360 100644 --- a/cmake/macros/ConfigureBoost.cmake +++ b/cmake/macros/ConfigureBoost.cmake @@ -1,3 +1,13 @@ +macro(get_WIN32_WINNT version) + if (WIN32 AND CMAKE_SYSTEM_VERSION) + set(ver ${CMAKE_SYSTEM_VERSION}) + string(REPLACE "." "" ver ${ver}) + string(REGEX REPLACE "([0-9])" "0\\1" ver ${ver}) + + set(${version} "0x${ver}") + endif() +endmacro() + if(WIN32) set(BOOST_DEBUG ON) if(DEFINED ENV{BOOST_ROOT}) @@ -12,9 +22,12 @@ if(WIN32) set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_MULTITHREADED ON) set(Boost_USE_STATIC_RUNTIME OFF) + + get_WIN32_WINNT(ver) + add_definitions(-D_WIN32_WINNT=${ver}) endif() -find_package(Boost 1.55 REQUIRED atomic chrono date_time exception system thread) +find_package(Boost 1.55 REQUIRED atomic chrono date_time exception regex system thread) if(Boost_FOUND) include_directories(${Boost_INCLUDE_DIRS}) diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index 0ccad3d1d8a..c8be23ca524 100644 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -24,11 +24,13 @@ * authentication server */ -#include -#include #include #include -#include +#include +#include +#include +#include +#include #include "Common.h" #include "Database/DatabaseEnv.h" @@ -36,9 +38,9 @@ #include "Log.h" #include "SystemConfig.h" #include "Util.h" -#include "SignalHandler.h" #include "RealmList.h" -#include "RealmAcceptor.h" +#include "AuthServer.h" + #ifdef __linux__ #include @@ -52,24 +54,41 @@ bool StartDB(); void StopDB(); +void SetProcessPriority(); -bool stopEvent = false; // Setting it to true stops the server +boost::asio::io_service _ioService; +boost::asio::deadline_timer _dbPingTimer(_ioService); +uint32 _dbPingInterval; LoginDatabaseWorkerPool LoginDatabase; // Accessor to the authserver database -void SignalHandler(const boost::system::error_code& error, int signalNumber) -{ - TC_LOG_ERROR("server.authserver", "SIGNAL HANDLER WORKING"); - if (!error) - { +using boost::asio::ip::tcp; + + +void SignalHandler(const boost::system::error_code& error, int signalNumber) +{ + TC_LOG_ERROR("server.authserver", "SIGNAL HANDLER WORKING"); + if (!error) + { switch (signalNumber) { case SIGINT: case SIGTERM: - stopEvent = true; + _ioService.stop(); break; } - } + } +} + +void KeepDatabaseAliveHandler(const boost::system::error_code& error) +{ + if (!error) + { + TC_LOG_INFO("server.authserver", "Ping MySQL to keep connection alive"); + LoginDatabase.KeepAlive(); + + _dbPingTimer.expires_from_now(boost::posix_time::minutes(_dbPingInterval)); + } } /// Print out the usage string for this program on the console. @@ -81,7 +100,7 @@ void usage(const char* prog) } /// Launch the auth server -extern int main(int argc, char** argv) +int main(int argc, char** argv) { // Command line parsing to get the configuration file name char const* configFile = _TRINITY_REALM_CONFIG; @@ -115,14 +134,6 @@ extern int main(int argc, char** argv) TC_LOG_WARN("server.authserver", "%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); -#if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) - ACE_Reactor::instance(new ACE_Reactor(new ACE_Dev_Poll_Reactor(ACE::max_handles(), 1), 1), true); -#else - ACE_Reactor::instance(new ACE_Reactor(new ACE_TP_Reactor(), true), true); -#endif - - TC_LOG_DEBUG("server.authserver", "Max allowed open files is %d", ACE::max_handles()); - // authserver PID file creation std::string pidFile = sConfigMgr->GetStringDefault("PidFile", ""); if (!pidFile.empty()) @@ -149,121 +160,32 @@ extern int main(int argc, char** argv) } // Launch the listening network socket - RealmAcceptor acceptor; - int32 rmport = sConfigMgr->GetIntDefault("RealmServerPort", 3724); - if (rmport < 0 || rmport > 0xFFFF) + int32 port = sConfigMgr->GetIntDefault("RealmServerPort", 3724); + if (port < 0 || port > 0xFFFF) { TC_LOG_ERROR("server.authserver", "Specified port out of allowed range (1-65535)"); return 1; } - std::string bind_ip = sConfigMgr->GetStringDefault("BindIP", "0.0.0.0"); + std::string bindIp = sConfigMgr->GetStringDefault("BindIP", "0.0.0.0"); - ACE_INET_Addr bind_addr(uint16(rmport), bind_ip.c_str()); - - if (acceptor.open(bind_addr, ACE_Reactor::instance(), ACE_NONBLOCK) == -1) - { - TC_LOG_ERROR("server.authserver", "Auth server can not bind to %s:%d", bind_ip.c_str(), rmport); - return 1; - } - - boost::asio::io_service io_service; - - boost::asio::signal_set signals(io_service, SIGINT, SIGTERM); + AuthServer authServer(_ioService, bindIp, port); + // Set signal handlers + boost::asio::signal_set signals(_ioService, SIGINT, SIGTERM); signals.async_wait(SignalHandler); -#if defined(_WIN32) || defined(__linux__) - - ///- Handle affinity for multiple processors and process priority - uint32 affinity = sConfigMgr->GetIntDefault("UseProcessors", 0); - bool highPriority = sConfigMgr->GetBoolDefault("ProcessPriority", false); - -#ifdef _WIN32 // Windows - - HANDLE hProcess = GetCurrentProcess(); - if (affinity > 0) - { - ULONG_PTR appAff; - ULONG_PTR sysAff; - - if (GetProcessAffinityMask(hProcess, &appAff, &sysAff)) - { - // remove non accessible processors - ULONG_PTR currentAffinity = affinity & appAff; - - if (!currentAffinity) - TC_LOG_ERROR("server.authserver", "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the authserver. Accessible processors bitmask (hex): %x", affinity, appAff); - else if (SetProcessAffinityMask(hProcess, currentAffinity)) - TC_LOG_INFO("server.authserver", "Using processors (bitmask, hex): %x", currentAffinity); - else - TC_LOG_ERROR("server.authserver", "Can't set used processors (hex): %x", currentAffinity); - } - } - - if (highPriority) - { - if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS)) - TC_LOG_INFO("server.authserver", "authserver process priority class set to HIGH"); - else - TC_LOG_ERROR("server.authserver", "Can't set authserver process priority class."); - } - -#else // Linux - - if (affinity > 0) - { - cpu_set_t mask; - CPU_ZERO(&mask); - - for (unsigned int i = 0; i < sizeof(affinity) * 8; ++i) - if (affinity & (1 << i)) - CPU_SET(i, &mask); - - if (sched_setaffinity(0, sizeof(mask), &mask)) - TC_LOG_ERROR("server.authserver", "Can't set used processors (hex): %x, error: %s", affinity, strerror(errno)); - else - { - CPU_ZERO(&mask); - sched_getaffinity(0, sizeof(mask), &mask); - TC_LOG_INFO("server.authserver", "Using processors (bitmask, hex): %lx", *(__cpu_mask*)(&mask)); - } - } - - if (highPriority) - { - if (setpriority(PRIO_PROCESS, 0, PROCESS_HIGH_PRIORITY)) - TC_LOG_ERROR("server.authserver", "Can't set authserver process priority class, error: %s", strerror(errno)); - else - TC_LOG_INFO("server.authserver", "authserver process priority class set to %i", getpriority(PRIO_PROCESS, 0)); - } - -#endif -#endif + SetProcessPriority(); - // maximum counter for next ping - uint32 numLoops = (sConfigMgr->GetIntDefault("MaxPingTime", 30) * (MINUTE * 1000000 / 100000)); - uint32 loopCounter = 0; - - // Wait for termination signal - while (!stopEvent) - { - // dont move this outside the loop, the reactor will modify it - ACE_Time_Value interval(0, 100000); - if (ACE_Reactor::instance()->run_reactor_event_loop(interval) == -1) - break; + _dbPingInterval = sConfigMgr->GetIntDefault("MaxPingTime", 30); - io_service.run(); + _dbPingTimer.expires_from_now(boost::posix_time::seconds(_dbPingInterval)); + _dbPingTimer.async_wait(KeepDatabaseAliveHandler); - if ((++loopCounter) == numLoops) - { - loopCounter = 0; - TC_LOG_INFO("server.authserver", "Ping MySQL to keep connection alive"); - LoginDatabase.KeepAlive(); - } - } + // Start the io service + _ioService.run(); // Close the Database Pool and library StopDB(); @@ -272,6 +194,7 @@ extern int main(int argc, char** argv) return 0; } + /// Initialize connection to the database bool StartDB() { @@ -316,3 +239,74 @@ void StopDB() LoginDatabase.Close(); MySQL::Library_End(); } + +void SetProcessPriority() +{ +#if defined(_WIN32) || defined(__linux__) + + ///- Handle affinity for multiple processors and process priority + uint32 affinity = sConfigMgr->GetIntDefault("UseProcessors", 0); + bool highPriority = sConfigMgr->GetBoolDefault("ProcessPriority", false); + +#ifdef _WIN32 // Windows + + HANDLE hProcess = GetCurrentProcess(); + if (affinity > 0) + { + ULONG_PTR appAff; + ULONG_PTR sysAff; + + if (GetProcessAffinityMask(hProcess, &appAff, &sysAff)) + { + // remove non accessible processors + ULONG_PTR currentAffinity = affinity & appAff; + + if (!currentAffinity) + TC_LOG_ERROR("server.authserver", "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the authserver. Accessible processors bitmask (hex): %x", affinity, appAff); + else if (SetProcessAffinityMask(hProcess, currentAffinity)) + TC_LOG_INFO("server.authserver", "Using processors (bitmask, hex): %x", currentAffinity); + else + TC_LOG_ERROR("server.authserver", "Can't set used processors (hex): %x", currentAffinity); + } + } + + if (highPriority) + { + if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS)) + TC_LOG_INFO("server.authserver", "authserver process priority class set to HIGH"); + else + TC_LOG_ERROR("server.authserver", "Can't set authserver process priority class."); + } + +#else // Linux + + if (affinity > 0) + { + cpu_set_t mask; + CPU_ZERO(&mask); + + for (unsigned int i = 0; i < sizeof(affinity) * 8; ++i) + if (affinity & (1 << i)) + CPU_SET(i, &mask); + + if (sched_setaffinity(0, sizeof(mask), &mask)) + TC_LOG_ERROR("server.authserver", "Can't set used processors (hex): %x, error: %s", affinity, strerror(errno)); + else + { + CPU_ZERO(&mask); + sched_getaffinity(0, sizeof(mask), &mask); + TC_LOG_INFO("server.authserver", "Using processors (bitmask, hex): %lx", *(__cpu_mask*)(&mask)); + } + } + + if (highPriority) + { + if (setpriority(PRIO_PROCESS, 0, PROCESS_HIGH_PRIORITY)) + TC_LOG_ERROR("server.authserver", "Can't set authserver process priority class, error: %s", strerror(errno)); + else + TC_LOG_INFO("server.authserver", "authserver process priority class set to %i", getpriority(PRIO_PROCESS, 0)); + } + +#endif +#endif +} \ No newline at end of file diff --git a/src/server/authserver/Server/AuthServer.cpp b/src/server/authserver/Server/AuthServer.cpp new file mode 100644 index 00000000000..a699734be79 --- /dev/null +++ b/src/server/authserver/Server/AuthServer.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2008-2014 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "AuthServer.h" +#include "AuthSession.h" + +#include +#include + +using boost::asio::ip::tcp; + +void AuthServer::AsyncAccept() +{ + _acceptor.async_accept(_socket, [this](boost::system::error_code error) + { + if (!error) + { + std::make_shared(std::move(_socket))->Start(); + } + + AsyncAccept(); + }); +} + + + diff --git a/src/server/authserver/Server/AuthServer.h b/src/server/authserver/Server/AuthServer.h new file mode 100644 index 00000000000..0496326ee7b --- /dev/null +++ b/src/server/authserver/Server/AuthServer.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2008-2014 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef __AUTHSERVER_H__ +#define __AUTHSERVER_H__ + +#include + +using boost::asio::ip::tcp; + +class AuthServer +{ +public: + AuthServer(boost::asio::io_service& ioService, std::string bindIp, int port) : _socket(ioService), _acceptor(ioService, tcp::endpoint(tcp::v4(), port)) + { + tcp::endpoint endpoint(boost::asio::ip::address::from_string(bindIp), port); + + _acceptor = tcp::acceptor(ioService, endpoint); + + AsyncAccept(); + }; + +private: + void AsyncAccept(); + + tcp::acceptor _acceptor; + tcp::socket _socket; +}; + +#endif /* __AUTHSERVER_H__ */ diff --git a/src/server/authserver/Server/AuthSession.cpp b/src/server/authserver/Server/AuthSession.cpp new file mode 100644 index 00000000000..cb78336f2d3 --- /dev/null +++ b/src/server/authserver/Server/AuthSession.cpp @@ -0,0 +1,915 @@ +/* +* Copyright (C) 2008-2014 TrinityCore +* Copyright (C) 2005-2009 MaNGOS +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program. If not, see . +*/ + +#include +#include +#include +#include +#include "ByteBuffer.h" +#include "AuthCodes.h" +#include "Database/DatabaseEnv.h" +#include "SHA1.h" +#include "openssl/crypto.h" +#include "Configuration/Config.h" +#include "RealmList.h" + +using boost::asio::ip::tcp; + +enum eAuthCmd +{ + AUTH_LOGON_CHALLENGE = 0x00, + AUTH_LOGON_PROOF = 0x01, + AUTH_RECONNECT_CHALLENGE = 0x02, + AUTH_RECONNECT_PROOF = 0x03, + REALM_LIST = 0x10, + XFER_INITIATE = 0x30, + XFER_DATA = 0x31, + XFER_ACCEPT = 0x32, + XFER_RESUME = 0x33, + XFER_CANCEL = 0x34 +}; + +enum eStatus +{ + STATUS_CONNECTED = 0, + STATUS_AUTHED +}; + +#pragma pack(push, 1) + +typedef struct AUTH_LOGON_CHALLENGE_C +{ + uint8 cmd; + uint8 error; + uint16 size; + uint8 gamename[4]; + uint8 version1; + uint8 version2; + uint8 version3; + uint16 build; + uint8 platform[4]; + uint8 os[4]; + uint8 country[4]; + uint32 timezone_bias; + uint32 ip; + uint8 I_len; + uint8 I[1]; +} sAuthLogonChallenge_C; + +typedef struct AUTH_LOGON_PROOF_C +{ + uint8 cmd; + uint8 A[32]; + uint8 M1[20]; + uint8 crc_hash[20]; + uint8 number_of_keys; + uint8 securityFlags; +} sAuthLogonProof_C; + +typedef struct AUTH_LOGON_PROOF_S +{ + uint8 cmd; + uint8 error; + uint8 M2[20]; + uint32 unk1; + uint32 unk2; + uint16 unk3; +} sAuthLogonProof_S; + +typedef struct AUTH_LOGON_PROOF_S_OLD +{ + uint8 cmd; + uint8 error; + uint8 M2[20]; + uint32 unk2; +} sAuthLogonProof_S_Old; + +typedef struct AUTH_RECONNECT_PROOF_C +{ + uint8 cmd; + uint8 R1[16]; + uint8 R2[20]; + uint8 R3[20]; + uint8 number_of_keys; +} sAuthReconnectProof_C; + +#pragma pack(pop) + + +typedef struct AuthHandler +{ + eAuthCmd cmd; + uint32 status; + size_t packetSize; + bool (AuthSession::*handler)(); +} AuthHandler; + +#define BYTE_SIZE 32 +#define REALMLIST_SKIP_PACKETS 5 + +const AuthHandler table[] = +{ + { AUTH_LOGON_CHALLENGE, STATUS_CONNECTED, sizeof(AUTH_LOGON_CHALLENGE_C), &AuthSession::_HandleLogonChallenge }, + { AUTH_LOGON_PROOF, STATUS_CONNECTED, sizeof(AUTH_LOGON_PROOF_C), &AuthSession::_HandleLogonProof }, + { AUTH_RECONNECT_CHALLENGE, STATUS_CONNECTED, sizeof(AUTH_LOGON_CHALLENGE_C), &AuthSession::_HandleReconnectChallenge }, + { AUTH_RECONNECT_PROOF, STATUS_CONNECTED, sizeof(AUTH_RECONNECT_PROOF_C), &AuthSession::_HandleReconnectProof }, + { REALM_LIST, STATUS_AUTHED, REALMLIST_SKIP_PACKETS, &AuthSession::_HandleRealmList } +}; + +void AuthSession::AsyncReadHeader() +{ + auto self(shared_from_this()); + + _socket.async_read_some(boost::asio::buffer(_readBuffer, 1), [this, self](boost::system::error_code error, size_t transferedBytes) + { + if (!error && transferedBytes == 1) + { + for (const AuthHandler& entry : table) + { + if ((uint8)entry.cmd == _readBuffer[0] && (entry.status == STATUS_CONNECTED || (_isAuthenticated && entry.status == STATUS_AUTHED))) + { + // Handle dynamic size packet + if (_readBuffer[0] == AUTH_LOGON_CHALLENGE) + { + _socket.read_some(boost::asio::buffer(&_readBuffer[1], sizeof(uint8) + sizeof(uint16))); //error + size + + AsyncReadData(entry.handler, (uint16)&_readBuffer[2], sizeof(uint8) + sizeof(uint8) + sizeof(uint16)); // cmd + error + size + } + else + { + AsyncReadData(entry.handler, entry.packetSize, sizeof(uint8)); + } + break; + } + } + } + else + { + _socket.close(); + } + }); +} + +void AuthSession::AsyncReadData(bool (AuthSession::*handler)(), size_t dataSize, size_t bufferOffSet) +{ + auto self(shared_from_this()); + + _socket.async_read_some(boost::asio::buffer(&_readBuffer[bufferOffSet], dataSize), [handler, this, self](boost::system::error_code error, size_t transferedBytes) + { + if (!error && transferedBytes > 0) + { + if (!(*this.*handler)()) + { + _socket.close(); + return; + } + + AsyncReadHeader(); + } + else + { + _socket.close(); + } + }); +} + +void AuthSession::AsyncWrite(std::size_t length) +{ + boost::asio::async_write(_socket, boost::asio::buffer(_writeBuffer, length), [this](boost::system::error_code error, std::size_t /*length*/) + { + if (error) + { + _socket.close(); + } + }); +} + +bool AuthSession::_HandleLogonChallenge() +{ + sAuthLogonChallenge_C *challenge = (sAuthLogonChallenge_C*)&_readBuffer; + + //TC_LOG_DEBUG("server.authserver", "[AuthChallenge] got full packet, %#04x bytes", challenge->size); + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] name(%d): '%s'", challenge->I_len, challenge->I); + + ByteBuffer pkt; + + _login.assign((const char*)challenge->I, challenge->I_len); + _build = challenge->build; + _expversion = uint8(AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG)); + _os = (const char*)challenge->os; + + if (_os.size() > 4) + return false; + + // Restore string order as its byte order is reversed + std::reverse(_os.begin(), _os.end()); + + pkt << uint8(AUTH_LOGON_CHALLENGE); + pkt << uint8(0x00); + + // Verify that this IP is not in the ip_banned table + LoginDatabase.Execute(LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS)); + + std::string const& ipAddress = _socket.remote_endpoint().address().to_string(); + unsigned short port = _socket.remote_endpoint().port(); + + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED); + stmt->setString(0, ipAddress); + PreparedQueryResult result = LoginDatabase.Query(stmt); + if (result) + { + pkt << uint8(WOW_FAIL_BANNED); + TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] Banned ip tries to login!", ipAddress.c_str(), port); + } + else + { + // Get the account details from the account table + // No SQL injection (prepared statement) + stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_LOGONCHALLENGE); + stmt->setString(0, _login); + + PreparedQueryResult res2 = LoginDatabase.Query(stmt); + if (res2) + { + Field* fields = res2->Fetch(); + + // If the IP is 'locked', check that the player comes indeed from the correct IP address + bool locked = false; + if (fields[2].GetUInt8() == 1) // if ip is locked + { + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account '%s' is locked to IP - '%s'", _login.c_str(), fields[4].GetCString()); + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Player address is '%s'", ipAddress.c_str()); + + if (strcmp(fields[4].GetCString(), ipAddress.c_str()) != 0) + { + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account IP differs"); + pkt << uint8(WOW_FAIL_LOCKED_ENFORCED); + locked = true; + } + else + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account IP matches"); + } + else + { + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account '%s' is not locked to ip", _login.c_str()); + std::string accountCountry = fields[3].GetString(); + if (accountCountry.empty() || accountCountry == "00") + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account '%s' is not locked to country", _login.c_str()); + else if (!accountCountry.empty()) + { + uint32 ip = inet_addr(ipAddress.c_str()); + EndianConvertReverse(ip); + + stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_LOGON_COUNTRY); + stmt->setUInt32(0, ip); + if (PreparedQueryResult sessionCountryQuery = LoginDatabase.Query(stmt)) + { + std::string loginCountry = (*sessionCountryQuery)[0].GetString(); + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account '%s' is locked to country: '%s' Player country is '%s'", _login.c_str(), + accountCountry.c_str(), loginCountry.c_str()); + + if (loginCountry != accountCountry) + { + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account country differs."); + pkt << uint8(WOW_FAIL_UNLOCKABLE_LOCK); + locked = true; + } + else + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account country matches"); + } + else + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] IP2NATION Table empty"); + } + } + + if (!locked) + { + //set expired bans to inactive + LoginDatabase.DirectExecute(LoginDatabase.GetPreparedStatement(LOGIN_UPD_EXPIRED_ACCOUNT_BANS)); + + // If the account is banned, reject the logon attempt + stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED); + stmt->setUInt32(0, fields[1].GetUInt32()); + PreparedQueryResult banresult = LoginDatabase.Query(stmt); + if (banresult) + { + if ((*banresult)[0].GetUInt32() == (*banresult)[1].GetUInt32()) + { + pkt << uint8(WOW_FAIL_BANNED); + TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] Banned account %s tried to login!", ipAddress.c_str(), + port, _login.c_str()); + } + else + { + pkt << uint8(WOW_FAIL_SUSPENDED); + TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] Temporarily banned account %s tried to login!", + ipAddress.c_str(), port, _login.c_str()); + } + } + else + { + // Get the password from the account table, upper it, and make the SRP6 calculation + std::string rI = fields[0].GetString(); + + // Don't calculate (v, s) if there are already some in the database + std::string databaseV = fields[6].GetString(); + std::string databaseS = fields[7].GetString(); + + TC_LOG_DEBUG("network", "database authentication values: v='%s' s='%s'", databaseV.c_str(), databaseS.c_str()); + + // multiply with 2 since bytes are stored as hexstring + if (databaseV.size() != BYTE_SIZE * 2 || databaseS.size() != BYTE_SIZE * 2) + SetVSFields(rI); + else + { + s.SetHexStr(databaseS.c_str()); + v.SetHexStr(databaseV.c_str()); + } + + b.SetRand(19 * 8); + BigNumber gmod = g.ModExp(b, N); + B = ((v * 3) + gmod) % N; + + ASSERT(gmod.GetNumBytes() <= 32); + + BigNumber unk3; + unk3.SetRand(16 * 8); + + // Fill the response packet with the result + if (AuthHelper::IsAcceptedClientBuild(_build)) + pkt << uint8(WOW_SUCCESS); + else + pkt << uint8(WOW_FAIL_VERSION_INVALID); + + // B may be calculated < 32B so we force minimal length to 32B + pkt.append(B.AsByteArray(32).get(), 32); // 32 bytes + pkt << uint8(1); + pkt.append(g.AsByteArray().get(), 1); + pkt << uint8(32); + pkt.append(N.AsByteArray(32).get(), 32); + pkt.append(s.AsByteArray().get(), s.GetNumBytes()); // 32 bytes + pkt.append(unk3.AsByteArray(16).get(), 16); + uint8 securityFlags = 0; + + // Check if token is used + _tokenKey = fields[8].GetString(); + if (!_tokenKey.empty()) + securityFlags = 4; + + pkt << uint8(securityFlags); // security flags (0x0...0x04) + + if (securityFlags & 0x01) // PIN input + { + pkt << uint32(0); + pkt << uint64(0) << uint64(0); // 16 bytes hash? + } + + if (securityFlags & 0x02) // Matrix input + { + pkt << uint8(0); + pkt << uint8(0); + pkt << uint8(0); + pkt << uint8(0); + pkt << uint64(0); + } + + if (securityFlags & 0x04) // Security token input + pkt << uint8(1); + + uint8 secLevel = fields[5].GetUInt8(); + _accountSecurityLevel = secLevel <= SEC_ADMINISTRATOR ? AccountTypes(secLevel) : SEC_ADMINISTRATOR; + + _localizationName.resize(4); + for (int i = 0; i < 4; ++i) + _localizationName[i] = challenge->country[4 - i - 1]; + + TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] account %s is using '%c%c%c%c' locale (%u)", + ipAddress.c_str(), port, _login.c_str(), + challenge->country[3], challenge->country[2], challenge->country[1], challenge->country[0], + GetLocaleByName(_localizationName) + ); + } + } + } + else //no account + pkt << uint8(WOW_FAIL_UNKNOWN_ACCOUNT); + } + + std::memcpy(_writeBuffer, (char const*)pkt.contents(), pkt.size()); + + AsyncWrite(pkt.size()); + + return true; +} + +// Logon Proof command handler +bool AuthSession::_HandleLogonProof() +{ + + TC_LOG_DEBUG("server.authserver", "Entering _HandleLogonProof"); + // Read the packet + sAuthLogonProof_C *logonProof = (sAuthLogonProof_C*)&_readBuffer; + + // If the client has no valid version + if (_expversion == NO_VALID_EXP_FLAG) + { + // Check if we have the appropriate patch on the disk + TC_LOG_DEBUG("network", "Client with invalid version, patching is not implemented"); + return false; + } + + // Continue the SRP6 calculation based on data received from the client + BigNumber A; + + A.SetBinary(logonProof->A, 32); + + // SRP safeguard: abort if A == 0 + if (A.isZero()) + { + return false; + } + + SHA1Hash sha; + sha.UpdateBigNumbers(&A, &B, NULL); + sha.Finalize(); + BigNumber u; + u.SetBinary(sha.GetDigest(), 20); + BigNumber S = (A * (v.ModExp(u, N))).ModExp(b, N); + + uint8 t[32]; + uint8 t1[16]; + uint8 vK[40]; + memcpy(t, S.AsByteArray(32).get(), 32); + + for (int i = 0; i < 16; ++i) + t1[i] = t[i * 2]; + + sha.Initialize(); + sha.UpdateData(t1, 16); + sha.Finalize(); + + for (int i = 0; i < 20; ++i) + vK[i * 2] = sha.GetDigest()[i]; + + for (int i = 0; i < 16; ++i) + t1[i] = t[i * 2 + 1]; + + sha.Initialize(); + sha.UpdateData(t1, 16); + sha.Finalize(); + + for (int i = 0; i < 20; ++i) + vK[i * 2 + 1] = sha.GetDigest()[i]; + + K.SetBinary(vK, 40); + + uint8 hash[20]; + + sha.Initialize(); + sha.UpdateBigNumbers(&N, NULL); + sha.Finalize(); + memcpy(hash, sha.GetDigest(), 20); + sha.Initialize(); + sha.UpdateBigNumbers(&g, NULL); + sha.Finalize(); + + for (int i = 0; i < 20; ++i) + hash[i] ^= sha.GetDigest()[i]; + + BigNumber t3; + t3.SetBinary(hash, 20); + + sha.Initialize(); + sha.UpdateData(_login); + sha.Finalize(); + uint8 t4[SHA_DIGEST_LENGTH]; + memcpy(t4, sha.GetDigest(), SHA_DIGEST_LENGTH); + + sha.Initialize(); + sha.UpdateBigNumbers(&t3, NULL); + sha.UpdateData(t4, SHA_DIGEST_LENGTH); + sha.UpdateBigNumbers(&s, &A, &B, &K, NULL); + sha.Finalize(); + BigNumber M; + M.SetBinary(sha.GetDigest(), 20); + + // Check if SRP6 results match (password is correct), else send an error + if (!memcmp(M.AsByteArray().get(), logonProof->M1, 20)) + { + TC_LOG_DEBUG("server.authserver", "'%s:%d' User '%s' successfully authenticated", GetRemoteIpAddress().c_str(), GetRemotePort(), _login.c_str()); + + // Update the sessionkey, last_ip, last login time and reset number of failed logins in the account table for this account + // No SQL injection (escaped user name) and IP address as received by socket + const char *K_hex = K.AsHexStr(); + + PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LOGONPROOF); + stmt->setString(0, K_hex); + stmt->setString(1, GetRemoteIpAddress().c_str()); + stmt->setUInt32(2, GetLocaleByName(_localizationName)); + stmt->setString(3, _os); + stmt->setString(4, _login); + LoginDatabase.DirectExecute(stmt); + + OPENSSL_free((void*)K_hex); + + // Finish SRP6 and send the final result to the client + sha.Initialize(); + sha.UpdateBigNumbers(&A, &M, &K, NULL); + sha.Finalize(); + + // Check auth token + if ((logonProof->securityFlags & 0x04) || !_tokenKey.empty()) + { + // TODO To be fixed + + /* + uint8 size; + socket().recv((char*)&size, 1); + char* token = new char[size + 1]; + token[size] = '\0'; + socket().recv(token, size); + unsigned int validToken = TOTP::GenerateToken(_tokenKey.c_str()); + unsigned int incomingToken = atoi(token); + delete[] token; + if (validToken != incomingToken) + { + char data[] = { AUTH_LOGON_PROOF, WOW_FAIL_UNKNOWN_ACCOUNT, 3, 0 }; + socket().send(data, sizeof(data)); + return false; + }*/ + } + + if (_expversion & POST_BC_EXP_FLAG) // 2.x and 3.x clients + { + sAuthLogonProof_S proof; + memcpy(proof.M2, sha.GetDigest(), 20); + proof.cmd = AUTH_LOGON_PROOF; + proof.error = 0; + proof.unk1 = 0x00800000; // Accountflags. 0x01 = GM, 0x08 = Trial, 0x00800000 = Pro pass (arena tournament) + proof.unk2 = 0x00; // SurveyId + proof.unk3 = 0x00; + + std::memcpy(_writeBuffer, (char *)&proof, sizeof(proof)); + AsyncWrite(sizeof(proof)); + } + else + { + sAuthLogonProof_S_Old proof; + memcpy(proof.M2, sha.GetDigest(), 20); + proof.cmd = AUTH_LOGON_PROOF; + proof.error = 0; + proof.unk2 = 0x00; + + std::memcpy(_writeBuffer, (char *)&proof, sizeof(proof)); + AsyncWrite(sizeof(proof)); + } + + _isAuthenticated = true; + } + else + { + char data[4] = { AUTH_LOGON_PROOF, WOW_FAIL_UNKNOWN_ACCOUNT, 3, 0 }; + + std::memcpy(_writeBuffer, data, sizeof(data)); + AsyncWrite(sizeof(data)); + + TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] account %s tried to login with invalid password!", + GetRemoteIpAddress().c_str(), GetRemotePort(), _login.c_str()); + + uint32 MaxWrongPassCount = sConfigMgr->GetIntDefault("WrongPass.MaxCount", 0); + if (MaxWrongPassCount > 0) + { + //Increment number of failed logins by one and if it reaches the limit temporarily ban that account or IP + PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_FAILEDLOGINS); + stmt->setString(0, _login); + LoginDatabase.Execute(stmt); + + stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_FAILEDLOGINS); + stmt->setString(0, _login); + + if (PreparedQueryResult loginfail = LoginDatabase.Query(stmt)) + { + uint32 failed_logins = (*loginfail)[1].GetUInt32(); + + if (failed_logins >= MaxWrongPassCount) + { + uint32 WrongPassBanTime = sConfigMgr->GetIntDefault("WrongPass.BanTime", 600); + bool WrongPassBanType = sConfigMgr->GetBoolDefault("WrongPass.BanType", false); + + if (WrongPassBanType) + { + uint32 acc_id = (*loginfail)[0].GetUInt32(); + stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_AUTO_BANNED); + stmt->setUInt32(0, acc_id); + stmt->setUInt32(1, WrongPassBanTime); + LoginDatabase.Execute(stmt); + + TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] account %s got banned for '%u' seconds because it failed to authenticate '%u' times", + GetRemoteIpAddress().c_str(), GetRemotePort(), _login.c_str(), WrongPassBanTime, failed_logins); + } + else + { + stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_IP_AUTO_BANNED); + stmt->setString(0, GetRemoteIpAddress()); + stmt->setUInt32(1, WrongPassBanTime); + LoginDatabase.Execute(stmt); + + TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] IP got banned for '%u' seconds because account %s failed to authenticate '%u' times", + GetRemoteIpAddress().c_str(), GetRemotePort(), WrongPassBanTime, _login.c_str(), failed_logins); + } + } + } + } + } + + return true; +} + +bool AuthSession::_HandleReconnectChallenge() +{ + TC_LOG_DEBUG("server.authserver", "Entering _HandleReconnectChallenge"); + sAuthLogonChallenge_C *challenge = (sAuthLogonChallenge_C*)&_readBuffer; + + //TC_LOG_DEBUG("server.authserver", "[AuthChallenge] got full packet, %#04x bytes", challenge->size); + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] name(%d): '%s'", challenge->I_len, challenge->I); + + _login.assign((const char*)challenge->I, challenge->I_len); + + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_SESSIONKEY); + stmt->setString(0, _login); + PreparedQueryResult result = LoginDatabase.Query(stmt); + + // Stop if the account is not found + if (!result) + { + TC_LOG_ERROR("server.authserver", "'%s:%d' [ERROR] user %s tried to login and we cannot find his session key in the database.", + GetRemoteIpAddress().c_str(), GetRemotePort(), _login.c_str()); + return false; + } + + // Reinitialize build, expansion and the account securitylevel + _build = challenge->build; + _expversion = uint8(AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG)); + _os = (const char*)challenge->os; + + if (_os.size() > 4) + return false; + + // Restore string order as its byte order is reversed + std::reverse(_os.begin(), _os.end()); + + Field* fields = result->Fetch(); + uint8 secLevel = fields[2].GetUInt8(); + _accountSecurityLevel = secLevel <= SEC_ADMINISTRATOR ? AccountTypes(secLevel) : SEC_ADMINISTRATOR; + + K.SetHexStr((*result)[0].GetCString()); + + // Sending response + ByteBuffer pkt; + pkt << uint8(AUTH_RECONNECT_CHALLENGE); + pkt << uint8(0x00); + _reconnectProof.SetRand(16 * 8); + pkt.append(_reconnectProof.AsByteArray(16).get(), 16); // 16 bytes random + pkt << uint64(0x00) << uint64(0x00); // 16 bytes zeros + + std::memcpy(_writeBuffer, (char const*)pkt.contents(), pkt.size()); + AsyncWrite(pkt.size()); + + return true; +} +bool AuthSession::_HandleReconnectProof() +{ + TC_LOG_DEBUG("server.authserver", "Entering _HandleReconnectProof"); + sAuthReconnectProof_C *reconnectProof = (sAuthReconnectProof_C*)&_readBuffer; + + if (_login.empty() || !_reconnectProof.GetNumBytes() || !K.GetNumBytes()) + return false; + + BigNumber t1; + t1.SetBinary(reconnectProof->R1, 16); + + SHA1Hash sha; + sha.Initialize(); + sha.UpdateData(_login); + sha.UpdateBigNumbers(&t1, &_reconnectProof, &K, NULL); + sha.Finalize(); + + if (!memcmp(sha.GetDigest(), reconnectProof->R2, SHA_DIGEST_LENGTH)) + { + // Sending response + ByteBuffer pkt; + pkt << uint8(AUTH_RECONNECT_PROOF); + pkt << uint8(0x00); + pkt << uint16(0x00); // 2 bytes zeros + std::memcpy(_writeBuffer, (char const*)pkt.contents(), pkt.size()); + AsyncWrite(pkt.size()); + _isAuthenticated = true; + return true; + } + else + { + TC_LOG_ERROR("server.authserver", "'%s:%d' [ERROR] user %s tried to login, but session is invalid.", GetRemoteIpAddress().c_str(), + GetRemotePort(), _login.c_str()); + return false; + } +} + +ACE_INET_Addr const& GetAddressForClient(Realm const& realm, ACE_INET_Addr const& clientAddr) +{ + // Attempt to send best address for client + if (clientAddr.is_loopback()) + { + // Try guessing if realm is also connected locally + if (realm.LocalAddress.is_loopback() || realm.ExternalAddress.is_loopback()) + return clientAddr; + + // Assume that user connecting from the machine that authserver is located on + // has all realms available in his local network + return realm.LocalAddress; + } + + // Check if connecting client is in the same network + if (IsIPAddrInNetwork(realm.LocalAddress, clientAddr, realm.LocalSubnetMask)) + return realm.LocalAddress; + + // Return external IP + return realm.ExternalAddress; +} + + +bool AuthSession::_HandleRealmList() +{ + TC_LOG_DEBUG("server.authserver", "Entering _HandleRealmList"); + + // Get the user id (else close the connection) + // No SQL injection (prepared statement) + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_ID_BY_NAME); + stmt->setString(0, _login); + PreparedQueryResult result = LoginDatabase.Query(stmt); + if (!result) + { + TC_LOG_ERROR("server.authserver", "'%s:%d' [ERROR] user %s tried to login but we cannot find him in the database.", GetRemoteIpAddress().c_str(), + GetRemotePort(), _login.c_str()); + return false; + } + + Field* fields = result->Fetch(); + uint32 id = fields[0].GetUInt32(); + + // Update realm list if need + sRealmList->UpdateIfNeed(); + + // Circle through realms in the RealmList and construct the return packet (including # of user characters in each realm) + ByteBuffer pkt; + + size_t RealmListSize = 0; + for (RealmList::RealmMap::const_iterator i = sRealmList->begin(); i != sRealmList->end(); ++i) + { + const Realm &realm = i->second; + // don't work with realms which not compatible with the client + bool okBuild = ((_expversion & POST_BC_EXP_FLAG) && realm.gamebuild == _build) || ((_expversion & PRE_BC_EXP_FLAG) && !AuthHelper::IsPreBCAcceptedClientBuild(realm.gamebuild)); + + // No SQL injection. id of realm is controlled by the database. + uint32 flag = realm.flag; + RealmBuildInfo const* buildInfo = AuthHelper::GetBuildInfo(realm.gamebuild); + if (!okBuild) + { + if (!buildInfo) + continue; + + flag |= REALM_FLAG_OFFLINE | REALM_FLAG_SPECIFYBUILD; // tell the client what build the realm is for + } + + if (!buildInfo) + flag &= ~REALM_FLAG_SPECIFYBUILD; + + std::string name = i->first; + if (_expversion & PRE_BC_EXP_FLAG && flag & REALM_FLAG_SPECIFYBUILD) + { + std::ostringstream ss; + ss << name << " (" << buildInfo->MajorVersion << '.' << buildInfo->MinorVersion << '.' << buildInfo->BugfixVersion << ')'; + name = ss.str(); + } + + // We don't need the port number from which client connects with but the realm's port + ACE_INET_Addr clientAddr(realm.ExternalAddress.get_port_number(), GetRemoteIpAddress().c_str(), AF_INET); + + uint8 lock = (realm.allowedSecurityLevel > _accountSecurityLevel) ? 1 : 0; + + uint8 AmountOfCharacters = 0; + stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_NUM_CHARS_ON_REALM); + stmt->setUInt32(0, realm.m_ID); + stmt->setUInt32(1, id); + result = LoginDatabase.Query(stmt); + if (result) + AmountOfCharacters = (*result)[0].GetUInt8(); + + pkt << realm.icon; // realm type + if (_expversion & POST_BC_EXP_FLAG) // only 2.x and 3.x clients + pkt << lock; // if 1, then realm locked + pkt << uint8(flag); // RealmFlags + pkt << name; + pkt << GetAddressString(GetAddressForClient(realm, clientAddr)); + pkt << realm.populationLevel; + pkt << AmountOfCharacters; + pkt << realm.timezone; // realm category + if (_expversion & POST_BC_EXP_FLAG) // 2.x and 3.x clients + pkt << uint8(0x2C); // unk, may be realm number/id? + else + pkt << uint8(0x0); // 1.12.1 and 1.12.2 clients + + if (_expversion & POST_BC_EXP_FLAG && flag & REALM_FLAG_SPECIFYBUILD) + { + pkt << uint8(buildInfo->MajorVersion); + pkt << uint8(buildInfo->MinorVersion); + pkt << uint8(buildInfo->BugfixVersion); + pkt << uint16(buildInfo->Build); + } + + ++RealmListSize; + } + + if (_expversion & POST_BC_EXP_FLAG) // 2.x and 3.x clients + { + pkt << uint8(0x10); + pkt << uint8(0x00); + } + else // 1.12.1 and 1.12.2 clients + { + pkt << uint8(0x00); + pkt << uint8(0x02); + } + + // make a ByteBuffer which stores the RealmList's size + ByteBuffer RealmListSizeBuffer; + RealmListSizeBuffer << uint32(0); + if (_expversion & POST_BC_EXP_FLAG) // only 2.x and 3.x clients + RealmListSizeBuffer << uint16(RealmListSize); + else + RealmListSizeBuffer << uint32(RealmListSize); + + ByteBuffer hdr; + hdr << uint8(REALM_LIST); + hdr << uint16(pkt.size() + RealmListSizeBuffer.size()); + hdr.append(RealmListSizeBuffer); // append RealmList's size buffer + hdr.append(pkt); // append realms in the realmlist + + std::memcpy(_writeBuffer, (char const*)hdr.contents(), hdr.size()); + AsyncWrite(hdr.size()); + + return true; +} + +// Make the SRP6 calculation from hash in dB +void AuthSession::SetVSFields(const std::string& rI) +{ + s.SetRand(BYTE_SIZE * 8); + + BigNumber I; + I.SetHexStr(rI.c_str()); + + // In case of leading zeros in the rI hash, restore them + uint8 mDigest[SHA_DIGEST_LENGTH]; + memset(mDigest, 0, SHA_DIGEST_LENGTH); + if (I.GetNumBytes() <= SHA_DIGEST_LENGTH) + memcpy(mDigest, I.AsByteArray().get(), I.GetNumBytes()); + + std::reverse(mDigest, mDigest + SHA_DIGEST_LENGTH); + + SHA1Hash sha; + sha.UpdateData(s.AsByteArray().get(), s.GetNumBytes()); + sha.UpdateData(mDigest, SHA_DIGEST_LENGTH); + sha.Finalize(); + BigNumber x; + x.SetBinary(sha.GetDigest(), sha.GetLength()); + v = g.ModExp(x, N); + + // No SQL injection (username escaped) + char *v_hex, *s_hex; + v_hex = v.AsHexStr(); + s_hex = s.AsHexStr(); + + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_VS); + stmt->setString(0, v_hex); + stmt->setString(1, s_hex); + stmt->setString(2, _login); + LoginDatabase.Execute(stmt); + + OPENSSL_free(v_hex); + OPENSSL_free(s_hex); +} \ No newline at end of file diff --git a/src/server/authserver/Server/AuthSession.h b/src/server/authserver/Server/AuthSession.h new file mode 100644 index 00000000000..205300e806a --- /dev/null +++ b/src/server/authserver/Server/AuthSession.h @@ -0,0 +1,85 @@ +/* +* Copyright (C) 2008-2014 TrinityCore +* Copyright (C) 2005-2009 MaNGOS +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program. If not, see . +*/ + +#ifndef __AUTHSESSION_H__ +#define __AUTHSESSION_H__ + +#include +#include + +#include "Common.h" +#include "BigNumber.h" + +using boost::asio::ip::tcp; + +const size_t bufferSize = 4096; + +#define BUFFER_SIZE 4096 + +class AuthSession : public std::enable_shared_from_this < AuthSession > +{ +public: + AuthSession(tcp::socket socket) : _socket(std::move(socket)) + { + N.SetHexStr("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7"); + g.SetDword(7); + } + + void Start() + { + AsyncReadHeader(); + } + + bool _HandleLogonChallenge(); + bool _HandleLogonProof(); + bool _HandleReconnectChallenge(); + bool _HandleReconnectProof(); + bool _HandleRealmList(); + + const std::string GetRemoteIpAddress() const { return _socket.remote_endpoint().address().to_string(); }; + unsigned short GetRemotePort() const { return _socket.remote_endpoint().port(); } + +private: + void AsyncReadHeader(); + void AsyncReadData(bool (AuthSession::*handler)(), size_t dataSize, size_t bufferOffset); + void AsyncWrite(size_t length); + + + void SetVSFields(const std::string& rI); + + BigNumber N, s, g, v; + BigNumber b, B; + BigNumber K; + BigNumber _reconnectProof; + + tcp::socket _socket; + char _readBuffer[BUFFER_SIZE]; + char _writeBuffer[BUFFER_SIZE]; + + bool _isAuthenticated; + std::string _tokenKey; + std::string _login; + std::string _localizationName; + std::string _os; + uint16 _build; + uint8 _expversion; + + AccountTypes _accountSecurityLevel; +}; + +#endif \ No newline at end of file diff --git a/src/server/authserver/Server/AuthSocket.cpp b/src/server/authserver/Server/AuthSocket.cpp deleted file mode 100644 index c7bb600024a..00000000000 --- a/src/server/authserver/Server/AuthSocket.cpp +++ /dev/null @@ -1,1207 +0,0 @@ -/* - * Copyright (C) 2008-2014 TrinityCore - * Copyright (C) 2005-2009 MaNGOS - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include -#include - -#include "Common.h" -#include "Database/DatabaseEnv.h" -#include "ByteBuffer.h" -#include "Configuration/Config.h" -#include "Log.h" -#include "RealmList.h" -#include "AuthSocket.h" -#include "AuthCodes.h" -#include "TOTP.h" -#include "SHA1.h" -#include "openssl/crypto.h" - -#define ChunkSize 2048 - -enum eAuthCmd -{ - AUTH_LOGON_CHALLENGE = 0x00, - AUTH_LOGON_PROOF = 0x01, - AUTH_RECONNECT_CHALLENGE = 0x02, - AUTH_RECONNECT_PROOF = 0x03, - REALM_LIST = 0x10, - XFER_INITIATE = 0x30, - XFER_DATA = 0x31, - XFER_ACCEPT = 0x32, - XFER_RESUME = 0x33, - XFER_CANCEL = 0x34 -}; - -enum eStatus -{ - STATUS_CONNECTED = 0, - STATUS_AUTHED -}; - -// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push, N), also any gcc version not support it at some paltform -#if defined(__GNUC__) -#pragma pack(1) -#else -#pragma pack(push, 1) -#endif - -typedef struct AUTH_LOGON_CHALLENGE_C -{ - uint8 cmd; - uint8 error; - uint16 size; - uint8 gamename[4]; - uint8 version1; - uint8 version2; - uint8 version3; - uint16 build; - uint8 platform[4]; - uint8 os[4]; - uint8 country[4]; - uint32 timezone_bias; - uint32 ip; - uint8 I_len; - uint8 I[1]; -} sAuthLogonChallenge_C; - -typedef struct AUTH_LOGON_PROOF_C -{ - uint8 cmd; - uint8 A[32]; - uint8 M1[20]; - uint8 crc_hash[20]; - uint8 number_of_keys; - uint8 securityFlags; // 0x00-0x04 -} sAuthLogonProof_C; - -typedef struct AUTH_LOGON_PROOF_S -{ - uint8 cmd; - uint8 error; - uint8 M2[20]; - uint32 unk1; - uint32 unk2; - uint16 unk3; -} sAuthLogonProof_S; - -typedef struct AUTH_LOGON_PROOF_S_OLD -{ - uint8 cmd; - uint8 error; - uint8 M2[20]; - uint32 unk2; -} sAuthLogonProof_S_Old; - -typedef struct AUTH_RECONNECT_PROOF_C -{ - uint8 cmd; - uint8 R1[16]; - uint8 R2[20]; - uint8 R3[20]; - uint8 number_of_keys; -} sAuthReconnectProof_C; - -typedef struct XFER_INIT -{ - uint8 cmd; // XFER_INITIATE - uint8 fileNameLen; // strlen(fileName); - uint8 fileName[5]; // fileName[fileNameLen] - uint64 file_size; // file size (bytes) - uint8 md5[MD5_DIGEST_LENGTH]; // MD5 -} XFER_INIT; - -typedef struct XFER_DATA -{ - uint8 opcode; - uint16 data_size; - uint8 data[ChunkSize]; -} XFER_DATA_STRUCT; - -typedef struct AuthHandler -{ - eAuthCmd cmd; - uint32 status; - bool (AuthSocket::*handler)(void); -} AuthHandler; - -// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some paltform -#if defined(__GNUC__) -#pragma pack() -#else -#pragma pack(pop) -#endif - -// Launch a thread to transfer a patch to the client -class PatcherRunnable: public ACE_Based::Runnable -{ -public: - PatcherRunnable(class AuthSocket*); - void run(); - -private: - AuthSocket* mySocket; -}; - -typedef struct PATCH_INFO -{ - uint8 md5[MD5_DIGEST_LENGTH]; -} PATCH_INFO; - -// Caches MD5 hash of client patches present on the server -class Patcher -{ -public: - typedef std::map Patches; - ~Patcher(); - Patcher(); - Patches::const_iterator begin() const { return _patches.begin(); } - Patches::const_iterator end() const { return _patches.end(); } - void LoadPatchMD5(char*); - bool GetHash(char * pat, uint8 mymd5[16]); - -private: - void LoadPatchesInfo(); - Patches _patches; -}; - -const AuthHandler table[] = -{ - { AUTH_LOGON_CHALLENGE, STATUS_CONNECTED, &AuthSocket::_HandleLogonChallenge }, - { AUTH_LOGON_PROOF, STATUS_CONNECTED, &AuthSocket::_HandleLogonProof }, - { AUTH_RECONNECT_CHALLENGE, STATUS_CONNECTED, &AuthSocket::_HandleReconnectChallenge}, - { AUTH_RECONNECT_PROOF, STATUS_CONNECTED, &AuthSocket::_HandleReconnectProof }, - { REALM_LIST, STATUS_AUTHED, &AuthSocket::_HandleRealmList }, - { XFER_ACCEPT, STATUS_CONNECTED, &AuthSocket::_HandleXferAccept }, - { XFER_RESUME, STATUS_CONNECTED, &AuthSocket::_HandleXferResume }, - { XFER_CANCEL, STATUS_CONNECTED, &AuthSocket::_HandleXferCancel } -}; - -#define AUTH_TOTAL_COMMANDS 8 - -// Holds the MD5 hash of client patches present on the server -Patcher PatchesCache; - -// Constructor - set the N and g values for SRP6 -AuthSocket::AuthSocket(RealmSocket& socket) : - pPatch(NULL), socket_(socket), _authed(false), _build(0), - _expversion(0), _accountSecurityLevel(SEC_PLAYER) -{ - N.SetHexStr("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7"); - g.SetDword(7); -} - -// Close patch file descriptor before leaving -AuthSocket::~AuthSocket(void) { } - -// Accept the connection -void AuthSocket::OnAccept(void) -{ - TC_LOG_DEBUG("server.authserver", "'%s:%d' Accepting connection", socket().getRemoteAddress().c_str(), socket().getRemotePort()); -} - -void AuthSocket::OnClose(void) -{ - TC_LOG_DEBUG("server.authserver", "AuthSocket::OnClose"); -} - -// Read the packet from the client -void AuthSocket::OnRead() -{ - #define MAX_AUTH_LOGON_CHALLENGES_IN_A_ROW 3 - uint32 challengesInARow = 0; - uint8 _cmd; - while (1) - { - if (!socket().recv_soft((char *)&_cmd, 1)) - return; - - if (_cmd == AUTH_LOGON_CHALLENGE) - { - ++challengesInARow; - if (challengesInARow == MAX_AUTH_LOGON_CHALLENGES_IN_A_ROW) - { - TC_LOG_WARN("server.authserver", "Got %u AUTH_LOGON_CHALLENGE in a row from '%s', possible ongoing DoS", challengesInARow, socket().getRemoteAddress().c_str()); - socket().shutdown(); - return; - } - } - - size_t i; - - // Circle through known commands and call the correct command handler - for (i = 0; i < AUTH_TOTAL_COMMANDS; ++i) - { - if ((uint8)table[i].cmd == _cmd && (table[i].status == STATUS_CONNECTED || (_authed && table[i].status == STATUS_AUTHED))) - { - TC_LOG_DEBUG("server.authserver", "Got data for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len()); - - if (!(*this.*table[i].handler)()) - { - TC_LOG_DEBUG("server.authserver", "Command handler failed for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len()); - return; - } - break; - } - } - - // Report unknown packets in the error log - if (i == AUTH_TOTAL_COMMANDS) - { - TC_LOG_ERROR("server.authserver", "Got unknown packet from '%s'", socket().getRemoteAddress().c_str()); - socket().shutdown(); - return; - } - } -} - -// Make the SRP6 calculation from hash in dB -void AuthSocket::_SetVSFields(const std::string& rI) -{ - s.SetRand(s_BYTE_SIZE * 8); - - BigNumber I; - I.SetHexStr(rI.c_str()); - - // In case of leading zeros in the rI hash, restore them - uint8 mDigest[SHA_DIGEST_LENGTH]; - memset(mDigest, 0, SHA_DIGEST_LENGTH); - if (I.GetNumBytes() <= SHA_DIGEST_LENGTH) - memcpy(mDigest, I.AsByteArray().get(), I.GetNumBytes()); - - std::reverse(mDigest, mDigest + SHA_DIGEST_LENGTH); - - SHA1Hash sha; - sha.UpdateData(s.AsByteArray().get(), s.GetNumBytes()); - sha.UpdateData(mDigest, SHA_DIGEST_LENGTH); - sha.Finalize(); - BigNumber x; - x.SetBinary(sha.GetDigest(), sha.GetLength()); - v = g.ModExp(x, N); - - // No SQL injection (username escaped) - char *v_hex, *s_hex; - v_hex = v.AsHexStr(); - s_hex = s.AsHexStr(); - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_VS); - stmt->setString(0, v_hex); - stmt->setString(1, s_hex); - stmt->setString(2, _login); - LoginDatabase.Execute(stmt); - - OPENSSL_free(v_hex); - OPENSSL_free(s_hex); -} - -// Logon Challenge command handler -bool AuthSocket::_HandleLogonChallenge() -{ - TC_LOG_DEBUG("server.authserver", "Entering _HandleLogonChallenge"); - if (socket().recv_len() < sizeof(sAuthLogonChallenge_C)) - return false; - - // Read the first 4 bytes (header) to get the length of the remaining of the packet - std::vector buf; - buf.resize(4); - - socket().recv((char *)&buf[0], 4); - - EndianConvertPtr(&buf[0]); - - uint16 remaining = ((sAuthLogonChallenge_C *)&buf[0])->size; - TC_LOG_DEBUG("server.authserver", "[AuthChallenge] got header, body is %#04x bytes", remaining); - - if ((remaining < sizeof(sAuthLogonChallenge_C) - buf.size()) || (socket().recv_len() < remaining)) - return false; - - //No big fear of memory outage (size is int16, i.e. < 65536) - buf.resize(remaining + buf.size() + 1); - buf[buf.size() - 1] = 0; - sAuthLogonChallenge_C *ch = (sAuthLogonChallenge_C*)&buf[0]; - - // Read the remaining of the packet - socket().recv((char *)&buf[4], remaining); - TC_LOG_DEBUG("server.authserver", "[AuthChallenge] got full packet, %#04x bytes", ch->size); - TC_LOG_DEBUG("server.authserver", "[AuthChallenge] name(%d): '%s'", ch->I_len, ch->I); - - // BigEndian code, nop in little endian case - // size already converted - EndianConvertPtr(&ch->gamename[0]); - EndianConvert(ch->build); - EndianConvertPtr(&ch->platform[0]); - EndianConvertPtr(&ch->os[0]); - EndianConvertPtr(&ch->country[0]); - EndianConvert(ch->timezone_bias); - EndianConvert(ch->ip); - - ByteBuffer pkt; - - _login = (const char*)ch->I; - _build = ch->build; - _expversion = uint8(AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG)); - _os = (const char*)ch->os; - - if (_os.size() > 4) - return false; - - // Restore string order as its byte order is reversed - std::reverse(_os.begin(), _os.end()); - - pkt << uint8(AUTH_LOGON_CHALLENGE); - pkt << uint8(0x00); - - // Verify that this IP is not in the ip_banned table - LoginDatabase.Execute(LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS)); - - std::string const& ip_address = socket().getRemoteAddress(); - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED); - stmt->setString(0, ip_address); - PreparedQueryResult result = LoginDatabase.Query(stmt); - if (result) - { - pkt << uint8(WOW_FAIL_BANNED); - TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] Banned ip tries to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort()); - } - else - { - // Get the account details from the account table - // No SQL injection (prepared statement) - stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_LOGONCHALLENGE); - stmt->setString(0, _login); - - PreparedQueryResult res2 = LoginDatabase.Query(stmt); - if (res2) - { - Field* fields = res2->Fetch(); - - // If the IP is 'locked', check that the player comes indeed from the correct IP address - bool locked = false; - if (fields[2].GetUInt8() == 1) // if ip is locked - { - TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account '%s' is locked to IP - '%s'", _login.c_str(), fields[4].GetCString()); - TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Player address is '%s'", ip_address.c_str()); - - if (strcmp(fields[4].GetCString(), ip_address.c_str()) != 0) - { - TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account IP differs"); - pkt << uint8(WOW_FAIL_LOCKED_ENFORCED); - locked = true; - } - else - TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account IP matches"); - } - else - { - TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account '%s' is not locked to ip", _login.c_str()); - std::string accountCountry = fields[3].GetString(); - if (accountCountry.empty() || accountCountry == "00") - TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account '%s' is not locked to country", _login.c_str()); - else if (!accountCountry.empty()) - { - uint32 ip = inet_addr(ip_address.c_str()); - EndianConvertReverse(ip); - - stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_LOGON_COUNTRY); - stmt->setUInt32(0, ip); - if (PreparedQueryResult sessionCountryQuery = LoginDatabase.Query(stmt)) - { - std::string loginCountry = (*sessionCountryQuery)[0].GetString(); - TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account '%s' is locked to country: '%s' Player country is '%s'", _login.c_str(), accountCountry.c_str(), loginCountry.c_str()); - if (loginCountry != accountCountry) - { - TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account country differs."); - pkt << uint8(WOW_FAIL_UNLOCKABLE_LOCK); - locked = true; - } - else - TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account country matches"); - } - else - TC_LOG_DEBUG("server.authserver", "[AuthChallenge] IP2NATION Table empty"); - } - } - - if (!locked) - { - //set expired bans to inactive - LoginDatabase.DirectExecute(LoginDatabase.GetPreparedStatement(LOGIN_UPD_EXPIRED_ACCOUNT_BANS)); - - // If the account is banned, reject the logon attempt - stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED); - stmt->setUInt32(0, fields[1].GetUInt32()); - PreparedQueryResult banresult = LoginDatabase.Query(stmt); - if (banresult) - { - if ((*banresult)[0].GetUInt32() == (*banresult)[1].GetUInt32()) - { - pkt << uint8(WOW_FAIL_BANNED); - TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] Banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ()); - } - else - { - pkt << uint8(WOW_FAIL_SUSPENDED); - TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] Temporarily banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ()); - } - } - else - { - // Get the password from the account table, upper it, and make the SRP6 calculation - std::string rI = fields[0].GetString(); - - // Don't calculate (v, s) if there are already some in the database - std::string databaseV = fields[6].GetString(); - std::string databaseS = fields[7].GetString(); - - TC_LOG_DEBUG("network", "database authentication values: v='%s' s='%s'", databaseV.c_str(), databaseS.c_str()); - - // multiply with 2 since bytes are stored as hexstring - if (databaseV.size() != s_BYTE_SIZE * 2 || databaseS.size() != s_BYTE_SIZE * 2) - _SetVSFields(rI); - else - { - s.SetHexStr(databaseS.c_str()); - v.SetHexStr(databaseV.c_str()); - } - - b.SetRand(19 * 8); - BigNumber gmod = g.ModExp(b, N); - B = ((v * 3) + gmod) % N; - - ASSERT(gmod.GetNumBytes() <= 32); - - BigNumber unk3; - unk3.SetRand(16 * 8); - - // Fill the response packet with the result - if (AuthHelper::IsAcceptedClientBuild(_build)) - pkt << uint8(WOW_SUCCESS); - else - pkt << uint8(WOW_FAIL_VERSION_INVALID); - - // B may be calculated < 32B so we force minimal length to 32B - pkt.append(B.AsByteArray(32).get(), 32); // 32 bytes - pkt << uint8(1); - pkt.append(g.AsByteArray().get(), 1); - pkt << uint8(32); - pkt.append(N.AsByteArray(32).get(), 32); - pkt.append(s.AsByteArray().get(), s.GetNumBytes()); // 32 bytes - pkt.append(unk3.AsByteArray(16).get(), 16); - uint8 securityFlags = 0; - - // Check if token is used - _tokenKey = fields[8].GetString(); - if (!_tokenKey.empty()) - securityFlags = 4; - - pkt << uint8(securityFlags); // security flags (0x0...0x04) - - if (securityFlags & 0x01) // PIN input - { - pkt << uint32(0); - pkt << uint64(0) << uint64(0); // 16 bytes hash? - } - - if (securityFlags & 0x02) // Matrix input - { - pkt << uint8(0); - pkt << uint8(0); - pkt << uint8(0); - pkt << uint8(0); - pkt << uint64(0); - } - - if (securityFlags & 0x04) // Security token input - pkt << uint8(1); - - uint8 secLevel = fields[5].GetUInt8(); - _accountSecurityLevel = secLevel <= SEC_ADMINISTRATOR ? AccountTypes(secLevel) : SEC_ADMINISTRATOR; - - _localizationName.resize(4); - for (int i = 0; i < 4; ++i) - _localizationName[i] = ch->country[4-i-1]; - - TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] account %s is using '%c%c%c%c' locale (%u)", socket().getRemoteAddress().c_str(), socket().getRemotePort(), - _login.c_str (), ch->country[3], ch->country[2], ch->country[1], ch->country[0], GetLocaleByName(_localizationName) - ); - } - } - } - else //no account - pkt << uint8(WOW_FAIL_UNKNOWN_ACCOUNT); - } - - socket().send((char const*)pkt.contents(), pkt.size()); - return true; -} - -// Logon Proof command handler -bool AuthSocket::_HandleLogonProof() -{ - TC_LOG_DEBUG("server.authserver", "Entering _HandleLogonProof"); - // Read the packet - sAuthLogonProof_C lp; - - if (!socket().recv((char *)&lp, sizeof(sAuthLogonProof_C))) - return false; - - // If the client has no valid version - if (_expversion == NO_VALID_EXP_FLAG) - { - // Check if we have the appropriate patch on the disk - TC_LOG_DEBUG("network", "Client with invalid version, patching is not implemented"); - socket().shutdown(); - return true; - } - - // Continue the SRP6 calculation based on data received from the client - BigNumber A; - - A.SetBinary(lp.A, 32); - - // SRP safeguard: abort if A == 0 - if (A.isZero()) - { - socket().shutdown(); - return true; - } - - SHA1Hash sha; - sha.UpdateBigNumbers(&A, &B, NULL); - sha.Finalize(); - BigNumber u; - u.SetBinary(sha.GetDigest(), 20); - BigNumber S = (A * (v.ModExp(u, N))).ModExp(b, N); - - uint8 t[32]; - uint8 t1[16]; - uint8 vK[40]; - memcpy(t, S.AsByteArray(32).get(), 32); - - for (int i = 0; i < 16; ++i) - t1[i] = t[i * 2]; - - sha.Initialize(); - sha.UpdateData(t1, 16); - sha.Finalize(); - - for (int i = 0; i < 20; ++i) - vK[i * 2] = sha.GetDigest()[i]; - - for (int i = 0; i < 16; ++i) - t1[i] = t[i * 2 + 1]; - - sha.Initialize(); - sha.UpdateData(t1, 16); - sha.Finalize(); - - for (int i = 0; i < 20; ++i) - vK[i * 2 + 1] = sha.GetDigest()[i]; - - K.SetBinary(vK, 40); - - uint8 hash[20]; - - sha.Initialize(); - sha.UpdateBigNumbers(&N, NULL); - sha.Finalize(); - memcpy(hash, sha.GetDigest(), 20); - sha.Initialize(); - sha.UpdateBigNumbers(&g, NULL); - sha.Finalize(); - - for (int i = 0; i < 20; ++i) - hash[i] ^= sha.GetDigest()[i]; - - BigNumber t3; - t3.SetBinary(hash, 20); - - sha.Initialize(); - sha.UpdateData(_login); - sha.Finalize(); - uint8 t4[SHA_DIGEST_LENGTH]; - memcpy(t4, sha.GetDigest(), SHA_DIGEST_LENGTH); - - sha.Initialize(); - sha.UpdateBigNumbers(&t3, NULL); - sha.UpdateData(t4, SHA_DIGEST_LENGTH); - sha.UpdateBigNumbers(&s, &A, &B, &K, NULL); - sha.Finalize(); - BigNumber M; - M.SetBinary(sha.GetDigest(), 20); - - // Check if SRP6 results match (password is correct), else send an error - if (!memcmp(M.AsByteArray().get(), lp.M1, 20)) - { - TC_LOG_DEBUG("server.authserver", "'%s:%d' User '%s' successfully authenticated", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); - - // Update the sessionkey, last_ip, last login time and reset number of failed logins in the account table for this account - // No SQL injection (escaped user name) and IP address as received by socket - const char *K_hex = K.AsHexStr(); - - PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LOGONPROOF); - stmt->setString(0, K_hex); - stmt->setString(1, socket().getRemoteAddress().c_str()); - stmt->setUInt32(2, GetLocaleByName(_localizationName)); - stmt->setString(3, _os); - stmt->setString(4, _login); - LoginDatabase.DirectExecute(stmt); - - OPENSSL_free((void*)K_hex); - - // Finish SRP6 and send the final result to the client - sha.Initialize(); - sha.UpdateBigNumbers(&A, &M, &K, NULL); - sha.Finalize(); - - // Check auth token - if ((lp.securityFlags & 0x04) || !_tokenKey.empty()) - { - uint8 size; - socket().recv((char*)&size, 1); - char* token = new char[size + 1]; - token[size] = '\0'; - socket().recv(token, size); - unsigned int validToken = TOTP::GenerateToken(_tokenKey.c_str()); - unsigned int incomingToken = atoi(token); - delete[] token; - if (validToken != incomingToken) - { - char data[] = { AUTH_LOGON_PROOF, WOW_FAIL_UNKNOWN_ACCOUNT, 3, 0 }; - socket().send(data, sizeof(data)); - return false; - } - } - - if (_expversion & POST_BC_EXP_FLAG) // 2.x and 3.x clients - { - sAuthLogonProof_S proof; - memcpy(proof.M2, sha.GetDigest(), 20); - proof.cmd = AUTH_LOGON_PROOF; - proof.error = 0; - proof.unk1 = 0x00800000; // Accountflags. 0x01 = GM, 0x08 = Trial, 0x00800000 = Pro pass (arena tournament) - proof.unk2 = 0x00; // SurveyId - proof.unk3 = 0x00; - socket().send((char *)&proof, sizeof(proof)); - } - else - { - sAuthLogonProof_S_Old proof; - memcpy(proof.M2, sha.GetDigest(), 20); - proof.cmd = AUTH_LOGON_PROOF; - proof.error = 0; - proof.unk2 = 0x00; - socket().send((char *)&proof, sizeof(proof)); - } - - _authed = true; - } - else - { - char data[4] = { AUTH_LOGON_PROOF, WOW_FAIL_UNKNOWN_ACCOUNT, 3, 0 }; - socket().send(data, sizeof(data)); - - TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] account %s tried to login with invalid password!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ()); - - uint32 MaxWrongPassCount = sConfigMgr->GetIntDefault("WrongPass.MaxCount", 0); - if (MaxWrongPassCount > 0) - { - //Increment number of failed logins by one and if it reaches the limit temporarily ban that account or IP - PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_FAILEDLOGINS); - stmt->setString(0, _login); - LoginDatabase.Execute(stmt); - - stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_FAILEDLOGINS); - stmt->setString(0, _login); - - if (PreparedQueryResult loginfail = LoginDatabase.Query(stmt)) - { - uint32 failed_logins = (*loginfail)[1].GetUInt32(); - - if (failed_logins >= MaxWrongPassCount) - { - uint32 WrongPassBanTime = sConfigMgr->GetIntDefault("WrongPass.BanTime", 600); - bool WrongPassBanType = sConfigMgr->GetBoolDefault("WrongPass.BanType", false); - - if (WrongPassBanType) - { - uint32 acc_id = (*loginfail)[0].GetUInt32(); - stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_AUTO_BANNED); - stmt->setUInt32(0, acc_id); - stmt->setUInt32(1, WrongPassBanTime); - LoginDatabase.Execute(stmt); - - TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] account %s got banned for '%u' seconds because it failed to authenticate '%u' times", - socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str(), WrongPassBanTime, failed_logins); - } - else - { - stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_IP_AUTO_BANNED); - stmt->setString(0, socket().getRemoteAddress()); - stmt->setUInt32(1, WrongPassBanTime); - LoginDatabase.Execute(stmt); - - TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] IP %s got banned for '%u' seconds because account %s failed to authenticate '%u' times", - socket().getRemoteAddress().c_str(), socket().getRemotePort(), socket().getRemoteAddress().c_str(), WrongPassBanTime, _login.c_str(), failed_logins); - } - } - } - } - } - - return true; -} - -// Reconnect Challenge command handler -bool AuthSocket::_HandleReconnectChallenge() -{ - TC_LOG_DEBUG("server.authserver", "Entering _HandleReconnectChallenge"); - if (socket().recv_len() < sizeof(sAuthLogonChallenge_C)) - return false; - - // Read the first 4 bytes (header) to get the length of the remaining of the packet - std::vector buf; - buf.resize(4); - - socket().recv((char *)&buf[0], 4); - - EndianConvertPtr(&buf[0]); - - uint16 remaining = ((sAuthLogonChallenge_C *)&buf[0])->size; - TC_LOG_DEBUG("server.authserver", "[ReconnectChallenge] got header, body is %#04x bytes", remaining); - - if ((remaining < sizeof(sAuthLogonChallenge_C) - buf.size()) || (socket().recv_len() < remaining)) - return false; - - // No big fear of memory outage (size is int16, i.e. < 65536) - buf.resize(remaining + buf.size() + 1); - buf[buf.size() - 1] = 0; - sAuthLogonChallenge_C *ch = (sAuthLogonChallenge_C*)&buf[0]; - - // Read the remaining of the packet - socket().recv((char *)&buf[4], remaining); - TC_LOG_DEBUG("server.authserver", "[ReconnectChallenge] got full packet, %#04x bytes", ch->size); - TC_LOG_DEBUG("server.authserver", "[ReconnectChallenge] name(%d): '%s'", ch->I_len, ch->I); - - _login = (const char*)ch->I; - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_SESSIONKEY); - stmt->setString(0, _login); - PreparedQueryResult result = LoginDatabase.Query(stmt); - - // Stop if the account is not found - if (!result) - { - TC_LOG_ERROR("server.authserver", "'%s:%d' [ERROR] user %s tried to login and we cannot find his session key in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); - socket().shutdown(); - return false; - } - - // Reinitialize build, expansion and the account securitylevel - _build = ch->build; - _expversion = uint8(AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG)); - _os = (const char*)ch->os; - - if (_os.size() > 4) - return false; - - // Restore string order as its byte order is reversed - std::reverse(_os.begin(), _os.end()); - - Field* fields = result->Fetch(); - uint8 secLevel = fields[2].GetUInt8(); - _accountSecurityLevel = secLevel <= SEC_ADMINISTRATOR ? AccountTypes(secLevel) : SEC_ADMINISTRATOR; - - K.SetHexStr ((*result)[0].GetCString()); - - // Sending response - ByteBuffer pkt; - pkt << uint8(AUTH_RECONNECT_CHALLENGE); - pkt << uint8(0x00); - _reconnectProof.SetRand(16 * 8); - pkt.append(_reconnectProof.AsByteArray(16).get(), 16); // 16 bytes random - pkt << uint64(0x00) << uint64(0x00); // 16 bytes zeros - socket().send((char const*)pkt.contents(), pkt.size()); - return true; -} - -// Reconnect Proof command handler -bool AuthSocket::_HandleReconnectProof() -{ - TC_LOG_DEBUG("server.authserver", "Entering _HandleReconnectProof"); - // Read the packet - sAuthReconnectProof_C lp; - if (!socket().recv((char *)&lp, sizeof(sAuthReconnectProof_C))) - return false; - - if (_login.empty() || !_reconnectProof.GetNumBytes() || !K.GetNumBytes()) - return false; - - BigNumber t1; - t1.SetBinary(lp.R1, 16); - - SHA1Hash sha; - sha.Initialize(); - sha.UpdateData(_login); - sha.UpdateBigNumbers(&t1, &_reconnectProof, &K, NULL); - sha.Finalize(); - - if (!memcmp(sha.GetDigest(), lp.R2, SHA_DIGEST_LENGTH)) - { - // Sending response - ByteBuffer pkt; - pkt << uint8(AUTH_RECONNECT_PROOF); - pkt << uint8(0x00); - pkt << uint16(0x00); // 2 bytes zeros - socket().send((char const*)pkt.contents(), pkt.size()); - _authed = true; - return true; - } - else - { - TC_LOG_ERROR("server.authserver", "'%s:%d' [ERROR] user %s tried to login, but session is invalid.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); - socket().shutdown(); - return false; - } -} - -ACE_INET_Addr const& AuthSocket::GetAddressForClient(Realm const& realm, ACE_INET_Addr const& clientAddr) -{ - // Attempt to send best address for client - if (clientAddr.is_loopback()) - { - // Try guessing if realm is also connected locally - if (realm.LocalAddress.is_loopback() || realm.ExternalAddress.is_loopback()) - return clientAddr; - - // Assume that user connecting from the machine that authserver is located on - // has all realms available in his local network - return realm.LocalAddress; - } - - // Check if connecting client is in the same network - if (IsIPAddrInNetwork(realm.LocalAddress, clientAddr, realm.LocalSubnetMask)) - return realm.LocalAddress; - - // Return external IP - return realm.ExternalAddress; -} - -// Realm List command handler -bool AuthSocket::_HandleRealmList() -{ - TC_LOG_DEBUG("server.authserver", "Entering _HandleRealmList"); - if (socket().recv_len() < 5) - return false; - - socket().recv_skip(5); - - // Get the user id (else close the connection) - // No SQL injection (prepared statement) - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_ID_BY_NAME); - stmt->setString(0, _login); - PreparedQueryResult result = LoginDatabase.Query(stmt); - if (!result) - { - TC_LOG_ERROR("server.authserver", "'%s:%d' [ERROR] user %s tried to login but we cannot find him in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); - socket().shutdown(); - return false; - } - - Field* fields = result->Fetch(); - uint32 id = fields[0].GetUInt32(); - - // Update realm list if need - sRealmList->UpdateIfNeed(); - - ACE_INET_Addr clientAddr; - socket().peer().get_remote_addr(clientAddr); - - // Circle through realms in the RealmList and construct the return packet (including # of user characters in each realm) - ByteBuffer pkt; - - size_t RealmListSize = 0; - for (RealmList::RealmMap::const_iterator i = sRealmList->begin(); i != sRealmList->end(); ++i) - { - const Realm &realm = i->second; - // don't work with realms which not compatible with the client - bool okBuild = ((_expversion & POST_BC_EXP_FLAG) && realm.gamebuild == _build) || ((_expversion & PRE_BC_EXP_FLAG) && !AuthHelper::IsPreBCAcceptedClientBuild(realm.gamebuild)); - - // No SQL injection. id of realm is controlled by the database. - uint32 flag = realm.flag; - RealmBuildInfo const* buildInfo = AuthHelper::GetBuildInfo(realm.gamebuild); - if (!okBuild) - { - if (!buildInfo) - continue; - - flag |= REALM_FLAG_OFFLINE | REALM_FLAG_SPECIFYBUILD; // tell the client what build the realm is for - } - - if (!buildInfo) - flag &= ~REALM_FLAG_SPECIFYBUILD; - - std::string name = i->first; - if (_expversion & PRE_BC_EXP_FLAG && flag & REALM_FLAG_SPECIFYBUILD) - { - std::ostringstream ss; - ss << name << " (" << buildInfo->MajorVersion << '.' << buildInfo->MinorVersion << '.' << buildInfo->BugfixVersion << ')'; - name = ss.str(); - } - - // We don't need the port number from which client connects with but the realm's port - clientAddr.set_port_number(realm.ExternalAddress.get_port_number()); - - uint8 lock = (realm.allowedSecurityLevel > _accountSecurityLevel) ? 1 : 0; - - uint8 AmountOfCharacters = 0; - stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_NUM_CHARS_ON_REALM); - stmt->setUInt32(0, realm.m_ID); - stmt->setUInt32(1, id); - result = LoginDatabase.Query(stmt); - if (result) - AmountOfCharacters = (*result)[0].GetUInt8(); - - pkt << realm.icon; // realm type - if (_expversion & POST_BC_EXP_FLAG) // only 2.x and 3.x clients - pkt << lock; // if 1, then realm locked - pkt << uint8(flag); // RealmFlags - pkt << name; - pkt << GetAddressString(GetAddressForClient(realm, clientAddr)); - pkt << realm.populationLevel; - pkt << AmountOfCharacters; - pkt << realm.timezone; // realm category - if (_expversion & POST_BC_EXP_FLAG) // 2.x and 3.x clients - pkt << uint8(0x2C); // unk, may be realm number/id? - else - pkt << uint8(0x0); // 1.12.1 and 1.12.2 clients - - if (_expversion & POST_BC_EXP_FLAG && flag & REALM_FLAG_SPECIFYBUILD) - { - pkt << uint8(buildInfo->MajorVersion); - pkt << uint8(buildInfo->MinorVersion); - pkt << uint8(buildInfo->BugfixVersion); - pkt << uint16(buildInfo->Build); - } - - ++RealmListSize; - } - - if (_expversion & POST_BC_EXP_FLAG) // 2.x and 3.x clients - { - pkt << uint8(0x10); - pkt << uint8(0x00); - } - else // 1.12.1 and 1.12.2 clients - { - pkt << uint8(0x00); - pkt << uint8(0x02); - } - - // make a ByteBuffer which stores the RealmList's size - ByteBuffer RealmListSizeBuffer; - RealmListSizeBuffer << uint32(0); - if (_expversion & POST_BC_EXP_FLAG) // only 2.x and 3.x clients - RealmListSizeBuffer << uint16(RealmListSize); - else - RealmListSizeBuffer << uint32(RealmListSize); - - ByteBuffer hdr; - hdr << uint8(REALM_LIST); - hdr << uint16(pkt.size() + RealmListSizeBuffer.size()); - hdr.append(RealmListSizeBuffer); // append RealmList's size buffer - hdr.append(pkt); // append realms in the realmlist - - socket().send((char const*)hdr.contents(), hdr.size()); - - return true; -} - -// Resume patch transfer -bool AuthSocket::_HandleXferResume() -{ - TC_LOG_DEBUG("server.authserver", "Entering _HandleXferResume"); - // Check packet length and patch existence - if (socket().recv_len() < 9 || !pPatch) // FIXME: pPatch is never used - { - TC_LOG_ERROR("server.authserver", "Error while resuming patch transfer (wrong packet)"); - return false; - } - - // Launch a PatcherRunnable thread starting at given patch file offset - uint64 start; - socket().recv_skip(1); - socket().recv((char*)&start, sizeof(start)); - fseek(pPatch, long(start), 0); - - ACE_Based::Thread u(new PatcherRunnable(this)); - return true; -} - -// Cancel patch transfer -bool AuthSocket::_HandleXferCancel() -{ - TC_LOG_DEBUG("server.authserver", "Entering _HandleXferCancel"); - - // Close and delete the socket - socket().recv_skip(1); //clear input buffer - socket().shutdown(); - - return true; -} - -// Accept patch transfer -bool AuthSocket::_HandleXferAccept() -{ - TC_LOG_DEBUG("server.authserver", "Entering _HandleXferAccept"); - - // Check packet length and patch existence - if (!pPatch) - { - TC_LOG_ERROR("server.authserver", "Error while accepting patch transfer (wrong packet)"); - return false; - } - - // Launch a PatcherRunnable thread, starting at the beginning of the patch file - socket().recv_skip(1); // clear input buffer - fseek(pPatch, 0, 0); - - ACE_Based::Thread u(new PatcherRunnable(this)); - return true; -} - -PatcherRunnable::PatcherRunnable(class AuthSocket* as) -{ - mySocket = as; -} - -// Send content of patch file to the client -void PatcherRunnable::run() { } - -// Preload MD5 hashes of existing patch files on server -#ifndef _WIN32 -#include -#include -void Patcher::LoadPatchesInfo() -{ - DIR *dirp; - struct dirent *dp; - dirp = opendir("./patches/"); - - if (!dirp) - return; - - while (dirp) - { - errno = 0; - if ((dp = readdir(dirp)) != NULL) - { - int l = strlen(dp->d_name); - - if (l < 8) - continue; - - if (!memcmp(&dp->d_name[l - 4], ".mpq", 4)) - LoadPatchMD5(dp->d_name); - } - else - { - if (errno != 0) - { - closedir(dirp); - return; - } - break; - } - } - - if (dirp) - closedir(dirp); -} -#else -void Patcher::LoadPatchesInfo() -{ - WIN32_FIND_DATA fil; - HANDLE hFil = FindFirstFile("./patches/*.mpq", &fil); - if (hFil == INVALID_HANDLE_VALUE) - return; // no patches were found - - do - LoadPatchMD5(fil.cFileName); - while (FindNextFile(hFil, &fil)); -} -#endif - -// Calculate and store MD5 hash for a given patch file -void Patcher::LoadPatchMD5(char *szFileName) -{ - // Try to open the patch file - std::string path = "./patches/"; - path += szFileName; - FILE* pPatch = fopen(path.c_str(), "rb"); - TC_LOG_DEBUG("network", "Loading patch info from %s\n", path.c_str()); - - if (!pPatch) - { - TC_LOG_ERROR("server.authserver", "Error loading patch %s\n", path.c_str()); - return; - } - - // Calculate the MD5 hash - MD5_CTX ctx; - MD5_Init(&ctx); - uint8* buf = new uint8[512 * 1024]; - - while (!feof(pPatch)) - { - size_t read = fread(buf, 1, 512 * 1024, pPatch); - MD5_Update(&ctx, buf, read); - } - - delete [] buf; - fclose(pPatch); - - // Store the result in the internal patch hash map - _patches[path] = new PATCH_INFO; - MD5_Final((uint8 *)&_patches[path]->md5, &ctx); -} - -// Get cached MD5 hash for a given patch file -bool Patcher::GetHash(char * pat, uint8 mymd5[16]) -{ - for (Patches::iterator i = _patches.begin(); i != _patches.end(); ++i) - if (!stricmp(pat, i->first.c_str())) - { - memcpy(mymd5, i->second->md5, 16); - return true; - } - - return false; -} - -// Launch the patch hashing mechanism on object creation -Patcher::Patcher() -{ - LoadPatchesInfo(); -} - -// Empty and delete the patch map on termination -Patcher::~Patcher() -{ - for (Patches::iterator i = _patches.begin(); i != _patches.end(); ++i) - delete i->second; -} diff --git a/src/server/authserver/Server/AuthSocket.h b/src/server/authserver/Server/AuthSocket.h deleted file mode 100644 index 5e04d459ba1..00000000000 --- a/src/server/authserver/Server/AuthSocket.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2008-2014 TrinityCore - * Copyright (C) 2005-2009 MaNGOS - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef _AUTHSOCKET_H -#define _AUTHSOCKET_H - -#include "Common.h" -#include "BigNumber.h" -#include "RealmSocket.h" - -class ACE_INET_Addr; -struct Realm; - -// Handle login commands -class AuthSocket: public RealmSocket::Session -{ -public: - const static int s_BYTE_SIZE = 32; - - AuthSocket(RealmSocket& socket); - virtual ~AuthSocket(void); - - virtual void OnRead(void); - virtual void OnAccept(void); - virtual void OnClose(void); - - static ACE_INET_Addr const& GetAddressForClient(Realm const& realm, ACE_INET_Addr const& clientAddr); - - bool _HandleLogonChallenge(); - bool _HandleLogonProof(); - bool _HandleReconnectChallenge(); - bool _HandleReconnectProof(); - bool _HandleRealmList(); - - //data transfer handle for patch - bool _HandleXferResume(); - bool _HandleXferCancel(); - bool _HandleXferAccept(); - - void _SetVSFields(const std::string& rI); - - FILE* pPatch; - ACE_Thread_Mutex patcherLock; - -private: - RealmSocket& socket_; - RealmSocket& socket(void) { return socket_; } - - BigNumber N, s, g, v; - BigNumber b, B; - BigNumber K; - BigNumber _reconnectProof; - - bool _authed; - - std::string _login; - std::string _tokenKey; - - // Since GetLocaleByName() is _NOT_ bijective, we have to store the locale as a string. Otherwise we can't differ - // between enUS and enGB, which is important for the patch system - std::string _localizationName; - std::string _os; - uint16 _build; - uint8 _expversion; - AccountTypes _accountSecurityLevel; -}; - -#endif diff --git a/src/server/authserver/Server/RealmAcceptor.h b/src/server/authserver/Server/RealmAcceptor.h deleted file mode 100644 index e89135c4896..00000000000 --- a/src/server/authserver/Server/RealmAcceptor.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2008-2014 TrinityCore - * Copyright (C) 2005-2010 MaNGOS - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef __REALMACCEPTOR_H__ -#define __REALMACCEPTOR_H__ - -#include -#include - -#include "RealmSocket.h" -#include "AuthSocket.h" - -class RealmAcceptor : public ACE_Acceptor -{ -public: - RealmAcceptor(void) { } - virtual ~RealmAcceptor(void) - { - if (reactor()) - reactor()->cancel_timer(this, 1); - } - -protected: - virtual int make_svc_handler(RealmSocket* &sh) - { - if (sh == 0) - ACE_NEW_RETURN(sh, RealmSocket, -1); - - sh->reactor(reactor()); - sh->set_session(new AuthSocket(*sh)); - return 0; - } - - virtual int handle_timeout(const ACE_Time_Value& /*current_time*/, const void* /*act = 0*/) - { - TC_LOG_DEBUG("server.authserver", "Resuming acceptor"); - reactor()->cancel_timer(this, 1); - return reactor()->register_handler(this, ACE_Event_Handler::ACCEPT_MASK); - } - - virtual int handle_accept_error(void) - { -#if defined(ENFILE) && defined(EMFILE) - if (errno == ENFILE || errno == EMFILE) - { - TC_LOG_ERROR("server.authserver", "Out of file descriptors, suspending incoming connections for 10 seconds"); - reactor()->remove_handler(this, ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); - reactor()->schedule_timer(this, NULL, ACE_Time_Value(10)); - } -#endif - return 0; - } -}; - -#endif diff --git a/src/server/authserver/Server/RealmSocket.cpp b/src/server/authserver/Server/RealmSocket.cpp deleted file mode 100644 index 1013639cc50..00000000000 --- a/src/server/authserver/Server/RealmSocket.cpp +++ /dev/null @@ -1,291 +0,0 @@ -/* - * Copyright (C) 2008-2014 TrinityCore - * Copyright (C) 2005-2010 MaNGOS - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include -#include -#include - -#include "RealmSocket.h" -#include "Log.h" - -RealmSocket::Session::Session(void) { } - -RealmSocket::Session::~Session(void) { } - -RealmSocket::RealmSocket(void) : - input_buffer_(4096), session_(NULL), - _remoteAddress(), _remotePort(0) -{ - reference_counting_policy().value(ACE_Event_Handler::Reference_Counting_Policy::ENABLED); - - msg_queue()->high_water_mark(8 * 1024 * 1024); - msg_queue()->low_water_mark(8 * 1024 * 1024); -} - -RealmSocket::~RealmSocket(void) -{ - if (msg_queue()) - msg_queue()->close(); - - // delete RealmSocketObject must never be called from our code. - closing_ = true; - - delete session_; - - peer().close(); -} - -int RealmSocket::open(void * arg) -{ - ACE_INET_Addr addr; - - if (peer().get_remote_addr(addr) == -1) - { - TC_LOG_ERROR("server.authserver", "Error %s while opening realm socket!", ACE_OS::strerror(errno)); - return -1; - } - - _remoteAddress = addr.get_host_addr(); - _remotePort = addr.get_port_number(); - - // Register with ACE Reactor - if (Base::open(arg) == -1) - return -1; - - if (session_) - session_->OnAccept(); - - // reactor takes care of the socket from now on - remove_reference(); - - return 0; -} - -int RealmSocket::close(u_long) -{ - shutdown(); - - closing_ = true; - - remove_reference(); - - return 0; -} - -const std::string& RealmSocket::getRemoteAddress(void) const -{ - return _remoteAddress; -} - -uint16 RealmSocket::getRemotePort(void) const -{ - return _remotePort; -} - -size_t RealmSocket::recv_len(void) const -{ - return input_buffer_.length(); -} - -bool RealmSocket::recv_soft(char *buf, size_t len) -{ - if (input_buffer_.length() < len) - return false; - - ACE_OS::memcpy(buf, input_buffer_.rd_ptr(), len); - - return true; -} - -bool RealmSocket::recv(char *buf, size_t len) -{ - bool ret = recv_soft(buf, len); - - if (ret) - recv_skip(len); - - return ret; -} - -void RealmSocket::recv_skip(size_t len) -{ - input_buffer_.rd_ptr(len); -} - -ssize_t RealmSocket::noblk_send(ACE_Message_Block &message_block) -{ - const size_t len = message_block.length(); - - if (len == 0) - return -1; - - // Try to send the message directly. -#ifdef MSG_NOSIGNAL - ssize_t n = peer().send(message_block.rd_ptr(), len, MSG_NOSIGNAL); -#else - ssize_t n = peer().send(message_block.rd_ptr(), len); -#endif // MSG_NOSIGNAL - - if (n < 0) - { - if (errno == EWOULDBLOCK) // Blocking signal - return 0; - else // Error happened - return -1; - } - else if (n == 0) - { - // Can this happen ? - return -1; - } - - // return bytes transmitted - return n; -} - -bool RealmSocket::send(const char *buf, size_t len) -{ - if (buf == NULL || len == 0) - return true; - - ACE_Data_Block db(len, ACE_Message_Block::MB_DATA, (const char*)buf, 0, 0, ACE_Message_Block::DONT_DELETE, 0); - ACE_Message_Block message_block(&db, ACE_Message_Block::DONT_DELETE, 0); - - message_block.wr_ptr(len); - - if (msg_queue()->is_empty()) - { - // Try to send it directly. - ssize_t n = noblk_send(message_block); - - if (n < 0) - return false; - - size_t un = size_t(n); - if (un == len) - return true; - - // fall down - message_block.rd_ptr(un); - } - - ACE_Message_Block* mb = message_block.clone(); - - if (msg_queue()->enqueue_tail(mb, (ACE_Time_Value *)(&ACE_Time_Value::zero)) == -1) - { - mb->release(); - return false; - } - - if (reactor()->schedule_wakeup(this, ACE_Event_Handler::WRITE_MASK) == -1) - return false; - - return true; -} - -int RealmSocket::handle_output(ACE_HANDLE) -{ - if (closing_) - return -1; - - ACE_Message_Block* mb = 0; - - if (msg_queue()->is_empty()) - { - reactor()->cancel_wakeup(this, ACE_Event_Handler::WRITE_MASK); - return 0; - } - - if (msg_queue()->dequeue_head(mb, (ACE_Time_Value *)(&ACE_Time_Value::zero)) == -1) - return -1; - - ssize_t n = noblk_send(*mb); - - if (n < 0) - { - mb->release(); - return -1; - } - else if (size_t(n) == mb->length()) - { - mb->release(); - return 1; - } - else - { - mb->rd_ptr(n); - - if (msg_queue()->enqueue_head(mb, (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) - { - mb->release(); - return -1; - } - - return 0; - } - - ACE_NOTREACHED(return -1); -} - -int RealmSocket::handle_close(ACE_HANDLE h, ACE_Reactor_Mask) -{ - // As opposed to WorldSocket::handle_close, we don't need locks here. - closing_ = true; - - if (h == ACE_INVALID_HANDLE) - peer().close_writer(); - - if (session_) - session_->OnClose(); - - reactor()->remove_handler(this, ACE_Event_Handler::DONT_CALL | ACE_Event_Handler::ALL_EVENTS_MASK); - return 0; -} - -int RealmSocket::handle_input(ACE_HANDLE) -{ - if (closing_) - return -1; - - const ssize_t space = input_buffer_.space(); - - ssize_t n = peer().recv(input_buffer_.wr_ptr(), space); - - if (n < 0) - return errno == EWOULDBLOCK ? 0 : -1; - else if (n == 0) // EOF - return -1; - - input_buffer_.wr_ptr((size_t)n); - - if (session_ != NULL) - { - session_->OnRead(); - input_buffer_.crunch(); - } - - // return 1 in case there is more data to read from OS - return n == space ? 1 : 0; -} - -void RealmSocket::set_session(Session* session) -{ - delete session_; - - session_ = session; -} diff --git a/src/server/authserver/Server/RealmSocket.h b/src/server/authserver/Server/RealmSocket.h deleted file mode 100644 index c1190d638b3..00000000000 --- a/src/server/authserver/Server/RealmSocket.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2008-2014 TrinityCore - * Copyright (C) 2005-2010 MaNGOS - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef __REALMSOCKET_H__ -#define __REALMSOCKET_H__ - -#include -#include -#include -#include -#include -#include "Common.h" - -class RealmSocket : public ACE_Svc_Handler -{ -private: - typedef ACE_Svc_Handler Base; - -public: - class Session - { - public: - Session(void); - virtual ~Session(void); - - virtual void OnRead(void) = 0; - virtual void OnAccept(void) = 0; - virtual void OnClose(void) = 0; - }; - - RealmSocket(void); - virtual ~RealmSocket(void); - - size_t recv_len(void) const; - bool recv_soft(char *buf, size_t len); - bool recv(char *buf, size_t len); - void recv_skip(size_t len); - - bool send(const char *buf, size_t len); - - const std::string& getRemoteAddress(void) const; - - uint16 getRemotePort(void) const; - - virtual int open(void *); - - virtual int close(u_long); - - virtual int handle_input(ACE_HANDLE = ACE_INVALID_HANDLE); - virtual int handle_output(ACE_HANDLE = ACE_INVALID_HANDLE); - - virtual int handle_close(ACE_HANDLE = ACE_INVALID_HANDLE, ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); - - void set_session(Session* session); - -private: - ssize_t noblk_send(ACE_Message_Block &message_block); - - ACE_Message_Block input_buffer_; - Session* session_; - std::string _remoteAddress; - uint16 _remotePort; -}; - -#endif /* __REALMSOCKET_H__ */ diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index c5424374f5a..a5230b908ef 100644 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -40,7 +40,6 @@ #include "TCSoap.h" #include "Timer.h" #include "Util.h" -#include "AuthSocket.h" #include "RealmList.h" #include "BigNumber.h" -- cgit v1.2.3 From b520f7da018aa0d771e6589b58081e71643bf860 Mon Sep 17 00:00:00 2001 From: leak Date: Fri, 30 May 2014 15:46:17 +0200 Subject: Damn you VS default settings.. --- src/server/authserver/Main.cpp | 168 +-- src/server/authserver/Realms/RealmList.h | 20 +- src/server/authserver/Server/AuthServer.cpp | 18 +- src/server/authserver/Server/AuthServer.h | 18 +- src/server/authserver/Server/AuthSession.cpp | 1572 +++++++++++++------------- src/server/authserver/Server/AuthSession.h | 78 +- 6 files changed, 937 insertions(+), 937 deletions(-) (limited to 'src') diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index c8be23ca524..27834f50814 100644 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -67,28 +67,28 @@ using boost::asio::ip::tcp; void SignalHandler(const boost::system::error_code& error, int signalNumber) { - TC_LOG_ERROR("server.authserver", "SIGNAL HANDLER WORKING"); - if (!error) - { - switch (signalNumber) - { - case SIGINT: - case SIGTERM: - _ioService.stop(); - break; - } - } + TC_LOG_ERROR("server.authserver", "SIGNAL HANDLER WORKING"); + if (!error) + { + switch (signalNumber) + { + case SIGINT: + case SIGTERM: + _ioService.stop(); + break; + } + } } void KeepDatabaseAliveHandler(const boost::system::error_code& error) { - if (!error) - { - TC_LOG_INFO("server.authserver", "Ping MySQL to keep connection alive"); - LoginDatabase.KeepAlive(); + if (!error) + { + TC_LOG_INFO("server.authserver", "Ping MySQL to keep connection alive"); + LoginDatabase.KeepAlive(); - _dbPingTimer.expires_from_now(boost::posix_time::minutes(_dbPingInterval)); - } + _dbPingTimer.expires_from_now(boost::posix_time::minutes(_dbPingInterval)); + } } /// Print out the usage string for this program on the console. @@ -170,22 +170,22 @@ int main(int argc, char** argv) std::string bindIp = sConfigMgr->GetStringDefault("BindIP", "0.0.0.0"); - AuthServer authServer(_ioService, bindIp, port); + AuthServer authServer(_ioService, bindIp, port); - // Set signal handlers - boost::asio::signal_set signals(_ioService, SIGINT, SIGTERM); - signals.async_wait(SignalHandler); + // Set signal handlers + boost::asio::signal_set signals(_ioService, SIGINT, SIGTERM); + signals.async_wait(SignalHandler); - SetProcessPriority(); + SetProcessPriority(); - _dbPingInterval = sConfigMgr->GetIntDefault("MaxPingTime", 30); + _dbPingInterval = sConfigMgr->GetIntDefault("MaxPingTime", 30); - _dbPingTimer.expires_from_now(boost::posix_time::seconds(_dbPingInterval)); - _dbPingTimer.async_wait(KeepDatabaseAliveHandler); + _dbPingTimer.expires_from_now(boost::posix_time::seconds(_dbPingInterval)); + _dbPingTimer.async_wait(KeepDatabaseAliveHandler); - // Start the io service - _ioService.run(); + // Start the io service + _ioService.run(); // Close the Database Pool and library StopDB(); @@ -244,69 +244,69 @@ void SetProcessPriority() { #if defined(_WIN32) || defined(__linux__) - ///- Handle affinity for multiple processors and process priority - uint32 affinity = sConfigMgr->GetIntDefault("UseProcessors", 0); - bool highPriority = sConfigMgr->GetBoolDefault("ProcessPriority", false); + ///- Handle affinity for multiple processors and process priority + uint32 affinity = sConfigMgr->GetIntDefault("UseProcessors", 0); + bool highPriority = sConfigMgr->GetBoolDefault("ProcessPriority", false); #ifdef _WIN32 // Windows - HANDLE hProcess = GetCurrentProcess(); - if (affinity > 0) - { - ULONG_PTR appAff; - ULONG_PTR sysAff; - - if (GetProcessAffinityMask(hProcess, &appAff, &sysAff)) - { - // remove non accessible processors - ULONG_PTR currentAffinity = affinity & appAff; - - if (!currentAffinity) - TC_LOG_ERROR("server.authserver", "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the authserver. Accessible processors bitmask (hex): %x", affinity, appAff); - else if (SetProcessAffinityMask(hProcess, currentAffinity)) - TC_LOG_INFO("server.authserver", "Using processors (bitmask, hex): %x", currentAffinity); - else - TC_LOG_ERROR("server.authserver", "Can't set used processors (hex): %x", currentAffinity); - } - } - - if (highPriority) - { - if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS)) - TC_LOG_INFO("server.authserver", "authserver process priority class set to HIGH"); - else - TC_LOG_ERROR("server.authserver", "Can't set authserver process priority class."); - } + HANDLE hProcess = GetCurrentProcess(); + if (affinity > 0) + { + ULONG_PTR appAff; + ULONG_PTR sysAff; + + if (GetProcessAffinityMask(hProcess, &appAff, &sysAff)) + { + // remove non accessible processors + ULONG_PTR currentAffinity = affinity & appAff; + + if (!currentAffinity) + TC_LOG_ERROR("server.authserver", "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the authserver. Accessible processors bitmask (hex): %x", affinity, appAff); + else if (SetProcessAffinityMask(hProcess, currentAffinity)) + TC_LOG_INFO("server.authserver", "Using processors (bitmask, hex): %x", currentAffinity); + else + TC_LOG_ERROR("server.authserver", "Can't set used processors (hex): %x", currentAffinity); + } + } + + if (highPriority) + { + if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS)) + TC_LOG_INFO("server.authserver", "authserver process priority class set to HIGH"); + else + TC_LOG_ERROR("server.authserver", "Can't set authserver process priority class."); + } #else // Linux - if (affinity > 0) - { - cpu_set_t mask; - CPU_ZERO(&mask); - - for (unsigned int i = 0; i < sizeof(affinity) * 8; ++i) - if (affinity & (1 << i)) - CPU_SET(i, &mask); - - if (sched_setaffinity(0, sizeof(mask), &mask)) - TC_LOG_ERROR("server.authserver", "Can't set used processors (hex): %x, error: %s", affinity, strerror(errno)); - else - { - CPU_ZERO(&mask); - sched_getaffinity(0, sizeof(mask), &mask); - TC_LOG_INFO("server.authserver", "Using processors (bitmask, hex): %lx", *(__cpu_mask*)(&mask)); - } - } - - if (highPriority) - { - if (setpriority(PRIO_PROCESS, 0, PROCESS_HIGH_PRIORITY)) - TC_LOG_ERROR("server.authserver", "Can't set authserver process priority class, error: %s", strerror(errno)); - else - TC_LOG_INFO("server.authserver", "authserver process priority class set to %i", getpriority(PRIO_PROCESS, 0)); - } + if (affinity > 0) + { + cpu_set_t mask; + CPU_ZERO(&mask); + + for (unsigned int i = 0; i < sizeof(affinity) * 8; ++i) + if (affinity & (1 << i)) + CPU_SET(i, &mask); + + if (sched_setaffinity(0, sizeof(mask), &mask)) + TC_LOG_ERROR("server.authserver", "Can't set used processors (hex): %x, error: %s", affinity, strerror(errno)); + else + { + CPU_ZERO(&mask); + sched_getaffinity(0, sizeof(mask), &mask); + TC_LOG_INFO("server.authserver", "Using processors (bitmask, hex): %lx", *(__cpu_mask*)(&mask)); + } + } + + if (highPriority) + { + if (setpriority(PRIO_PROCESS, 0, PROCESS_HIGH_PRIORITY)) + TC_LOG_ERROR("server.authserver", "Can't set authserver process priority class, error: %s", strerror(errno)); + else + TC_LOG_INFO("server.authserver", "authserver process priority class set to %i", getpriority(PRIO_PROCESS, 0)); + } #endif #endif -} \ No newline at end of file +} diff --git a/src/server/authserver/Realms/RealmList.h b/src/server/authserver/Realms/RealmList.h index 1d76c39e4f0..88da30ea963 100644 --- a/src/server/authserver/Realms/RealmList.h +++ b/src/server/authserver/Realms/RealmList.h @@ -26,15 +26,15 @@ enum RealmFlags { - REALM_FLAG_NONE = 0x00, - REALM_FLAG_INVALID = 0x01, - REALM_FLAG_OFFLINE = 0x02, - REALM_FLAG_SPECIFYBUILD = 0x04, - REALM_FLAG_UNK1 = 0x08, - REALM_FLAG_UNK2 = 0x10, - REALM_FLAG_RECOMMENDED = 0x20, - REALM_FLAG_NEW = 0x40, - REALM_FLAG_FULL = 0x80 + REALM_FLAG_NONE = 0x00, + REALM_FLAG_INVALID = 0x01, + REALM_FLAG_OFFLINE = 0x02, + REALM_FLAG_SPECIFYBUILD = 0x04, + REALM_FLAG_UNK1 = 0x08, + REALM_FLAG_UNK2 = 0x10, + REALM_FLAG_RECOMMENDED = 0x20, + REALM_FLAG_NEW = 0x40, + REALM_FLAG_FULL = 0x80 }; // Storage object for a realm @@ -73,7 +73,7 @@ public: uint32 size() const { return m_realms.size(); } private: - void UpdateRealms(bool init=false); + void UpdateRealms(bool init = false); void UpdateRealm(uint32 id, const std::string& name, ACE_INET_Addr const& address, ACE_INET_Addr const& localAddr, ACE_INET_Addr const& localSubmask, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build); RealmMap m_realms; diff --git a/src/server/authserver/Server/AuthServer.cpp b/src/server/authserver/Server/AuthServer.cpp index a699734be79..5c3ef247254 100644 --- a/src/server/authserver/Server/AuthServer.cpp +++ b/src/server/authserver/Server/AuthServer.cpp @@ -25,15 +25,15 @@ using boost::asio::ip::tcp; void AuthServer::AsyncAccept() { - _acceptor.async_accept(_socket, [this](boost::system::error_code error) - { - if (!error) - { - std::make_shared(std::move(_socket))->Start(); - } - - AsyncAccept(); - }); + _acceptor.async_accept(_socket, [this](boost::system::error_code error) + { + if (!error) + { + std::make_shared(std::move(_socket))->Start(); + } + + AsyncAccept(); + }); } diff --git a/src/server/authserver/Server/AuthServer.h b/src/server/authserver/Server/AuthServer.h index 0496326ee7b..985a48ad243 100644 --- a/src/server/authserver/Server/AuthServer.h +++ b/src/server/authserver/Server/AuthServer.h @@ -25,20 +25,20 @@ using boost::asio::ip::tcp; class AuthServer { public: - AuthServer(boost::asio::io_service& ioService, std::string bindIp, int port) : _socket(ioService), _acceptor(ioService, tcp::endpoint(tcp::v4(), port)) - { - tcp::endpoint endpoint(boost::asio::ip::address::from_string(bindIp), port); + AuthServer(boost::asio::io_service& ioService, std::string bindIp, int port) : _socket(ioService), _acceptor(ioService, tcp::endpoint(tcp::v4(), port)) + { + tcp::endpoint endpoint(boost::asio::ip::address::from_string(bindIp), port); - _acceptor = tcp::acceptor(ioService, endpoint); + _acceptor = tcp::acceptor(ioService, endpoint); - AsyncAccept(); - }; + AsyncAccept(); + }; private: - void AsyncAccept(); + void AsyncAccept(); - tcp::acceptor _acceptor; - tcp::socket _socket; + tcp::acceptor _acceptor; + tcp::socket _socket; }; #endif /* __AUTHSERVER_H__ */ diff --git a/src/server/authserver/Server/AuthSession.cpp b/src/server/authserver/Server/AuthSession.cpp index cb78336f2d3..6a3c145d08b 100644 --- a/src/server/authserver/Server/AuthSession.cpp +++ b/src/server/authserver/Server/AuthSession.cpp @@ -32,80 +32,80 @@ using boost::asio::ip::tcp; enum eAuthCmd { - AUTH_LOGON_CHALLENGE = 0x00, - AUTH_LOGON_PROOF = 0x01, - AUTH_RECONNECT_CHALLENGE = 0x02, - AUTH_RECONNECT_PROOF = 0x03, - REALM_LIST = 0x10, - XFER_INITIATE = 0x30, - XFER_DATA = 0x31, - XFER_ACCEPT = 0x32, - XFER_RESUME = 0x33, - XFER_CANCEL = 0x34 + AUTH_LOGON_CHALLENGE = 0x00, + AUTH_LOGON_PROOF = 0x01, + AUTH_RECONNECT_CHALLENGE = 0x02, + AUTH_RECONNECT_PROOF = 0x03, + REALM_LIST = 0x10, + XFER_INITIATE = 0x30, + XFER_DATA = 0x31, + XFER_ACCEPT = 0x32, + XFER_RESUME = 0x33, + XFER_CANCEL = 0x34 }; enum eStatus { - STATUS_CONNECTED = 0, - STATUS_AUTHED + STATUS_CONNECTED = 0, + STATUS_AUTHED }; #pragma pack(push, 1) typedef struct AUTH_LOGON_CHALLENGE_C { - uint8 cmd; - uint8 error; - uint16 size; - uint8 gamename[4]; - uint8 version1; - uint8 version2; - uint8 version3; - uint16 build; - uint8 platform[4]; - uint8 os[4]; - uint8 country[4]; - uint32 timezone_bias; - uint32 ip; - uint8 I_len; - uint8 I[1]; + uint8 cmd; + uint8 error; + uint16 size; + uint8 gamename[4]; + uint8 version1; + uint8 version2; + uint8 version3; + uint16 build; + uint8 platform[4]; + uint8 os[4]; + uint8 country[4]; + uint32 timezone_bias; + uint32 ip; + uint8 I_len; + uint8 I[1]; } sAuthLogonChallenge_C; typedef struct AUTH_LOGON_PROOF_C { - uint8 cmd; - uint8 A[32]; - uint8 M1[20]; - uint8 crc_hash[20]; - uint8 number_of_keys; - uint8 securityFlags; + uint8 cmd; + uint8 A[32]; + uint8 M1[20]; + uint8 crc_hash[20]; + uint8 number_of_keys; + uint8 securityFlags; } sAuthLogonProof_C; typedef struct AUTH_LOGON_PROOF_S { - uint8 cmd; - uint8 error; - uint8 M2[20]; - uint32 unk1; - uint32 unk2; - uint16 unk3; + uint8 cmd; + uint8 error; + uint8 M2[20]; + uint32 unk1; + uint32 unk2; + uint16 unk3; } sAuthLogonProof_S; typedef struct AUTH_LOGON_PROOF_S_OLD { - uint8 cmd; - uint8 error; - uint8 M2[20]; - uint32 unk2; + uint8 cmd; + uint8 error; + uint8 M2[20]; + uint32 unk2; } sAuthLogonProof_S_Old; typedef struct AUTH_RECONNECT_PROOF_C { - uint8 cmd; - uint8 R1[16]; - uint8 R2[20]; - uint8 R3[20]; - uint8 number_of_keys; + uint8 cmd; + uint8 R1[16]; + uint8 R2[20]; + uint8 R3[20]; + uint8 number_of_keys; } sAuthReconnectProof_C; #pragma pack(pop) @@ -113,10 +113,10 @@ typedef struct AUTH_RECONNECT_PROOF_C typedef struct AuthHandler { - eAuthCmd cmd; - uint32 status; - size_t packetSize; - bool (AuthSession::*handler)(); + eAuthCmd cmd; + uint32 status; + size_t packetSize; + bool (AuthSession::*handler)(); } AuthHandler; #define BYTE_SIZE 32 @@ -124,792 +124,792 @@ typedef struct AuthHandler const AuthHandler table[] = { - { AUTH_LOGON_CHALLENGE, STATUS_CONNECTED, sizeof(AUTH_LOGON_CHALLENGE_C), &AuthSession::_HandleLogonChallenge }, - { AUTH_LOGON_PROOF, STATUS_CONNECTED, sizeof(AUTH_LOGON_PROOF_C), &AuthSession::_HandleLogonProof }, - { AUTH_RECONNECT_CHALLENGE, STATUS_CONNECTED, sizeof(AUTH_LOGON_CHALLENGE_C), &AuthSession::_HandleReconnectChallenge }, - { AUTH_RECONNECT_PROOF, STATUS_CONNECTED, sizeof(AUTH_RECONNECT_PROOF_C), &AuthSession::_HandleReconnectProof }, - { REALM_LIST, STATUS_AUTHED, REALMLIST_SKIP_PACKETS, &AuthSession::_HandleRealmList } + { AUTH_LOGON_CHALLENGE, STATUS_CONNECTED, sizeof(AUTH_LOGON_CHALLENGE_C), &AuthSession::_HandleLogonChallenge }, + { AUTH_LOGON_PROOF, STATUS_CONNECTED, sizeof(AUTH_LOGON_PROOF_C), &AuthSession::_HandleLogonProof }, + { AUTH_RECONNECT_CHALLENGE, STATUS_CONNECTED, sizeof(AUTH_LOGON_CHALLENGE_C), &AuthSession::_HandleReconnectChallenge }, + { AUTH_RECONNECT_PROOF, STATUS_CONNECTED, sizeof(AUTH_RECONNECT_PROOF_C), &AuthSession::_HandleReconnectProof }, + { REALM_LIST, STATUS_AUTHED, REALMLIST_SKIP_PACKETS, &AuthSession::_HandleRealmList } }; void AuthSession::AsyncReadHeader() { - auto self(shared_from_this()); - - _socket.async_read_some(boost::asio::buffer(_readBuffer, 1), [this, self](boost::system::error_code error, size_t transferedBytes) - { - if (!error && transferedBytes == 1) - { - for (const AuthHandler& entry : table) - { - if ((uint8)entry.cmd == _readBuffer[0] && (entry.status == STATUS_CONNECTED || (_isAuthenticated && entry.status == STATUS_AUTHED))) - { - // Handle dynamic size packet - if (_readBuffer[0] == AUTH_LOGON_CHALLENGE) - { - _socket.read_some(boost::asio::buffer(&_readBuffer[1], sizeof(uint8) + sizeof(uint16))); //error + size - - AsyncReadData(entry.handler, (uint16)&_readBuffer[2], sizeof(uint8) + sizeof(uint8) + sizeof(uint16)); // cmd + error + size - } - else - { - AsyncReadData(entry.handler, entry.packetSize, sizeof(uint8)); - } - break; - } - } - } - else - { - _socket.close(); - } - }); + auto self(shared_from_this()); + + _socket.async_read_some(boost::asio::buffer(_readBuffer, 1), [this, self](boost::system::error_code error, size_t transferedBytes) + { + if (!error && transferedBytes == 1) + { + for (const AuthHandler& entry : table) + { + if ((uint8)entry.cmd == _readBuffer[0] && (entry.status == STATUS_CONNECTED || (_isAuthenticated && entry.status == STATUS_AUTHED))) + { + // Handle dynamic size packet + if (_readBuffer[0] == AUTH_LOGON_CHALLENGE) + { + _socket.read_some(boost::asio::buffer(&_readBuffer[1], sizeof(uint8) + sizeof(uint16))); //error + size + + AsyncReadData(entry.handler, (uint16)&_readBuffer[2], sizeof(uint8) + sizeof(uint8) + sizeof(uint16)); // cmd + error + size + } + else + { + AsyncReadData(entry.handler, entry.packetSize, sizeof(uint8)); + } + break; + } + } + } + else + { + _socket.close(); + } + }); } void AuthSession::AsyncReadData(bool (AuthSession::*handler)(), size_t dataSize, size_t bufferOffSet) { - auto self(shared_from_this()); - - _socket.async_read_some(boost::asio::buffer(&_readBuffer[bufferOffSet], dataSize), [handler, this, self](boost::system::error_code error, size_t transferedBytes) - { - if (!error && transferedBytes > 0) - { - if (!(*this.*handler)()) - { - _socket.close(); - return; - } - - AsyncReadHeader(); - } - else - { - _socket.close(); - } - }); + auto self(shared_from_this()); + + _socket.async_read_some(boost::asio::buffer(&_readBuffer[bufferOffSet], dataSize), [handler, this, self](boost::system::error_code error, size_t transferedBytes) + { + if (!error && transferedBytes > 0) + { + if (!(*this.*handler)()) + { + _socket.close(); + return; + } + + AsyncReadHeader(); + } + else + { + _socket.close(); + } + }); } void AuthSession::AsyncWrite(std::size_t length) { - boost::asio::async_write(_socket, boost::asio::buffer(_writeBuffer, length), [this](boost::system::error_code error, std::size_t /*length*/) - { - if (error) - { - _socket.close(); - } - }); + boost::asio::async_write(_socket, boost::asio::buffer(_writeBuffer, length), [this](boost::system::error_code error, std::size_t /*length*/) + { + if (error) + { + _socket.close(); + } + }); } bool AuthSession::_HandleLogonChallenge() { - sAuthLogonChallenge_C *challenge = (sAuthLogonChallenge_C*)&_readBuffer; - - //TC_LOG_DEBUG("server.authserver", "[AuthChallenge] got full packet, %#04x bytes", challenge->size); - TC_LOG_DEBUG("server.authserver", "[AuthChallenge] name(%d): '%s'", challenge->I_len, challenge->I); - - ByteBuffer pkt; - - _login.assign((const char*)challenge->I, challenge->I_len); - _build = challenge->build; - _expversion = uint8(AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG)); - _os = (const char*)challenge->os; - - if (_os.size() > 4) - return false; - - // Restore string order as its byte order is reversed - std::reverse(_os.begin(), _os.end()); - - pkt << uint8(AUTH_LOGON_CHALLENGE); - pkt << uint8(0x00); - - // Verify that this IP is not in the ip_banned table - LoginDatabase.Execute(LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS)); - - std::string const& ipAddress = _socket.remote_endpoint().address().to_string(); - unsigned short port = _socket.remote_endpoint().port(); - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED); - stmt->setString(0, ipAddress); - PreparedQueryResult result = LoginDatabase.Query(stmt); - if (result) - { - pkt << uint8(WOW_FAIL_BANNED); - TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] Banned ip tries to login!", ipAddress.c_str(), port); - } - else - { - // Get the account details from the account table - // No SQL injection (prepared statement) - stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_LOGONCHALLENGE); - stmt->setString(0, _login); - - PreparedQueryResult res2 = LoginDatabase.Query(stmt); - if (res2) - { - Field* fields = res2->Fetch(); - - // If the IP is 'locked', check that the player comes indeed from the correct IP address - bool locked = false; - if (fields[2].GetUInt8() == 1) // if ip is locked - { - TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account '%s' is locked to IP - '%s'", _login.c_str(), fields[4].GetCString()); - TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Player address is '%s'", ipAddress.c_str()); - - if (strcmp(fields[4].GetCString(), ipAddress.c_str()) != 0) - { - TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account IP differs"); - pkt << uint8(WOW_FAIL_LOCKED_ENFORCED); - locked = true; - } - else - TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account IP matches"); - } - else - { - TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account '%s' is not locked to ip", _login.c_str()); - std::string accountCountry = fields[3].GetString(); - if (accountCountry.empty() || accountCountry == "00") - TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account '%s' is not locked to country", _login.c_str()); - else if (!accountCountry.empty()) - { - uint32 ip = inet_addr(ipAddress.c_str()); - EndianConvertReverse(ip); - - stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_LOGON_COUNTRY); - stmt->setUInt32(0, ip); - if (PreparedQueryResult sessionCountryQuery = LoginDatabase.Query(stmt)) - { - std::string loginCountry = (*sessionCountryQuery)[0].GetString(); - TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account '%s' is locked to country: '%s' Player country is '%s'", _login.c_str(), - accountCountry.c_str(), loginCountry.c_str()); - - if (loginCountry != accountCountry) - { - TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account country differs."); - pkt << uint8(WOW_FAIL_UNLOCKABLE_LOCK); - locked = true; - } - else - TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account country matches"); - } - else - TC_LOG_DEBUG("server.authserver", "[AuthChallenge] IP2NATION Table empty"); - } - } - - if (!locked) - { - //set expired bans to inactive - LoginDatabase.DirectExecute(LoginDatabase.GetPreparedStatement(LOGIN_UPD_EXPIRED_ACCOUNT_BANS)); - - // If the account is banned, reject the logon attempt - stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED); - stmt->setUInt32(0, fields[1].GetUInt32()); - PreparedQueryResult banresult = LoginDatabase.Query(stmt); - if (banresult) - { - if ((*banresult)[0].GetUInt32() == (*banresult)[1].GetUInt32()) - { - pkt << uint8(WOW_FAIL_BANNED); - TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] Banned account %s tried to login!", ipAddress.c_str(), - port, _login.c_str()); - } - else - { - pkt << uint8(WOW_FAIL_SUSPENDED); - TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] Temporarily banned account %s tried to login!", - ipAddress.c_str(), port, _login.c_str()); - } - } - else - { - // Get the password from the account table, upper it, and make the SRP6 calculation - std::string rI = fields[0].GetString(); - - // Don't calculate (v, s) if there are already some in the database - std::string databaseV = fields[6].GetString(); - std::string databaseS = fields[7].GetString(); - - TC_LOG_DEBUG("network", "database authentication values: v='%s' s='%s'", databaseV.c_str(), databaseS.c_str()); - - // multiply with 2 since bytes are stored as hexstring - if (databaseV.size() != BYTE_SIZE * 2 || databaseS.size() != BYTE_SIZE * 2) - SetVSFields(rI); - else - { - s.SetHexStr(databaseS.c_str()); - v.SetHexStr(databaseV.c_str()); - } - - b.SetRand(19 * 8); - BigNumber gmod = g.ModExp(b, N); - B = ((v * 3) + gmod) % N; - - ASSERT(gmod.GetNumBytes() <= 32); - - BigNumber unk3; - unk3.SetRand(16 * 8); - - // Fill the response packet with the result - if (AuthHelper::IsAcceptedClientBuild(_build)) - pkt << uint8(WOW_SUCCESS); - else - pkt << uint8(WOW_FAIL_VERSION_INVALID); - - // B may be calculated < 32B so we force minimal length to 32B - pkt.append(B.AsByteArray(32).get(), 32); // 32 bytes - pkt << uint8(1); - pkt.append(g.AsByteArray().get(), 1); - pkt << uint8(32); - pkt.append(N.AsByteArray(32).get(), 32); - pkt.append(s.AsByteArray().get(), s.GetNumBytes()); // 32 bytes - pkt.append(unk3.AsByteArray(16).get(), 16); - uint8 securityFlags = 0; - - // Check if token is used - _tokenKey = fields[8].GetString(); - if (!_tokenKey.empty()) - securityFlags = 4; - - pkt << uint8(securityFlags); // security flags (0x0...0x04) - - if (securityFlags & 0x01) // PIN input - { - pkt << uint32(0); - pkt << uint64(0) << uint64(0); // 16 bytes hash? - } - - if (securityFlags & 0x02) // Matrix input - { - pkt << uint8(0); - pkt << uint8(0); - pkt << uint8(0); - pkt << uint8(0); - pkt << uint64(0); - } - - if (securityFlags & 0x04) // Security token input - pkt << uint8(1); - - uint8 secLevel = fields[5].GetUInt8(); - _accountSecurityLevel = secLevel <= SEC_ADMINISTRATOR ? AccountTypes(secLevel) : SEC_ADMINISTRATOR; - - _localizationName.resize(4); - for (int i = 0; i < 4; ++i) - _localizationName[i] = challenge->country[4 - i - 1]; - - TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] account %s is using '%c%c%c%c' locale (%u)", - ipAddress.c_str(), port, _login.c_str(), - challenge->country[3], challenge->country[2], challenge->country[1], challenge->country[0], - GetLocaleByName(_localizationName) - ); - } - } - } - else //no account - pkt << uint8(WOW_FAIL_UNKNOWN_ACCOUNT); - } - - std::memcpy(_writeBuffer, (char const*)pkt.contents(), pkt.size()); - - AsyncWrite(pkt.size()); - - return true; + sAuthLogonChallenge_C *challenge = (sAuthLogonChallenge_C*)&_readBuffer; + + //TC_LOG_DEBUG("server.authserver", "[AuthChallenge] got full packet, %#04x bytes", challenge->size); + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] name(%d): '%s'", challenge->I_len, challenge->I); + + ByteBuffer pkt; + + _login.assign((const char*)challenge->I, challenge->I_len); + _build = challenge->build; + _expversion = uint8(AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG)); + _os = (const char*)challenge->os; + + if (_os.size() > 4) + return false; + + // Restore string order as its byte order is reversed + std::reverse(_os.begin(), _os.end()); + + pkt << uint8(AUTH_LOGON_CHALLENGE); + pkt << uint8(0x00); + + // Verify that this IP is not in the ip_banned table + LoginDatabase.Execute(LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS)); + + std::string const& ipAddress = _socket.remote_endpoint().address().to_string(); + unsigned short port = _socket.remote_endpoint().port(); + + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED); + stmt->setString(0, ipAddress); + PreparedQueryResult result = LoginDatabase.Query(stmt); + if (result) + { + pkt << uint8(WOW_FAIL_BANNED); + TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] Banned ip tries to login!", ipAddress.c_str(), port); + } + else + { + // Get the account details from the account table + // No SQL injection (prepared statement) + stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_LOGONCHALLENGE); + stmt->setString(0, _login); + + PreparedQueryResult res2 = LoginDatabase.Query(stmt); + if (res2) + { + Field* fields = res2->Fetch(); + + // If the IP is 'locked', check that the player comes indeed from the correct IP address + bool locked = false; + if (fields[2].GetUInt8() == 1) // if ip is locked + { + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account '%s' is locked to IP - '%s'", _login.c_str(), fields[4].GetCString()); + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Player address is '%s'", ipAddress.c_str()); + + if (strcmp(fields[4].GetCString(), ipAddress.c_str()) != 0) + { + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account IP differs"); + pkt << uint8(WOW_FAIL_LOCKED_ENFORCED); + locked = true; + } + else + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account IP matches"); + } + else + { + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account '%s' is not locked to ip", _login.c_str()); + std::string accountCountry = fields[3].GetString(); + if (accountCountry.empty() || accountCountry == "00") + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account '%s' is not locked to country", _login.c_str()); + else if (!accountCountry.empty()) + { + uint32 ip = inet_addr(ipAddress.c_str()); + EndianConvertReverse(ip); + + stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_LOGON_COUNTRY); + stmt->setUInt32(0, ip); + if (PreparedQueryResult sessionCountryQuery = LoginDatabase.Query(stmt)) + { + std::string loginCountry = (*sessionCountryQuery)[0].GetString(); + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account '%s' is locked to country: '%s' Player country is '%s'", _login.c_str(), + accountCountry.c_str(), loginCountry.c_str()); + + if (loginCountry != accountCountry) + { + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account country differs."); + pkt << uint8(WOW_FAIL_UNLOCKABLE_LOCK); + locked = true; + } + else + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account country matches"); + } + else + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] IP2NATION Table empty"); + } + } + + if (!locked) + { + //set expired bans to inactive + LoginDatabase.DirectExecute(LoginDatabase.GetPreparedStatement(LOGIN_UPD_EXPIRED_ACCOUNT_BANS)); + + // If the account is banned, reject the logon attempt + stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED); + stmt->setUInt32(0, fields[1].GetUInt32()); + PreparedQueryResult banresult = LoginDatabase.Query(stmt); + if (banresult) + { + if ((*banresult)[0].GetUInt32() == (*banresult)[1].GetUInt32()) + { + pkt << uint8(WOW_FAIL_BANNED); + TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] Banned account %s tried to login!", ipAddress.c_str(), + port, _login.c_str()); + } + else + { + pkt << uint8(WOW_FAIL_SUSPENDED); + TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] Temporarily banned account %s tried to login!", + ipAddress.c_str(), port, _login.c_str()); + } + } + else + { + // Get the password from the account table, upper it, and make the SRP6 calculation + std::string rI = fields[0].GetString(); + + // Don't calculate (v, s) if there are already some in the database + std::string databaseV = fields[6].GetString(); + std::string databaseS = fields[7].GetString(); + + TC_LOG_DEBUG("network", "database authentication values: v='%s' s='%s'", databaseV.c_str(), databaseS.c_str()); + + // multiply with 2 since bytes are stored as hexstring + if (databaseV.size() != BYTE_SIZE * 2 || databaseS.size() != BYTE_SIZE * 2) + SetVSFields(rI); + else + { + s.SetHexStr(databaseS.c_str()); + v.SetHexStr(databaseV.c_str()); + } + + b.SetRand(19 * 8); + BigNumber gmod = g.ModExp(b, N); + B = ((v * 3) + gmod) % N; + + ASSERT(gmod.GetNumBytes() <= 32); + + BigNumber unk3; + unk3.SetRand(16 * 8); + + // Fill the response packet with the result + if (AuthHelper::IsAcceptedClientBuild(_build)) + pkt << uint8(WOW_SUCCESS); + else + pkt << uint8(WOW_FAIL_VERSION_INVALID); + + // B may be calculated < 32B so we force minimal length to 32B + pkt.append(B.AsByteArray(32).get(), 32); // 32 bytes + pkt << uint8(1); + pkt.append(g.AsByteArray().get(), 1); + pkt << uint8(32); + pkt.append(N.AsByteArray(32).get(), 32); + pkt.append(s.AsByteArray().get(), s.GetNumBytes()); // 32 bytes + pkt.append(unk3.AsByteArray(16).get(), 16); + uint8 securityFlags = 0; + + // Check if token is used + _tokenKey = fields[8].GetString(); + if (!_tokenKey.empty()) + securityFlags = 4; + + pkt << uint8(securityFlags); // security flags (0x0...0x04) + + if (securityFlags & 0x01) // PIN input + { + pkt << uint32(0); + pkt << uint64(0) << uint64(0); // 16 bytes hash? + } + + if (securityFlags & 0x02) // Matrix input + { + pkt << uint8(0); + pkt << uint8(0); + pkt << uint8(0); + pkt << uint8(0); + pkt << uint64(0); + } + + if (securityFlags & 0x04) // Security token input + pkt << uint8(1); + + uint8 secLevel = fields[5].GetUInt8(); + _accountSecurityLevel = secLevel <= SEC_ADMINISTRATOR ? AccountTypes(secLevel) : SEC_ADMINISTRATOR; + + _localizationName.resize(4); + for (int i = 0; i < 4; ++i) + _localizationName[i] = challenge->country[4 - i - 1]; + + TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] account %s is using '%c%c%c%c' locale (%u)", + ipAddress.c_str(), port, _login.c_str(), + challenge->country[3], challenge->country[2], challenge->country[1], challenge->country[0], + GetLocaleByName(_localizationName) + ); + } + } + } + else //no account + pkt << uint8(WOW_FAIL_UNKNOWN_ACCOUNT); + } + + std::memcpy(_writeBuffer, (char const*)pkt.contents(), pkt.size()); + + AsyncWrite(pkt.size()); + + return true; } // Logon Proof command handler bool AuthSession::_HandleLogonProof() { - TC_LOG_DEBUG("server.authserver", "Entering _HandleLogonProof"); - // Read the packet - sAuthLogonProof_C *logonProof = (sAuthLogonProof_C*)&_readBuffer; - - // If the client has no valid version - if (_expversion == NO_VALID_EXP_FLAG) - { - // Check if we have the appropriate patch on the disk - TC_LOG_DEBUG("network", "Client with invalid version, patching is not implemented"); - return false; - } - - // Continue the SRP6 calculation based on data received from the client - BigNumber A; - - A.SetBinary(logonProof->A, 32); - - // SRP safeguard: abort if A == 0 - if (A.isZero()) - { - return false; - } - - SHA1Hash sha; - sha.UpdateBigNumbers(&A, &B, NULL); - sha.Finalize(); - BigNumber u; - u.SetBinary(sha.GetDigest(), 20); - BigNumber S = (A * (v.ModExp(u, N))).ModExp(b, N); - - uint8 t[32]; - uint8 t1[16]; - uint8 vK[40]; - memcpy(t, S.AsByteArray(32).get(), 32); - - for (int i = 0; i < 16; ++i) - t1[i] = t[i * 2]; - - sha.Initialize(); - sha.UpdateData(t1, 16); - sha.Finalize(); - - for (int i = 0; i < 20; ++i) - vK[i * 2] = sha.GetDigest()[i]; - - for (int i = 0; i < 16; ++i) - t1[i] = t[i * 2 + 1]; - - sha.Initialize(); - sha.UpdateData(t1, 16); - sha.Finalize(); - - for (int i = 0; i < 20; ++i) - vK[i * 2 + 1] = sha.GetDigest()[i]; - - K.SetBinary(vK, 40); - - uint8 hash[20]; - - sha.Initialize(); - sha.UpdateBigNumbers(&N, NULL); - sha.Finalize(); - memcpy(hash, sha.GetDigest(), 20); - sha.Initialize(); - sha.UpdateBigNumbers(&g, NULL); - sha.Finalize(); - - for (int i = 0; i < 20; ++i) - hash[i] ^= sha.GetDigest()[i]; - - BigNumber t3; - t3.SetBinary(hash, 20); - - sha.Initialize(); - sha.UpdateData(_login); - sha.Finalize(); - uint8 t4[SHA_DIGEST_LENGTH]; - memcpy(t4, sha.GetDigest(), SHA_DIGEST_LENGTH); - - sha.Initialize(); - sha.UpdateBigNumbers(&t3, NULL); - sha.UpdateData(t4, SHA_DIGEST_LENGTH); - sha.UpdateBigNumbers(&s, &A, &B, &K, NULL); - sha.Finalize(); - BigNumber M; - M.SetBinary(sha.GetDigest(), 20); - - // Check if SRP6 results match (password is correct), else send an error - if (!memcmp(M.AsByteArray().get(), logonProof->M1, 20)) - { - TC_LOG_DEBUG("server.authserver", "'%s:%d' User '%s' successfully authenticated", GetRemoteIpAddress().c_str(), GetRemotePort(), _login.c_str()); - - // Update the sessionkey, last_ip, last login time and reset number of failed logins in the account table for this account - // No SQL injection (escaped user name) and IP address as received by socket - const char *K_hex = K.AsHexStr(); - - PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LOGONPROOF); - stmt->setString(0, K_hex); - stmt->setString(1, GetRemoteIpAddress().c_str()); - stmt->setUInt32(2, GetLocaleByName(_localizationName)); - stmt->setString(3, _os); - stmt->setString(4, _login); - LoginDatabase.DirectExecute(stmt); - - OPENSSL_free((void*)K_hex); - - // Finish SRP6 and send the final result to the client - sha.Initialize(); - sha.UpdateBigNumbers(&A, &M, &K, NULL); - sha.Finalize(); - - // Check auth token - if ((logonProof->securityFlags & 0x04) || !_tokenKey.empty()) - { - // TODO To be fixed - - /* - uint8 size; - socket().recv((char*)&size, 1); - char* token = new char[size + 1]; - token[size] = '\0'; - socket().recv(token, size); - unsigned int validToken = TOTP::GenerateToken(_tokenKey.c_str()); - unsigned int incomingToken = atoi(token); - delete[] token; - if (validToken != incomingToken) - { - char data[] = { AUTH_LOGON_PROOF, WOW_FAIL_UNKNOWN_ACCOUNT, 3, 0 }; - socket().send(data, sizeof(data)); - return false; - }*/ - } - - if (_expversion & POST_BC_EXP_FLAG) // 2.x and 3.x clients - { - sAuthLogonProof_S proof; - memcpy(proof.M2, sha.GetDigest(), 20); - proof.cmd = AUTH_LOGON_PROOF; - proof.error = 0; - proof.unk1 = 0x00800000; // Accountflags. 0x01 = GM, 0x08 = Trial, 0x00800000 = Pro pass (arena tournament) - proof.unk2 = 0x00; // SurveyId - proof.unk3 = 0x00; - - std::memcpy(_writeBuffer, (char *)&proof, sizeof(proof)); - AsyncWrite(sizeof(proof)); - } - else - { - sAuthLogonProof_S_Old proof; - memcpy(proof.M2, sha.GetDigest(), 20); - proof.cmd = AUTH_LOGON_PROOF; - proof.error = 0; - proof.unk2 = 0x00; - - std::memcpy(_writeBuffer, (char *)&proof, sizeof(proof)); - AsyncWrite(sizeof(proof)); - } - - _isAuthenticated = true; - } - else - { - char data[4] = { AUTH_LOGON_PROOF, WOW_FAIL_UNKNOWN_ACCOUNT, 3, 0 }; - - std::memcpy(_writeBuffer, data, sizeof(data)); - AsyncWrite(sizeof(data)); - - TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] account %s tried to login with invalid password!", - GetRemoteIpAddress().c_str(), GetRemotePort(), _login.c_str()); - - uint32 MaxWrongPassCount = sConfigMgr->GetIntDefault("WrongPass.MaxCount", 0); - if (MaxWrongPassCount > 0) - { - //Increment number of failed logins by one and if it reaches the limit temporarily ban that account or IP - PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_FAILEDLOGINS); - stmt->setString(0, _login); - LoginDatabase.Execute(stmt); - - stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_FAILEDLOGINS); - stmt->setString(0, _login); - - if (PreparedQueryResult loginfail = LoginDatabase.Query(stmt)) - { - uint32 failed_logins = (*loginfail)[1].GetUInt32(); - - if (failed_logins >= MaxWrongPassCount) - { - uint32 WrongPassBanTime = sConfigMgr->GetIntDefault("WrongPass.BanTime", 600); - bool WrongPassBanType = sConfigMgr->GetBoolDefault("WrongPass.BanType", false); - - if (WrongPassBanType) - { - uint32 acc_id = (*loginfail)[0].GetUInt32(); - stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_AUTO_BANNED); - stmt->setUInt32(0, acc_id); - stmt->setUInt32(1, WrongPassBanTime); - LoginDatabase.Execute(stmt); - - TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] account %s got banned for '%u' seconds because it failed to authenticate '%u' times", - GetRemoteIpAddress().c_str(), GetRemotePort(), _login.c_str(), WrongPassBanTime, failed_logins); - } - else - { - stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_IP_AUTO_BANNED); - stmt->setString(0, GetRemoteIpAddress()); - stmt->setUInt32(1, WrongPassBanTime); - LoginDatabase.Execute(stmt); - - TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] IP got banned for '%u' seconds because account %s failed to authenticate '%u' times", - GetRemoteIpAddress().c_str(), GetRemotePort(), WrongPassBanTime, _login.c_str(), failed_logins); - } - } - } - } - } - - return true; + TC_LOG_DEBUG("server.authserver", "Entering _HandleLogonProof"); + // Read the packet + sAuthLogonProof_C *logonProof = (sAuthLogonProof_C*)&_readBuffer; + + // If the client has no valid version + if (_expversion == NO_VALID_EXP_FLAG) + { + // Check if we have the appropriate patch on the disk + TC_LOG_DEBUG("network", "Client with invalid version, patching is not implemented"); + return false; + } + + // Continue the SRP6 calculation based on data received from the client + BigNumber A; + + A.SetBinary(logonProof->A, 32); + + // SRP safeguard: abort if A == 0 + if (A.isZero()) + { + return false; + } + + SHA1Hash sha; + sha.UpdateBigNumbers(&A, &B, NULL); + sha.Finalize(); + BigNumber u; + u.SetBinary(sha.GetDigest(), 20); + BigNumber S = (A * (v.ModExp(u, N))).ModExp(b, N); + + uint8 t[32]; + uint8 t1[16]; + uint8 vK[40]; + memcpy(t, S.AsByteArray(32).get(), 32); + + for (int i = 0; i < 16; ++i) + t1[i] = t[i * 2]; + + sha.Initialize(); + sha.UpdateData(t1, 16); + sha.Finalize(); + + for (int i = 0; i < 20; ++i) + vK[i * 2] = sha.GetDigest()[i]; + + for (int i = 0; i < 16; ++i) + t1[i] = t[i * 2 + 1]; + + sha.Initialize(); + sha.UpdateData(t1, 16); + sha.Finalize(); + + for (int i = 0; i < 20; ++i) + vK[i * 2 + 1] = sha.GetDigest()[i]; + + K.SetBinary(vK, 40); + + uint8 hash[20]; + + sha.Initialize(); + sha.UpdateBigNumbers(&N, NULL); + sha.Finalize(); + memcpy(hash, sha.GetDigest(), 20); + sha.Initialize(); + sha.UpdateBigNumbers(&g, NULL); + sha.Finalize(); + + for (int i = 0; i < 20; ++i) + hash[i] ^= sha.GetDigest()[i]; + + BigNumber t3; + t3.SetBinary(hash, 20); + + sha.Initialize(); + sha.UpdateData(_login); + sha.Finalize(); + uint8 t4[SHA_DIGEST_LENGTH]; + memcpy(t4, sha.GetDigest(), SHA_DIGEST_LENGTH); + + sha.Initialize(); + sha.UpdateBigNumbers(&t3, NULL); + sha.UpdateData(t4, SHA_DIGEST_LENGTH); + sha.UpdateBigNumbers(&s, &A, &B, &K, NULL); + sha.Finalize(); + BigNumber M; + M.SetBinary(sha.GetDigest(), 20); + + // Check if SRP6 results match (password is correct), else send an error + if (!memcmp(M.AsByteArray().get(), logonProof->M1, 20)) + { + TC_LOG_DEBUG("server.authserver", "'%s:%d' User '%s' successfully authenticated", GetRemoteIpAddress().c_str(), GetRemotePort(), _login.c_str()); + + // Update the sessionkey, last_ip, last login time and reset number of failed logins in the account table for this account + // No SQL injection (escaped user name) and IP address as received by socket + const char *K_hex = K.AsHexStr(); + + PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LOGONPROOF); + stmt->setString(0, K_hex); + stmt->setString(1, GetRemoteIpAddress().c_str()); + stmt->setUInt32(2, GetLocaleByName(_localizationName)); + stmt->setString(3, _os); + stmt->setString(4, _login); + LoginDatabase.DirectExecute(stmt); + + OPENSSL_free((void*)K_hex); + + // Finish SRP6 and send the final result to the client + sha.Initialize(); + sha.UpdateBigNumbers(&A, &M, &K, NULL); + sha.Finalize(); + + // Check auth token + if ((logonProof->securityFlags & 0x04) || !_tokenKey.empty()) + { + // TODO To be fixed + + /* + uint8 size; + socket().recv((char*)&size, 1); + char* token = new char[size + 1]; + token[size] = '\0'; + socket().recv(token, size); + unsigned int validToken = TOTP::GenerateToken(_tokenKey.c_str()); + unsigned int incomingToken = atoi(token); + delete[] token; + if (validToken != incomingToken) + { + char data[] = { AUTH_LOGON_PROOF, WOW_FAIL_UNKNOWN_ACCOUNT, 3, 0 }; + socket().send(data, sizeof(data)); + return false; + }*/ + } + + if (_expversion & POST_BC_EXP_FLAG) // 2.x and 3.x clients + { + sAuthLogonProof_S proof; + memcpy(proof.M2, sha.GetDigest(), 20); + proof.cmd = AUTH_LOGON_PROOF; + proof.error = 0; + proof.unk1 = 0x00800000; // Accountflags. 0x01 = GM, 0x08 = Trial, 0x00800000 = Pro pass (arena tournament) + proof.unk2 = 0x00; // SurveyId + proof.unk3 = 0x00; + + std::memcpy(_writeBuffer, (char *)&proof, sizeof(proof)); + AsyncWrite(sizeof(proof)); + } + else + { + sAuthLogonProof_S_Old proof; + memcpy(proof.M2, sha.GetDigest(), 20); + proof.cmd = AUTH_LOGON_PROOF; + proof.error = 0; + proof.unk2 = 0x00; + + std::memcpy(_writeBuffer, (char *)&proof, sizeof(proof)); + AsyncWrite(sizeof(proof)); + } + + _isAuthenticated = true; + } + else + { + char data[4] = { AUTH_LOGON_PROOF, WOW_FAIL_UNKNOWN_ACCOUNT, 3, 0 }; + + std::memcpy(_writeBuffer, data, sizeof(data)); + AsyncWrite(sizeof(data)); + + TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] account %s tried to login with invalid password!", + GetRemoteIpAddress().c_str(), GetRemotePort(), _login.c_str()); + + uint32 MaxWrongPassCount = sConfigMgr->GetIntDefault("WrongPass.MaxCount", 0); + if (MaxWrongPassCount > 0) + { + //Increment number of failed logins by one and if it reaches the limit temporarily ban that account or IP + PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_FAILEDLOGINS); + stmt->setString(0, _login); + LoginDatabase.Execute(stmt); + + stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_FAILEDLOGINS); + stmt->setString(0, _login); + + if (PreparedQueryResult loginfail = LoginDatabase.Query(stmt)) + { + uint32 failed_logins = (*loginfail)[1].GetUInt32(); + + if (failed_logins >= MaxWrongPassCount) + { + uint32 WrongPassBanTime = sConfigMgr->GetIntDefault("WrongPass.BanTime", 600); + bool WrongPassBanType = sConfigMgr->GetBoolDefault("WrongPass.BanType", false); + + if (WrongPassBanType) + { + uint32 acc_id = (*loginfail)[0].GetUInt32(); + stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_AUTO_BANNED); + stmt->setUInt32(0, acc_id); + stmt->setUInt32(1, WrongPassBanTime); + LoginDatabase.Execute(stmt); + + TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] account %s got banned for '%u' seconds because it failed to authenticate '%u' times", + GetRemoteIpAddress().c_str(), GetRemotePort(), _login.c_str(), WrongPassBanTime, failed_logins); + } + else + { + stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_IP_AUTO_BANNED); + stmt->setString(0, GetRemoteIpAddress()); + stmt->setUInt32(1, WrongPassBanTime); + LoginDatabase.Execute(stmt); + + TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] IP got banned for '%u' seconds because account %s failed to authenticate '%u' times", + GetRemoteIpAddress().c_str(), GetRemotePort(), WrongPassBanTime, _login.c_str(), failed_logins); + } + } + } + } + } + + return true; } bool AuthSession::_HandleReconnectChallenge() { - TC_LOG_DEBUG("server.authserver", "Entering _HandleReconnectChallenge"); - sAuthLogonChallenge_C *challenge = (sAuthLogonChallenge_C*)&_readBuffer; + TC_LOG_DEBUG("server.authserver", "Entering _HandleReconnectChallenge"); + sAuthLogonChallenge_C *challenge = (sAuthLogonChallenge_C*)&_readBuffer; - //TC_LOG_DEBUG("server.authserver", "[AuthChallenge] got full packet, %#04x bytes", challenge->size); - TC_LOG_DEBUG("server.authserver", "[AuthChallenge] name(%d): '%s'", challenge->I_len, challenge->I); + //TC_LOG_DEBUG("server.authserver", "[AuthChallenge] got full packet, %#04x bytes", challenge->size); + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] name(%d): '%s'", challenge->I_len, challenge->I); - _login.assign((const char*)challenge->I, challenge->I_len); + _login.assign((const char*)challenge->I, challenge->I_len); - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_SESSIONKEY); - stmt->setString(0, _login); - PreparedQueryResult result = LoginDatabase.Query(stmt); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_SESSIONKEY); + stmt->setString(0, _login); + PreparedQueryResult result = LoginDatabase.Query(stmt); - // Stop if the account is not found - if (!result) - { - TC_LOG_ERROR("server.authserver", "'%s:%d' [ERROR] user %s tried to login and we cannot find his session key in the database.", - GetRemoteIpAddress().c_str(), GetRemotePort(), _login.c_str()); - return false; - } + // Stop if the account is not found + if (!result) + { + TC_LOG_ERROR("server.authserver", "'%s:%d' [ERROR] user %s tried to login and we cannot find his session key in the database.", + GetRemoteIpAddress().c_str(), GetRemotePort(), _login.c_str()); + return false; + } - // Reinitialize build, expansion and the account securitylevel - _build = challenge->build; - _expversion = uint8(AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG)); - _os = (const char*)challenge->os; + // Reinitialize build, expansion and the account securitylevel + _build = challenge->build; + _expversion = uint8(AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG)); + _os = (const char*)challenge->os; - if (_os.size() > 4) - return false; + if (_os.size() > 4) + return false; - // Restore string order as its byte order is reversed - std::reverse(_os.begin(), _os.end()); + // Restore string order as its byte order is reversed + std::reverse(_os.begin(), _os.end()); - Field* fields = result->Fetch(); - uint8 secLevel = fields[2].GetUInt8(); - _accountSecurityLevel = secLevel <= SEC_ADMINISTRATOR ? AccountTypes(secLevel) : SEC_ADMINISTRATOR; + Field* fields = result->Fetch(); + uint8 secLevel = fields[2].GetUInt8(); + _accountSecurityLevel = secLevel <= SEC_ADMINISTRATOR ? AccountTypes(secLevel) : SEC_ADMINISTRATOR; - K.SetHexStr((*result)[0].GetCString()); + K.SetHexStr((*result)[0].GetCString()); - // Sending response - ByteBuffer pkt; - pkt << uint8(AUTH_RECONNECT_CHALLENGE); - pkt << uint8(0x00); - _reconnectProof.SetRand(16 * 8); - pkt.append(_reconnectProof.AsByteArray(16).get(), 16); // 16 bytes random - pkt << uint64(0x00) << uint64(0x00); // 16 bytes zeros + // Sending response + ByteBuffer pkt; + pkt << uint8(AUTH_RECONNECT_CHALLENGE); + pkt << uint8(0x00); + _reconnectProof.SetRand(16 * 8); + pkt.append(_reconnectProof.AsByteArray(16).get(), 16); // 16 bytes random + pkt << uint64(0x00) << uint64(0x00); // 16 bytes zeros - std::memcpy(_writeBuffer, (char const*)pkt.contents(), pkt.size()); - AsyncWrite(pkt.size()); + std::memcpy(_writeBuffer, (char const*)pkt.contents(), pkt.size()); + AsyncWrite(pkt.size()); - return true; + return true; } bool AuthSession::_HandleReconnectProof() { - TC_LOG_DEBUG("server.authserver", "Entering _HandleReconnectProof"); - sAuthReconnectProof_C *reconnectProof = (sAuthReconnectProof_C*)&_readBuffer; - - if (_login.empty() || !_reconnectProof.GetNumBytes() || !K.GetNumBytes()) - return false; - - BigNumber t1; - t1.SetBinary(reconnectProof->R1, 16); - - SHA1Hash sha; - sha.Initialize(); - sha.UpdateData(_login); - sha.UpdateBigNumbers(&t1, &_reconnectProof, &K, NULL); - sha.Finalize(); - - if (!memcmp(sha.GetDigest(), reconnectProof->R2, SHA_DIGEST_LENGTH)) - { - // Sending response - ByteBuffer pkt; - pkt << uint8(AUTH_RECONNECT_PROOF); - pkt << uint8(0x00); - pkt << uint16(0x00); // 2 bytes zeros - std::memcpy(_writeBuffer, (char const*)pkt.contents(), pkt.size()); - AsyncWrite(pkt.size()); - _isAuthenticated = true; - return true; - } - else - { - TC_LOG_ERROR("server.authserver", "'%s:%d' [ERROR] user %s tried to login, but session is invalid.", GetRemoteIpAddress().c_str(), - GetRemotePort(), _login.c_str()); - return false; - } + TC_LOG_DEBUG("server.authserver", "Entering _HandleReconnectProof"); + sAuthReconnectProof_C *reconnectProof = (sAuthReconnectProof_C*)&_readBuffer; + + if (_login.empty() || !_reconnectProof.GetNumBytes() || !K.GetNumBytes()) + return false; + + BigNumber t1; + t1.SetBinary(reconnectProof->R1, 16); + + SHA1Hash sha; + sha.Initialize(); + sha.UpdateData(_login); + sha.UpdateBigNumbers(&t1, &_reconnectProof, &K, NULL); + sha.Finalize(); + + if (!memcmp(sha.GetDigest(), reconnectProof->R2, SHA_DIGEST_LENGTH)) + { + // Sending response + ByteBuffer pkt; + pkt << uint8(AUTH_RECONNECT_PROOF); + pkt << uint8(0x00); + pkt << uint16(0x00); // 2 bytes zeros + std::memcpy(_writeBuffer, (char const*)pkt.contents(), pkt.size()); + AsyncWrite(pkt.size()); + _isAuthenticated = true; + return true; + } + else + { + TC_LOG_ERROR("server.authserver", "'%s:%d' [ERROR] user %s tried to login, but session is invalid.", GetRemoteIpAddress().c_str(), + GetRemotePort(), _login.c_str()); + return false; + } } ACE_INET_Addr const& GetAddressForClient(Realm const& realm, ACE_INET_Addr const& clientAddr) { - // Attempt to send best address for client - if (clientAddr.is_loopback()) - { - // Try guessing if realm is also connected locally - if (realm.LocalAddress.is_loopback() || realm.ExternalAddress.is_loopback()) - return clientAddr; - - // Assume that user connecting from the machine that authserver is located on - // has all realms available in his local network - return realm.LocalAddress; - } - - // Check if connecting client is in the same network - if (IsIPAddrInNetwork(realm.LocalAddress, clientAddr, realm.LocalSubnetMask)) - return realm.LocalAddress; - - // Return external IP - return realm.ExternalAddress; + // Attempt to send best address for client + if (clientAddr.is_loopback()) + { + // Try guessing if realm is also connected locally + if (realm.LocalAddress.is_loopback() || realm.ExternalAddress.is_loopback()) + return clientAddr; + + // Assume that user connecting from the machine that authserver is located on + // has all realms available in his local network + return realm.LocalAddress; + } + + // Check if connecting client is in the same network + if (IsIPAddrInNetwork(realm.LocalAddress, clientAddr, realm.LocalSubnetMask)) + return realm.LocalAddress; + + // Return external IP + return realm.ExternalAddress; } bool AuthSession::_HandleRealmList() { - TC_LOG_DEBUG("server.authserver", "Entering _HandleRealmList"); - - // Get the user id (else close the connection) - // No SQL injection (prepared statement) - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_ID_BY_NAME); - stmt->setString(0, _login); - PreparedQueryResult result = LoginDatabase.Query(stmt); - if (!result) - { - TC_LOG_ERROR("server.authserver", "'%s:%d' [ERROR] user %s tried to login but we cannot find him in the database.", GetRemoteIpAddress().c_str(), - GetRemotePort(), _login.c_str()); - return false; - } - - Field* fields = result->Fetch(); - uint32 id = fields[0].GetUInt32(); - - // Update realm list if need - sRealmList->UpdateIfNeed(); - - // Circle through realms in the RealmList and construct the return packet (including # of user characters in each realm) - ByteBuffer pkt; - - size_t RealmListSize = 0; - for (RealmList::RealmMap::const_iterator i = sRealmList->begin(); i != sRealmList->end(); ++i) - { - const Realm &realm = i->second; - // don't work with realms which not compatible with the client - bool okBuild = ((_expversion & POST_BC_EXP_FLAG) && realm.gamebuild == _build) || ((_expversion & PRE_BC_EXP_FLAG) && !AuthHelper::IsPreBCAcceptedClientBuild(realm.gamebuild)); - - // No SQL injection. id of realm is controlled by the database. - uint32 flag = realm.flag; - RealmBuildInfo const* buildInfo = AuthHelper::GetBuildInfo(realm.gamebuild); - if (!okBuild) - { - if (!buildInfo) - continue; - - flag |= REALM_FLAG_OFFLINE | REALM_FLAG_SPECIFYBUILD; // tell the client what build the realm is for - } - - if (!buildInfo) - flag &= ~REALM_FLAG_SPECIFYBUILD; - - std::string name = i->first; - if (_expversion & PRE_BC_EXP_FLAG && flag & REALM_FLAG_SPECIFYBUILD) - { - std::ostringstream ss; - ss << name << " (" << buildInfo->MajorVersion << '.' << buildInfo->MinorVersion << '.' << buildInfo->BugfixVersion << ')'; - name = ss.str(); - } - - // We don't need the port number from which client connects with but the realm's port - ACE_INET_Addr clientAddr(realm.ExternalAddress.get_port_number(), GetRemoteIpAddress().c_str(), AF_INET); - - uint8 lock = (realm.allowedSecurityLevel > _accountSecurityLevel) ? 1 : 0; - - uint8 AmountOfCharacters = 0; - stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_NUM_CHARS_ON_REALM); - stmt->setUInt32(0, realm.m_ID); - stmt->setUInt32(1, id); - result = LoginDatabase.Query(stmt); - if (result) - AmountOfCharacters = (*result)[0].GetUInt8(); - - pkt << realm.icon; // realm type - if (_expversion & POST_BC_EXP_FLAG) // only 2.x and 3.x clients - pkt << lock; // if 1, then realm locked - pkt << uint8(flag); // RealmFlags - pkt << name; - pkt << GetAddressString(GetAddressForClient(realm, clientAddr)); - pkt << realm.populationLevel; - pkt << AmountOfCharacters; - pkt << realm.timezone; // realm category - if (_expversion & POST_BC_EXP_FLAG) // 2.x and 3.x clients - pkt << uint8(0x2C); // unk, may be realm number/id? - else - pkt << uint8(0x0); // 1.12.1 and 1.12.2 clients - - if (_expversion & POST_BC_EXP_FLAG && flag & REALM_FLAG_SPECIFYBUILD) - { - pkt << uint8(buildInfo->MajorVersion); - pkt << uint8(buildInfo->MinorVersion); - pkt << uint8(buildInfo->BugfixVersion); - pkt << uint16(buildInfo->Build); - } - - ++RealmListSize; - } - - if (_expversion & POST_BC_EXP_FLAG) // 2.x and 3.x clients - { - pkt << uint8(0x10); - pkt << uint8(0x00); - } - else // 1.12.1 and 1.12.2 clients - { - pkt << uint8(0x00); - pkt << uint8(0x02); - } - - // make a ByteBuffer which stores the RealmList's size - ByteBuffer RealmListSizeBuffer; - RealmListSizeBuffer << uint32(0); - if (_expversion & POST_BC_EXP_FLAG) // only 2.x and 3.x clients - RealmListSizeBuffer << uint16(RealmListSize); - else - RealmListSizeBuffer << uint32(RealmListSize); - - ByteBuffer hdr; - hdr << uint8(REALM_LIST); - hdr << uint16(pkt.size() + RealmListSizeBuffer.size()); - hdr.append(RealmListSizeBuffer); // append RealmList's size buffer - hdr.append(pkt); // append realms in the realmlist - - std::memcpy(_writeBuffer, (char const*)hdr.contents(), hdr.size()); - AsyncWrite(hdr.size()); - - return true; + TC_LOG_DEBUG("server.authserver", "Entering _HandleRealmList"); + + // Get the user id (else close the connection) + // No SQL injection (prepared statement) + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_ID_BY_NAME); + stmt->setString(0, _login); + PreparedQueryResult result = LoginDatabase.Query(stmt); + if (!result) + { + TC_LOG_ERROR("server.authserver", "'%s:%d' [ERROR] user %s tried to login but we cannot find him in the database.", GetRemoteIpAddress().c_str(), + GetRemotePort(), _login.c_str()); + return false; + } + + Field* fields = result->Fetch(); + uint32 id = fields[0].GetUInt32(); + + // Update realm list if need + sRealmList->UpdateIfNeed(); + + // Circle through realms in the RealmList and construct the return packet (including # of user characters in each realm) + ByteBuffer pkt; + + size_t RealmListSize = 0; + for (RealmList::RealmMap::const_iterator i = sRealmList->begin(); i != sRealmList->end(); ++i) + { + const Realm &realm = i->second; + // don't work with realms which not compatible with the client + bool okBuild = ((_expversion & POST_BC_EXP_FLAG) && realm.gamebuild == _build) || ((_expversion & PRE_BC_EXP_FLAG) && !AuthHelper::IsPreBCAcceptedClientBuild(realm.gamebuild)); + + // No SQL injection. id of realm is controlled by the database. + uint32 flag = realm.flag; + RealmBuildInfo const* buildInfo = AuthHelper::GetBuildInfo(realm.gamebuild); + if (!okBuild) + { + if (!buildInfo) + continue; + + flag |= REALM_FLAG_OFFLINE | REALM_FLAG_SPECIFYBUILD; // tell the client what build the realm is for + } + + if (!buildInfo) + flag &= ~REALM_FLAG_SPECIFYBUILD; + + std::string name = i->first; + if (_expversion & PRE_BC_EXP_FLAG && flag & REALM_FLAG_SPECIFYBUILD) + { + std::ostringstream ss; + ss << name << " (" << buildInfo->MajorVersion << '.' << buildInfo->MinorVersion << '.' << buildInfo->BugfixVersion << ')'; + name = ss.str(); + } + + // We don't need the port number from which client connects with but the realm's port + ACE_INET_Addr clientAddr(realm.ExternalAddress.get_port_number(), GetRemoteIpAddress().c_str(), AF_INET); + + uint8 lock = (realm.allowedSecurityLevel > _accountSecurityLevel) ? 1 : 0; + + uint8 AmountOfCharacters = 0; + stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_NUM_CHARS_ON_REALM); + stmt->setUInt32(0, realm.m_ID); + stmt->setUInt32(1, id); + result = LoginDatabase.Query(stmt); + if (result) + AmountOfCharacters = (*result)[0].GetUInt8(); + + pkt << realm.icon; // realm type + if (_expversion & POST_BC_EXP_FLAG) // only 2.x and 3.x clients + pkt << lock; // if 1, then realm locked + pkt << uint8(flag); // RealmFlags + pkt << name; + pkt << GetAddressString(GetAddressForClient(realm, clientAddr)); + pkt << realm.populationLevel; + pkt << AmountOfCharacters; + pkt << realm.timezone; // realm category + if (_expversion & POST_BC_EXP_FLAG) // 2.x and 3.x clients + pkt << uint8(0x2C); // unk, may be realm number/id? + else + pkt << uint8(0x0); // 1.12.1 and 1.12.2 clients + + if (_expversion & POST_BC_EXP_FLAG && flag & REALM_FLAG_SPECIFYBUILD) + { + pkt << uint8(buildInfo->MajorVersion); + pkt << uint8(buildInfo->MinorVersion); + pkt << uint8(buildInfo->BugfixVersion); + pkt << uint16(buildInfo->Build); + } + + ++RealmListSize; + } + + if (_expversion & POST_BC_EXP_FLAG) // 2.x and 3.x clients + { + pkt << uint8(0x10); + pkt << uint8(0x00); + } + else // 1.12.1 and 1.12.2 clients + { + pkt << uint8(0x00); + pkt << uint8(0x02); + } + + // make a ByteBuffer which stores the RealmList's size + ByteBuffer RealmListSizeBuffer; + RealmListSizeBuffer << uint32(0); + if (_expversion & POST_BC_EXP_FLAG) // only 2.x and 3.x clients + RealmListSizeBuffer << uint16(RealmListSize); + else + RealmListSizeBuffer << uint32(RealmListSize); + + ByteBuffer hdr; + hdr << uint8(REALM_LIST); + hdr << uint16(pkt.size() + RealmListSizeBuffer.size()); + hdr.append(RealmListSizeBuffer); // append RealmList's size buffer + hdr.append(pkt); // append realms in the realmlist + + std::memcpy(_writeBuffer, (char const*)hdr.contents(), hdr.size()); + AsyncWrite(hdr.size()); + + return true; } // Make the SRP6 calculation from hash in dB void AuthSession::SetVSFields(const std::string& rI) { - s.SetRand(BYTE_SIZE * 8); - - BigNumber I; - I.SetHexStr(rI.c_str()); - - // In case of leading zeros in the rI hash, restore them - uint8 mDigest[SHA_DIGEST_LENGTH]; - memset(mDigest, 0, SHA_DIGEST_LENGTH); - if (I.GetNumBytes() <= SHA_DIGEST_LENGTH) - memcpy(mDigest, I.AsByteArray().get(), I.GetNumBytes()); - - std::reverse(mDigest, mDigest + SHA_DIGEST_LENGTH); - - SHA1Hash sha; - sha.UpdateData(s.AsByteArray().get(), s.GetNumBytes()); - sha.UpdateData(mDigest, SHA_DIGEST_LENGTH); - sha.Finalize(); - BigNumber x; - x.SetBinary(sha.GetDigest(), sha.GetLength()); - v = g.ModExp(x, N); - - // No SQL injection (username escaped) - char *v_hex, *s_hex; - v_hex = v.AsHexStr(); - s_hex = s.AsHexStr(); - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_VS); - stmt->setString(0, v_hex); - stmt->setString(1, s_hex); - stmt->setString(2, _login); - LoginDatabase.Execute(stmt); - - OPENSSL_free(v_hex); - OPENSSL_free(s_hex); -} \ No newline at end of file + s.SetRand(BYTE_SIZE * 8); + + BigNumber I; + I.SetHexStr(rI.c_str()); + + // In case of leading zeros in the rI hash, restore them + uint8 mDigest[SHA_DIGEST_LENGTH]; + memset(mDigest, 0, SHA_DIGEST_LENGTH); + if (I.GetNumBytes() <= SHA_DIGEST_LENGTH) + memcpy(mDigest, I.AsByteArray().get(), I.GetNumBytes()); + + std::reverse(mDigest, mDigest + SHA_DIGEST_LENGTH); + + SHA1Hash sha; + sha.UpdateData(s.AsByteArray().get(), s.GetNumBytes()); + sha.UpdateData(mDigest, SHA_DIGEST_LENGTH); + sha.Finalize(); + BigNumber x; + x.SetBinary(sha.GetDigest(), sha.GetLength()); + v = g.ModExp(x, N); + + // No SQL injection (username escaped) + char *v_hex, *s_hex; + v_hex = v.AsHexStr(); + s_hex = s.AsHexStr(); + + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_VS); + stmt->setString(0, v_hex); + stmt->setString(1, s_hex); + stmt->setString(2, _login); + LoginDatabase.Execute(stmt); + + OPENSSL_free(v_hex); + OPENSSL_free(s_hex); +} diff --git a/src/server/authserver/Server/AuthSession.h b/src/server/authserver/Server/AuthSession.h index 205300e806a..79b1e568aa6 100644 --- a/src/server/authserver/Server/AuthSession.h +++ b/src/server/authserver/Server/AuthSession.h @@ -34,52 +34,52 @@ const size_t bufferSize = 4096; class AuthSession : public std::enable_shared_from_this < AuthSession > { public: - AuthSession(tcp::socket socket) : _socket(std::move(socket)) - { - N.SetHexStr("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7"); - g.SetDword(7); - } - - void Start() - { - AsyncReadHeader(); - } - - bool _HandleLogonChallenge(); - bool _HandleLogonProof(); - bool _HandleReconnectChallenge(); - bool _HandleReconnectProof(); - bool _HandleRealmList(); - - const std::string GetRemoteIpAddress() const { return _socket.remote_endpoint().address().to_string(); }; - unsigned short GetRemotePort() const { return _socket.remote_endpoint().port(); } + AuthSession(tcp::socket socket) : _socket(std::move(socket)) + { + N.SetHexStr("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7"); + g.SetDword(7); + } + + void Start() + { + AsyncReadHeader(); + } + + bool _HandleLogonChallenge(); + bool _HandleLogonProof(); + bool _HandleReconnectChallenge(); + bool _HandleReconnectProof(); + bool _HandleRealmList(); + + const std::string GetRemoteIpAddress() const { return _socket.remote_endpoint().address().to_string(); }; + unsigned short GetRemotePort() const { return _socket.remote_endpoint().port(); } private: - void AsyncReadHeader(); - void AsyncReadData(bool (AuthSession::*handler)(), size_t dataSize, size_t bufferOffset); - void AsyncWrite(size_t length); + void AsyncReadHeader(); + void AsyncReadData(bool (AuthSession::*handler)(), size_t dataSize, size_t bufferOffset); + void AsyncWrite(size_t length); - void SetVSFields(const std::string& rI); + void SetVSFields(const std::string& rI); - BigNumber N, s, g, v; - BigNumber b, B; - BigNumber K; - BigNumber _reconnectProof; + BigNumber N, s, g, v; + BigNumber b, B; + BigNumber K; + BigNumber _reconnectProof; - tcp::socket _socket; - char _readBuffer[BUFFER_SIZE]; - char _writeBuffer[BUFFER_SIZE]; + tcp::socket _socket; + char _readBuffer[BUFFER_SIZE]; + char _writeBuffer[BUFFER_SIZE]; - bool _isAuthenticated; - std::string _tokenKey; - std::string _login; - std::string _localizationName; - std::string _os; - uint16 _build; - uint8 _expversion; + bool _isAuthenticated; + std::string _tokenKey; + std::string _login; + std::string _localizationName; + std::string _os; + uint16 _build; + uint8 _expversion; - AccountTypes _accountSecurityLevel; + AccountTypes _accountSecurityLevel; }; -#endif \ No newline at end of file +#endif -- cgit v1.2.3 From f05d5406585fe2d69796b93bff73a21e1cd41a23 Mon Sep 17 00:00:00 2001 From: leak Date: Sat, 31 May 2014 01:02:03 +0200 Subject: Restore PCH builds and make GCC happy --- src/server/authserver/PrecompiledHeaders/authPCH.h | 3 ++- src/server/authserver/Server/AuthSession.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/authserver/PrecompiledHeaders/authPCH.h b/src/server/authserver/PrecompiledHeaders/authPCH.h index 5fc3b0a3416..0ec181d9c63 100644 --- a/src/server/authserver/PrecompiledHeaders/authPCH.h +++ b/src/server/authserver/PrecompiledHeaders/authPCH.h @@ -2,5 +2,6 @@ #include "Database/DatabaseEnv.h" #include "Log.h" #include "RealmList.h" -#include "RealmSocket.h" +#include "AuthServer.h" +#include "AuthSession.h" #include "Common.h" diff --git a/src/server/authserver/Server/AuthSession.cpp b/src/server/authserver/Server/AuthSession.cpp index 6a3c145d08b..a366f7d11f7 100644 --- a/src/server/authserver/Server/AuthSession.cpp +++ b/src/server/authserver/Server/AuthSession.cpp @@ -148,7 +148,7 @@ void AuthSession::AsyncReadHeader() { _socket.read_some(boost::asio::buffer(&_readBuffer[1], sizeof(uint8) + sizeof(uint16))); //error + size - AsyncReadData(entry.handler, (uint16)&_readBuffer[2], sizeof(uint8) + sizeof(uint8) + sizeof(uint16)); // cmd + error + size + AsyncReadData(entry.handler, *reinterpret_cast(&_readBuffer[2]), sizeof(uint8) + sizeof(uint8) + sizeof(uint16)); // cmd + error + size } else { -- cgit v1.2.3 From bf6e58b8d44d3a4b78e9473df029caac74c68220 Mon Sep 17 00:00:00 2001 From: leak Date: Sat, 31 May 2014 15:58:59 +0200 Subject: Ditched ACE_Singleton in favor of C++11 like Singleton --- src/server/authserver/Main.cpp | 5 +++-- src/server/authserver/Realms/RealmList.h | 16 ++++++++++------ src/server/authserver/Server/AuthSession.cpp | 4 ++-- 3 files changed, 15 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index 27834f50814..2427c47a438 100644 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -152,8 +152,9 @@ int main(int argc, char** argv) return 1; // Get the list of realms for the server - sRealmList->Initialize(sConfigMgr->GetIntDefault("RealmsStateUpdateDelay", 20)); - if (sRealmList->size() == 0) + sRealmList.Initialize(sConfigMgr->GetIntDefault("RealmsStateUpdateDelay", 20)); + + if (sRealmList.size() == 0) { TC_LOG_ERROR("server.authserver", "No valid realms specified."); return 1; diff --git a/src/server/authserver/Realms/RealmList.h b/src/server/authserver/Realms/RealmList.h index 88da30ea963..29b6aca07d3 100644 --- a/src/server/authserver/Realms/RealmList.h +++ b/src/server/authserver/Realms/RealmList.h @@ -19,8 +19,6 @@ #ifndef _REALMLIST_H #define _REALMLIST_H -#include -#include #include #include "Common.h" @@ -59,8 +57,11 @@ class RealmList public: typedef std::map RealmMap; - RealmList(); - ~RealmList() { } + static RealmList& instance() + { + static RealmList *instance = new RealmList(); + return *instance; + } void Initialize(uint32 updateInterval); @@ -73,13 +74,16 @@ public: uint32 size() const { return m_realms.size(); } private: + RealmList(); + void UpdateRealms(bool init = false); - void UpdateRealm(uint32 id, const std::string& name, ACE_INET_Addr const& address, ACE_INET_Addr const& localAddr, ACE_INET_Addr const& localSubmask, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build); + void UpdateRealm(uint32 id, const std::string& name, ACE_INET_Addr const& address, ACE_INET_Addr const& localAddr, ACE_INET_Addr const& localSubmask, + uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build); RealmMap m_realms; uint32 m_UpdateInterval; time_t m_NextUpdateTime; }; -#define sRealmList ACE_Singleton::instance() +#define sRealmList RealmList::instance() #endif diff --git a/src/server/authserver/Server/AuthSession.cpp b/src/server/authserver/Server/AuthSession.cpp index a366f7d11f7..627e1fc470d 100644 --- a/src/server/authserver/Server/AuthSession.cpp +++ b/src/server/authserver/Server/AuthSession.cpp @@ -772,13 +772,13 @@ bool AuthSession::_HandleRealmList() uint32 id = fields[0].GetUInt32(); // Update realm list if need - sRealmList->UpdateIfNeed(); + sRealmList.UpdateIfNeed(); // Circle through realms in the RealmList and construct the return packet (including # of user characters in each realm) ByteBuffer pkt; size_t RealmListSize = 0; - for (RealmList::RealmMap::const_iterator i = sRealmList->begin(); i != sRealmList->end(); ++i) + for (RealmList::RealmMap::const_iterator i = sRealmList.begin(); i != sRealmList.end(); ++i) { const Realm &realm = i->second; // don't work with realms which not compatible with the client -- cgit v1.2.3 From 35aa142f6aa748db1febe901b2446fe53b9abbe0 Mon Sep 17 00:00:00 2001 From: leak Date: Sat, 31 May 2014 18:31:53 +0200 Subject: Replaced ACE_INET_Addr with boost::asio::ip::address --- src/server/authserver/Realms/RealmList.cpp | 25 +++++++++-------- src/server/authserver/Realms/RealmList.h | 15 ++++++----- src/server/authserver/Server/AuthSession.cpp | 40 +++++++++++++++++----------- src/server/authserver/Server/AuthSession.h | 1 - 4 files changed, 48 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/server/authserver/Realms/RealmList.cpp b/src/server/authserver/Realms/RealmList.cpp index 4aeecfc0aaa..7ed9021dd21 100644 --- a/src/server/authserver/Realms/RealmList.cpp +++ b/src/server/authserver/Realms/RealmList.cpp @@ -16,10 +16,13 @@ * with this program. If not, see . */ +#include #include "Common.h" #include "RealmList.h" #include "Database/DatabaseEnv.h" +namespace boost { namespace asio { namespace ip { class address; } } } + RealmList::RealmList() : m_UpdateInterval(0), m_NextUpdateTime(time(NULL)) { } // Load the realm list from the database @@ -31,7 +34,8 @@ void RealmList::Initialize(uint32 updateInterval) UpdateRealms(true); } -void RealmList::UpdateRealm(uint32 id, const std::string& name, ACE_INET_Addr const& address, ACE_INET_Addr const& localAddr, ACE_INET_Addr const& localSubmask, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build) +void RealmList::UpdateRealm(uint32 id, const std::string& name, ip::address const& address, ip::address const& localAddr, + ip::address const& localSubmask, uint16 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float population, uint32 build) { // Create new if not exist or update existed Realm& realm = m_realms[name]; @@ -42,12 +46,14 @@ void RealmList::UpdateRealm(uint32 id, const std::string& name, ACE_INET_Addr co realm.flag = flag; realm.timezone = timezone; realm.allowedSecurityLevel = allowedSecurityLevel; - realm.populationLevel = popu; + realm.populationLevel = population; // Append port to IP address. + realm.ExternalAddress = address; realm.LocalAddress = localAddr; realm.LocalSubnetMask = localSubmask; + realm.port = port; realm.gamebuild = build; } @@ -81,9 +87,9 @@ void RealmList::UpdateRealms(bool init) Field* fields = result->Fetch(); uint32 realmId = fields[0].GetUInt32(); std::string name = fields[1].GetString(); - std::string externalAddress = fields[2].GetString(); - std::string localAddress = fields[3].GetString(); - std::string localSubmask = fields[4].GetString(); + ip::address externalAddress = ip::address::from_string(fields[2].GetString()); + ip::address localAddress = ip::address::from_string(fields[3].GetString()); + ip::address localSubmask = ip::address::from_string(fields[4].GetString()); uint16 port = fields[5].GetUInt16(); uint8 icon = fields[6].GetUInt8(); RealmFlags flag = RealmFlags(fields[7].GetUInt8()); @@ -92,14 +98,11 @@ void RealmList::UpdateRealms(bool init) float pop = fields[10].GetFloat(); uint32 build = fields[11].GetUInt32(); - ACE_INET_Addr externalAddr(port, externalAddress.c_str(), AF_INET); - ACE_INET_Addr localAddr(port, localAddress.c_str(), AF_INET); - ACE_INET_Addr submask(0, localSubmask.c_str(), AF_INET); - - UpdateRealm(realmId, name, externalAddr, localAddr, submask, icon, flag, timezone, (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), pop, build); + UpdateRealm(realmId, name, externalAddress, localAddress, localSubmask, port, icon, flag, timezone, + (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), pop, build); if (init) - TC_LOG_INFO("server.authserver", "Added realm \"%s\" at %s:%u.", name.c_str(), m_realms[name].ExternalAddress.get_host_addr(), port); + TC_LOG_INFO("server.authserver", "Added realm \"%s\" at %s:%u.", name.c_str(), m_realms[name].ExternalAddress.to_string(), port); } while (result->NextRow()); } diff --git a/src/server/authserver/Realms/RealmList.h b/src/server/authserver/Realms/RealmList.h index 29b6aca07d3..b96d5523da9 100644 --- a/src/server/authserver/Realms/RealmList.h +++ b/src/server/authserver/Realms/RealmList.h @@ -19,9 +19,11 @@ #ifndef _REALMLIST_H #define _REALMLIST_H -#include +#include #include "Common.h" +using namespace boost::asio; + enum RealmFlags { REALM_FLAG_NONE = 0x00, @@ -38,9 +40,10 @@ enum RealmFlags // Storage object for a realm struct Realm { - ACE_INET_Addr ExternalAddress; - ACE_INET_Addr LocalAddress; - ACE_INET_Addr LocalSubnetMask; + ip::address ExternalAddress; + ip::address LocalAddress; + ip::address LocalSubnetMask; + uint16 port; std::string name; uint8 icon; RealmFlags flag; @@ -77,8 +80,8 @@ private: RealmList(); void UpdateRealms(bool init = false); - void UpdateRealm(uint32 id, const std::string& name, ACE_INET_Addr const& address, ACE_INET_Addr const& localAddr, ACE_INET_Addr const& localSubmask, - uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build); + void UpdateRealm(uint32 id, const std::string& name, ip::address const& address, ip::address const& localAddr, + ip::address const& localSubmask, uint16 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float population, uint32 build); RealmMap m_realms; uint32 m_UpdateInterval; diff --git a/src/server/authserver/Server/AuthSession.cpp b/src/server/authserver/Server/AuthSession.cpp index 627e1fc470d..304d593fa3d 100644 --- a/src/server/authserver/Server/AuthSession.cpp +++ b/src/server/authserver/Server/AuthSession.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include "ByteBuffer.h" @@ -729,29 +730,41 @@ bool AuthSession::_HandleReconnectProof() } } -ACE_INET_Addr const& GetAddressForClient(Realm const& realm, ACE_INET_Addr const& clientAddr) +tcp::endpoint const GetAddressForClient(Realm const& realm, ip::address const& clientAddr) { + ip::address realmIp; + // Attempt to send best address for client if (clientAddr.is_loopback()) { // Try guessing if realm is also connected locally if (realm.LocalAddress.is_loopback() || realm.ExternalAddress.is_loopback()) - return clientAddr; - - // Assume that user connecting from the machine that authserver is located on - // has all realms available in his local network - return realm.LocalAddress; + realmIp = clientAddr; + else + { + // Assume that user connecting from the machine that authserver is located on + // has all realms available in his local network + realmIp = realm.LocalAddress; + } + } + else + { + if (clientAddr.is_v4() && + (clientAddr.to_v4().to_ulong() & realm.LocalSubnetMask.to_v4().to_ulong()) == + (realm.LocalAddress.to_v4().to_ulong() & realm.LocalSubnetMask.to_v4().to_ulong())) + { + realmIp = realm.LocalAddress; + } + else + realmIp = realm.ExternalAddress; } - // Check if connecting client is in the same network - if (IsIPAddrInNetwork(realm.LocalAddress, clientAddr, realm.LocalSubnetMask)) - return realm.LocalAddress; + tcp::endpoint endpoint(realmIp, realm.port); // Return external IP - return realm.ExternalAddress; + return endpoint; } - bool AuthSession::_HandleRealmList() { TC_LOG_DEBUG("server.authserver", "Entering _HandleRealmList"); @@ -806,9 +819,6 @@ bool AuthSession::_HandleRealmList() name = ss.str(); } - // We don't need the port number from which client connects with but the realm's port - ACE_INET_Addr clientAddr(realm.ExternalAddress.get_port_number(), GetRemoteIpAddress().c_str(), AF_INET); - uint8 lock = (realm.allowedSecurityLevel > _accountSecurityLevel) ? 1 : 0; uint8 AmountOfCharacters = 0; @@ -824,7 +834,7 @@ bool AuthSession::_HandleRealmList() pkt << lock; // if 1, then realm locked pkt << uint8(flag); // RealmFlags pkt << name; - pkt << GetAddressString(GetAddressForClient(realm, clientAddr)); + pkt << boost::lexical_cast(GetAddressForClient(realm, _socket.remote_endpoint().address())); pkt << realm.populationLevel; pkt << AmountOfCharacters; pkt << realm.timezone; // realm category diff --git a/src/server/authserver/Server/AuthSession.h b/src/server/authserver/Server/AuthSession.h index 79b1e568aa6..32e81d5240e 100644 --- a/src/server/authserver/Server/AuthSession.h +++ b/src/server/authserver/Server/AuthSession.h @@ -21,7 +21,6 @@ #include #include - #include "Common.h" #include "BigNumber.h" -- cgit v1.2.3 From 68e22ad311ed19d3ad4460f2d178a46eda19ed65 Mon Sep 17 00:00:00 2001 From: leak Date: Sun, 1 Jun 2014 20:55:31 +0200 Subject: Replaced ACE based typedefs for fixed width ints with C++11 versions --- dep/g3dlite/Readme.txt | 1 + dep/g3dlite/include/G3D/g3dmath.h | 2 +- src/server/authserver/PrecompiledHeaders/authPCH.h | 2 +- src/server/authserver/Realms/RealmList.cpp | 2 +- src/server/collision/BoundingIntervalHierarchy.h | 4 +- src/server/collision/Models/ModelInstance.cpp | 4 +- src/server/collision/VMapDefinitions.h | 1 + src/server/game/Events/GameEventMgr.cpp | 12 +++--- src/server/game/PrecompiledHeaders/gamePCH.h | 4 +- src/server/scripts/Commands/cs_debug.cpp | 8 ++-- src/server/scripts/Commands/cs_mmaps.cpp | 4 +- src/server/shared/Define.h | 45 +++++++++++----------- .../worldserver/PrecompiledHeaders/worldPCH.h | 3 +- 13 files changed, 46 insertions(+), 46 deletions(-) (limited to 'src') diff --git a/dep/g3dlite/Readme.txt b/dep/g3dlite/Readme.txt index 7988d1f314e..739f6985090 100644 --- a/dep/g3dlite/Readme.txt +++ b/dep/g3dlite/Readme.txt @@ -9,3 +9,4 @@ G3D-v8.0_hotfix5.diff - 2013-02-27 - fix compilation in cygwin environments G3D-v8.0_hotfix6.diff - 2013-03-08 - fix compilation in mingw G3D-v8.0_hotfix7.diff - 2013-08-31 - fix typo in Matrix4 == operator G3D-v8.0_hotfix8.diff - 2013-09-01 - fix typo in Vector3int32 += operator +G3D-v8.0_hotfix9.diff - 2014-06-01 - only VS < 10 don't ship inttypes.h diff --git a/dep/g3dlite/include/G3D/g3dmath.h b/dep/g3dlite/include/G3D/g3dmath.h index b0c98aeaf04..4be723ca30c 100644 --- a/dep/g3dlite/include/G3D/g3dmath.h +++ b/dep/g3dlite/include/G3D/g3dmath.h @@ -30,7 +30,7 @@ #include #include -#ifdef _MSC_VER +#if defined(_MSC_VER) && (_MSC_VER < 1000) // Visual Studio is missing inttypes.h # ifndef PRId64 # define PRId64 "I64d" diff --git a/src/server/authserver/PrecompiledHeaders/authPCH.h b/src/server/authserver/PrecompiledHeaders/authPCH.h index 0ec181d9c63..61059ae91b0 100644 --- a/src/server/authserver/PrecompiledHeaders/authPCH.h +++ b/src/server/authserver/PrecompiledHeaders/authPCH.h @@ -1,7 +1,7 @@ +#include "Common.h" #include "Configuration/Config.h" #include "Database/DatabaseEnv.h" #include "Log.h" #include "RealmList.h" #include "AuthServer.h" #include "AuthSession.h" -#include "Common.h" diff --git a/src/server/authserver/Realms/RealmList.cpp b/src/server/authserver/Realms/RealmList.cpp index 7ed9021dd21..94d52fb3138 100644 --- a/src/server/authserver/Realms/RealmList.cpp +++ b/src/server/authserver/Realms/RealmList.cpp @@ -102,7 +102,7 @@ void RealmList::UpdateRealms(bool init) (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), pop, build); if (init) - TC_LOG_INFO("server.authserver", "Added realm \"%s\" at %s:%u.", name.c_str(), m_realms[name].ExternalAddress.to_string(), port); + TC_LOG_INFO("server.authserver", "Added realm \"%s\" at %s:%u.", name.c_str(), m_realms[name].ExternalAddress.to_string().c_str(), port); } while (result->NextRow()); } diff --git a/src/server/collision/BoundingIntervalHierarchy.h b/src/server/collision/BoundingIntervalHierarchy.h index 4d38bfc18c4..491a299ca68 100644 --- a/src/server/collision/BoundingIntervalHierarchy.h +++ b/src/server/collision/BoundingIntervalHierarchy.h @@ -177,7 +177,7 @@ class BIH { uint32 tn = tree[node]; uint32 axis = (tn & (3 << 30)) >> 30; - bool BVH2 = tn & (1 << 29); + bool BVH2 = (tn & (1 << 29)) != 0; int offset = tn & ~(7 << 29); if (!BVH2) { @@ -271,7 +271,7 @@ class BIH { uint32 tn = tree[node]; uint32 axis = (tn & (3 << 30)) >> 30; - bool BVH2 = tn & (1 << 29); + bool BVH2 = (tn & (1 << 29)) != 0; int offset = tn & ~(7 << 29); if (!BVH2) { diff --git a/src/server/collision/Models/ModelInstance.cpp b/src/server/collision/Models/ModelInstance.cpp index 3262c154965..475984c4fd3 100644 --- a/src/server/collision/Models/ModelInstance.cpp +++ b/src/server/collision/Models/ModelInstance.cpp @@ -167,7 +167,7 @@ namespace VMAP check += fread(&spawn.iPos, sizeof(float), 3, rf); check += fread(&spawn.iRot, sizeof(float), 3, rf); check += fread(&spawn.iScale, sizeof(float), 1, rf); - bool has_bound = (spawn.flags & MOD_HAS_BOUND); + bool has_bound = (spawn.flags & MOD_HAS_BOUND) != 0; if (has_bound) // only WMOs have bound in MPQ, only available after computation { Vector3 bLow, bHigh; @@ -206,7 +206,7 @@ namespace VMAP check += fwrite(&spawn.iPos, sizeof(float), 3, wf); check += fwrite(&spawn.iRot, sizeof(float), 3, wf); check += fwrite(&spawn.iScale, sizeof(float), 1, wf); - bool has_bound = (spawn.flags & MOD_HAS_BOUND); + bool has_bound = (spawn.flags & MOD_HAS_BOUND) != 0; if (has_bound) // only WMOs have bound in MPQ, only available after computation { check += fwrite(&spawn.iBound.low(), sizeof(float), 3, wf); diff --git a/src/server/collision/VMapDefinitions.h b/src/server/collision/VMapDefinitions.h index 0bc74df51ec..8cd965ddffd 100644 --- a/src/server/collision/VMapDefinitions.h +++ b/src/server/collision/VMapDefinitions.h @@ -19,6 +19,7 @@ #ifndef _VMAPDEFINITIONS_H #define _VMAPDEFINITIONS_H #include +#include #define LIQUID_TILE_SIZE (533.333f / 128.f) diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index e4522536a81..5669f36a939 100644 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -1163,7 +1163,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) if (internal_event_id < 0 || internal_event_id >= int32(mGameEventCreatureGuids.size())) { - TC_LOG_ERROR("gameevent", "GameEventMgr::GameEventSpawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")", + TC_LOG_ERROR("gameevent", "GameEventMgr::GameEventSpawn attempt access to out of range mGameEventCreatureGuids element %i (size: %zu)", internal_event_id, mGameEventCreatureGuids.size()); return; } @@ -1190,7 +1190,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) if (internal_event_id < 0 || internal_event_id >= int32(mGameEventGameobjectGuids.size())) { - TC_LOG_ERROR("gameevent", "GameEventMgr::GameEventSpawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")", + TC_LOG_ERROR("gameevent", "GameEventMgr::GameEventSpawn attempt access to out of range mGameEventGameobjectGuids element %i (size: %zu)", internal_event_id, mGameEventGameobjectGuids.size()); return; } @@ -1223,7 +1223,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) if (internal_event_id < 0 || internal_event_id >= int32(mGameEventPoolIds.size())) { - TC_LOG_ERROR("gameevent", "GameEventMgr::GameEventSpawn attempt access to out of range mGameEventPoolIds element %u (size: " SIZEFMTD ")", + TC_LOG_ERROR("gameevent", "GameEventMgr::GameEventSpawn attempt access to out of range mGameEventPoolIds element %u (size: %zu)", internal_event_id, mGameEventPoolIds.size()); return; } @@ -1238,7 +1238,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) if (internal_event_id < 0 || internal_event_id >= int32(mGameEventCreatureGuids.size())) { - TC_LOG_ERROR("gameevent", "GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")", + TC_LOG_ERROR("gameevent", "GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventCreatureGuids element %i (size: %zu)", internal_event_id, mGameEventCreatureGuids.size()); return; } @@ -1260,7 +1260,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) if (internal_event_id < 0 || internal_event_id >= int32(mGameEventGameobjectGuids.size())) { - TC_LOG_ERROR("gameevent", "GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")", + TC_LOG_ERROR("gameevent", "GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventGameobjectGuids element %i (size: %zu)", internal_event_id, mGameEventGameobjectGuids.size()); return; } @@ -1281,7 +1281,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) } if (internal_event_id < 0 || internal_event_id >= int32(mGameEventPoolIds.size())) { - TC_LOG_ERROR("gameevent", "GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventPoolIds element %u (size: " SIZEFMTD ")", internal_event_id, mGameEventPoolIds.size()); + TC_LOG_ERROR("gameevent", "GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventPoolIds element %u (size: %zu)", internal_event_id, mGameEventPoolIds.size()); return; } diff --git a/src/server/game/PrecompiledHeaders/gamePCH.h b/src/server/game/PrecompiledHeaders/gamePCH.h index 68f628430c4..d389c4b360c 100644 --- a/src/server/game/PrecompiledHeaders/gamePCH.h +++ b/src/server/game/PrecompiledHeaders/gamePCH.h @@ -1,9 +1,7 @@ //add here most rarely modified headers to speed up debug build compilation -#include "WorldSocket.h" // must be first to make ACE happy with ACE includes in it - #include "Common.h" - +#include "WorldSocket.h" #include "MapManager.h" #include "Log.h" #include "ObjectAccessor.h" diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index f18f9b4499c..d0050a0d4fd 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -745,14 +745,14 @@ public: if (item->GetOwnerGUID() != player->GetGUID()) { - handler->PSendSysMessage("queue(" SIZEFMTD "): For the item with guid %d, the owner's guid (%d) and the player's guid (%d) don't match!", i, item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow()); + handler->PSendSysMessage("queue(%zu): For the item with guid %d, the owner's guid (%d) and the player's guid (%d) don't match!", i, item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow()); error = true; continue; } if (item->GetQueuePos() != i) { - handler->PSendSysMessage("queue(" SIZEFMTD "): For the item with guid %d, the queuepos doesn't match it's position in the queue!", i, item->GetGUIDLow()); + handler->PSendSysMessage("queue(%zu): For the item with guid %d, the queuepos doesn't match it's position in the queue!", i, item->GetGUIDLow()); error = true; continue; } @@ -764,14 +764,14 @@ public: if (test == NULL) { - handler->PSendSysMessage("queue(" SIZEFMTD "): The bag(%d) and slot(%d) values for the item with guid %d are incorrect, the player doesn't have any item at that position!", i, item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow()); + handler->PSendSysMessage("queue(%zu): The bag(%d) and slot(%d) values for the item with guid %d are incorrect, the player doesn't have any item at that position!", i, item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow()); error = true; continue; } if (test != item) { - handler->PSendSysMessage("queue(" SIZEFMTD "): The bag(%d) and slot(%d) values for the item with guid %d are incorrect, an item which guid is %d is there instead!", i, item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), test->GetGUIDLow()); + handler->PSendSysMessage("queue(%zu): The bag(%d) and slot(%d) values for the item with guid %d are incorrect, an item which guid is %d is there instead!", i, item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), test->GetGUIDLow()); error = true; continue; } diff --git a/src/server/scripts/Commands/cs_mmaps.cpp b/src/server/scripts/Commands/cs_mmaps.cpp index d89edd4d925..0be5994e8ed 100644 --- a/src/server/scripts/Commands/cs_mmaps.cpp +++ b/src/server/scripts/Commands/cs_mmaps.cpp @@ -98,7 +98,7 @@ public: Movement::PointsArray const& pointPath = path.GetPath(); handler->PSendSysMessage("%s's path to %s:", target->GetName().c_str(), player->GetName().c_str()); handler->PSendSysMessage("Building: %s", useStraightPath ? "StraightPath" : "SmoothPath"); - handler->PSendSysMessage("Result: %s - Length: " SIZEFMTD " - Type: %u", (result ? "true" : "false"), pointPath.size(), path.GetPathType()); + handler->PSendSysMessage("Result: %s - Length: %zu - Type: %u", (result ? "true" : "false"), pointPath.size(), path.GetPathType()); G3D::Vector3 const &start = path.GetStartPosition(); G3D::Vector3 const &end = path.GetEndPosition(); @@ -273,7 +273,7 @@ public: if (!creatureList.empty()) { - handler->PSendSysMessage("Found " SIZEFMTD " Creatures.", creatureList.size()); + handler->PSendSysMessage("Found %zu Creatures.", creatureList.size()); uint32 paths = 0; uint32 uStartTime = getMSTime(); diff --git a/src/server/shared/Define.h b/src/server/shared/Define.h index e43853e5bb0..0678d84decd 100644 --- a/src/server/shared/Define.h +++ b/src/server/shared/Define.h @@ -19,23 +19,26 @@ #ifndef TRINITY_DEFINE_H #define TRINITY_DEFINE_H -#include "CompilerDefs.h" - -#include -#include +#if COMPILER_GNU == COMPILER_GNU +# if !defined(__STDC_FORMAT_MACROS) +# define __STDC_FORMAT_MACROS +# endif +#endif #include +#include +#include "CompilerDefs.h" #define TRINITY_LITTLEENDIAN 0 #define TRINITY_BIGENDIAN 1 #if !defined(TRINITY_ENDIAN) -# if defined (ACE_BIG_ENDIAN) +# if defined (BOOST_ENDIAN_BIG_BYTE) # define TRINITY_ENDIAN TRINITY_BIGENDIAN -# else //ACE_BYTE_ORDER != ACE_BIG_ENDIAN +# else # define TRINITY_ENDIAN TRINITY_LITTLEENDIAN -# endif //ACE_BYTE_ORDER -#endif //TRINITY_ENDIAN +# endif +#endif #if PLATFORM == PLATFORM_WINDOWS # define TRINITY_PATH_MAX MAX_PATH @@ -70,21 +73,19 @@ # define ATTR_DEPRECATED #endif //COMPILER == COMPILER_GNU -#define UI64FMTD ACE_UINT64_FORMAT_SPECIFIER -#define UI64LIT(N) ACE_UINT64_LITERAL(N) - -#define SI64FMTD ACE_INT64_FORMAT_SPECIFIER -#define SI64LIT(N) ACE_INT64_LITERAL(N) +#define UI64FMTD PRIu64 +#define UI64LIT(N) UINT64_C(N) -#define SIZEFMTD ACE_SIZE_T_FORMAT_SPECIFIER +#define SI64FMTD PRId64 +#define SI64LIT(N) INT64_C(N) -typedef ACE_INT64 int64; -typedef ACE_INT32 int32; -typedef ACE_INT16 int16; -typedef ACE_INT8 int8; -typedef ACE_UINT64 uint64; -typedef ACE_UINT32 uint32; -typedef ACE_UINT16 uint16; -typedef ACE_UINT8 uint8; +typedef int64_t int64; +typedef int32_t int32; +typedef int16_t int16; +typedef int8_t int8; +typedef uint64_t uint64; +typedef uint32_t uint32; +typedef uint16_t uint16; +typedef uint8_t uint8; #endif //TRINITY_DEFINE_H diff --git a/src/server/worldserver/PrecompiledHeaders/worldPCH.h b/src/server/worldserver/PrecompiledHeaders/worldPCH.h index f94dd953bba..889e3855995 100644 --- a/src/server/worldserver/PrecompiledHeaders/worldPCH.h +++ b/src/server/worldserver/PrecompiledHeaders/worldPCH.h @@ -1,6 +1,5 @@ -#include "WorldSocket.h" // must be first to make ACE happy with ACE includes in it - #include "Common.h" +#include "WorldSocket.h" #include "World.h" #include "Log.h" #include "Database/DatabaseEnv.h" -- cgit v1.2.3 From 0fa3a4923efb492a71f888e256348148fdd73d80 Mon Sep 17 00:00:00 2001 From: leak Date: Mon, 2 Jun 2014 23:01:01 +0200 Subject: Replaced LockedQueue ACE lock with std::mutex --- src/server/game/Server/WorldSession.h | 2 +- src/server/game/World/World.h | 4 +- src/server/shared/Common.h | 3 +- src/server/shared/Threading/LockedQueue.h | 244 ++++++++++++++---------------- 4 files changed, 122 insertions(+), 131 deletions(-) (limited to 'src') diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 9d1a05ae753..5929726642c 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -1007,7 +1007,7 @@ class WorldSession AddonsList m_addonsList; uint32 recruiterId; bool isRecruiter; - ACE_Based::LockedQueue _recvQueue; + LockedQueue _recvQueue; time_t timeLastWhoCommand; rbac::RBACData* _RBACData; diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 9bac3032161..3e836df1989 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -808,7 +808,7 @@ class World static int32 m_visibility_notify_periodInBGArenas; // CLI command holder to be thread safe - ACE_Based::LockedQueue cliCmdQueue; + LockedQueue cliCmdQueue; // next daily quests and random bg reset time time_t m_NextDailyQuestReset; @@ -822,7 +822,7 @@ class World // sessions that are added async void AddSession_(WorldSession* s); - ACE_Based::LockedQueue addSessQueue; + LockedQueue addSessQueue; // used versions std::string m_DBVersion; diff --git a/src/server/shared/Common.h b/src/server/shared/Common.h index f49bbf0bada..14cc6533a68 100644 --- a/src/server/shared/Common.h +++ b/src/server/shared/Common.h @@ -79,10 +79,11 @@ #include #include +#include "Debugging/Errors.h" + #include "Threading/LockedQueue.h" #include "Threading/Threading.h" -#include #include #include #include diff --git a/src/server/shared/Threading/LockedQueue.h b/src/server/shared/Threading/LockedQueue.h index 5709724c9a2..3ca2a5cd45c 100644 --- a/src/server/shared/Threading/LockedQueue.h +++ b/src/server/shared/Threading/LockedQueue.h @@ -19,140 +19,130 @@ #ifndef LOCKEDQUEUE_H #define LOCKEDQUEUE_H -#include -#include #include -#include -#include "Debugging/Errors.h" +#include -namespace ACE_Based + + +template > +class LockedQueue { - template > - class LockedQueue + //! Lock access to the queue. + std::mutex _lock; + + //! Storage backing the queue. + StorageType _queue; + + //! Cancellation flag. + volatile bool _canceled; + +public: + + //! Create a LockedQueue. + LockedQueue() + : _canceled(false) + { + } + + //! Destroy a LockedQueue. + virtual ~LockedQueue() + { + } + + //! Adds an item to the queue. + void add(const T& item) + { + lock(); + + _queue.push_back(item); + + unlock(); + } + + //! Gets the next result in the queue, if any. + bool next(T& result) + { + std::lock_guard lock(_lock); + + if (_queue.empty()) + return false; + + result = _queue.front(); + _queue.pop_front(); + + return true; + } + + template + bool next(T& result, Checker& check) + { + std::lock_guard lock(_lock); + + if (_queue.empty()) + return false; + + result = _queue.front(); + if (!check.Process(result)) + return false; + + _queue.pop_front(); + return true; + } + + //! Peeks at the top of the queue. Check if the queue is empty before calling! Remember to unlock after use if autoUnlock == false. + T& peek(bool autoUnlock = false) + { + lock(); + + T& result = _queue.front(); + + if (autoUnlock) + unlock(); + + return result; + } + + //! Cancels the queue. + void cancel() { - //! Lock access to the queue. - LockType _lock; + lock(); - //! Storage backing the queue. - StorageType _queue; + _canceled = true; - //! Cancellation flag. - volatile bool _canceled; + unlock(); + } - public: + //! Checks if the queue is cancelled. + bool cancelled() + { + ACE_Guard g(this->_lock); + return _canceled; + } - //! Create a LockedQueue. - LockedQueue() - : _canceled(false) - { - } + //! Locks the queue for access. + void lock() + { + this->_lock.lock(); + } - //! Destroy a LockedQueue. - virtual ~LockedQueue() - { - } - - //! Adds an item to the queue. - void add(const T& item) - { - lock(); - - //ASSERT(!this->_canceled); - // throw Cancellation_Exception(); - - _queue.push_back(item); - - unlock(); - } - - //! Gets the next result in the queue, if any. - bool next(T& result) - { - // ACE_Guard g(this->_lock); - ACE_GUARD_RETURN (LockType, g, this->_lock, false); - - if (_queue.empty()) - return false; - - //ASSERT (!_queue.empty() || !this->_canceled); - // throw Cancellation_Exception(); - result = _queue.front(); - _queue.pop_front(); - - return true; - } - - template - bool next(T& result, Checker& check) - { - ACE_Guard g(this->_lock); - - if (_queue.empty()) - return false; - - result = _queue.front(); - if (!check.Process(result)) - return false; - - _queue.pop_front(); - return true; - } - - //! Peeks at the top of the queue. Check if the queue is empty before calling! Remember to unlock after use if autoUnlock == false. - T& peek(bool autoUnlock = false) - { - lock(); - - T& result = _queue.front(); - - if (autoUnlock) - unlock(); - - return result; - } - - //! Cancels the queue. - void cancel() - { - lock(); - - _canceled = true; - - unlock(); - } - - //! Checks if the queue is cancelled. - bool cancelled() - { - ACE_Guard g(this->_lock); - return _canceled; - } - - //! Locks the queue for access. - void lock() - { - this->_lock.acquire(); - } - - //! Unlocks the queue. - void unlock() - { - this->_lock.release(); - } - - ///! Calls pop_front of the queue - void pop_front() - { - ACE_GUARD (LockType, g, this->_lock); - _queue.pop_front(); - } - - ///! Checks if we're empty or not with locks held - bool empty() - { - ACE_GUARD_RETURN (LockType, g, this->_lock, false); - return _queue.empty(); - } - }; -} + //! Unlocks the queue. + void unlock() + { + this->_lock.unlock(); + } + + ///! Calls pop_front of the queue + void pop_front() + { + std::lock_guard lock(_lock); + _queue.pop_front(); + } + + ///! Checks if we're empty or not with locks held + bool empty() + { + std::lock_guard lock(_lock); + return _queue.empty(); + } +}; #endif -- cgit v1.2.3 From ee4a3b9d59867a2440f8eb35f96405e5c4f6fe28 Mon Sep 17 00:00:00 2001 From: leak Date: Sun, 8 Jun 2014 15:30:57 +0200 Subject: Replaced mutex related code in Common.h --- src/server/collision/Management/VMapManager2.cpp | 5 ++- src/server/collision/Management/VMapManager2.h | 6 +-- src/server/game/Events/GameEventMgr.cpp | 4 +- src/server/game/Globals/ObjectAccessor.cpp | 23 ++++++---- src/server/game/Globals/ObjectAccessor.h | 53 +++++++++++++----------- src/server/game/Handlers/MiscHandler.cpp | 3 +- src/server/game/Instances/InstanceSaveMgr.h | 28 +++++++++---- src/server/game/Maps/Map.cpp | 6 +-- src/server/game/Maps/Map.h | 4 +- src/server/game/Maps/MapInstanced.cpp | 4 +- src/server/game/Maps/MapManager.cpp | 6 +-- src/server/game/Maps/MapManager.h | 2 +- src/server/game/Maps/MapUpdater.cpp | 39 +++++++++++++---- src/server/game/Maps/MapUpdater.h | 26 ++++++++++-- src/server/game/Server/WorldSocketMgr.cpp | 8 ++-- src/server/scripts/Commands/cs_gm.cpp | 2 +- src/server/scripts/Commands/cs_reset.cpp | 2 +- src/server/shared/Common.h | 19 --------- src/server/shared/Threading/LockedQueue.h | 2 - 19 files changed, 142 insertions(+), 100 deletions(-) (limited to 'src') diff --git a/src/server/collision/Management/VMapManager2.cpp b/src/server/collision/Management/VMapManager2.cpp index 813a3c04288..2aa3b6ab40d 100644 --- a/src/server/collision/Management/VMapManager2.cpp +++ b/src/server/collision/Management/VMapManager2.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include "VMapManager2.h" @@ -252,7 +253,7 @@ namespace VMAP WorldModel* VMapManager2::acquireModelInstance(const std::string& basepath, const std::string& filename) { //! Critical section, thread safe access to iLoadedModelFiles - TRINITY_GUARD(ACE_Thread_Mutex, LoadedModelFilesLock); + std::lock_guard lock(LoadedModelFilesLock); ModelFileMap::iterator model = iLoadedModelFiles.find(filename); if (model == iLoadedModelFiles.end()) @@ -275,7 +276,7 @@ namespace VMAP void VMapManager2::releaseModelInstance(const std::string &filename) { //! Critical section, thread safe access to iLoadedModelFiles - TRINITY_GUARD(ACE_Thread_Mutex, LoadedModelFilesLock); + std::lock_guard lock(LoadedModelFilesLock); ModelFileMap::iterator model = iLoadedModelFiles.find(filename); if (model == iLoadedModelFiles.end()) diff --git a/src/server/collision/Management/VMapManager2.h b/src/server/collision/Management/VMapManager2.h index 711025e67c0..03de6951d5d 100644 --- a/src/server/collision/Management/VMapManager2.h +++ b/src/server/collision/Management/VMapManager2.h @@ -19,10 +19,10 @@ #ifndef _VMAPMANAGER2_H #define _VMAPMANAGER2_H +#include +#include #include "Define.h" #include "IVMapManager.h" -#include -#include //=========================================================== @@ -73,7 +73,7 @@ namespace VMAP ModelFileMap iLoadedModelFiles; InstanceTreeMap iInstanceMapTrees; // Mutex for iLoadedModelFiles - ACE_Thread_Mutex LoadedModelFilesLock; + std::mutex LoadedModelFilesLock; bool _loadMap(uint32 mapId, const std::string& basePath, uint32 tileX, uint32 tileY); /* void _unloadMap(uint32 pMapId, uint32 x, uint32 y); */ diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index 5669f36a939..9e1514f11bd 100644 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -1600,14 +1600,14 @@ void GameEventMgr::RunSmartAIScripts(uint16 event_id, bool activate) //! Iterate over every supported source type (creature and gameobject) //! Not entirely sure how this will affect units in non-loaded grids. { - TRINITY_READ_GUARD(HashMapHolder::LockType, *HashMapHolder::GetLock()); + boost::shared_lock lock(*HashMapHolder::GetLock()); HashMapHolder::MapType const& m = ObjectAccessor::GetCreatures(); for (HashMapHolder::MapType::const_iterator iter = m.begin(); iter != m.end(); ++iter) if (iter->second->IsInWorld()) iter->second->AI()->sOnGameEvent(activate, event_id); } { - TRINITY_READ_GUARD(HashMapHolder::LockType, *HashMapHolder::GetLock()); + boost::shared_lock lock(*HashMapHolder::GetLock()); HashMapHolder::MapType const& m = ObjectAccessor::GetGameObjects(); for (HashMapHolder::MapType::const_iterator iter = m.begin(); iter != m.end(); ++iter) if (iter->second->IsInWorld()) diff --git a/src/server/game/Globals/ObjectAccessor.cpp b/src/server/game/Globals/ObjectAccessor.cpp index 8bf353d3eaa..ec33d8efbe1 100644 --- a/src/server/game/Globals/ObjectAccessor.cpp +++ b/src/server/game/Globals/ObjectAccessor.cpp @@ -16,6 +16,9 @@ * with this program. If not, see . */ +#include +#include + #include "ObjectAccessor.h" #include "CellImpl.h" #include "Corpse.h" @@ -205,7 +208,8 @@ Unit* ObjectAccessor::FindUnit(uint64 guid) Player* ObjectAccessor::FindPlayerByName(std::string const& name) { - TRINITY_READ_GUARD(HashMapHolder::LockType, *HashMapHolder::GetLock()); + boost::shared_lock lock(*HashMapHolder::GetLock()); + std::string nameStr = name; std::transform(nameStr.begin(), nameStr.end(), nameStr.begin(), ::tolower); HashMapHolder::MapType const& m = GetPlayers(); @@ -224,7 +228,8 @@ Player* ObjectAccessor::FindPlayerByName(std::string const& name) void ObjectAccessor::SaveAllPlayers() { - TRINITY_READ_GUARD(HashMapHolder::LockType, *HashMapHolder::GetLock()); + boost::shared_lock lock(*HashMapHolder::GetLock()); + HashMapHolder::MapType const& m = GetPlayers(); for (HashMapHolder::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) itr->second->SaveToDB(); @@ -232,7 +237,7 @@ void ObjectAccessor::SaveAllPlayers() Corpse* ObjectAccessor::GetCorpseForPlayerGUID(uint64 guid) { - TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, i_corpseLock); + boost::shared_lock lock(_corpseLock); Player2CorpsesMapType::iterator iter = i_player2corpse.find(guid); if (iter == i_player2corpse.end()) @@ -247,6 +252,8 @@ void ObjectAccessor::RemoveCorpse(Corpse* corpse) { ASSERT(corpse && corpse->GetType() != CORPSE_BONES); + boost::upgrade_lock lock(_corpseLock); + /// @todo more works need to be done for corpse and other world object if (Map* map = corpse->FindMap()) { @@ -265,7 +272,7 @@ void ObjectAccessor::RemoveCorpse(Corpse* corpse) // Critical section { - TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, i_corpseLock); + boost::upgrade_to_unique_lock uniqueLock(lock); Player2CorpsesMapType::iterator iter = i_player2corpse.find(corpse->GetOwnerGUID()); if (iter == i_player2corpse.end()) /// @todo Fix this @@ -285,7 +292,7 @@ void ObjectAccessor::AddCorpse(Corpse* corpse) // Critical section { - TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, i_corpseLock); + boost::unique_lock lock(_corpseLock); ASSERT(i_player2corpse.find(corpse->GetOwnerGUID()) == i_player2corpse.end()); i_player2corpse[corpse->GetOwnerGUID()] = corpse; @@ -298,7 +305,7 @@ void ObjectAccessor::AddCorpse(Corpse* corpse) void ObjectAccessor::AddCorpsesToGrid(GridCoord const& gridpair, GridType& grid, Map* map) { - TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, i_corpseLock); + boost::shared_lock lock(_corpseLock); for (Player2CorpsesMapType::iterator iter = i_player2corpse.begin(); iter != i_player2corpse.end(); ++iter) { @@ -431,8 +438,8 @@ void ObjectAccessor::UnloadAll() /// Define the static members of HashMapHolder -template std::unordered_map< uint64, T* > HashMapHolder::m_objectMap; -template typename HashMapHolder::LockType HashMapHolder::i_lock; +template std::unordered_map< uint64, T* > HashMapHolder::_objectMap; +template boost::shared_mutex HashMapHolder::_lock; /// Global definitions for the hashmap storage diff --git a/src/server/game/Globals/ObjectAccessor.h b/src/server/game/Globals/ObjectAccessor.h index b52699c85ac..79799cec55f 100644 --- a/src/server/game/Globals/ObjectAccessor.h +++ b/src/server/game/Globals/ObjectAccessor.h @@ -19,17 +19,17 @@ #ifndef TRINITY_OBJECTACCESSOR_H #define TRINITY_OBJECTACCESSOR_H -#include "Define.h" -#include -#include +#include +#include #include +#include +#include -#include "UpdateData.h" - +#include "Define.h" #include "GridDefines.h" +#include "UpdateData.h" #include "Object.h" -#include class Creature; class Corpse; @@ -48,42 +48,41 @@ class HashMapHolder public: typedef std::unordered_map MapType; - typedef ACE_RW_Thread_Mutex LockType; static void Insert(T* o) { - TRINITY_WRITE_GUARD(LockType, i_lock); - m_objectMap[o->GetGUID()] = o; + boost::shared_lock lock(_lock); + + _objectMap[o->GetGUID()] = o; } static void Remove(T* o) { - TRINITY_WRITE_GUARD(LockType, i_lock); - m_objectMap.erase(o->GetGUID()); + boost::unique_lock lock(_lock); + _objectMap.erase(o->GetGUID()); } static T* Find(uint64 guid) { - TRINITY_READ_GUARD(LockType, i_lock); - typename MapType::iterator itr = m_objectMap.find(guid); - return (itr != m_objectMap.end()) ? itr->second : NULL; + boost::shared_lock lock(_lock); + typename MapType::iterator itr = _objectMap.find(guid); + return (itr != _objectMap.end()) ? itr->second : NULL; } - static MapType& GetContainer() { return m_objectMap; } + static MapType& GetContainer() { return _objectMap; } - static LockType* GetLock() { return &i_lock; } + static boost::shared_mutex* GetLock() { return &_lock; } private: //Non instanceable only static HashMapHolder() { } - static LockType i_lock; - static MapType m_objectMap; + static boost::shared_mutex _lock; + static MapType _objectMap; }; class ObjectAccessor { - friend class ACE_Singleton; private: ObjectAccessor(); ~ObjectAccessor(); @@ -93,6 +92,12 @@ class ObjectAccessor public: /// @todo: Override these template functions for each holder type and add assertions + static ObjectAccessor* instance() + { + static ObjectAccessor *instance = new ObjectAccessor(); + return instance; + } + template static T* GetObjectInOrOutOfWorld(uint64 guid, T* /*typeSpecifier*/) { return HashMapHolder::Find(guid); @@ -195,13 +200,13 @@ class ObjectAccessor //non-static functions void AddUpdateObject(Object* obj) { - TRINITY_GUARD(ACE_Thread_Mutex, i_objectLock); + std::lock_guard lock(_objectLock); i_objects.insert(obj); } void RemoveUpdateObject(Object* obj) { - TRINITY_GUARD(ACE_Thread_Mutex, i_objectLock); + std::lock_guard lock(_objectLock); i_objects.erase(obj); } @@ -228,9 +233,9 @@ class ObjectAccessor std::set i_objects; Player2CorpsesMapType i_player2corpse; - ACE_Thread_Mutex i_objectLock; - ACE_RW_Thread_Mutex i_corpseLock; + std::mutex _objectLock; + boost::shared_mutex _corpseLock; }; -#define sObjectAccessor ACE_Singleton::instance() +#define sObjectAccessor ObjectAccessor::instance() #endif diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index 1b04c89b338..40830d63d05 100644 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -260,7 +260,8 @@ void WorldSession::HandleWhoOpcode(WorldPacket& recvData) data << uint32(matchcount); // placeholder, count of players matching criteria data << uint32(displaycount); // placeholder, count of players displayed - TRINITY_READ_GUARD(HashMapHolder::LockType, *HashMapHolder::GetLock()); + boost::shared_lock lock(*HashMapHolder::GetLock()); + HashMapHolder::MapType const& m = sObjectAccessor->GetPlayers(); for (HashMapHolder::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) { diff --git a/src/server/game/Instances/InstanceSaveMgr.h b/src/server/game/Instances/InstanceSaveMgr.h index 4f1b576cae6..98b37386a3f 100644 --- a/src/server/game/Instances/InstanceSaveMgr.h +++ b/src/server/game/Instances/InstanceSaveMgr.h @@ -19,12 +19,12 @@ #ifndef _INSTANCESAVEMGR_H #define _INSTANCESAVEMGR_H -#include "Define.h" -#include -#include #include #include +#include #include + +#include "Define.h" #include "DatabaseEnv.h" #include "DBCEnums.h" #include "ObjectDefines.h" @@ -80,13 +80,18 @@ class InstanceSave /* online players bound to the instance (perm/solo) does not include the members of the group unless they have permanent saves */ - void AddPlayer(Player* player) { TRINITY_GUARD(ACE_Thread_Mutex, _lock); m_playerList.push_back(player); } + void AddPlayer(Player* player) + { + std::lock_guard lock(_playerListLock); + m_playerList.push_back(player); + } + bool RemovePlayer(Player* player) { - _lock.acquire(); + _playerListLock.lock(); m_playerList.remove(player); bool isStillValid = UnloadIfEmpty(); - _lock.release(); + _playerListLock.unlock(); //delete here if needed, after releasing the lock if (m_toDelete) @@ -137,14 +142,13 @@ class InstanceSave bool m_canReset; bool m_toDelete; - ACE_Thread_Mutex _lock; + std::mutex _playerListLock; }; typedef std::unordered_map ResetTimeByMapDifficultyMap; class InstanceSaveManager { - friend class ACE_Singleton; friend class InstanceSave; private: @@ -154,6 +158,12 @@ class InstanceSaveManager public: typedef std::unordered_map InstanceSaveHashMap; + static InstanceSaveManager* instance() + { + static InstanceSaveManager *instance = new InstanceSaveManager(); + return instance; + } + /* resetTime is a global propery of each (raid/heroic) map all instances of that map reset at the same time */ struct InstResetEvent @@ -221,5 +231,5 @@ class InstanceSaveManager ResetTimeQueue m_resetTimeQueue; }; -#define sInstanceSaveMgr ACE_Singleton::instance() +#define sInstanceSaveMgr InstanceSaveManager::instance() #endif diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index ba271235330..96c784cc9d9 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -382,7 +382,7 @@ void Map::DeleteFromWorld(Player* player) void Map::EnsureGridCreated(const GridCoord &p) { - TRINITY_GUARD(ACE_Thread_Mutex, GridLock); + std::lock_guard lock(_gridLock); EnsureGridCreated_i(p); } @@ -2901,7 +2901,7 @@ bool InstanceMap::AddPlayerToMap(Player* player) // Is it needed? { - TRINITY_GUARD(ACE_Thread_Mutex, Lock); + std::lock_guard lock(_mapLock); // Check moved to void WorldSession::HandleMoveWorldportAckOpcode() //if (!CanEnter(player)) //return false; @@ -3242,7 +3242,7 @@ bool BattlegroundMap::CanEnter(Player* player) bool BattlegroundMap::AddPlayerToMap(Player* player) { { - TRINITY_GUARD(ACE_Thread_Mutex, Lock); + std::lock_guard lock(_mapLock); //Check moved to void WorldSession::HandleMoveWorldportAckOpcode() //if (!CanEnter(player)) //return false; diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index a2d88905f50..27c290264b2 100644 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -574,8 +574,8 @@ class Map : public GridRefManager protected: void SetUnloadReferenceLock(const GridCoord &p, bool on) { getNGrid(p.x_coord, p.y_coord)->setUnloadReferenceLock(on); } - ACE_Thread_Mutex Lock; - ACE_Thread_Mutex GridLock; + std::mutex _mapLock; + std::mutex _gridLock; MapEntry const* i_mapEntry; uint8 i_spawnMode; diff --git a/src/server/game/Maps/MapInstanced.cpp b/src/server/game/Maps/MapInstanced.cpp index e914a5c3eee..498c669ba01 100644 --- a/src/server/game/Maps/MapInstanced.cpp +++ b/src/server/game/Maps/MapInstanced.cpp @@ -187,7 +187,7 @@ Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player) InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save, Difficulty difficulty) { // load/create a map - TRINITY_GUARD(ACE_Thread_Mutex, Lock); + std::lock_guard lock(_mapLock); // make sure we have a valid map id const MapEntry* entry = sMapStore.LookupEntry(GetId()); @@ -223,7 +223,7 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save, BattlegroundMap* MapInstanced::CreateBattleground(uint32 InstanceId, Battleground* bg) { // load/create a map - TRINITY_GUARD(ACE_Thread_Mutex, Lock); + std::lock_guard lock(_mapLock); TC_LOG_DEBUG("maps", "MapInstanced::CreateBattleground: map bg %d for %d created.", InstanceId, GetId()); diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index d8c8889da67..2b8dbde8280 100644 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -68,7 +68,7 @@ Map* MapManager::CreateBaseMap(uint32 id) if (map == NULL) { - TRINITY_GUARD(ACE_Thread_Mutex, Lock); + std::lock_guard lock(_mapsLock); MapEntry const* entry = sMapStore.LookupEntry(id); ASSERT(entry); @@ -302,7 +302,7 @@ void MapManager::UnloadAll() uint32 MapManager::GetNumInstances() { - TRINITY_GUARD(ACE_Thread_Mutex, Lock); + std::lock_guard lock(_mapsLock); uint32 ret = 0; for (MapMapType::iterator itr = i_maps.begin(); itr != i_maps.end(); ++itr) @@ -319,7 +319,7 @@ uint32 MapManager::GetNumInstances() uint32 MapManager::GetNumPlayersInInstances() { - TRINITY_GUARD(ACE_Thread_Mutex, Lock); + std::lock_guard lock(_mapsLock); uint32 ret = 0; for (MapMapType::iterator itr = i_maps.begin(); itr != i_maps.end(); ++itr) diff --git a/src/server/game/Maps/MapManager.h b/src/server/game/Maps/MapManager.h index b7fb0617a46..91becb88dfe 100644 --- a/src/server/game/Maps/MapManager.h +++ b/src/server/game/Maps/MapManager.h @@ -141,7 +141,7 @@ class MapManager MapManager(const MapManager &); MapManager& operator=(const MapManager &); - ACE_Thread_Mutex Lock; + std::mutex _mapsLock; uint32 i_gridCleanUpDelay; MapMapType i_maps; IntervalTimer i_timer; diff --git a/src/server/game/Maps/MapUpdater.cpp b/src/server/game/Maps/MapUpdater.cpp index f3a5a66bf66..c2d8123c2d2 100644 --- a/src/server/game/Maps/MapUpdater.cpp +++ b/src/server/game/Maps/MapUpdater.cpp @@ -1,10 +1,30 @@ +/* +* Copyright (C) 2008-2014 TrinityCore +* Copyright (C) 2005-2009 MaNGOS +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program. If not, see . +*/ + +#include +#include +#include + #include "MapUpdater.h" #include "DelayExecutor.h" #include "Map.h" #include "DatabaseEnv.h" -#include -#include class WDBThreadStartReq1 : public ACE_Method_Request { @@ -57,8 +77,7 @@ class MapUpdateRequest : public ACE_Method_Request } }; -MapUpdater::MapUpdater(): -m_executor(), m_mutex(), m_condition(m_mutex), pending_requests(0) { } +MapUpdater::MapUpdater(): m_executor(), pending_requests(0) { } MapUpdater::~MapUpdater() { @@ -79,17 +98,19 @@ int MapUpdater::deactivate() int MapUpdater::wait() { - TRINITY_GUARD(ACE_Thread_Mutex, m_mutex); + std::unique_lock lock(_lock); while (pending_requests > 0) - m_condition.wait(); + _condition.wait(lock); + + lock.unlock(); return 0; } int MapUpdater::schedule_update(Map& map, ACE_UINT32 diff) { - TRINITY_GUARD(ACE_Thread_Mutex, m_mutex); + std::lock_guard lock(_lock); ++pending_requests; @@ -111,7 +132,7 @@ bool MapUpdater::activated() void MapUpdater::update_finished() { - TRINITY_GUARD(ACE_Thread_Mutex, m_mutex); + std::lock_guard lock(_lock); if (pending_requests == 0) { @@ -121,5 +142,5 @@ void MapUpdater::update_finished() --pending_requests; - m_condition.broadcast(); + _condition.notify_all(); } diff --git a/src/server/game/Maps/MapUpdater.h b/src/server/game/Maps/MapUpdater.h index 89798026339..8461b53e992 100644 --- a/src/server/game/Maps/MapUpdater.h +++ b/src/server/game/Maps/MapUpdater.h @@ -1,8 +1,26 @@ +/* +* Copyright (C) 2008-2014 TrinityCore +* Copyright (C) 2005-2009 MaNGOS +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program. If not, see . +*/ + #ifndef _MAP_UPDATER_H_INCLUDED #define _MAP_UPDATER_H_INCLUDED -#include -#include +#include +#include #include "DelayExecutor.h" @@ -30,8 +48,8 @@ class MapUpdater private: DelayExecutor m_executor; - ACE_Thread_Mutex m_mutex; - ACE_Condition_Thread_Mutex m_condition; + std::mutex _lock; + std::condition_variable _condition; size_t pending_requests; void update_finished(); diff --git a/src/server/game/Server/WorldSocketMgr.cpp b/src/server/game/Server/WorldSocketMgr.cpp index 7880552ffa1..3c1db3551d0 100644 --- a/src/server/game/Server/WorldSocketMgr.cpp +++ b/src/server/game/Server/WorldSocketMgr.cpp @@ -29,13 +29,13 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include "Log.h" @@ -109,7 +109,7 @@ class ReactorRunnable : protected ACE_Task_Base int AddSocket (WorldSocket* sock) { - TRINITY_GUARD(ACE_Thread_Mutex, m_NewSockets_Lock); + std::lock_guard lock(newSocketsLock); ++m_Connections; sock->AddReference(); @@ -130,7 +130,7 @@ class ReactorRunnable : protected ACE_Task_Base void AddNewSockets() { - TRINITY_GUARD(ACE_Thread_Mutex, m_NewSockets_Lock); + std::lock_guard lock(newSocketsLock); if (m_NewSockets.empty()) return; @@ -208,7 +208,7 @@ class ReactorRunnable : protected ACE_Task_Base SocketSet m_Sockets; SocketSet m_NewSockets; - ACE_Thread_Mutex m_NewSockets_Lock; + std::mutex newSocketsLock; }; WorldSocketMgr::WorldSocketMgr() : diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp index a2c0861c113..90fd0bdd71c 100644 --- a/src/server/scripts/Commands/cs_gm.cpp +++ b/src/server/scripts/Commands/cs_gm.cpp @@ -123,7 +123,7 @@ public: bool first = true; bool footer = false; - TRINITY_READ_GUARD(HashMapHolder::LockType, *HashMapHolder::GetLock()); + boost::shared_lock lock(*HashMapHolder::GetLock()); HashMapHolder::MapType const& m = sObjectAccessor->GetPlayers(); for (HashMapHolder::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) { diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp index d61c36c887f..279f9c2ef4c 100644 --- a/src/server/scripts/Commands/cs_reset.cpp +++ b/src/server/scripts/Commands/cs_reset.cpp @@ -297,7 +297,7 @@ public: stmt->setUInt16(0, uint16(atLogin)); CharacterDatabase.Execute(stmt); - TRINITY_READ_GUARD(HashMapHolder::LockType, *HashMapHolder::GetLock()); + boost::shared_lock lock(*HashMapHolder::GetLock()); HashMapHolder::MapType const& plist = sObjectAccessor->GetPlayers(); for (HashMapHolder::MapType::const_iterator itr = plist.begin(); itr != plist.end(); ++itr) itr->second->SetAtLoginFlag(atLogin); diff --git a/src/server/shared/Common.h b/src/server/shared/Common.h index 14cc6533a68..a7bc3acd1e5 100644 --- a/src/server/shared/Common.h +++ b/src/server/shared/Common.h @@ -84,9 +84,6 @@ #include "Threading/LockedQueue.h" #include "Threading/Threading.h" -#include -#include -#include #include #if PLATFORM == PLATFORM_WINDOWS @@ -188,20 +185,4 @@ typedef std::vector StringVector; #define MAX_QUERY_LEN 32*1024 -#define TRINITY_GUARD(MUTEX, LOCK) \ - ACE_Guard< MUTEX > TRINITY_GUARD_OBJECT (LOCK); \ - if (TRINITY_GUARD_OBJECT.locked() == 0) ASSERT(false); - -//! For proper implementation of multiple-read, single-write pattern, use -//! ACE_RW_Mutex as underlying @MUTEX -# define TRINITY_WRITE_GUARD(MUTEX, LOCK) \ - ACE_Write_Guard< MUTEX > TRINITY_GUARD_OBJECT (LOCK); \ - if (TRINITY_GUARD_OBJECT.locked() == 0) ASSERT(false); - -//! For proper implementation of multiple-read, single-write pattern, use -//! ACE_RW_Mutex as underlying @MUTEX -# define TRINITY_READ_GUARD(MUTEX, LOCK) \ - ACE_Read_Guard< MUTEX > TRINITY_GUARD_OBJECT (LOCK); \ - if (TRINITY_GUARD_OBJECT.locked() == 0) ASSERT(false); - #endif diff --git a/src/server/shared/Threading/LockedQueue.h b/src/server/shared/Threading/LockedQueue.h index 3ca2a5cd45c..93225496df3 100644 --- a/src/server/shared/Threading/LockedQueue.h +++ b/src/server/shared/Threading/LockedQueue.h @@ -22,8 +22,6 @@ #include #include - - template > class LockedQueue { -- cgit v1.2.3 From fdd5e11a15a4e635bb1298c3d4c4b3c9e718e6b0 Mon Sep 17 00:00:00 2001 From: leak Date: Sun, 8 Jun 2014 16:05:23 +0200 Subject: Fix for LockedQueue.h (clean rebuilds ftw.) --- src/server/shared/Threading/LockedQueue.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/shared/Threading/LockedQueue.h b/src/server/shared/Threading/LockedQueue.h index 93225496df3..bbd60cb7760 100644 --- a/src/server/shared/Threading/LockedQueue.h +++ b/src/server/shared/Threading/LockedQueue.h @@ -103,17 +103,15 @@ public: //! Cancels the queue. void cancel() { - lock(); + std::lock_guard lock(_lock); _canceled = true; - - unlock(); } //! Checks if the queue is cancelled. bool cancelled() { - ACE_Guard g(this->_lock); + std::lock_guard lock(_lock); return _canceled; } -- cgit v1.2.3 From 0dd10269d15b11b3beb0cb1b8537e15126699d32 Mon Sep 17 00:00:00 2001 From: leak Date: Sun, 8 Jun 2014 20:08:43 +0200 Subject: Replaced dependencies on ace/OS_NS_time.h --- src/server/shared/Common.h | 2 - src/server/shared/Logging/Appender.cpp | 4 +- src/server/shared/Logging/Log.cpp | 7 +- src/server/shared/Utilities/Timer.h | 248 +++++++++++++++++---------------- src/server/shared/Utilities/Util.cpp | 15 +- src/server/shared/Utilities/Util.h | 2 + 6 files changed, 146 insertions(+), 132 deletions(-) (limited to 'src') diff --git a/src/server/shared/Common.h b/src/server/shared/Common.h index a7bc3acd1e5..54c7bfc5be8 100644 --- a/src/server/shared/Common.h +++ b/src/server/shared/Common.h @@ -84,8 +84,6 @@ #include "Threading/LockedQueue.h" #include "Threading/Threading.h" -#include - #if PLATFORM == PLATFORM_WINDOWS # include // XP winver - needed to compile with standard leak check in MemoryLeaks.h diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp index 718c3a406f1..a4fc93e119c 100644 --- a/src/server/shared/Logging/Appender.cpp +++ b/src/server/shared/Logging/Appender.cpp @@ -17,11 +17,11 @@ #include "Appender.h" #include "Common.h" +#include "Util.h" std::string LogMessage::getTimeStr(time_t time) { - tm aTm; - ACE_OS::localtime_r(&time, &aTm); + tm aTm = localtime_r(time); char buf[20]; snprintf(buf, 20, "%04d-%02d-%02d_%02d:%02d:%02d", aTm.tm_year+1900, aTm.tm_mon+1, aTm.tm_mday, aTm.tm_hour, aTm.tm_min, aTm.tm_sec); return std::string(buf); diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index bc002668b3b..bb8cb1719c8 100644 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -283,9 +283,10 @@ void Log::write(LogMessage* msg) std::string Log::GetTimestampStr() { - time_t t = time(NULL); - tm aTm; - ACE_OS::localtime_r(&t, &aTm); + time_t tt = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); + + std::tm aTm = localtime_r(tt); + // YYYY year // MM month (2 digits 01-12) // DD day (2 digits 01-31) diff --git a/src/server/shared/Utilities/Timer.h b/src/server/shared/Utilities/Timer.h index c809a59c20f..7c62de5f5ed 100644 --- a/src/server/shared/Utilities/Timer.h +++ b/src/server/shared/Utilities/Timer.h @@ -19,13 +19,15 @@ #ifndef TRINITY_TIMER_H #define TRINITY_TIMER_H -#include "ace/OS_NS_sys_time.h" -#include "Common.h" +#include + +using namespace std::chrono; inline uint32 getMSTime() { - static const ACE_Time_Value ApplicationStartTime = ACE_OS::gettimeofday(); - return (ACE_OS::gettimeofday() - ApplicationStartTime).msec(); + static const system_clock::time_point ApplicationStartTime = system_clock::now(); + + return duration_cast(system_clock::now() - ApplicationStartTime).count(); } inline uint32 getMSTimeDiff(uint32 oldMSTime, uint32 newMSTime) @@ -44,158 +46,158 @@ inline uint32 GetMSTimeDiffToNow(uint32 oldMSTime) struct IntervalTimer { - public: - - IntervalTimer() - : _interval(0), _current(0) - { - } - - void Update(time_t diff) - { - _current += diff; - if (_current < 0) - _current = 0; - } - - bool Passed() - { - return _current >= _interval; - } - - void Reset() - { - if (_current >= _interval) - _current %= _interval; - } - - void SetCurrent(time_t current) - { - _current = current; - } - - void SetInterval(time_t interval) - { - _interval = interval; - } - - time_t GetInterval() const - { - return _interval; - } - - time_t GetCurrent() const - { - return _current; - } - - private: - - time_t _interval; - time_t _current; +public: + + IntervalTimer() + : _interval(0), _current(0) + { + } + + void Update(time_t diff) + { + _current += diff; + if (_current < 0) + _current = 0; + } + + bool Passed() + { + return _current >= _interval; + } + + void Reset() + { + if (_current >= _interval) + _current %= _interval; + } + + void SetCurrent(time_t current) + { + _current = current; + } + + void SetInterval(time_t interval) + { + _interval = interval; + } + + time_t GetInterval() const + { + return _interval; + } + + time_t GetCurrent() const + { + return _current; + } + +private: + + time_t _interval; + time_t _current; }; struct TimeTracker { - public: +public: - TimeTracker(time_t expiry) - : i_expiryTime(expiry) - { - } + TimeTracker(time_t expiry) + : i_expiryTime(expiry) + { + } - void Update(time_t diff) - { - i_expiryTime -= diff; - } + void Update(time_t diff) + { + i_expiryTime -= diff; + } - bool Passed() const - { - return i_expiryTime <= 0; - } + bool Passed() const + { + return i_expiryTime <= 0; + } - void Reset(time_t interval) - { - i_expiryTime = interval; - } + void Reset(time_t interval) + { + i_expiryTime = interval; + } - time_t GetExpiry() const - { - return i_expiryTime; - } + time_t GetExpiry() const + { + return i_expiryTime; + } - private: +private: - time_t i_expiryTime; + time_t i_expiryTime; }; struct TimeTrackerSmall { - public: +public: - TimeTrackerSmall(uint32 expiry = 0) - : i_expiryTime(expiry) - { - } + TimeTrackerSmall(uint32 expiry = 0) + : i_expiryTime(expiry) + { + } - void Update(int32 diff) - { - i_expiryTime -= diff; - } + void Update(int32 diff) + { + i_expiryTime -= diff; + } - bool Passed() const - { - return i_expiryTime <= 0; - } + bool Passed() const + { + return i_expiryTime <= 0; + } - void Reset(uint32 interval) - { - i_expiryTime = interval; - } + void Reset(uint32 interval) + { + i_expiryTime = interval; + } - int32 GetExpiry() const - { - return i_expiryTime; - } + int32 GetExpiry() const + { + return i_expiryTime; + } - private: +private: - int32 i_expiryTime; + int32 i_expiryTime; }; struct PeriodicTimer { - public: +public: - PeriodicTimer(int32 period, int32 start_time) - : i_period(period), i_expireTime(start_time) - { - } + PeriodicTimer(int32 period, int32 start_time) + : i_period(period), i_expireTime(start_time) + { + } - bool Update(const uint32 diff) - { - if ((i_expireTime -= diff) > 0) - return false; + bool Update(const uint32 diff) + { + if ((i_expireTime -= diff) > 0) + return false; - i_expireTime += i_period > int32(diff) ? i_period : diff; - return true; - } + i_expireTime += i_period > int32(diff) ? i_period : diff; + return true; + } - void SetPeriodic(int32 period, int32 start_time) - { - i_expireTime = start_time; - i_period = period; - } + void SetPeriodic(int32 period, int32 start_time) + { + i_expireTime = start_time; + i_period = period; + } - // Tracker interface - void TUpdate(int32 diff) { i_expireTime -= diff; } - bool TPassed() const { return i_expireTime <= 0; } - void TReset(int32 diff, int32 period) { i_expireTime += period > diff ? period : diff; } + // Tracker interface + void TUpdate(int32 diff) { i_expireTime -= diff; } + bool TPassed() const { return i_expireTime <= 0; } + void TReset(int32 diff, int32 period) { i_expireTime += period > diff ? period : diff; } - private: +private: - int32 i_period; - int32 i_expireTime; + int32 i_period; + int32 i_expireTime; }; #endif diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp index ffef61557fc..fc01442adb3 100644 --- a/src/server/shared/Utilities/Util.cpp +++ b/src/server/shared/Utilities/Util.cpp @@ -127,6 +127,18 @@ void stripLineInvisibleChars(std::string &str) } +std::tm localtime_r(const time_t& time) +{ + std::tm tm_snapshot; +#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) + localtime_s(&tm_snapshot, &time); +#else + localtime_r(&time, &tm_snapshot); // POSIX +#endif + return tm_snapshot; +} + + std::string secsToTimeString(uint64 timeInSecs, bool shortText, bool hoursOnly) { uint64 secs = timeInSecs % MINUTE; @@ -215,8 +227,7 @@ uint32 TimeStringToSecs(const std::string& timestring) std::string TimeToTimestampStr(time_t t) { - tm aTm; - ACE_OS::localtime_r(&t, &aTm); + tm aTm = localtime_r(t); // YYYY year // MM month (2 digits 01-12) // DD day (2 digits 01-31) diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h index b086a28134c..fb40b921bc2 100644 --- a/src/server/shared/Utilities/Util.h +++ b/src/server/shared/Utilities/Util.h @@ -70,6 +70,8 @@ void stripLineInvisibleChars(std::string &src); int32 MoneyStringToMoney(const std::string& moneyString); +std::tm localtime_r(const time_t& time); + std::string secsToTimeString(uint64 timeInSecs, bool shortText = false, bool hoursOnly = false); uint32 TimeStringToSecs(const std::string& timestring); std::string TimeToTimestampStr(time_t t); -- cgit v1.2.3 From daa5c0ad0de795f289e8328680f658de01e732dd Mon Sep 17 00:00:00 2001 From: leak Date: Sun, 8 Jun 2014 23:25:40 +0200 Subject: Use correct define for endianess --- src/server/shared/Define.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/shared/Define.h b/src/server/shared/Define.h index 0678d84decd..2258456e1a1 100644 --- a/src/server/shared/Define.h +++ b/src/server/shared/Define.h @@ -33,7 +33,7 @@ #define TRINITY_BIGENDIAN 1 #if !defined(TRINITY_ENDIAN) -# if defined (BOOST_ENDIAN_BIG_BYTE) +# if defined (BOOST_BIG_ENDIAN) # define TRINITY_ENDIAN TRINITY_BIGENDIAN # else # define TRINITY_ENDIAN TRINITY_LITTLEENDIAN -- cgit v1.2.3 From 55dee85ed80d43cc0d312d588652f85d9a027297 Mon Sep 17 00:00:00 2001 From: leak Date: Sun, 8 Jun 2014 23:28:01 +0200 Subject: Remove ace/config-all.h and ancient WinXP defines which are actually commented out... --- src/server/shared/Common.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src') diff --git a/src/server/shared/Common.h b/src/server/shared/Common.h index 54c7bfc5be8..f6152fafc8e 100644 --- a/src/server/shared/Common.h +++ b/src/server/shared/Common.h @@ -85,12 +85,7 @@ #include "Threading/Threading.h" #if PLATFORM == PLATFORM_WINDOWS -# include -// XP winver - needed to compile with standard leak check in MemoryLeaks.h -// uncomment later if needed -//#define _WIN32_WINNT 0x0501 # include -//#undef WIN32_WINNT #else # include # include -- cgit v1.2.3 From 33dc72a812ad5fb6e17a26b14d6d7f9aaf5d34b5 Mon Sep 17 00:00:00 2001 From: leak Date: Sat, 21 Jun 2014 19:39:16 +0200 Subject: Replaced Threading and SFMT access related code with std::thread and boost TSS Note: The remote access thread is currently broken due to unknown ACE fail (will be replaced at some point anyways..) --- dep/SFMT/SFMT.h | 87 ++++---- src/server/shared/Common.h | 3 - src/server/shared/Database/MySQLThreading.h | 27 +-- src/server/shared/Threading/Threading.cpp | 235 --------------------- src/server/shared/Threading/Threading.h | 108 ---------- src/server/shared/Utilities/Util.cpp | 37 ++-- src/server/shared/Utilities/Util.h | 3 - src/server/worldserver/CommandLine/CliRunnable.cpp | 2 +- src/server/worldserver/CommandLine/CliRunnable.h | 7 +- src/server/worldserver/Master.cpp | 104 ++++----- src/server/worldserver/RemoteAccess/RARunnable.cpp | 28 ++- src/server/worldserver/RemoteAccess/RARunnable.h | 16 +- src/server/worldserver/TCSoap/TCSoap.cpp | 10 +- src/server/worldserver/TCSoap/TCSoap.h | 22 +- .../worldserver/WorldThread/WorldRunnable.cpp | 7 +- src/server/worldserver/WorldThread/WorldRunnable.h | 7 +- 16 files changed, 138 insertions(+), 565 deletions(-) delete mode 100644 src/server/shared/Threading/Threading.cpp delete mode 100644 src/server/shared/Threading/Threading.h (limited to 'src') diff --git a/dep/SFMT/SFMT.h b/dep/SFMT/SFMT.h index 4004ae1db6e..3d15d651e5b 100644 --- a/dep/SFMT/SFMT.h +++ b/dep/SFMT/SFMT.h @@ -150,9 +150,13 @@ __m128i const &c, __m128i const &d, __m128i const &mask) { return z2; } +namespace boost { + template class thread_specific_ptr; +} + // Class for SFMT generator class SFMTRand { // Encapsulate random number generator - friend class ACE_TSS; + friend class boost::thread_specific_ptr; public: SFMTRand() @@ -243,6 +247,47 @@ public: y = ((uint32_t*)state)[ix++]; return y; } + + void* operator new(size_t size, std::nothrow_t const&) + { + return _mm_malloc(size, 16); + } + + void operator delete(void* ptr, std::nothrow_t const&) + { + _mm_free(ptr); + } + + void* operator new(size_t size) + { + return _mm_malloc(size, 16); + } + + void operator delete(void* ptr) + { + _mm_free(ptr); + } + + void* operator new[](size_t size, std::nothrow_t const&) + { + return _mm_malloc(size, 16); + } + + void operator delete[](void* ptr, std::nothrow_t const&) + { + _mm_free(ptr); + } + + void* operator new[](size_t size) + { + return _mm_malloc(size, 16); + } + + void operator delete[](void* ptr) + { + _mm_free(ptr); + } + private: void Init2() // Various initializations and period certification { @@ -307,46 +352,6 @@ private: ix = 0; } - void* operator new(size_t size, std::nothrow_t const&) - { - return _mm_malloc(size, 16); - } - - void operator delete(void* ptr, std::nothrow_t const&) - { - _mm_free(ptr); - } - - void* operator new(size_t size) - { - return _mm_malloc(size, 16); - } - - void operator delete(void* ptr) - { - _mm_free(ptr); - } - - void* operator new[](size_t size, std::nothrow_t const&) - { - return _mm_malloc(size, 16); - } - - void operator delete[](void* ptr, std::nothrow_t const&) - { - _mm_free(ptr); - } - - void* operator new[](size_t size) - { - return _mm_malloc(size, 16); - } - - void operator delete[](void* ptr) - { - _mm_free(ptr); - } - __m128i mask; // AND mask __m128i state[SFMT_N]; // State vector for SFMT generator uint32_t ix; // Index into state array diff --git a/src/server/shared/Common.h b/src/server/shared/Common.h index f6152fafc8e..8cab769ec8a 100644 --- a/src/server/shared/Common.h +++ b/src/server/shared/Common.h @@ -82,7 +82,6 @@ #include "Debugging/Errors.h" #include "Threading/LockedQueue.h" -#include "Threading/Threading.h" #if PLATFORM == PLATFORM_WINDOWS # include @@ -114,8 +113,6 @@ inline float finiteAlways(float f) { return finite(f) ? f : 0.0f; } -#define atol(a) strtoul( a, NULL, 10) - #define STRINGIZE(a) #a enum TimeConstants diff --git a/src/server/shared/Database/MySQLThreading.h b/src/server/shared/Database/MySQLThreading.h index 0f6af8ace20..da234138879 100644 --- a/src/server/shared/Database/MySQLThreading.h +++ b/src/server/shared/Database/MySQLThreading.h @@ -23,31 +23,6 @@ class MySQL { public: - /*! Create a thread on the MySQL server to mirrior the calling thread, - initializes thread-specific variables and allows thread-specific - operations without concurrence from other threads. - This should only be called if multiple core threads are running - on the same MySQL connection. Seperate MySQL connections implicitly - create a mirror thread. - */ - static void Thread_Init() - { - mysql_thread_init(); - TC_LOG_WARN("sql.sql", "Core thread with ID [" UI64FMTD "] initializing MySQL thread.", - (uint64)ACE_Based::Thread::currentId()); - } - - /*! Shuts down MySQL thread and frees resources, should only be called - when we terminate. MySQL threads and connections are not configurable - during runtime. - */ - static void Thread_End() - { - mysql_thread_end(); - TC_LOG_WARN("sql.sql", "Core thread with ID [" UI64FMTD "] shutting down MySQL thread.", - (uint64)ACE_Based::Thread::currentId()); - } - static void Library_Init() { mysql_library_init(-1, NULL, NULL); @@ -59,4 +34,4 @@ class MySQL } }; -#endif \ No newline at end of file +#endif diff --git a/src/server/shared/Threading/Threading.cpp b/src/server/shared/Threading/Threading.cpp deleted file mode 100644 index f67a985943a..00000000000 --- a/src/server/shared/Threading/Threading.cpp +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright (C) 2008-2014 TrinityCore - * Copyright (C) 2005-2008 MaNGOS - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "Threading.h" -#include "Errors.h" -#include -#include -#include - -using namespace ACE_Based; - -ThreadPriority::ThreadPriority() -{ - for (int i = Idle; i < MAXPRIORITYNUM; ++i) - m_priority[i] = ACE_THR_PRI_OTHER_DEF; - - m_priority[Idle] = ACE_Sched_Params::priority_min(ACE_SCHED_OTHER); - m_priority[Realtime] = ACE_Sched_Params::priority_max(ACE_SCHED_OTHER); - - std::vector _tmp; - - ACE_Sched_Params::Policy _policy = ACE_SCHED_OTHER; - ACE_Sched_Priority_Iterator pr_iter(_policy); - - while (pr_iter.more()) - { - _tmp.push_back(pr_iter.priority()); - pr_iter.next(); - } - - ASSERT (!_tmp.empty()); - - if (_tmp.size() >= MAXPRIORITYNUM) - { - const size_t max_pos = _tmp.size(); - size_t min_pos = 1; - size_t norm_pos = 0; - for (size_t i = 0; i < max_pos; ++i) - { - if (_tmp[i] == ACE_THR_PRI_OTHER_DEF) - { - norm_pos = i + 1; - break; - } - } - - // since we have only 7(seven) values in enum Priority - // and 3 we know already (Idle, Normal, Realtime) so - // we need to split each list [Idle...Normal] and [Normal...Realtime] - // into pieces - const size_t _divider = 4; - size_t _div = (norm_pos - min_pos) / _divider; - if (_div == 0) - _div = 1; - - min_pos = (norm_pos - 1); - - m_priority[Low] = _tmp[min_pos -= _div]; - m_priority[Lowest] = _tmp[min_pos -= _div ]; - - _div = (max_pos - norm_pos) / _divider; - if (_div == 0) - _div = 1; - - min_pos = norm_pos - 1; - - m_priority[High] = _tmp[min_pos += _div]; - m_priority[Highest] = _tmp[min_pos += _div]; - } -} - -int ThreadPriority::getPriority(Priority p) const -{ - if (p < Idle) - p = Idle; - - if (p > Realtime) - p = Realtime; - - return m_priority[p]; -} - -#define THREADFLAG (THR_NEW_LWP | THR_SCHED_DEFAULT| THR_JOINABLE) - -Thread::Thread(): m_iThreadId(0), m_hThreadHandle(0), m_task(0) -{ - -} - -Thread::Thread(Runnable* instance): m_iThreadId(0), m_hThreadHandle(0), m_task(instance) -{ - // register reference to m_task to prevent it deeltion until destructor - if (m_task) - m_task->incReference(); - - bool _start = start(); - ASSERT (_start); -} - -Thread::~Thread() -{ - //Wait(); - - // deleted runnable object (if no other references) - if (m_task) - m_task->decReference(); -} - -//initialize Thread's class static member -Thread::ThreadStorage Thread::m_ThreadStorage; -ThreadPriority Thread::m_TpEnum; - -bool Thread::start() -{ - if (m_task == 0 || m_iThreadId != 0) - return false; - - // incRef before spawing the thread, otherwise Thread::ThreadTask() might call decRef and delete m_task - m_task->incReference(); - - bool res = (ACE_Thread::spawn(&Thread::ThreadTask, (void*)m_task, THREADFLAG, &m_iThreadId, &m_hThreadHandle) == 0); - - if (!res) - m_task->decReference(); - - return res; -} - -bool Thread::wait() -{ - if (!m_hThreadHandle || !m_task) - return false; - - ACE_THR_FUNC_RETURN _value = ACE_THR_FUNC_RETURN(-1); - int _res = ACE_Thread::join(m_hThreadHandle, &_value); - - m_iThreadId = 0; - m_hThreadHandle = 0; - - return (_res == 0); -} - -void Thread::destroy() -{ - if (!m_iThreadId || !m_task) - return; - - if (ACE_Thread::kill(m_iThreadId, -1) != 0) - return; - - m_iThreadId = 0; - m_hThreadHandle = 0; - - // reference set at ACE_Thread::spawn - m_task->decReference(); -} - -void Thread::suspend() -{ - ACE_Thread::suspend(m_hThreadHandle); -} - -void Thread::resume() -{ - ACE_Thread::resume(m_hThreadHandle); -} - -ACE_THR_FUNC_RETURN Thread::ThreadTask(void * param) -{ - Runnable* _task = (Runnable*)param; - _task->run(); - - // task execution complete, free referecne added at - _task->decReference(); - - return (ACE_THR_FUNC_RETURN)0; -} - -ACE_thread_t Thread::currentId() -{ - return ACE_Thread::self(); -} - -ACE_hthread_t Thread::currentHandle() -{ - ACE_hthread_t _handle; - ACE_Thread::self(_handle); - - return _handle; -} - -Thread * Thread::current() -{ - Thread * _thread = m_ThreadStorage.ts_object(); - if (!_thread) - { - _thread = new Thread(); - _thread->m_iThreadId = Thread::currentId(); - _thread->m_hThreadHandle = Thread::currentHandle(); - - Thread * _oldValue = m_ThreadStorage.ts_object(_thread); - if (_oldValue) - delete _oldValue; - } - - return _thread; -} - -void Thread::setPriority(Priority type) -{ - int _priority = m_TpEnum.getPriority(type); - int _ok = ACE_Thread::setprio(m_hThreadHandle, _priority); - //remove this ASSERT in case you don't want to know is thread priority change was successful or not - ASSERT (_ok == 0); -} - -void Thread::Sleep(unsigned long msecs) -{ - ACE_OS::sleep(ACE_Time_Value(0, 1000 * msecs)); -} diff --git a/src/server/shared/Threading/Threading.h b/src/server/shared/Threading/Threading.h deleted file mode 100644 index 9d416109e9f..00000000000 --- a/src/server/shared/Threading/Threading.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2008-2014 TrinityCore - * Copyright (C) 2005-2008 MaNGOS - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef THREADING_H -#define THREADING_H - -#include -#include -#include -#include - -namespace ACE_Based -{ - - class Runnable - { - public: - virtual ~Runnable() { } - virtual void run() = 0; - - void incReference() { ++m_refs; } - void decReference() - { - if (!--m_refs) - delete this; - } - private: - ACE_Atomic_Op m_refs; - }; - - enum Priority - { - Idle, - Lowest, - Low, - Normal, - High, - Highest, - Realtime - }; - -#define MAXPRIORITYNUM (Realtime + 1) - - class ThreadPriority - { - public: - ThreadPriority(); - int getPriority(Priority p) const; - - private: - int m_priority[MAXPRIORITYNUM]; - }; - - class Thread - { - public: - Thread(); - explicit Thread(Runnable* instance); - ~Thread(); - - bool start(); - bool wait(); - void destroy(); - - void suspend(); - void resume(); - - void setPriority(Priority type); - - static void Sleep(unsigned long msecs); - static ACE_thread_t currentId(); - static ACE_hthread_t currentHandle(); - static Thread * current(); - - private: - Thread(const Thread&); - Thread& operator=(const Thread&); - - static ACE_THR_FUNC_RETURN ThreadTask(void * param); - - ACE_thread_t m_iThreadId; - ACE_hthread_t m_hThreadHandle; - Runnable* m_task; - - typedef ACE_TSS ThreadStorage; - //global object - container for Thread class representation of every thread - static ThreadStorage m_ThreadStorage; - //use this object to determine current OS thread priority values mapped to enum Priority{ } - static ThreadPriority m_TpEnum; - }; - -} -#endif diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp index fc01442adb3..c766cc3ca91 100644 --- a/src/server/shared/Utilities/Util.cpp +++ b/src/server/shared/Utilities/Util.cpp @@ -21,42 +21,54 @@ #include "utf8.h" #include "SFMT.h" #include "Errors.h" // for ASSERT -#include +#include -typedef ACE_TSS SFMTRandTSS; -static SFMTRandTSS sfmtRand; +static boost::thread_specific_ptr sfmtRand; + +static SFMTRand* GetRng() +{ + SFMTRand* rand = sfmtRand.get(); + + if (!rand) + { + rand = new SFMTRand(); + sfmtRand.reset(rand); + } + + return rand; +} int32 irand(int32 min, int32 max) { ASSERT(max >= min); - return int32(sfmtRand->IRandom(min, max)); + return int32(GetRng()->IRandom(min, max)); } uint32 urand(uint32 min, uint32 max) { ASSERT(max >= min); - return sfmtRand->URandom(min, max); + return GetRng()->URandom(min, max); } float frand(float min, float max) { ASSERT(max >= min); - return float(sfmtRand->Random() * (max - min) + min); + return float(GetRng()->Random() * (max - min) + min); } int32 rand32() { - return int32(sfmtRand->BRandom()); + return int32(GetRng()->BRandom()); } double rand_norm(void) { - return sfmtRand->Random(); + return GetRng()->Random(); } double rand_chance(void) { - return sfmtRand->Random() * 100.0; + return GetRng()->Random() * 100.0; } Tokenizer::Tokenizer(const std::string &src, const char sep, uint32 vectorReserve) @@ -250,13 +262,6 @@ bool IsIPAddress(char const* ipaddress) return inet_addr(ipaddress) != INADDR_NONE; } -std::string GetAddressString(ACE_INET_Addr const& addr) -{ - char buf[ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 16]; - addr.addr_to_string(buf, ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 16); - return buf; -} - bool IsIPAddrInNetwork(ACE_INET_Addr const& net, ACE_INET_Addr const& addr, ACE_INET_Addr const& subnetMask) { uint32 mask = subnetMask.get_ip_address(); diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h index fb40b921bc2..af28afd66ff 100644 --- a/src/server/shared/Utilities/Util.h +++ b/src/server/shared/Utilities/Util.h @@ -351,9 +351,6 @@ bool IsIPAddress(char const* ipaddress); /// Checks if address belongs to the a network with specified submask bool IsIPAddrInNetwork(ACE_INET_Addr const& net, ACE_INET_Addr const& addr, ACE_INET_Addr const& subnetMask); -/// Transforms ACE_INET_Addr address into string format "dotted_ip:port" -std::string GetAddressString(ACE_INET_Addr const& addr); - uint32 CreatePIDFile(const std::string& filename); std::string ByteArrayToHexStr(uint8 const* bytes, uint32 length, bool reverse = false); diff --git a/src/server/worldserver/CommandLine/CliRunnable.cpp b/src/server/worldserver/CommandLine/CliRunnable.cpp index ac46b218305..295e63c696b 100644 --- a/src/server/worldserver/CommandLine/CliRunnable.cpp +++ b/src/server/worldserver/CommandLine/CliRunnable.cpp @@ -131,7 +131,7 @@ int kb_hit_return() #endif /// %Thread start -void CliRunnable::run() +void CliThread() { ///- Display the list of available CLI functions then beep //TC_LOG_INFO("server.worldserver", ""); diff --git a/src/server/worldserver/CommandLine/CliRunnable.h b/src/server/worldserver/CommandLine/CliRunnable.h index 5510173973e..7ed3a44995f 100644 --- a/src/server/worldserver/CommandLine/CliRunnable.h +++ b/src/server/worldserver/CommandLine/CliRunnable.h @@ -23,12 +23,7 @@ #ifndef __CLIRUNNABLE_H #define __CLIRUNNABLE_H -/// Command Line Interface handling thread -class CliRunnable : public ACE_Based::Runnable -{ - public: - void run() override; -}; +void CliThread(); #endif diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index a5230b908ef..82c547cad40 100644 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -20,6 +20,8 @@ \ingroup Trinityd */ +#include + #include #include "Common.h" @@ -78,51 +80,35 @@ class WorldServerSignalHandler : public Trinity::SignalHandler } }; -class FreezeDetectorRunnable : public ACE_Based::Runnable +void FreezeDetectorThread(uint32 delayTime) { -private: - uint32 _loops; - uint32 _lastChange; - uint32 _delaytime; -public: - FreezeDetectorRunnable() - { - _loops = 0; - _lastChange = 0; - _delaytime = 0; - } + if (!delayTime) + return; - void SetDelayTime(uint32 t) { _delaytime = t; } + TC_LOG_INFO("server.worldserver", "Starting up anti-freeze thread (%u seconds max stuck time)...", delayTime / 1000); + uint32 loops = 0; + uint32 lastChange = 0; - void run() override + while (!World::IsStopped()) { - if (!_delaytime) - return; - - TC_LOG_INFO("server.worldserver", "Starting up anti-freeze thread (%u seconds max stuck time)...", _delaytime/1000); - _loops = 0; - _lastChange = 0; - while (!World::IsStopped()) + std::this_thread::sleep_for(std::chrono::milliseconds(1000)); + uint32 curtime = getMSTime(); + // normal work + uint32 worldLoopCounter = World::m_worldLoopCounter.value(); + if (loops != worldLoopCounter) { - ACE_Based::Thread::Sleep(1000); - uint32 curtime = getMSTime(); - // normal work - uint32 worldLoopCounter = World::m_worldLoopCounter.value(); - if (_loops != worldLoopCounter) - { - _lastChange = curtime; - _loops = worldLoopCounter; - } - // possible freeze - else if (getMSTimeDiff(_lastChange, curtime) > _delaytime) - { - TC_LOG_ERROR("server.worldserver", "World Thread hangs, kicking out server!"); - ASSERT(false); - } + lastChange = curtime; + loops = worldLoopCounter; + } + // possible freeze + else if (getMSTimeDiff(lastChange, curtime) > delayTime) + { + TC_LOG_ERROR("server.worldserver", "World Thread hangs, kicking out server!"); + ASSERT(false); } - TC_LOG_INFO("server.worldserver", "Anti-freeze thread exiting without problems."); } -}; + TC_LOG_INFO("server.worldserver", "Anti-freeze thread exiting without problems."); +} /// Main function int Master::Run() @@ -182,10 +168,10 @@ int Master::Run() #endif ///- Launch WorldRunnable thread - ACE_Based::Thread worldThread(new WorldRunnable); - worldThread.setPriority(ACE_Based::Highest); - ACE_Based::Thread* cliThread = NULL; + std::thread worldThread(WorldThread); + + std::thread* cliThread = NULL; #ifdef _WIN32 if (sConfigMgr->GetBoolDefault("Console.Enable", true) && (m_ServiceStatus == -1)/* need disable console in service mode*/) @@ -194,10 +180,10 @@ int Master::Run() #endif { ///- Launch CliRunnable thread - cliThread = new ACE_Based::Thread(new CliRunnable); + cliThread = new std::thread(CliThread); } - ACE_Based::Thread rarThread(new RARunnable); + std::thread rarThread(RemoteAccessThread); #if defined(_WIN32) || defined(__linux__) @@ -268,22 +254,19 @@ int Master::Run() #endif //Start soap serving thread - ACE_Based::Thread* soapThread = NULL; + std::thread* soapThread = nullptr; if (sConfigMgr->GetBoolDefault("SOAP.Enabled", false)) { - TCSoapRunnable* runnable = new TCSoapRunnable(); - runnable->SetListenArguments(sConfigMgr->GetStringDefault("SOAP.IP", "127.0.0.1"), uint16(sConfigMgr->GetIntDefault("SOAP.Port", 7878))); - soapThread = new ACE_Based::Thread(runnable); + soapThread = new std::thread(TCSoapThread, sConfigMgr->GetStringDefault("SOAP.IP", "127.0.0.1"), uint16(sConfigMgr->GetIntDefault("SOAP.Port", 7878))); } + std::thread* freezeDetectorThread = nullptr; + ///- Start up freeze catcher thread if (uint32 freezeDelay = sConfigMgr->GetIntDefault("MaxCoreStuckTime", 0)) { - FreezeDetectorRunnable* fdr = new FreezeDetectorRunnable(); - fdr->SetDelayTime(freezeDelay * 1000); - ACE_Based::Thread freezeThread(fdr); - freezeThread.setPriority(ACE_Based::Highest); + freezeDetectorThread = new std::thread(FreezeDetectorThread, freezeDelay); } ///- Launch the world listener socket @@ -304,13 +287,12 @@ int Master::Run() // when the main thread closes the singletons get unloaded // since worldrunnable uses them, it will crash if unloaded after master - worldThread.wait(); - rarThread.wait(); + worldThread.join(); + //rarThread.join(); - if (soapThread) + if (soapThread != nullptr) { - soapThread->wait(); - soapThread->destroy(); + soapThread->join(); delete soapThread; } @@ -324,7 +306,7 @@ int Master::Run() TC_LOG_INFO("server.worldserver", "Halting process..."); - if (cliThread) + if (cliThread != nullptr) { #ifdef _WIN32 @@ -363,17 +345,15 @@ int Master::Run() DWORD numb; WriteConsoleInput(hStdIn, b, 4, &numb); - cliThread->wait(); - - #else - - cliThread->destroy(); + cliThread->join(); #endif delete cliThread; } + delete freezeDetectorThread; + // for some unknown reason, unloading scripts here and not in worldrunnable // fixes a memory leak related to detaching threads from the module //UnloadScriptingModule(); diff --git a/src/server/worldserver/RemoteAccess/RARunnable.cpp b/src/server/worldserver/RemoteAccess/RARunnable.cpp index 44b07163294..4efeb07ef25 100644 --- a/src/server/worldserver/RemoteAccess/RARunnable.cpp +++ b/src/server/worldserver/RemoteAccess/RARunnable.cpp @@ -33,29 +33,22 @@ #include "RASocket.h" -RARunnable::RARunnable() + +void RemoteAccessThread() { - ACE_Reactor_Impl* imp; + ACE_Reactor_Impl* imp = nullptr; #if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) imp = new ACE_Dev_Poll_Reactor(); - imp->max_notify_iterations (128); - imp->restart (1); + imp->max_notify_iterations(128); + imp->restart(1); #else imp = new ACE_TP_Reactor(); - imp->max_notify_iterations (128); + imp->max_notify_iterations(128); #endif - m_Reactor = new ACE_Reactor (imp, 1); -} + ACE_Reactor* reactor = new ACE_Reactor(imp, 1); -RARunnable::~RARunnable() -{ - delete m_Reactor; -} - -void RARunnable::run() -{ if (!sConfigMgr->GetBoolDefault("Ra.Enable", false)) return; @@ -65,7 +58,7 @@ void RARunnable::run() std::string stringIp = sConfigMgr->GetStringDefault("Ra.IP", "0.0.0.0"); ACE_INET_Addr listenAddress(raPort, stringIp.c_str()); - if (acceptor.open(listenAddress, m_Reactor) == -1) + if (acceptor.open(listenAddress, reactor) == -1) { TC_LOG_ERROR("server.worldserver", "Trinity RA can not bind to port %d on %s", raPort, stringIp.c_str()); return; @@ -76,9 +69,12 @@ void RARunnable::run() while (!World::IsStopped()) { ACE_Time_Value interval(0, 100000); - if (m_Reactor->run_reactor_event_loop(interval) == -1) + if (reactor->run_reactor_event_loop(interval) == -1) break; } + delete imp; + delete reactor; + TC_LOG_DEBUG("server.worldserver", "Trinity RA thread exiting"); } diff --git a/src/server/worldserver/RemoteAccess/RARunnable.h b/src/server/worldserver/RemoteAccess/RARunnable.h index 540ac762f30..a65df077f97 100644 --- a/src/server/worldserver/RemoteAccess/RARunnable.h +++ b/src/server/worldserver/RemoteAccess/RARunnable.h @@ -22,21 +22,7 @@ #ifndef _TRINITY_RARUNNABLE_H_ #define _TRINITY_RARUNNABLE_H_ -#include "Common.h" - -#include - -class RARunnable : public ACE_Based::Runnable -{ -public: - RARunnable(); - virtual ~RARunnable(); - void run() override; - -private: - ACE_Reactor* m_Reactor; - -}; +void RemoteAccessThread(); #endif /* _TRINITY_RARUNNABLE_H_ */ diff --git a/src/server/worldserver/TCSoap/TCSoap.cpp b/src/server/worldserver/TCSoap/TCSoap.cpp index 1549019352d..3d242859ff2 100644 --- a/src/server/worldserver/TCSoap/TCSoap.cpp +++ b/src/server/worldserver/TCSoap/TCSoap.cpp @@ -22,7 +22,7 @@ #include "AccountMgr.h" #include "Log.h" -void TCSoapRunnable::run() +void TCSoapThread(const std::string& host, uint16 port) { struct soap soap; soap_init(&soap); @@ -33,13 +33,13 @@ void TCSoapRunnable::run() soap.accept_timeout = 3; soap.recv_timeout = 5; soap.send_timeout = 5; - if (!soap_valid_socket(soap_bind(&soap, _host.c_str(), _port, 100))) + if (!soap_valid_socket(soap_bind(&soap, host.c_str(), port, 100))) { - TC_LOG_ERROR("network.soap", "Couldn't bind to %s:%d", _host.c_str(), _port); + TC_LOG_ERROR("network.soap", "Couldn't bind to %s:%d", host.c_str(), port); exit(-1); } - TC_LOG_INFO("network.soap", "Bound to http://%s:%d", _host.c_str(), _port); + TC_LOG_INFO("network.soap", "Bound to http://%s:%d", host.c_str(), port); while (!World::IsStopped()) { @@ -57,7 +57,7 @@ void TCSoapRunnable::run() soap_done(&soap); } -void TCSoapRunnable::process_message(ACE_Message_Block* mb) +void process_message(ACE_Message_Block* mb) { ACE_TRACE (ACE_TEXT ("SOAPWorkingThread::process_message")); diff --git a/src/server/worldserver/TCSoap/TCSoap.h b/src/server/worldserver/TCSoap/TCSoap.h index 427d37ef0cc..937ceac6425 100644 --- a/src/server/worldserver/TCSoap/TCSoap.h +++ b/src/server/worldserver/TCSoap/TCSoap.h @@ -22,27 +22,9 @@ #include #include -#include -class TCSoapRunnable : public ACE_Based::Runnable -{ - public: - TCSoapRunnable() : _port(0) { } - - void run() override; - - void SetListenArguments(const std::string& host, uint16 port) - { - _host = host; - _port = port; - } - - private: - void process_message(ACE_Message_Block* mb); - - std::string _host; - uint16 _port; -}; +void process_message(ACE_Message_Block* mb); +void TCSoapThread(const std::string& host, uint16 port); class SOAPCommand { diff --git a/src/server/worldserver/WorldThread/WorldRunnable.cpp b/src/server/worldserver/WorldThread/WorldRunnable.cpp index 476007f6ea0..7722492b5a8 100644 --- a/src/server/worldserver/WorldThread/WorldRunnable.cpp +++ b/src/server/worldserver/WorldThread/WorldRunnable.cpp @@ -20,6 +20,8 @@ \ingroup Trinityd */ +#include + #include "Common.h" #include "ObjectAccessor.h" #include "World.h" @@ -40,7 +42,7 @@ extern int m_ServiceStatus; #endif /// Heartbeat for the World -void WorldRunnable::run() +void WorldThread() { uint32 realCurrTime = 0; uint32 realPrevTime = getMSTime(); @@ -67,7 +69,8 @@ void WorldRunnable::run() if (diff <= WORLD_SLEEP_CONST+prevSleepTime) { prevSleepTime = WORLD_SLEEP_CONST+prevSleepTime-diff; - ACE_Based::Thread::Sleep(prevSleepTime); + + std::this_thread::sleep_for(std::chrono::milliseconds(prevSleepTime)); } else prevSleepTime = 0; diff --git a/src/server/worldserver/WorldThread/WorldRunnable.h b/src/server/worldserver/WorldThread/WorldRunnable.h index dfc74dd1e3a..915bd5b580a 100644 --- a/src/server/worldserver/WorldThread/WorldRunnable.h +++ b/src/server/worldserver/WorldThread/WorldRunnable.h @@ -23,12 +23,7 @@ #ifndef __WORLDRUNNABLE_H #define __WORLDRUNNABLE_H -/// Heartbeat thread for the World -class WorldRunnable : public ACE_Based::Runnable -{ - public: - void run() override; -}; +void WorldThread(); #endif -- cgit v1.2.3 From 0df19b9087b1336dd60a98256b016def9b058b1e Mon Sep 17 00:00:00 2001 From: leak Date: Sat, 21 Jun 2014 20:19:55 +0200 Subject: Replaced ACE_Auto_Array_Ptr --- src/server/shared/Cryptography/BigNumber.cpp | 8 +++----- src/server/shared/Cryptography/BigNumber.h | 5 +++-- src/server/worldserver/Master.cpp | 3 ++- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/server/shared/Cryptography/BigNumber.cpp b/src/server/shared/Cryptography/BigNumber.cpp index 1f3fc96e28d..ed355b5f63c 100644 --- a/src/server/shared/Cryptography/BigNumber.cpp +++ b/src/server/shared/Cryptography/BigNumber.cpp @@ -16,13 +16,11 @@ * with this program. If not, see . */ -#include - #include "Cryptography/BigNumber.h" #include #include #include -#include +#include BigNumber::BigNumber() : _bn(BN_new()) @@ -170,7 +168,7 @@ bool BigNumber::isZero() const return BN_is_zero(_bn); } -ACE_Auto_Array_Ptr BigNumber::AsByteArray(int32 minSize, bool littleEndian) +std::unique_ptr BigNumber::AsByteArray(int32 minSize, bool littleEndian) { int length = (minSize >= GetNumBytes()) ? minSize : GetNumBytes(); @@ -186,7 +184,7 @@ ACE_Auto_Array_Ptr BigNumber::AsByteArray(int32 minSize, bool littleEndia if (littleEndian) std::reverse(array, array + length); - ACE_Auto_Array_Ptr ret(array); + std::unique_ptr ret(array); return ret; } diff --git a/src/server/shared/Cryptography/BigNumber.h b/src/server/shared/Cryptography/BigNumber.h index dc553babec9..d0a09dca6c4 100644 --- a/src/server/shared/Cryptography/BigNumber.h +++ b/src/server/shared/Cryptography/BigNumber.h @@ -19,8 +19,9 @@ #ifndef _AUTH_BIGNUMBER_H #define _AUTH_BIGNUMBER_H +#include #include "Define.h" -#include + struct bignum_st; @@ -87,7 +88,7 @@ class BigNumber uint32 AsDword(); - ACE_Auto_Array_Ptr AsByteArray(int32 minSize = 0, bool littleEndian = true); + std::unique_ptr AsByteArray(int32 minSize = 0, bool littleEndian = true); char * AsHexStr() const; char * AsDecStr() const; diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index 82c547cad40..32ca89f3c45 100644 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -183,7 +183,8 @@ int Master::Run() cliThread = new std::thread(CliThread); } - std::thread rarThread(RemoteAccessThread); + // TODO C++11/Boost + // std::thread rarThread(RemoteAccessThread); #if defined(_WIN32) || defined(__linux__) -- cgit v1.2.3 From ccf3374e494c31f52c9ae3b63480e3cc6fd2510d Mon Sep 17 00:00:00 2001 From: leak Date: Sat, 21 Jun 2014 20:21:33 +0200 Subject: Removed ACE dependies from ByteBuffer --- src/server/shared/Packets/ByteBuffer.cpp | 8 ++------ src/server/shared/Packets/ByteBuffer.h | 5 ++--- 2 files changed, 4 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/server/shared/Packets/ByteBuffer.cpp b/src/server/shared/Packets/ByteBuffer.cpp index b8cb5215665..450c9a4fa6c 100644 --- a/src/server/shared/Packets/ByteBuffer.cpp +++ b/src/server/shared/Packets/ByteBuffer.cpp @@ -20,18 +20,16 @@ #include "Common.h" #include "Log.h" -#include #include ByteBufferPositionException::ByteBufferPositionException(bool add, size_t pos, size_t size, size_t valueSize) { std::ostringstream ss; - ACE_Stack_Trace trace; ss << "Attempted to " << (add ? "put" : "get") << " value with size: " << valueSize << " in ByteBuffer (pos: " << pos << " size: " << size - << ")\n\n" << trace.c_str(); + << ")\n\n"; message().assign(ss.str()); } @@ -40,12 +38,10 @@ ByteBufferSourceException::ByteBufferSourceException(size_t pos, size_t size, size_t valueSize) { std::ostringstream ss; - ACE_Stack_Trace trace; ss << "Attempted to put a " << (valueSize > 0 ? "NULL-pointer" : "zero-sized value") - << " in ByteBuffer (pos: " << pos << " size: " << size << ")\n\n" - << trace.c_str(); + << " in ByteBuffer (pos: " << pos << " size: " << size << ")\n\n"; message().assign(ss.str()); } diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index bc46b87fa27..73b8f6b336f 100644 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -22,8 +22,8 @@ #include "Define.h" #include "Errors.h" #include "ByteConverter.h" +#include "Util.h" -#include #include #include #include @@ -460,8 +460,7 @@ class ByteBuffer void AppendPackedTime(time_t time) { - tm lt; - ACE_OS::localtime_r(&time, <); + tm lt = localtime_r(time); append((lt.tm_year - 100) << 24 | lt.tm_mon << 20 | (lt.tm_mday - 1) << 14 | lt.tm_wday << 11 | lt.tm_hour << 6 | lt.tm_min); } -- cgit v1.2.3 From 7dd6f0f1d8dcd14c8b9306553170f0023d30fc66 Mon Sep 17 00:00:00 2001 From: leak Date: Sun, 22 Jun 2014 15:42:46 +0200 Subject: Replaced all ACE_OS::localtime_r calls --- src/server/game/Achievements/AchievementMgr.cpp | 2 +- src/server/game/Globals/ObjectMgr.cpp | 2 +- src/server/game/Weather/Weather.cpp | 2 +- src/server/game/World/World.cpp | 10 +++++----- src/server/scripts/Commands/cs_ban.cpp | 12 ++++++------ src/server/shared/Logging/Appender.cpp | 3 ++- src/server/shared/Logging/Log.cpp | 3 ++- src/server/shared/Packets/ByteBuffer.h | 3 ++- src/server/shared/Utilities/Util.cpp | 12 ++++++------ src/server/shared/Utilities/Util.h | 2 +- 10 files changed, 27 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index 302adda0c8e..6e0de858561 100644 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -425,7 +425,7 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un { time_t birthday_start = time_t(sWorld->getIntConfig(CONFIG_BIRTHDAY_TIME)); tm birthday_tm; - ACE_OS::localtime_r(&birthday_start, &birthday_tm); + localtime_r(&birthday_start, &birthday_tm); // exactly N birthday birthday_tm.tm_year += birthday_login.nth_birthday; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 207f80eabe7..1b2a68b2d4e 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -5347,7 +5347,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) time_t curTime = time(NULL); tm lt; - ACE_OS::localtime_r(&curTime, <); + localtime_r(&curTime, <); uint64 basetime(curTime); TC_LOG_INFO("misc", "Returning mails current time: hour: %d, minute: %d, second: %d ", lt.tm_hour, lt.tm_min, lt.tm_sec); diff --git a/src/server/game/Weather/Weather.cpp b/src/server/game/Weather/Weather.cpp index cb332df9a41..0fc5be97ae6 100644 --- a/src/server/game/Weather/Weather.cpp +++ b/src/server/game/Weather/Weather.cpp @@ -94,7 +94,7 @@ bool Weather::ReGenerate() // season source http://aa.usno.navy.mil/data/docs/EarthSeasons.html time_t gtime = sWorld->GetGameTime(); struct tm ltime; - ACE_OS::localtime_r(>ime, <ime); + localtime_r(>ime, <ime); uint32 season = ((ltime.tm_yday - 78 + 365)/91)%4; static char const* seasonName[WEATHER_SEASONS] = { "spring", "summer", "fall", "winter" }; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index e40e2f7e6d1..6f9a812ab3b 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1745,7 +1745,7 @@ void World::SetInitialWorldSettings() //one second is 1000 -(tested on win system) /// @todo Get rid of magic numbers tm localTm; - ACE_OS::localtime_r(&m_gameTime, &localTm); + localtime_r(&m_gameTime, &localTm); mail_timer = ((((localTm.tm_hour + 20) % 24)* HOUR * IN_MILLISECONDS) / m_timers[WUPDATE_AUCTIONS].GetInterval()); //1440 mail_timer_expires = ((DAY * IN_MILLISECONDS) / (m_timers[WUPDATE_AUCTIONS].GetInterval())); @@ -2775,7 +2775,7 @@ void World::InitDailyQuestResetTime() // FIX ME: client not show day start time time_t curTime = time(NULL); tm localTm; - ACE_OS::localtime_r(&curTime, &localTm); + localtime_r(&curTime, &localTm); localTm.tm_hour = 6; localTm.tm_min = 0; localTm.tm_sec = 0; @@ -2809,7 +2809,7 @@ void World::InitRandomBGResetTime() // generate time by config time_t curTime = time(NULL); tm localTm; - ACE_OS::localtime_r(&curTime, &localTm); + localtime_r(&curTime, &localTm); localTm.tm_hour = getIntConfig(CONFIG_RANDOM_BG_RESET_HOUR); localTm.tm_min = 0; localTm.tm_sec = 0; @@ -2837,7 +2837,7 @@ void World::InitGuildResetTime() // generate time by config time_t curTime = time(NULL); tm localTm; - ACE_OS::localtime_r(&curTime, &localTm); + localtime_r(&curTime, &localTm); localTm.tm_hour = getIntConfig(CONFIG_GUILD_RESET_HOUR); localTm.tm_min = 0; localTm.tm_sec = 0; @@ -2922,7 +2922,7 @@ void World::ResetMonthlyQuests() // generate time time_t curTime = time(NULL); tm localTm; - ACE_OS::localtime_r(&curTime, &localTm); + localtime_r(&curTime, &localTm); int month = localTm.tm_mon; int year = localTm.tm_year; diff --git a/src/server/scripts/Commands/cs_ban.cpp b/src/server/scripts/Commands/cs_ban.cpp index afaf5f651bc..45875623b22 100644 --- a/src/server/scripts/Commands/cs_ban.cpp +++ b/src/server/scripts/Commands/cs_ban.cpp @@ -457,7 +457,7 @@ public: { time_t timeBan = time_t(fields2[0].GetUInt32()); tm tmBan; - ACE_OS::localtime_r(&timeBan, &tmBan); + localtime_r(&timeBan, &tmBan); if (fields2[0].GetUInt32() == fields2[1].GetUInt32()) { @@ -469,7 +469,7 @@ public: { time_t timeUnban = time_t(fields2[1].GetUInt32()); tm tmUnban; - ACE_OS::localtime_r(&timeUnban, &tmUnban); + localtime_r(&timeUnban, &tmUnban); handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|", accountName.c_str(), tmBan.tm_year%100, tmBan.tm_mon+1, tmBan.tm_mday, tmBan.tm_hour, tmBan.tm_min, tmUnban.tm_year%100, tmUnban.tm_mon+1, tmUnban.tm_mday, tmUnban.tm_hour, tmUnban.tm_min, @@ -546,7 +546,7 @@ public: { time_t timeBan = time_t(banFields[0].GetUInt32()); tm tmBan; - ACE_OS::localtime_r(&timeBan, &tmBan); + localtime_r(&timeBan, &tmBan); if (banFields[0].GetUInt32() == banFields[1].GetUInt32()) { @@ -558,7 +558,7 @@ public: { time_t timeUnban = time_t(banFields[1].GetUInt32()); tm tmUnban; - ACE_OS::localtime_r(&timeUnban, &tmUnban); + localtime_r(&timeUnban, &tmUnban); handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|", char_name.c_str(), tmBan.tm_year%100, tmBan.tm_mon+1, tmBan.tm_mday, tmBan.tm_hour, tmBan.tm_min, tmUnban.tm_year%100, tmUnban.tm_mon+1, tmUnban.tm_mday, tmUnban.tm_hour, tmUnban.tm_min, @@ -627,7 +627,7 @@ public: Field* fields = result->Fetch(); time_t timeBan = time_t(fields[1].GetUInt32()); tm tmBan; - ACE_OS::localtime_r(&timeBan, &tmBan); + localtime_r(&timeBan, &tmBan); if (fields[1].GetUInt32() == fields[2].GetUInt32()) { handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|", @@ -638,7 +638,7 @@ public: { time_t timeUnban = time_t(fields[2].GetUInt32()); tm tmUnban; - ACE_OS::localtime_r(&timeUnban, &tmUnban); + localtime_r(&timeUnban, &tmUnban); handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|", fields[0].GetCString(), tmBan.tm_year%100, tmBan.tm_mon+1, tmBan.tm_mday, tmBan.tm_hour, tmBan.tm_min, tmUnban.tm_year%100, tmUnban.tm_mon+1, tmUnban.tm_mday, tmUnban.tm_hour, tmUnban.tm_min, diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp index a4fc93e119c..2b38f9886c3 100644 --- a/src/server/shared/Logging/Appender.cpp +++ b/src/server/shared/Logging/Appender.cpp @@ -21,7 +21,8 @@ std::string LogMessage::getTimeStr(time_t time) { - tm aTm = localtime_r(time); + tm aTm; + localtime_r(&time, &aTm); char buf[20]; snprintf(buf, 20, "%04d-%02d-%02d_%02d:%02d:%02d", aTm.tm_year+1900, aTm.tm_mon+1, aTm.tm_mday, aTm.tm_hour, aTm.tm_min, aTm.tm_sec); return std::string(buf); diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index bb8cb1719c8..5f1c284d80d 100644 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -285,7 +285,8 @@ std::string Log::GetTimestampStr() { time_t tt = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); - std::tm aTm = localtime_r(tt); + std::tm aTm; + localtime_r(&tt, &aTm); // YYYY year // MM month (2 digits 01-12) diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index 73b8f6b336f..c375a3ffa75 100644 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -460,7 +460,8 @@ class ByteBuffer void AppendPackedTime(time_t time) { - tm lt = localtime_r(time); + tm lt; + localtime_r(&time, <); append((lt.tm_year - 100) << 24 | lt.tm_mon << 20 | (lt.tm_mday - 1) << 14 | lt.tm_wday << 11 | lt.tm_hour << 6 | lt.tm_min); } diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp index c766cc3ca91..f80730af05d 100644 --- a/src/server/shared/Utilities/Util.cpp +++ b/src/server/shared/Utilities/Util.cpp @@ -139,15 +139,14 @@ void stripLineInvisibleChars(std::string &str) } -std::tm localtime_r(const time_t& time) +struct tm* localtime_r(const time_t* time, struct tm *result) { - std::tm tm_snapshot; #if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) - localtime_s(&tm_snapshot, &time); + localtime_s(result, time); + return result; #else - localtime_r(&time, &tm_snapshot); // POSIX + return localtime_r(&time, &result); // POSIX #endif - return tm_snapshot; } @@ -239,7 +238,8 @@ uint32 TimeStringToSecs(const std::string& timestring) std::string TimeToTimestampStr(time_t t) { - tm aTm = localtime_r(t); + tm aTm; + localtime_r(&t, &aTm); // YYYY year // MM month (2 digits 01-12) // DD day (2 digits 01-31) diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h index af28afd66ff..21e5ac2ce0f 100644 --- a/src/server/shared/Utilities/Util.h +++ b/src/server/shared/Utilities/Util.h @@ -70,7 +70,7 @@ void stripLineInvisibleChars(std::string &src); int32 MoneyStringToMoney(const std::string& moneyString); -std::tm localtime_r(const time_t& time); +struct tm* localtime_r(const time_t* time, struct tm *result); std::string secsToTimeString(uint64 timeInSecs, bool shortText = false, bool hoursOnly = false); uint32 TimeStringToSecs(const std::string& timestring); -- cgit v1.2.3 From ca3327dbed76d7d13b9e2754990b717267700be9 Mon Sep 17 00:00:00 2001 From: leak Date: Sun, 22 Jun 2014 15:45:54 +0200 Subject: Replaced ACE_Configuration_Heap based config file handling with boost::property_tree::ini_parser --- src/server/shared/Configuration/Config.cpp | 120 ++++++++++------------------- src/server/shared/Configuration/Config.h | 35 +++------ 2 files changed, 52 insertions(+), 103 deletions(-) (limited to 'src') diff --git a/src/server/shared/Configuration/Config.cpp b/src/server/shared/Configuration/Config.cpp index 3f8997e6d55..95336457428 100644 --- a/src/server/shared/Configuration/Config.cpp +++ b/src/server/shared/Configuration/Config.cpp @@ -16,57 +16,41 @@ * with this program. If not, see . */ +#include +#include +#include +#include #include "Config.h" #include "Errors.h" -// Defined here as it must not be exposed to end-users. -bool ConfigMgr::GetValueHelper(const char* name, ACE_TString &result) -{ - GuardType guard(_configLock); - - if (_config.get() == 0) - return false; - - ACE_TString section_name; - ACE_Configuration_Section_Key section_key; - const ACE_Configuration_Section_Key &root_key = _config->root_section(); - - int i = 0; - while (_config->enumerate_sections(root_key, i, section_name) == 0) - { - _config->open_section(root_key, section_name.c_str(), 0, section_key); - if (_config->get_string_value(section_key, name, result) == 0) - return true; - ++i; - } - - return false; -} +using namespace boost::property_tree; bool ConfigMgr::LoadInitial(char const* file) { ASSERT(file); - GuardType guard(_configLock); + std::lock_guard lock(_configLock); _filename = file; - _config.reset(new ACE_Configuration_Heap()); - if (_config->open() == 0) - if (LoadData(_filename.c_str())) - return true; - _config.reset(); - return false; -} + try + { + ptree temp; + boost::property_tree::ini_parser::read_ini(file, temp); -bool ConfigMgr::LoadMore(char const* file) -{ - ASSERT(file); - ASSERT(_config); - GuardType guard(_configLock); + for (auto bla : temp) + { + _config = bla.second; + break; + } + } + catch (std::exception const& /*ex*/) + { + return false; + } - return LoadData(file); + return true; } bool ConfigMgr::Reload() @@ -74,78 +58,58 @@ bool ConfigMgr::Reload() return LoadInitial(_filename.c_str()); } -bool ConfigMgr::LoadData(char const* file) +std::string ConfigMgr::GetStringDefault(const char* name, const std::string &def) { - ACE_Ini_ImpExp config_importer(*_config.get()); - if (config_importer.import_config(file) == 0) - return true; + std::string value = _config.get(ptree::path_type(name,'/'), def); - return false; -} + value.erase(std::remove(value.begin(), value.end(), '"'), value.end()); -std::string ConfigMgr::GetStringDefault(const char* name, const std::string &def) -{ - ACE_TString val; - return GetValueHelper(name, val) ? val.c_str() : def; + return value; } bool ConfigMgr::GetBoolDefault(const char* name, bool def) { - ACE_TString val; - - if (!GetValueHelper(name, val)) + try + { + std::string val = _config.get(name); + val.erase(std::remove(val.begin(), val.end(), '"'), val.end()); + return (val == "true" || val == "TRUE" || val == "yes" || val == "YES" || val == "1"); + } + catch (std::exception const& /*ex*/) + { return def; - - return (val == "true" || val == "TRUE" || val == "yes" || val == "YES" || - val == "1"); + } } int ConfigMgr::GetIntDefault(const char* name, int def) { - ACE_TString val; - return GetValueHelper(name, val) ? atoi(val.c_str()) : def; + return _config.get(name, def); } float ConfigMgr::GetFloatDefault(const char* name, float def) { - ACE_TString val; - return GetValueHelper(name, val) ? (float)atof(val.c_str()) : def; + return _config.get(name, def); } std::string const& ConfigMgr::GetFilename() { - GuardType guard(_configLock); + std::lock_guard lock(_configLock); return _filename; } std::list ConfigMgr::GetKeysByString(std::string const& name) { - GuardType guard(_configLock); + std::lock_guard lock(_configLock); std::list keys; - if (_config.get() == 0) - return keys; - ACE_TString section_name; - ACE_Configuration_Section_Key section_key; - const ACE_Configuration_Section_Key &root_key = _config->root_section(); - - int i = 0; - while (_config->enumerate_sections(root_key, i++, section_name) == 0) + for (const ptree::value_type& child : _config) { - _config->open_section(root_key, section_name.c_str(), 0, section_key); - - ACE_TString key_name; - ACE_Configuration::VALUETYPE type; - int j = 0; - while (_config->enumerate_values(section_key, j++, key_name, type) == 0) + if (child.first.compare(0, name.length(), name) == 0) { - std::string temp = key_name.c_str(); - - if (!temp.find(name)) - keys.push_back(temp); + keys.push_back(child.first); } } - + return keys; } diff --git a/src/server/shared/Configuration/Config.h b/src/server/shared/Configuration/Config.h index 4693b21a0c7..d05a083d166 100644 --- a/src/server/shared/Configuration/Config.h +++ b/src/server/shared/Configuration/Config.h @@ -21,18 +21,11 @@ #include #include -#include -#include -#include -#include - -typedef Trinity::AutoPtr Config; +#include +#include class ConfigMgr { - friend class ACE_Singleton; - friend class ConfigLoader; - ConfigMgr() { } ~ConfigMgr() { } @@ -40,13 +33,11 @@ public: /// Method used only for loading main configuration files (authserver.conf and worldserver.conf) bool LoadInitial(char const* file); - /** - * This method loads additional configuration files - * It is recommended to use this method in WorldScript::OnConfigLoad hooks - * - * @return true if loading was successful - */ - bool LoadMore(char const* file); + static ConfigMgr* instance() + { + static ConfigMgr *instance = new ConfigMgr(); + return instance; + } bool Reload(); @@ -59,20 +50,14 @@ public: std::list GetKeysByString(std::string const& name); private: - bool GetValueHelper(const char* name, ACE_TString &result); - bool LoadData(char const* file); - - typedef ACE_Thread_Mutex LockType; - typedef ACE_Guard GuardType; - std::string _filename; - Config _config; - LockType _configLock; + boost::property_tree::ptree _config; + std::mutex _configLock; ConfigMgr(ConfigMgr const&); ConfigMgr& operator=(ConfigMgr const&); }; -#define sConfigMgr ACE_Singleton::instance() +#define sConfigMgr ConfigMgr::instance() #endif -- cgit v1.2.3 From bfcbde1c97971211d2ecdf5c5f8033eb138658d1 Mon Sep 17 00:00:00 2001 From: leak Date: Sun, 22 Jun 2014 16:29:49 +0200 Subject: Various cleanups and fixes due to feedback --- src/server/shared/Configuration/Config.cpp | 10 +++++----- src/server/shared/Cryptography/BigNumber.cpp | 4 ++-- src/server/shared/Cryptography/BigNumber.h | 2 +- src/server/shared/Utilities/Util.cpp | 7 ++----- src/server/worldserver/Master.cpp | 2 +- 5 files changed, 11 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/server/shared/Configuration/Config.cpp b/src/server/shared/Configuration/Config.cpp index 95336457428..9e0e57eb198 100644 --- a/src/server/shared/Configuration/Config.cpp +++ b/src/server/shared/Configuration/Config.cpp @@ -35,13 +35,13 @@ bool ConfigMgr::LoadInitial(char const* file) try { - ptree temp; - boost::property_tree::ini_parser::read_ini(file, temp); + ptree fullTree; + boost::property_tree::ini_parser::read_ini(file, fullTree); - - for (auto bla : temp) + // Since we're using only one section per config file, we skip the section and have direct property access + for (auto section : fullTree) { - _config = bla.second; + _config = section.second; break; } } diff --git a/src/server/shared/Cryptography/BigNumber.cpp b/src/server/shared/Cryptography/BigNumber.cpp index ed355b5f63c..c5e0635c5ec 100644 --- a/src/server/shared/Cryptography/BigNumber.cpp +++ b/src/server/shared/Cryptography/BigNumber.cpp @@ -168,7 +168,7 @@ bool BigNumber::isZero() const return BN_is_zero(_bn); } -std::unique_ptr BigNumber::AsByteArray(int32 minSize, bool littleEndian) +std::unique_ptr BigNumber::AsByteArray(int32 minSize, bool littleEndian) { int length = (minSize >= GetNumBytes()) ? minSize : GetNumBytes(); @@ -184,7 +184,7 @@ std::unique_ptr BigNumber::AsByteArray(int32 minSize, bool littleEndian) if (littleEndian) std::reverse(array, array + length); - std::unique_ptr ret(array); + std::unique_ptr ret(array); return ret; } diff --git a/src/server/shared/Cryptography/BigNumber.h b/src/server/shared/Cryptography/BigNumber.h index d0a09dca6c4..848b3da3e2d 100644 --- a/src/server/shared/Cryptography/BigNumber.h +++ b/src/server/shared/Cryptography/BigNumber.h @@ -88,7 +88,7 @@ class BigNumber uint32 AsDword(); - std::unique_ptr AsByteArray(int32 minSize = 0, bool littleEndian = true); + std::unique_ptr AsByteArray(int32 minSize = 0, bool littleEndian = true); char * AsHexStr() const; char * AsDecStr() const; diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp index f80730af05d..1290a7dbae4 100644 --- a/src/server/shared/Utilities/Util.cpp +++ b/src/server/shared/Utilities/Util.cpp @@ -139,16 +139,13 @@ void stripLineInvisibleChars(std::string &str) } +#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) struct tm* localtime_r(const time_t* time, struct tm *result) { -#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) localtime_s(result, time); return result; -#else - return localtime_r(&time, &result); // POSIX -#endif } - +#endif std::string secsToTimeString(uint64 timeInSecs, bool shortText, bool hoursOnly) { diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index 32ca89f3c45..765ab0f09a6 100644 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -171,7 +171,7 @@ int Master::Run() std::thread worldThread(WorldThread); - std::thread* cliThread = NULL; + std::thread* cliThread = nullptr; #ifdef _WIN32 if (sConfigMgr->GetBoolDefault("Console.Enable", true) && (m_ServiceStatus == -1)/* need disable console in service mode*/) -- cgit v1.2.3 From 79440b3d9d0c2388f4ee04e81561702847e7e34a Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 22 Jun 2014 13:17:47 -0500 Subject: Shared/Misc: Removed some more ACE dependencies --- src/server/shared/Dynamic/FactoryHolder.h | 6 ++---- src/server/shared/Dynamic/ObjectRegistry.h | 11 +++++++---- src/server/shared/Logging/AppenderFile.cpp | 2 +- src/server/shared/Logging/AppenderFile.h | 4 ++-- 4 files changed, 12 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/server/shared/Dynamic/FactoryHolder.h b/src/server/shared/Dynamic/FactoryHolder.h index aee84ab151e..a009fd37a7e 100644 --- a/src/server/shared/Dynamic/FactoryHolder.h +++ b/src/server/shared/Dynamic/FactoryHolder.h @@ -30,15 +30,13 @@ class FactoryHolder { public: typedef ObjectRegistry, Key > FactoryHolderRegistry; - friend class ACE_Singleton; - typedef ACE_Singleton FactoryHolderRepository; FactoryHolder(Key k) : i_key(k) { } virtual ~FactoryHolder() { } inline Key key() const { return i_key; } - void RegisterSelf(void) { FactoryHolderRepository::instance()->InsertItem(this, i_key); } - void DeregisterSelf(void) { FactoryHolderRepository::instance()->RemoveItem(this, false); } + void RegisterSelf(void) { FactoryHolderRegistry::instance()->InsertItem(this, i_key); } + void DeregisterSelf(void) { FactoryHolderRegistry::instance()->RemoveItem(this, false); } /// Abstract Factory create method virtual T* Create(void *data = NULL) const = 0; diff --git a/src/server/shared/Dynamic/ObjectRegistry.h b/src/server/shared/Dynamic/ObjectRegistry.h index be7ce00ac05..486b75b467e 100644 --- a/src/server/shared/Dynamic/ObjectRegistry.h +++ b/src/server/shared/Dynamic/ObjectRegistry.h @@ -20,12 +20,9 @@ #define TRINITY_OBJECTREGISTRY_H #include "Define.h" -#include #include -#include #include -#include /** ObjectRegistry holds all registry item of the same type */ @@ -33,7 +30,13 @@ template class ObjectRegistry { public: - typedef std::map RegistryMapType; + typedef std::map RegistryMapType; + + static ObjectRegistry* instance() + { + static ObjectRegistry* instance = new ObjectRegistry(); + return instance; + } /// Returns a registry item const T* GetRegistryItem(Key key) const diff --git a/src/server/shared/Logging/AppenderFile.cpp b/src/server/shared/Logging/AppenderFile.cpp index f2532ad8bb8..3e79ac40c6f 100644 --- a/src/server/shared/Logging/AppenderFile.cpp +++ b/src/server/shared/Logging/AppenderFile.cpp @@ -45,7 +45,7 @@ AppenderFile::~AppenderFile() void AppenderFile::_write(LogMessage const& message) { - bool exceedMaxSize = maxFileSize > 0 && (fileSize.value() + message.Size()) > maxFileSize; + bool exceedMaxSize = maxFileSize > 0 && (fileSize.load() + message.Size()) > maxFileSize; if (dynamicName) { diff --git a/src/server/shared/Logging/AppenderFile.h b/src/server/shared/Logging/AppenderFile.h index 1034b41f665..592742c2184 100644 --- a/src/server/shared/Logging/AppenderFile.h +++ b/src/server/shared/Logging/AppenderFile.h @@ -19,7 +19,7 @@ #define APPENDERFILE_H #include "Appender.h" -#include "ace/Atomic_Op.h" +#include class AppenderFile: public Appender { @@ -38,7 +38,7 @@ class AppenderFile: public Appender bool dynamicName; bool backup; uint64 maxFileSize; - ACE_Atomic_Op fileSize; + std::atomic fileSize; }; #endif -- cgit v1.2.3 From 11d545f01d958f19861a9b50003ed7e7f05d794d Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 22 Jun 2014 13:46:21 -0500 Subject: Core/Build: Fixed build. --- src/server/game/AI/CreatureAIFactory.h | 2 -- src/server/game/AI/CreatureAISelector.cpp | 6 +++--- src/server/game/Movement/MovementGenerator.h | 1 - 3 files changed, 3 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/CreatureAIFactory.h b/src/server/game/AI/CreatureAIFactory.h index fc2d009e673..f2854f1a9ce 100644 --- a/src/server/game/AI/CreatureAIFactory.h +++ b/src/server/game/AI/CreatureAIFactory.h @@ -49,7 +49,6 @@ CreatureAIFactory::Create(void* data) const typedef FactoryHolder CreatureAICreator; typedef FactoryHolder::FactoryHolderRegistry CreatureAIRegistry; -typedef FactoryHolder::FactoryHolderRepository CreatureAIRepository; //GO struct SelectableGameObjectAI : public FactoryHolder, public Permissible @@ -77,5 +76,4 @@ GameObjectAIFactory::Create(void* data) const typedef FactoryHolder GameObjectAICreator; typedef FactoryHolder::FactoryHolderRegistry GameObjectAIRegistry; -typedef FactoryHolder::FactoryHolderRepository GameObjectAIRepository; #endif diff --git a/src/server/game/AI/CreatureAISelector.cpp b/src/server/game/AI/CreatureAISelector.cpp index 473af0d787e..afbd306c184 100644 --- a/src/server/game/AI/CreatureAISelector.cpp +++ b/src/server/game/AI/CreatureAISelector.cpp @@ -31,7 +31,7 @@ namespace FactorySelector CreatureAI* selectAI(Creature* creature) { const CreatureAICreator* ai_factory = NULL; - CreatureAIRegistry& ai_registry(*CreatureAIRepository::instance()); + CreatureAIRegistry& ai_registry(*CreatureAIRegistry::instance()); if (creature->IsPet()) ai_factory = ai_registry.GetRegistryItem("PetAI"); @@ -101,7 +101,7 @@ namespace FactorySelector MovementGenerator* selectMovementGenerator(Creature* creature) { - MovementGeneratorRegistry& mv_registry(*MovementGeneratorRepository::instance()); + MovementGeneratorRegistry& mv_registry(*MovementGeneratorRegistry::instance()); ASSERT(creature->GetCreatureTemplate()); const MovementGeneratorCreator* mv_factory = mv_registry.GetRegistryItem(creature->GetDefaultMovementType()); @@ -130,7 +130,7 @@ namespace FactorySelector GameObjectAI* SelectGameObjectAI(GameObject* go) { const GameObjectAICreator* ai_factory = NULL; - GameObjectAIRegistry& ai_registry(*GameObjectAIRepository::instance()); + GameObjectAIRegistry& ai_registry(*GameObjectAIRegistry::instance()); // scriptname in db if (GameObjectAI* scriptedAI = sScriptMgr->GetGameObjectAI(go)) diff --git a/src/server/game/Movement/MovementGenerator.h b/src/server/game/Movement/MovementGenerator.h index f545f9fd314..5c74bef8d8c 100755 --- a/src/server/game/Movement/MovementGenerator.h +++ b/src/server/game/Movement/MovementGenerator.h @@ -92,5 +92,4 @@ struct MovementGeneratorFactory : public SelectableMovement typedef FactoryHolder MovementGeneratorCreator; typedef FactoryHolder::FactoryHolderRegistry MovementGeneratorRegistry; -typedef FactoryHolder::FactoryHolderRepository MovementGeneratorRepository; #endif -- cgit v1.2.3 From f9a08ac1c9cc1774b5f808364d9a011965641a3b Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 22 Jun 2014 14:07:23 -0500 Subject: Core/Dependencies: Remove ACE_Singleton dependency from the Log and DelayExecutor classes. Removed an unused function. --- src/server/shared/Logging/Log.h | 11 +++++++---- src/server/shared/Threading/DelayExecutor.cpp | 3 ++- src/server/shared/Utilities/Util.cpp | 8 -------- src/server/shared/Utilities/Util.h | 4 ---- 4 files changed, 9 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h index 5fa638e2f40..5f404fcfe70 100644 --- a/src/server/shared/Logging/Log.h +++ b/src/server/shared/Logging/Log.h @@ -26,14 +26,11 @@ #include #include -#include #define LOGGER_ROOT "root" class Log { - friend class ACE_Singleton; - typedef std::unordered_map LoggerMap; typedef std::unordered_map CachedLoggerContainer; @@ -42,6 +39,12 @@ class Log ~Log(); public: + static Log* instance() + { + static Log* instance = new Log(); + return instance; + } + void LoadFromConfig(); void Close(); bool ShouldLog(std::string const& type, LogLevel level); @@ -127,7 +130,7 @@ inline void Log::outMessage(std::string const& filter, LogLevel level, const cha va_end(ap); } -#define sLog ACE_Singleton::instance() +#define sLog Log::instance() #if PLATFORM != PLATFORM_WINDOWS #define TC_LOG_MESSAGE_BODY(filterType__, level__, ...) \ diff --git a/src/server/shared/Threading/DelayExecutor.cpp b/src/server/shared/Threading/DelayExecutor.cpp index ba8a19429b2..0db45a8ff8f 100644 --- a/src/server/shared/Threading/DelayExecutor.cpp +++ b/src/server/shared/Threading/DelayExecutor.cpp @@ -6,7 +6,8 @@ DelayExecutor* DelayExecutor::instance() { - return ACE_Singleton::instance(); + static DelayExecutor* instance = new DelayExecutor(); + return instance; } DelayExecutor::DelayExecutor() diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp index 1290a7dbae4..4489367a7ea 100644 --- a/src/server/shared/Utilities/Util.cpp +++ b/src/server/shared/Utilities/Util.cpp @@ -259,14 +259,6 @@ bool IsIPAddress(char const* ipaddress) return inet_addr(ipaddress) != INADDR_NONE; } -bool IsIPAddrInNetwork(ACE_INET_Addr const& net, ACE_INET_Addr const& addr, ACE_INET_Addr const& subnetMask) -{ - uint32 mask = subnetMask.get_ip_address(); - if ((net.get_ip_address() & mask) == (addr.get_ip_address() & mask)) - return true; - return false; -} - /// create PID file uint32 CreatePIDFile(const std::string& filename) { diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h index 21e5ac2ce0f..34d76bbc71b 100644 --- a/src/server/shared/Utilities/Util.h +++ b/src/server/shared/Utilities/Util.h @@ -26,7 +26,6 @@ #include #include #include -#include // Searcher for map of structs template struct Finder @@ -348,9 +347,6 @@ void vutf8printf(FILE* out, const char *str, va_list* ap); bool IsIPAddress(char const* ipaddress); -/// Checks if address belongs to the a network with specified submask -bool IsIPAddrInNetwork(ACE_INET_Addr const& net, ACE_INET_Addr const& addr, ACE_INET_Addr const& subnetMask); - uint32 CreatePIDFile(const std::string& filename); std::string ByteArrayToHexStr(uint8 const* bytes, uint32 length, bool reverse = false); -- cgit v1.2.3 From 28b61812cf0d87b84aefaa0889844b6288f93b93 Mon Sep 17 00:00:00 2001 From: leak Date: Mon, 23 Jun 2014 21:02:13 +0200 Subject: Fix non-PCH build --- src/server/shared/Dynamic/ObjectRegistry.h | 1 + src/server/shared/Logging/AppenderConsole.cpp | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/shared/Dynamic/ObjectRegistry.h b/src/server/shared/Dynamic/ObjectRegistry.h index 486b75b467e..e9e57415073 100644 --- a/src/server/shared/Dynamic/ObjectRegistry.h +++ b/src/server/shared/Dynamic/ObjectRegistry.h @@ -23,6 +23,7 @@ #include #include +#include /** ObjectRegistry holds all registry item of the same type */ diff --git a/src/server/shared/Logging/AppenderConsole.cpp b/src/server/shared/Logging/AppenderConsole.cpp index 14d434e35b8..8102d3b6021 100644 --- a/src/server/shared/Logging/AppenderConsole.cpp +++ b/src/server/shared/Logging/AppenderConsole.cpp @@ -15,11 +15,15 @@ * with this program. If not, see . */ +#include +#if PLATFORM == PLATFORM_WINDOWS + #include +#endif + #include "AppenderConsole.h" #include "Config.h" #include "Util.h" -#include AppenderConsole::AppenderConsole(uint8 id, std::string const& name, LogLevel level, AppenderFlags flags): Appender(id, name, APPENDER_CONSOLE, level, flags), _colored(false) -- cgit v1.2.3 From a20ac4c25bc25ddf8de1d9c5b810d332f5287d33 Mon Sep 17 00:00:00 2001 From: leak Date: Tue, 24 Jun 2014 17:41:43 +0200 Subject: Compile fix for recently added coding accessing socket information --- src/server/authserver/Server/AuthSession.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/authserver/Server/AuthSession.cpp b/src/server/authserver/Server/AuthSession.cpp index 5b56a99d640..ba31573cb4e 100644 --- a/src/server/authserver/Server/AuthSession.cpp +++ b/src/server/authserver/Server/AuthSession.cpp @@ -599,7 +599,7 @@ bool AuthSession::_HandleLogonProof() { PreparedStatement* logstmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_FALP_IP_LOGGING); logstmt->setString(0, _login); - logstmt->setString(1, socket().getRemoteAddress()); + logstmt->setString(1, GetRemoteIpAddress()); logstmt->setString(2, "Logged on failed AccountLogin due wrong password"); LoginDatabase.Execute(logstmt); -- cgit v1.2.3 From 0a592dd9dbd34818deee472dd42d700b4746a27e Mon Sep 17 00:00:00 2001 From: leak Date: Tue, 24 Jun 2014 19:13:29 +0200 Subject: Removed ACE dependencies from LogWorker --- src/server/shared/Logging/Log.cpp | 2 +- src/server/shared/Logging/Log.h | 2 +- src/server/shared/Logging/LogWorker.cpp | 17 +++++------------ src/server/shared/Logging/LogWorker.h | 20 +++++--------------- 4 files changed, 12 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index fd7aa84c0e9..68745046433 100644 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -273,7 +273,7 @@ void Log::write(LogMessage* msg) const msg->text.append("\n"); if (worker) - worker->enqueue(new LogOperation(logger, msg)); + worker->enqueue(*(new LogOperation(logger, msg))); else { logger->write(*msg); diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h index c3a47d14e9e..29ebdb3faa1 100644 --- a/src/server/shared/Logging/Log.h +++ b/src/server/shared/Logging/Log.h @@ -23,7 +23,7 @@ #include "Appender.h" #include "Logger.h" #include "LogWorker.h" - +#include #include #include diff --git a/src/server/shared/Logging/LogWorker.cpp b/src/server/shared/Logging/LogWorker.cpp index b0c82b614f4..cea4262032b 100644 --- a/src/server/shared/Logging/LogWorker.cpp +++ b/src/server/shared/Logging/LogWorker.cpp @@ -17,29 +17,22 @@ #include "LogWorker.h" -LogWorker::LogWorker() - : m_queue(HIGH_WATERMARK, LOW_WATERMARK) -{ - ACE_Task_Base::activate(THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED, 1); -} - LogWorker::~LogWorker() { - m_queue.deactivate(); - wait(); + m_queue.cancel(); } -int LogWorker::enqueue(LogOperation* op) +void LogWorker::enqueue(LogOperation& op) { - return m_queue.enqueue(op); + return m_queue.add(op); } int LogWorker::svc() { while (1) { - LogOperation* request; - if (m_queue.dequeue(request) == -1) + LogOperation* request = nullptr; + if (!m_queue.next(*request)) break; request->call(); diff --git a/src/server/shared/Logging/LogWorker.h b/src/server/shared/Logging/LogWorker.h index 25a57842e08..84d8ba632a8 100644 --- a/src/server/shared/Logging/LogWorker.h +++ b/src/server/shared/Logging/LogWorker.h @@ -19,29 +19,19 @@ #define LOGWORKER_H #include "LogOperation.h" +#include "LockedQueue.h" -#include -#include - -class LogWorker: protected ACE_Task_Base +class LogWorker { public: - LogWorker(); + LogWorker() {}; ~LogWorker(); - typedef ACE_Message_Queue_Ex LogMessageQueueType; - - enum - { - HIGH_WATERMARK = 8 * 1024 * 1024, - LOW_WATERMARK = 8 * 1024 * 1024 - }; - - int enqueue(LogOperation *op); + void enqueue(LogOperation& op); private: virtual int svc(); - LogMessageQueueType m_queue; + LockedQueue m_queue; }; #endif -- cgit v1.2.3 From f03d49705dc7a0c00350119b319dcf9feb566529 Mon Sep 17 00:00:00 2001 From: Subv Date: Tue, 24 Jun 2014 13:17:23 -0500 Subject: Core/Databases: Removed ACE dependencies on some of the database handling code. --- src/server/game/Server/WorldSession.cpp | 22 +++++--------- src/server/game/World/World.cpp | 20 ++++++------- src/server/game/World/World.h | 2 +- src/server/shared/Database/AdhocStatement.cpp | 8 ++--- src/server/shared/Database/AdhocStatement.h | 12 ++++---- src/server/shared/Database/DatabaseWorkerPool.h | 12 ++++---- src/server/shared/Database/MySQLConnection.cpp | 2 ++ src/server/shared/Database/PreparedStatement.cpp | 8 ++--- src/server/shared/Database/PreparedStatement.h | 9 +++--- src/server/shared/Database/QueryHolder.cpp | 5 +--- src/server/shared/Database/QueryHolder.h | 11 +++---- src/server/shared/Threading/Callback.h | 37 ++++++++++++------------ 12 files changed, 72 insertions(+), 76 deletions(-) (limited to 'src') diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 9f8b3785e92..0c391993c0b 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -1105,27 +1105,23 @@ void WorldSession::ProcessQueryCallbacks() PreparedQueryResult result; //! HandleCharEnumOpcode - if (_charEnumCallback.ready()) + if (_charEnumCallback.wait_for(std::chrono::seconds(0)) == std::future_status::ready) { - _charEnumCallback.get(result); + result = _charEnumCallback.get(); HandleCharEnum(result); - _charEnumCallback.cancel(); } if (_charCreateCallback.IsReady()) { _charCreateCallback.GetResult(result); HandleCharCreateCallback(result, _charCreateCallback.GetParam()); - // Don't call FreeResult() here, the callback handler will do that depending on the events in the callback chain } //! HandlePlayerLoginOpcode - if (_charLoginCallback.ready()) + if (_charLoginCallback.wait_for(std::chrono::seconds(0)) == std::future_status::ready) { - SQLQueryHolder* param; - _charLoginCallback.get(param); + SQLQueryHolder* param = _charLoginCallback.get(); HandlePlayerLogin((LoginQueryHolder*)param); - _charLoginCallback.cancel(); } //! HandleAddFriendOpcode @@ -1147,11 +1143,10 @@ void WorldSession::ProcessQueryCallbacks() } //- HandleCharAddIgnoreOpcode - if (_addIgnoreCallback.ready()) + if (_addIgnoreCallback.wait_for(std::chrono::seconds(0)) == std::future_status::ready) { - _addIgnoreCallback.get(result); + result = _addIgnoreCallback.get(); HandleAddIgnoreOpcodeCallBack(result); - _addIgnoreCallback.cancel(); } //- SendStabledPet @@ -1164,11 +1159,10 @@ void WorldSession::ProcessQueryCallbacks() } //- HandleStablePet - if (_stablePetCallback.ready()) + if (_stablePetCallback.wait_for(std::chrono::seconds(0)) == std::future_status::ready) { - _stablePetCallback.get(result); + result = _stablePetCallback.get(); HandleStablePetCallback(result); - _stablePetCallback.cancel(); } //- HandleUnstablePet diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index e5b207d9b46..234a366b08e 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -2731,7 +2731,7 @@ void World::UpdateRealmCharCount(uint32 accountId) PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_COUNT); stmt->setUInt32(0, accountId); PreparedQueryResultFuture result = CharacterDatabase.AsyncQuery(stmt); - m_realmCharCallbacks.insert(result); + m_realmCharCallbacks.push_back(std::move(result)); } void World::_UpdateRealmCharCount(PreparedQueryResult resultCharCount) @@ -3088,19 +3088,17 @@ void World::ProcessQueryCallbacks() { PreparedQueryResult result; - while (!m_realmCharCallbacks.is_empty()) + for (std::deque>::iterator itr = m_realmCharCallbacks.begin(); itr != m_realmCharCallbacks.end(); ) { - ACE_Future lResult; - ACE_Time_Value timeout = ACE_Time_Value::zero; - if (m_realmCharCallbacks.next_readable(lResult, &timeout) != 1) - break; - - if (lResult.ready()) + if ((*itr).wait_for(std::chrono::seconds(0)) != std::future_status::ready) { - lResult.get(result); - _UpdateRealmCharCount(result); - lResult.cancel(); + ++itr; + continue; } + + result = (*itr).get(); + _UpdateRealmCharCount(result); + itr = m_realmCharCallbacks.erase(itr); } } diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index f5c0dd1cb8f..9c68ee8add2 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -839,7 +839,7 @@ class World void LoadCharacterNameData(); void ProcessQueryCallbacks(); - ACE_Future_Set m_realmCharCallbacks; + std::deque> m_realmCharCallbacks; }; extern uint32 realmID; diff --git a/src/server/shared/Database/AdhocStatement.cpp b/src/server/shared/Database/AdhocStatement.cpp index 896fefde5b7..65c41823ccb 100644 --- a/src/server/shared/Database/AdhocStatement.cpp +++ b/src/server/shared/Database/AdhocStatement.cpp @@ -25,9 +25,9 @@ m_has_result(false) m_sql = strdup(sql); } -BasicStatementTask::BasicStatementTask(const char* sql, QueryResultFuture result) : +BasicStatementTask::BasicStatementTask(const char* sql, QueryResultPromise& result) : m_has_result(true), -m_result(result) +m_result(std::move(result)) { m_sql = strdup(sql); } @@ -45,11 +45,11 @@ bool BasicStatementTask::Execute() if (!result || !result->GetRowCount() || !result->NextRow()) { delete result; - m_result.set(QueryResult(NULL)); + m_result.set_value(QueryResult(NULL)); return false; } - m_result.set(QueryResult(result)); + m_result.set_value(QueryResult(result)); return true; } diff --git a/src/server/shared/Database/AdhocStatement.h b/src/server/shared/Database/AdhocStatement.h index 44a9fa3d3ee..a67caaa160f 100644 --- a/src/server/shared/Database/AdhocStatement.h +++ b/src/server/shared/Database/AdhocStatement.h @@ -18,24 +18,26 @@ #ifndef _ADHOCSTATEMENT_H #define _ADHOCSTATEMENT_H -#include +#include #include "SQLOperation.h" -typedef ACE_Future QueryResultFuture; +typedef std::future QueryResultFuture; +typedef std::promise QueryResultPromise; + /*! Raw, ad-hoc query. */ class BasicStatementTask : public SQLOperation { public: BasicStatementTask(const char* sql); - BasicStatementTask(const char* sql, QueryResultFuture result); + BasicStatementTask(const char* sql, QueryResultPromise& result); ~BasicStatementTask(); - bool Execute(); + bool Execute() override; private: const char* m_sql; //- Raw query to be executed bool m_has_result; - QueryResultFuture m_result; + QueryResultPromise m_result; }; #endif \ No newline at end of file diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h index 9c56c75bf71..078b97762b5 100644 --- a/src/server/shared/Database/DatabaseWorkerPool.h +++ b/src/server/shared/Database/DatabaseWorkerPool.h @@ -307,10 +307,10 @@ class DatabaseWorkerPool //! The return value is then processed in ProcessQueryCallback methods. QueryResultFuture AsyncQuery(const char* sql) { - QueryResultFuture res; + QueryResultPromise res; BasicStatementTask* task = new BasicStatementTask(sql, res); Enqueue(task); - return res; //! Actual return value has no use yet + return res.get_future(); //! Actual return value has no use yet } //! Enqueues a query in string format -with variable args- that will set the value of the QueryResultFuture return object as soon as the query is executed. @@ -331,10 +331,10 @@ class DatabaseWorkerPool //! Statement must be prepared with CONNECTION_ASYNC flag. PreparedQueryResultFuture AsyncQuery(PreparedStatement* stmt) { - PreparedQueryResultFuture res; + PreparedQueryResultPromise res; PreparedStatementTask* task = new PreparedStatementTask(stmt, res); Enqueue(task); - return res; + return res.get_future(); } //! Enqueues a vector of SQL operations (can be both adhoc and prepared) that will set the value of the QueryResultHolderFuture @@ -343,10 +343,10 @@ class DatabaseWorkerPool //! Any prepared statements added to this holder need to be prepared with the CONNECTION_ASYNC flag. QueryResultHolderFuture DelayQueryHolder(SQLQueryHolder* holder) { - QueryResultHolderFuture res; + QueryResultHolderPromise res; SQLQueryHolderTask* task = new SQLQueryHolderTask(holder, res); Enqueue(task); - return res; //! Fool compiler, has no use yet + return res.get_future(); //! Fool compiler, has no use yet } /** diff --git a/src/server/shared/Database/MySQLConnection.cpp b/src/server/shared/Database/MySQLConnection.cpp index 55d47c76430..0d2d97f7f28 100644 --- a/src/server/shared/Database/MySQLConnection.cpp +++ b/src/server/shared/Database/MySQLConnection.cpp @@ -34,6 +34,8 @@ #include "Timer.h" #include "Log.h" +#include + MySQLConnection::MySQLConnection(MySQLConnectionInfo& connInfo) : m_reconnecting(false), m_prepareError(false), diff --git a/src/server/shared/Database/PreparedStatement.cpp b/src/server/shared/Database/PreparedStatement.cpp index fe052bf5043..4b2b55f25e5 100644 --- a/src/server/shared/Database/PreparedStatement.cpp +++ b/src/server/shared/Database/PreparedStatement.cpp @@ -449,10 +449,10 @@ PreparedStatementTask::PreparedStatementTask(PreparedStatement* stmt) : m_stmt(stmt), m_has_result(false) { } -PreparedStatementTask::PreparedStatementTask(PreparedStatement* stmt, PreparedQueryResultFuture result) : +PreparedStatementTask::PreparedStatementTask(PreparedStatement* stmt, PreparedQueryResultPromise& result) : m_stmt(stmt), m_has_result(true), -m_result(result) { } +m_result(std::move(result)) { } PreparedStatementTask::~PreparedStatementTask() @@ -468,10 +468,10 @@ bool PreparedStatementTask::Execute() if (!result || !result->GetRowCount()) { delete result; - m_result.set(PreparedQueryResult(NULL)); + m_result.set_value(PreparedQueryResult(NULL)); return false; } - m_result.set(PreparedQueryResult(result)); + m_result.set_value(PreparedQueryResult(result)); return true; } diff --git a/src/server/shared/Database/PreparedStatement.h b/src/server/shared/Database/PreparedStatement.h index 6afb309db2c..d69ee52a3e7 100644 --- a/src/server/shared/Database/PreparedStatement.h +++ b/src/server/shared/Database/PreparedStatement.h @@ -18,8 +18,8 @@ #ifndef _PREPAREDSTATEMENT_H #define _PREPAREDSTATEMENT_H +#include #include "SQLOperation.h" -#include #ifdef __APPLE__ #undef TYPE_BOOL @@ -153,14 +153,15 @@ class MySQLPreparedStatement MySQLPreparedStatement& operator=(MySQLPreparedStatement const& right) = delete; }; -typedef ACE_Future PreparedQueryResultFuture; +typedef std::future PreparedQueryResultFuture; +typedef std::promise PreparedQueryResultPromise; //- Lower-level class, enqueuable operation class PreparedStatementTask : public SQLOperation { public: PreparedStatementTask(PreparedStatement* stmt); - PreparedStatementTask(PreparedStatement* stmt, PreparedQueryResultFuture result); + PreparedStatementTask(PreparedStatement* stmt, PreparedQueryResultPromise& result); ~PreparedStatementTask(); bool Execute(); @@ -168,6 +169,6 @@ class PreparedStatementTask : public SQLOperation protected: PreparedStatement* m_stmt; bool m_has_result; - PreparedQueryResultFuture m_result; + PreparedQueryResultPromise m_result; }; #endif diff --git a/src/server/shared/Database/QueryHolder.cpp b/src/server/shared/Database/QueryHolder.cpp index 7b4105ee076..bd938561b50 100644 --- a/src/server/shared/Database/QueryHolder.cpp +++ b/src/server/shared/Database/QueryHolder.cpp @@ -168,9 +168,6 @@ void SQLQueryHolder::SetSize(size_t size) bool SQLQueryHolderTask::Execute() { - //the result can't be ready as we are processing it right now - ASSERT(!m_result.ready()); - if (!m_holder) return false; @@ -202,6 +199,6 @@ bool SQLQueryHolderTask::Execute() } } - m_result.set(m_holder); + m_result.set_value(m_holder); return true; } diff --git a/src/server/shared/Database/QueryHolder.h b/src/server/shared/Database/QueryHolder.h index b92b2e5327e..5751675fe5f 100644 --- a/src/server/shared/Database/QueryHolder.h +++ b/src/server/shared/Database/QueryHolder.h @@ -18,7 +18,7 @@ #ifndef _QUERYHOLDER_H #define _QUERYHOLDER_H -#include +#include class SQLQueryHolder { @@ -39,17 +39,18 @@ class SQLQueryHolder void SetPreparedResult(size_t index, PreparedResultSet* result); }; -typedef ACE_Future QueryResultHolderFuture; +typedef std::future QueryResultHolderFuture; +typedef std::promise QueryResultHolderPromise; class SQLQueryHolderTask : public SQLOperation { private: SQLQueryHolder * m_holder; - QueryResultHolderFuture m_result; + QueryResultHolderPromise m_result; public: - SQLQueryHolderTask(SQLQueryHolder *holder, QueryResultHolderFuture res) - : m_holder(holder), m_result(res){ }; + SQLQueryHolderTask(SQLQueryHolder *holder, QueryResultHolderPromise& res) + : m_holder(holder), m_result(std::move(res)){ }; bool Execute(); }; diff --git a/src/server/shared/Threading/Callback.h b/src/server/shared/Threading/Callback.h index c48546bbf5c..a6aa11b3958 100644 --- a/src/server/shared/Threading/Callback.h +++ b/src/server/shared/Threading/Callback.h @@ -18,12 +18,13 @@ #ifndef _CALLBACK_H #define _CALLBACK_H -#include -#include +#include #include "QueryResult.h" -typedef ACE_Future QueryResultFuture; -typedef ACE_Future PreparedQueryResultFuture; +typedef std::future QueryResultFuture; +typedef std::promise QueryResultPromise; +typedef std::future PreparedQueryResultFuture; +typedef std::promise PreparedQueryResultPromise; /*! A simple template using ACE_Future to manage callbacks from the thread and object that issued the request. is variable type of parameter that is used as parameter @@ -38,29 +39,29 @@ class QueryCallback QueryCallback() : _param(), _stage(chain ? 0 : CALLBACK_STAGE_INVALID) { } //! The parameter of this function should be a resultset returned from either .AsyncQuery or .AsyncPQuery - void SetFutureResult(ACE_Future value) + void SetFutureResult(std::future& value) { - _result = value; + _result = std::move(value); } - ACE_Future GetFutureResult() + std::future& GetFutureResult() { return _result; } int IsReady() { - return _result.ready(); + return _result.wait_for(std::chrono::seconds(0)) == std::future_status::ready; } void GetResult(Result& res) { - _result.get(res); + res = _result.get(); } void FreeResult() { - _result.cancel(); + // Nothing to do here, the constructor of std::future will take care of the cleanup } void SetParam(ParamType value) @@ -106,7 +107,7 @@ class QueryCallback } private: - ACE_Future _result; + std::future _result; ParamType _param; uint8 _stage; @@ -121,29 +122,29 @@ class QueryCallback_2 QueryCallback_2() : _stage(chain ? 0 : CALLBACK_STAGE_INVALID) { } //! The parameter of this function should be a resultset returned from either .AsyncQuery or .AsyncPQuery - void SetFutureResult(ACE_Future value) + void SetFutureResult(std::future& value) { - _result = value; + _result = std::move(value); } - ACE_Future GetFutureResult() + std::future& GetFutureResult() { return _result; } int IsReady() { - return _result.ready(); + return _result.wait_for(std::chrono::seconds(0)) == std::future_status::ready; } void GetResult(Result& res) { - _result.get(res); + res = _result.get(); } void FreeResult() { - _result.cancel(); + // Nothing to do here, the constructor of std::future will take care of the cleanup } void SetFirstParam(ParamType1 value) @@ -200,7 +201,7 @@ class QueryCallback_2 } private: - ACE_Future _result; + std::future _result; ParamType1 _param_1; ParamType2 _param_2; uint8 _stage; -- cgit v1.2.3 From d8d0b4730e4aece0ffe6a7b89bd74fb2940ea3fb Mon Sep 17 00:00:00 2001 From: leak Date: Tue, 24 Jun 2014 21:09:43 +0200 Subject: Revert "Removed ACE dependencies from LogWorker" This actually needs way more work This reverts commit 0a592dd9dbd34818deee472dd42d700b4746a27e. --- src/server/shared/Logging/Log.cpp | 2 +- src/server/shared/Logging/Log.h | 2 +- src/server/shared/Logging/LogWorker.cpp | 17 ++++++++++++----- src/server/shared/Logging/LogWorker.h | 20 +++++++++++++++----- 4 files changed, 29 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 68745046433..fd7aa84c0e9 100644 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -273,7 +273,7 @@ void Log::write(LogMessage* msg) const msg->text.append("\n"); if (worker) - worker->enqueue(*(new LogOperation(logger, msg))); + worker->enqueue(new LogOperation(logger, msg)); else { logger->write(*msg); diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h index 29ebdb3faa1..c3a47d14e9e 100644 --- a/src/server/shared/Logging/Log.h +++ b/src/server/shared/Logging/Log.h @@ -23,7 +23,7 @@ #include "Appender.h" #include "Logger.h" #include "LogWorker.h" -#include + #include #include diff --git a/src/server/shared/Logging/LogWorker.cpp b/src/server/shared/Logging/LogWorker.cpp index cea4262032b..b0c82b614f4 100644 --- a/src/server/shared/Logging/LogWorker.cpp +++ b/src/server/shared/Logging/LogWorker.cpp @@ -17,22 +17,29 @@ #include "LogWorker.h" +LogWorker::LogWorker() + : m_queue(HIGH_WATERMARK, LOW_WATERMARK) +{ + ACE_Task_Base::activate(THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED, 1); +} + LogWorker::~LogWorker() { - m_queue.cancel(); + m_queue.deactivate(); + wait(); } -void LogWorker::enqueue(LogOperation& op) +int LogWorker::enqueue(LogOperation* op) { - return m_queue.add(op); + return m_queue.enqueue(op); } int LogWorker::svc() { while (1) { - LogOperation* request = nullptr; - if (!m_queue.next(*request)) + LogOperation* request; + if (m_queue.dequeue(request) == -1) break; request->call(); diff --git a/src/server/shared/Logging/LogWorker.h b/src/server/shared/Logging/LogWorker.h index 84d8ba632a8..25a57842e08 100644 --- a/src/server/shared/Logging/LogWorker.h +++ b/src/server/shared/Logging/LogWorker.h @@ -19,19 +19,29 @@ #define LOGWORKER_H #include "LogOperation.h" -#include "LockedQueue.h" -class LogWorker +#include +#include + +class LogWorker: protected ACE_Task_Base { public: - LogWorker() {}; + LogWorker(); ~LogWorker(); - void enqueue(LogOperation& op); + typedef ACE_Message_Queue_Ex LogMessageQueueType; + + enum + { + HIGH_WATERMARK = 8 * 1024 * 1024, + LOW_WATERMARK = 8 * 1024 * 1024 + }; + + int enqueue(LogOperation *op); private: virtual int svc(); - LockedQueue m_queue; + LogMessageQueueType m_queue; }; #endif -- cgit v1.2.3 From a5c742dafe74f26f45293e8f340862cd16f529ce Mon Sep 17 00:00:00 2001 From: leak Date: Wed, 25 Jun 2014 18:36:23 +0200 Subject: Compile fix (RASocket needs to be rewritten entirely at some point) --- src/server/worldserver/RemoteAccess/RASocket.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/worldserver/RemoteAccess/RASocket.cpp b/src/server/worldserver/RemoteAccess/RASocket.cpp index 6e621ddfffe..698d3c949cd 100644 --- a/src/server/worldserver/RemoteAccess/RASocket.cpp +++ b/src/server/worldserver/RemoteAccess/RASocket.cpp @@ -29,6 +29,7 @@ #include "Util.h" #include "World.h" #include "SHA1.h" +#include "ace/OS_NS_unistd.h" RASocket::RASocket() { -- cgit v1.2.3 From eb36acd1522a2e5b8a7d2b4b4a67fc34fc777f03 Mon Sep 17 00:00:00 2001 From: leak Date: Mon, 30 Jun 2014 14:44:52 +0200 Subject: Replaced ACE_Task_Base based LogWorker with ProducerConsumerQueue --- src/server/authserver/Main.cpp | 1 - src/server/shared/Configuration/Config.cpp | 6 +- src/server/shared/Logging/Log.cpp | 2 +- src/server/shared/Logging/Log.h | 1 + src/server/shared/Logging/LogWorker.cpp | 34 ++++--- src/server/shared/Logging/LogWorker.h | 27 +++--- .../shared/Threading/ProducerConsumerQueue.h | 102 +++++++++++++++++++++ 7 files changed, 140 insertions(+), 33 deletions(-) create mode 100644 src/server/shared/Threading/ProducerConsumerQueue.h (limited to 'src') diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index 2427c47a438..3901480c70d 100644 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -67,7 +67,6 @@ using boost::asio::ip::tcp; void SignalHandler(const boost::system::error_code& error, int signalNumber) { - TC_LOG_ERROR("server.authserver", "SIGNAL HANDLER WORKING"); if (!error) { switch (signalNumber) diff --git a/src/server/shared/Configuration/Config.cpp b/src/server/shared/Configuration/Config.cpp index 9e0e57eb198..b6690d02155 100644 --- a/src/server/shared/Configuration/Config.cpp +++ b/src/server/shared/Configuration/Config.cpp @@ -71,7 +71,7 @@ bool ConfigMgr::GetBoolDefault(const char* name, bool def) { try { - std::string val = _config.get(name); + std::string val = _config.get(ptree::path_type(name, '/')); val.erase(std::remove(val.begin(), val.end(), '"'), val.end()); return (val == "true" || val == "TRUE" || val == "yes" || val == "YES" || val == "1"); } @@ -83,12 +83,12 @@ bool ConfigMgr::GetBoolDefault(const char* name, bool def) int ConfigMgr::GetIntDefault(const char* name, int def) { - return _config.get(name, def); + return _config.get(ptree::path_type(name, '/'), def); } float ConfigMgr::GetFloatDefault(const char* name, float def) { - return _config.get(name, def); + return _config.get(ptree::path_type(name, '/'), def); } std::string const& ConfigMgr::GetFilename() diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index fd7aa84c0e9..57d8797e61e 100644 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -273,7 +273,7 @@ void Log::write(LogMessage* msg) const msg->text.append("\n"); if (worker) - worker->enqueue(new LogOperation(logger, msg)); + worker->Enqueue(new LogOperation(logger, msg)); else { logger->write(*msg); diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h index c3a47d14e9e..8d2fd33d886 100644 --- a/src/server/shared/Logging/Log.h +++ b/src/server/shared/Logging/Log.h @@ -23,6 +23,7 @@ #include "Appender.h" #include "Logger.h" #include "LogWorker.h" +#include #include #include diff --git a/src/server/shared/Logging/LogWorker.cpp b/src/server/shared/Logging/LogWorker.cpp index b0c82b614f4..ab0f41bf105 100644 --- a/src/server/shared/Logging/LogWorker.cpp +++ b/src/server/shared/Logging/LogWorker.cpp @@ -16,35 +16,41 @@ */ #include "LogWorker.h" +#include LogWorker::LogWorker() - : m_queue(HIGH_WATERMARK, LOW_WATERMARK) { - ACE_Task_Base::activate(THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED, 1); + _cancelationToken = false; + _workerThread = std::thread(&LogWorker::WorkerThread, this); } LogWorker::~LogWorker() { - m_queue.deactivate(); - wait(); + _cancelationToken = true; + + _queue.Cancel(); + + _workerThread.join(); } -int LogWorker::enqueue(LogOperation* op) +void LogWorker::Enqueue(LogOperation* op) { - return m_queue.enqueue(op); + return _queue.Push(op); } -int LogWorker::svc() +void LogWorker::WorkerThread() { while (1) { - LogOperation* request; - if (m_queue.dequeue(request) == -1) - break; + LogOperation* operation = nullptr; + + _queue.WaitAndPop(operation); - request->call(); - delete request; - } + if (_cancelationToken) + return; - return 0; + operation->call(); + + delete operation; + } } diff --git a/src/server/shared/Logging/LogWorker.h b/src/server/shared/Logging/LogWorker.h index 25a57842e08..b2680b12c34 100644 --- a/src/server/shared/Logging/LogWorker.h +++ b/src/server/shared/Logging/LogWorker.h @@ -18,30 +18,29 @@ #ifndef LOGWORKER_H #define LOGWORKER_H -#include "LogOperation.h" +#include +#include -#include -#include +#include "LogOperation.h" +#include "ProducerConsumerQueue.h" -class LogWorker: protected ACE_Task_Base +class LogWorker { public: LogWorker(); ~LogWorker(); - typedef ACE_Message_Queue_Ex LogMessageQueueType; + void Enqueue(LogOperation *op); - enum - { - HIGH_WATERMARK = 8 * 1024 * 1024, - LOW_WATERMARK = 8 * 1024 * 1024 - }; + private: + ProducerConsumerQueue _queue; - int enqueue(LogOperation *op); + void WorkerThread(); + std::thread _workerThread; - private: - virtual int svc(); - LogMessageQueueType m_queue; + std::atomic_bool _cancelationToken; }; + + #endif diff --git a/src/server/shared/Threading/ProducerConsumerQueue.h b/src/server/shared/Threading/ProducerConsumerQueue.h new file mode 100644 index 00000000000..961cb9f9c82 --- /dev/null +++ b/src/server/shared/Threading/ProducerConsumerQueue.h @@ -0,0 +1,102 @@ +/* +* Copyright (C) 2008-2014 TrinityCore +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program. If not, see . +*/ + +#ifndef _PCQ_H +#define _PCQ_H + +#include +#include +#include + +template +class ProducerConsumerQueue +{ +private: + std::mutex _queueLock; + std::queue _queue; + std::condition_variable _condition; + +public: + + void Push(const T& value) + { + _queueLock.lock(); + + _queue.push(std::move(value)); + + _queueLock.unlock(); + + _condition.notify_one(); + } + + bool Empty() const + { + std::lock_guard lock(_queueLock); + + return _queue.empty(); + } + + bool Pop(T& value) + { + std::lock_guard lock(_queueLock); + + if (_queue.empty()) + return false; + + value = _queue.front(); + + _queue.pop(); + + return true; + } + + void WaitAndPop(T& value) + { + std::unique_lock lock(_queueLock); + + _condition.wait(lock, [this](){ return !_queue.empty(); }); + + if (_queue.empty()) + return; + + value = _queue.front(); + + _queue.pop(); + } + + void Cancel() + { + _queueLock.lock(); + + while (!_queue.empty()) + { + T& value = _queue.front(); + + delete &value; + + _queue.pop(); + } + + _queueLock.unlock(); + + _condition.notify_all(); + } +}; + +#endif + + -- cgit v1.2.3 From 9588c1d92b20573c2bd214b44a15e41fd8cf35b4 Mon Sep 17 00:00:00 2001 From: leak Date: Mon, 30 Jun 2014 16:28:55 +0200 Subject: Replace ACE thread/mutex in OpenSSLCrypto --- src/server/game/World/World.h | 1 + src/server/shared/Cryptography/OpenSSLCrypto.cpp | 21 ++++++++------------- 2 files changed, 9 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 9c68ee8add2..4096dd7399a 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -27,6 +27,7 @@ #include "Timer.h" #include #include +#include #include "SharedDefines.h" #include "QueryResult.h" #include "Callback.h" diff --git a/src/server/shared/Cryptography/OpenSSLCrypto.cpp b/src/server/shared/Cryptography/OpenSSLCrypto.cpp index bd72459e9df..d4e06dfd661 100644 --- a/src/server/shared/Cryptography/OpenSSLCrypto.cpp +++ b/src/server/shared/Cryptography/OpenSSLCrypto.cpp @@ -17,28 +17,23 @@ #include #include -#include #include -#include +#include +#include -std::vector cryptoLocks; +std::vector cryptoLocks; static void lockingCallback(int mode, int type, const char* /*file*/, int /*line*/) { if (mode & CRYPTO_LOCK) - cryptoLocks[type]->acquire(); + cryptoLocks[type]->lock(); else - cryptoLocks[type]->release(); + cryptoLocks[type]->unlock(); } static void threadIdCallback(CRYPTO_THREADID * id) { -/// ACE_thread_t turns out to be a struct under Mac OS. -#ifndef __APPLE__ - CRYPTO_THREADID_set_numeric(id, ACE_Thread::self()); -#else - CRYPTO_THREADID_set_pointer(id, ACE_Thread::self()); -#endif + CRYPTO_THREADID_set_numeric(id, std::this_thread::get_id().hash()); } void OpenSSLCrypto::threadsSetup() @@ -46,7 +41,7 @@ void OpenSSLCrypto::threadsSetup() cryptoLocks.resize(CRYPTO_num_locks()); for(int i = 0 ; i < CRYPTO_num_locks(); ++i) { - cryptoLocks[i] = new ACE_Thread_Mutex(); + cryptoLocks[i] = new std::mutex; } CRYPTO_THREADID_set_callback(threadIdCallback); CRYPTO_set_locking_callback(lockingCallback); @@ -61,4 +56,4 @@ void OpenSSLCrypto::threadsCleanup() delete cryptoLocks[i]; } cryptoLocks.resize(0); -} \ No newline at end of file +} -- cgit v1.2.3 From d39a013b6b979a5158bf86c37a197cb902b2c2f9 Mon Sep 17 00:00:00 2001 From: leak Date: Mon, 30 Jun 2014 18:37:23 +0200 Subject: Replaced ACE_Task_Base based DatabaseWorker with PCQ Note: Not exactly sure how shutdown should be handled, currently the queue clears itself out before shutting down This might need to be changed if the queue should be fully processed before being deleted --- src/server/shared/Database/DatabaseWorker.cpp | 44 +++++++++++++--------- src/server/shared/Database/DatabaseWorker.h | 21 ++++++----- src/server/shared/Database/DatabaseWorkerPool.h | 20 ++++------ .../Database/Implementation/CharacterDatabase.h | 2 +- .../shared/Database/Implementation/LoginDatabase.h | 2 +- .../shared/Database/Implementation/WorldDatabase.h | 2 +- src/server/shared/Database/MySQLConnection.cpp | 13 +++---- src/server/shared/Database/MySQLConnection.h | 5 ++- src/server/shared/Database/SQLOperation.h | 5 +-- .../shared/Threading/ProducerConsumerQueue.h | 11 +++++- 10 files changed, 68 insertions(+), 57 deletions(-) (limited to 'src') diff --git a/src/server/shared/Database/DatabaseWorker.cpp b/src/server/shared/Database/DatabaseWorker.cpp index 3581f8e0211..3944c008652 100644 --- a/src/server/shared/Database/DatabaseWorker.cpp +++ b/src/server/shared/Database/DatabaseWorker.cpp @@ -20,32 +20,42 @@ #include "SQLOperation.h" #include "MySQLConnection.h" #include "MySQLThreading.h" +#include "ProducerConsumerQueue.h" -DatabaseWorker::DatabaseWorker(ACE_Activation_Queue* new_queue, MySQLConnection* con) : -m_queue(new_queue), -m_conn(con) +DatabaseWorker::DatabaseWorker(ProducerConsumerQueue* newQueue, MySQLConnection* connection) { - /// Assign thread to task - activate(); + _connection = connection; + _queue = newQueue; + _cancelationToken = false; + _workerThread = std::thread(&DatabaseWorker::WorkerThread, this); } -int DatabaseWorker::svc() +DatabaseWorker::~DatabaseWorker() { - if (!m_queue) - return -1; + _cancelationToken = true; + + _queue->Cancel(); + + _workerThread.join(); +} + +void DatabaseWorker::WorkerThread() +{ + if (!_queue) + return; - SQLOperation *request = NULL; while (1) { - request = (SQLOperation*)(m_queue->dequeue()); - if (!request) - break; + SQLOperation* operation = nullptr; - request->SetConnection(m_conn); - request->call(); + _queue->WaitAndPop(operation); - delete request; - } + if (_cancelationToken) + return; - return 0; + operation->SetConnection(_connection); + operation->call(); + + delete operation; + } } diff --git a/src/server/shared/Database/DatabaseWorker.h b/src/server/shared/Database/DatabaseWorker.h index dc883dd3428..9b45318e39f 100644 --- a/src/server/shared/Database/DatabaseWorker.h +++ b/src/server/shared/Database/DatabaseWorker.h @@ -19,23 +19,24 @@ #define _WORKERTHREAD_H #include "Define.h" -#include -#include +#include "ProducerConsumerQueue.h" class MySQLConnection; -class DatabaseWorker : protected ACE_Task_Base +class DatabaseWorker { public: - DatabaseWorker(ACE_Activation_Queue* new_queue, MySQLConnection* con); - - ///- Inherited from ACE_Task_Base - int svc(); - int wait() { return ACE_Task_Base::wait(); } + DatabaseWorker(ProducerConsumerQueue* newQueue, MySQLConnection* connection); + ~DatabaseWorker(); private: - ACE_Activation_Queue* m_queue; - MySQLConnection* m_conn; + ProducerConsumerQueue* _queue; + MySQLConnection* _connection; + + void WorkerThread(); + std::thread _workerThread; + + std::atomic_bool _cancelationToken; DatabaseWorker(DatabaseWorker const& right) = delete; DatabaseWorker& operator=(DatabaseWorker const& right) = delete; diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h index 078b97762b5..e56dcc329cd 100644 --- a/src/server/shared/Database/DatabaseWorkerPool.h +++ b/src/server/shared/Database/DatabaseWorkerPool.h @@ -52,7 +52,7 @@ class DatabaseWorkerPool DatabaseWorkerPool() : _connectionInfo(NULL) { _messageQueue = new ACE_Message_Queue(8 * 1024 * 1024, 8 * 1024 * 1024); - _queue = new ACE_Activation_Queue(_messageQueue); + _queue = new ProducerConsumerQueue(); memset(_connectionCount, 0, sizeof(_connectionCount)); _connections.resize(IDX_SIZE); @@ -107,16 +107,10 @@ class DatabaseWorkerPool { TC_LOG_INFO("sql.driver", "Closing down DatabasePool '%s'.", GetDatabaseName()); - //! Shuts down delaythreads for this connection pool by underlying deactivate(). - //! The next dequeue attempt in the worker thread tasks will result in an error, - //! ultimately ending the worker thread task. - _queue->queue()->close(); - for (uint8 i = 0; i < _connectionCount[IDX_ASYNC]; ++i) { T* t = _connections[IDX_ASYNC][i]; DatabaseWorker* worker = t->m_worker; - worker->wait(); //! Block until no more threads are running this task. delete worker; t->Close(); //! Closes the actualy MySQL connection. } @@ -488,7 +482,7 @@ class DatabaseWorkerPool void Enqueue(SQLOperation* op) { - _queue->enqueue(op); + _queue->Push(op); } //! Gets a free connection in the synchronous connection pool. @@ -523,11 +517,11 @@ class DatabaseWorkerPool IDX_SIZE }; - ACE_Message_Queue* _messageQueue; //! Message Queue used by ACE_Activation_Queue - ACE_Activation_Queue* _queue; //! Queue shared by async worker threads. - std::vector< std::vector > _connections; - uint32 _connectionCount[2]; //! Counter of MySQL connections; - MySQLConnectionInfo* _connectionInfo; + ACE_Message_Queue* _messageQueue; //! Message Queue used by ACE_Activation_Queue + ProducerConsumerQueue* _queue; //! Queue shared by async worker threads. + std::vector< std::vector > _connections; + uint32 _connectionCount[2]; //! Counter of MySQL connections; + MySQLConnectionInfo* _connectionInfo; }; #endif diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h index 98d7fe231f1..61167681b0b 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.h +++ b/src/server/shared/Database/Implementation/CharacterDatabase.h @@ -26,7 +26,7 @@ class CharacterDatabaseConnection : public MySQLConnection public: //- Constructors for sync and async connections CharacterDatabaseConnection(MySQLConnectionInfo& connInfo) : MySQLConnection(connInfo) { } - CharacterDatabaseConnection(ACE_Activation_Queue* q, MySQLConnectionInfo& connInfo) : MySQLConnection(q, connInfo) { } + CharacterDatabaseConnection(ProducerConsumerQueue* q, MySQLConnectionInfo& connInfo) : MySQLConnection(q, connInfo) { } //- Loads database type specific prepared statements void DoPrepareStatements(); diff --git a/src/server/shared/Database/Implementation/LoginDatabase.h b/src/server/shared/Database/Implementation/LoginDatabase.h index 604e9d39551..7fa2ff49324 100644 --- a/src/server/shared/Database/Implementation/LoginDatabase.h +++ b/src/server/shared/Database/Implementation/LoginDatabase.h @@ -26,7 +26,7 @@ class LoginDatabaseConnection : public MySQLConnection public: //- Constructors for sync and async connections LoginDatabaseConnection(MySQLConnectionInfo& connInfo) : MySQLConnection(connInfo) { } - LoginDatabaseConnection(ACE_Activation_Queue* q, MySQLConnectionInfo& connInfo) : MySQLConnection(q, connInfo) { } + LoginDatabaseConnection(ProducerConsumerQueue* q, MySQLConnectionInfo& connInfo) : MySQLConnection(q, connInfo) { } //- Loads database type specific prepared statements void DoPrepareStatements(); diff --git a/src/server/shared/Database/Implementation/WorldDatabase.h b/src/server/shared/Database/Implementation/WorldDatabase.h index a815373a1c6..c8c38d8a629 100644 --- a/src/server/shared/Database/Implementation/WorldDatabase.h +++ b/src/server/shared/Database/Implementation/WorldDatabase.h @@ -26,7 +26,7 @@ class WorldDatabaseConnection : public MySQLConnection public: //- Constructors for sync and async connections WorldDatabaseConnection(MySQLConnectionInfo& connInfo) : MySQLConnection(connInfo) { } - WorldDatabaseConnection(ACE_Activation_Queue* q, MySQLConnectionInfo& connInfo) : MySQLConnection(q, connInfo) { } + WorldDatabaseConnection(ProducerConsumerQueue* q, MySQLConnectionInfo& connInfo) : MySQLConnection(q, connInfo) { } //- Loads database type specific prepared statements void DoPrepareStatements(); diff --git a/src/server/shared/Database/MySQLConnection.cpp b/src/server/shared/Database/MySQLConnection.cpp index 0d2d97f7f28..8b24f508331 100644 --- a/src/server/shared/Database/MySQLConnection.cpp +++ b/src/server/shared/Database/MySQLConnection.cpp @@ -33,8 +33,7 @@ #include "DatabaseWorker.h" #include "Timer.h" #include "Log.h" - -#include +#include "ProducerConsumerQueue.h" MySQLConnection::MySQLConnection(MySQLConnectionInfo& connInfo) : m_reconnecting(false), @@ -45,7 +44,7 @@ m_Mysql(NULL), m_connectionInfo(connInfo), m_connectionFlags(CONNECTION_SYNCH) { } -MySQLConnection::MySQLConnection(ACE_Activation_Queue* queue, MySQLConnectionInfo& connInfo) : +MySQLConnection::MySQLConnection(ProducerConsumerQueue* queue, MySQLConnectionInfo& connInfo) : m_reconnecting(false), m_prepareError(false), m_queue(queue), @@ -502,8 +501,8 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo) } uint32 lErrno = mysql_errno(GetHandle()); // It's possible this attempted reconnect throws 2006 at us. To prevent crazy recursive calls, sleep here. - ACE_OS::sleep(3); // Sleep 3 seconds - return _HandleMySQLErrno(lErrno); // Call self (recursive) + std::this_thread::sleep_for(std::chrono::seconds(3)); // Sleep 3 seconds + return _HandleMySQLErrno(lErrno); // Call self (recursive) } case ER_LOCK_DEADLOCK: @@ -517,12 +516,12 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo) case ER_BAD_FIELD_ERROR: case ER_NO_SUCH_TABLE: TC_LOG_ERROR("sql.sql", "Your database structure is not up to date. Please make sure you've executed all queries in the sql/updates folders."); - ACE_OS::sleep(10); + std::this_thread::sleep_for(std::chrono::seconds(10)); std::abort(); return false; case ER_PARSE_ERROR: TC_LOG_ERROR("sql.sql", "Error while parsing SQL. Core fix required."); - ACE_OS::sleep(10); + std::this_thread::sleep_for(std::chrono::seconds(10)); std::abort(); return false; default: diff --git a/src/server/shared/Database/MySQLConnection.h b/src/server/shared/Database/MySQLConnection.h index 512df7c16c7..3b7efeb5846 100644 --- a/src/server/shared/Database/MySQLConnection.h +++ b/src/server/shared/Database/MySQLConnection.h @@ -20,6 +20,7 @@ #include "DatabaseWorkerPool.h" #include "Transaction.h" #include "Util.h" +#include "ProducerConsumerQueue.h" #ifndef _MYSQLCONNECTION_H #define _MYSQLCONNECTION_H @@ -70,7 +71,7 @@ class MySQLConnection public: MySQLConnection(MySQLConnectionInfo& connInfo); //! Constructor for synchronous connections. - MySQLConnection(ACE_Activation_Queue* queue, MySQLConnectionInfo& connInfo); //! Constructor for asynchronous connections. + MySQLConnection(ProducerConsumerQueue* queue, MySQLConnectionInfo& connInfo); //! Constructor for asynchronous connections. virtual ~MySQLConnection(); virtual bool Open(); @@ -125,7 +126,7 @@ class MySQLConnection bool _HandleMySQLErrno(uint32 errNo); private: - ACE_Activation_Queue* m_queue; //! Queue shared with other asynchronous connections. + ProducerConsumerQueue* m_queue; //! Queue shared with other asynchronous connections. DatabaseWorker* m_worker; //! Core worker task. MYSQL * m_Mysql; //! MySQL Handle. MySQLConnectionInfo& m_connectionInfo; //! Connection info (used for logging) diff --git a/src/server/shared/Database/SQLOperation.h b/src/server/shared/Database/SQLOperation.h index 6f933a051e3..64fc64e2c2e 100644 --- a/src/server/shared/Database/SQLOperation.h +++ b/src/server/shared/Database/SQLOperation.h @@ -18,9 +18,6 @@ #ifndef _SQLOPERATION_H #define _SQLOPERATION_H -#include -#include - #include "QueryResult.h" //- Forward declare (don't include header to prevent circular includes) @@ -56,7 +53,7 @@ union SQLResultSetUnion class MySQLConnection; -class SQLOperation : public ACE_Method_Request +class SQLOperation { public: SQLOperation(): m_conn(NULL) { } diff --git a/src/server/shared/Threading/ProducerConsumerQueue.h b/src/server/shared/Threading/ProducerConsumerQueue.h index 961cb9f9c82..41bff445c2e 100644 --- a/src/server/shared/Threading/ProducerConsumerQueue.h +++ b/src/server/shared/Threading/ProducerConsumerQueue.h @@ -21,6 +21,7 @@ #include #include #include +#include template class ProducerConsumerQueue @@ -29,9 +30,12 @@ private: std::mutex _queueLock; std::queue _queue; std::condition_variable _condition; + std::atomic _shutdown; public: + ProducerConsumerQueue() : _shutdown(false) { } + void Push(const T& value) { _queueLock.lock(); @@ -68,7 +72,10 @@ public: { std::unique_lock lock(_queueLock); - _condition.wait(lock, [this](){ return !_queue.empty(); }); + while (_queue.empty() && !_shutdown) + { + _condition.wait(lock); + } if (_queue.empty()) return; @@ -91,6 +98,8 @@ public: _queue.pop(); } + _shutdown = true; + _queueLock.unlock(); _condition.notify_all(); -- cgit v1.2.3 From 029bad6698df6ac9556fe308342e616f4a7a8cc7 Mon Sep 17 00:00:00 2001 From: leak Date: Tue, 1 Jul 2014 00:54:09 +0200 Subject: Replaced all remaining ACE based Singletons Replaced ACE base AutoPtr class with shared_ptr Note: worldserver currently broken due to MapUpdater threading failure (ACE ofc, what else could it be) --- src/server/authserver/Main.cpp | 1 - src/server/collision/Management/VMapManager2.cpp | 2 - src/server/game/AI/SmartScripts/SmartScriptMgr.h | 28 +++++++---- src/server/game/Accounts/AccountMgr.h | 11 +++-- src/server/game/Achievements/AchievementMgr.h | 10 ++-- src/server/game/AuctionHouse/AuctionHouseMgr.h | 11 +++-- src/server/game/Battlefield/BattlefieldMgr.h | 17 ++++--- src/server/game/Battlegrounds/ArenaTeam.h | 1 - src/server/game/Battlegrounds/ArenaTeamMgr.h | 10 +++- src/server/game/Battlegrounds/BattlegroundMgr.h | 11 +++-- src/server/game/Calendar/CalendarMgr.h | 11 +++-- src/server/game/Chat/Channels/ChannelMgr.cpp | 6 +-- src/server/game/Chat/Channels/ChannelMgr.h | 14 ++++-- src/server/game/Conditions/ConditionMgr.h | 12 +++-- src/server/game/DataStores/DBCStructure.h | 10 ++-- src/server/game/DungeonFinding/LFGMgr.h | 11 +++-- src/server/game/Entities/Creature/CreatureGroups.h | 13 +++-- src/server/game/Entities/Item/Item.cpp | 4 +- src/server/game/Entities/Player/Player.cpp | 6 +-- src/server/game/Entities/Player/SocialMgr.h | 11 +++-- src/server/game/Events/GameEventMgr.h | 11 +++-- src/server/game/Globals/ObjectMgr.h | 10 ++-- src/server/game/Groups/GroupMgr.h | 9 +++- src/server/game/Guilds/GuildMgr.h | 10 ++-- src/server/game/Handlers/AddonHandler.cpp | 4 -- src/server/game/Handlers/AddonHandler.h | 19 ++++---- src/server/game/Maps/MapManager.h | 14 +++--- src/server/game/Maps/TransportMgr.h | 10 ++-- src/server/game/Movement/MovementGenerator.h | 1 - .../game/Movement/Waypoints/WaypointManager.h | 13 ++--- src/server/game/OutdoorPvP/OutdoorPvPMgr.h | 11 +++-- src/server/game/Pools/PoolMgr.h | 11 +++-- src/server/game/Scripting/ScriptMgr.h | 10 ++-- src/server/game/Scripting/ScriptSystem.h | 11 +++-- src/server/game/Server/Protocol/PacketLog.h | 11 +++-- src/server/game/Server/WorldSession.cpp | 2 +- src/server/game/Server/WorldSocketMgr.h | 12 +++-- src/server/game/Spells/SpellMgr.h | 12 +++-- src/server/game/Texts/CreatureTextMgr.h | 14 ++++-- src/server/game/Tickets/TicketMgr.h | 11 +++-- src/server/game/Warden/WardenCheckMgr.h | 14 ++++-- src/server/game/Weather/WeatherMgr.cpp | 2 +- src/server/game/World/World.cpp | 4 +- src/server/game/World/World.h | 17 ++++--- src/server/shared/Cryptography/ARC4.h | 2 +- src/server/shared/Cryptography/BigNumber.h | 1 - src/server/shared/Database/DatabaseWorkerPool.h | 10 +--- src/server/shared/Database/MySQLConnection.h | 8 ++-- src/server/shared/Database/QueryResult.h | 8 ++-- src/server/shared/Database/Transaction.h | 2 +- src/server/shared/Debugging/Errors.cpp | 11 ++--- src/server/shared/Logging/Appender.h | 4 +- src/server/shared/Logging/AppenderConsole.h | 2 +- src/server/shared/Logging/AppenderFile.h | 2 +- src/server/shared/Threading/Callback.h | 6 +-- src/server/shared/Threading/DelayExecutor.cpp | 18 ++++++- src/server/shared/Threading/DelayExecutor.h | 2 - src/server/worldserver/Master.cpp | 55 ++++++++-------------- src/server/worldserver/Master.h | 8 +++- .../worldserver/WorldThread/WorldRunnable.cpp | 4 +- src/server/worldserver/WorldThread/WorldRunnable.h | 4 +- 61 files changed, 347 insertions(+), 243 deletions(-) (limited to 'src') diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index 3901480c70d..ad04a52c7db 100644 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -178,7 +178,6 @@ int main(int argc, char** argv) SetProcessPriority(); - _dbPingInterval = sConfigMgr->GetIntDefault("MaxPingTime", 30); _dbPingTimer.expires_from_now(boost::posix_time::seconds(_dbPingInterval)); diff --git a/src/server/collision/Management/VMapManager2.cpp b/src/server/collision/Management/VMapManager2.cpp index 2aa3b6ab40d..00381cb1205 100644 --- a/src/server/collision/Management/VMapManager2.cpp +++ b/src/server/collision/Management/VMapManager2.cpp @@ -26,8 +26,6 @@ #include "ModelInstance.h" #include "WorldModel.h" #include -#include -#include #include "DisableMgr.h" #include "DBCStores.h" #include "Log.h" diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 3d14b8f69e9..0380ec8bae9 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -1396,11 +1396,17 @@ typedef std::unordered_map ObjectListMap; class SmartWaypointMgr { - friend class ACE_Singleton; - SmartWaypointMgr() { } - public: + private: + SmartWaypointMgr() { } ~SmartWaypointMgr(); + public: + static SmartWaypointMgr* instance() + { + static SmartWaypointMgr* instance = new SmartWaypointMgr(); + return instance; + } + void LoadFromDB(); WPPath* GetPath(uint32 id) @@ -1426,11 +1432,17 @@ typedef std::pair; - SmartAIMgr() { } - public: + private: + SmartAIMgr() { } ~SmartAIMgr() { } + public: + static SmartAIMgr* instance() + { + static SmartAIMgr* instance = new SmartAIMgr(); + return instance; + } + void LoadSmartAIFromDB(); SmartAIEventList GetScript(int32 entry, SmartScriptType type) @@ -1598,6 +1610,6 @@ class SmartAIMgr CacheSpellContainer KillCreditSpellStore; }; -#define sSmartScriptMgr ACE_Singleton::instance() -#define sSmartWaypointMgr ACE_Singleton::instance() +#define sSmartScriptMgr SmartAIMgr::instance() +#define sSmartWaypointMgr SmartWaypointMgr::instance() #endif diff --git a/src/server/game/Accounts/AccountMgr.h b/src/server/game/Accounts/AccountMgr.h index b3012ace177..2f3137ae3cd 100644 --- a/src/server/game/Accounts/AccountMgr.h +++ b/src/server/game/Accounts/AccountMgr.h @@ -20,7 +20,6 @@ #define _ACCMGR_H #include "RBAC.h" -#include enum AccountOpResult { @@ -51,13 +50,17 @@ typedef std::map RBACDefaultPermissionsCon class AccountMgr { - friend class ACE_Singleton; - private: AccountMgr(); ~AccountMgr(); public: + static AccountMgr* instance() + { + static AccountMgr* instance = new AccountMgr(); + return instance; + } + AccountOpResult CreateAccount(std::string username, std::string password, std::string email); static AccountOpResult DeleteAccount(uint32 accountId); static AccountOpResult ChangeUsername(uint32 accountId, std::string newUsername, std::string newPassword); @@ -95,5 +98,5 @@ class AccountMgr rbac::RBACDefaultPermissionsContainer _defaultPermissions; }; -#define sAccountMgr ACE_Singleton::instance() +#define sAccountMgr AccountMgr::instance() #endif diff --git a/src/server/game/Achievements/AchievementMgr.h b/src/server/game/Achievements/AchievementMgr.h index c3a1481bb2e..7128b8d6318 100644 --- a/src/server/game/Achievements/AchievementMgr.h +++ b/src/server/game/Achievements/AchievementMgr.h @@ -23,7 +23,6 @@ #include #include "Common.h" -#include #include "DatabaseEnv.h" #include "DBCEnums.h" #include "DBCStores.h" @@ -305,11 +304,16 @@ class AchievementMgr class AchievementGlobalMgr { - friend class ACE_Singleton; AchievementGlobalMgr() { } ~AchievementGlobalMgr() { } public: + static AchievementGlobalMgr* instance() + { + static AchievementGlobalMgr* instance = new AchievementGlobalMgr(); + return instance; + } + AchievementCriteriaEntryList const& GetAchievementCriteriaByType(AchievementCriteriaTypes type) const { return m_AchievementCriteriasByType[type]; @@ -389,6 +393,6 @@ class AchievementGlobalMgr AchievementRewardLocales m_achievementRewardLocales; }; -#define sAchievementMgr ACE_Singleton::instance() +#define sAchievementMgr AchievementGlobalMgr::instance() #endif diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.h b/src/server/game/AuctionHouse/AuctionHouseMgr.h index f45fc4100de..0f42a5833a2 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.h +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.h @@ -19,8 +19,6 @@ #ifndef _AUCTION_HOUSE_MGR_H #define _AUCTION_HOUSE_MGR_H -#include - #include "Common.h" #include "DatabaseEnv.h" #include "DBCStructure.h" @@ -137,13 +135,16 @@ class AuctionHouseObject class AuctionHouseMgr { - friend class ACE_Singleton; - private: AuctionHouseMgr(); ~AuctionHouseMgr(); public: + static AuctionHouseMgr* instance() + { + static AuctionHouseMgr* instance = new AuctionHouseMgr(); + return instance; + } typedef std::unordered_map ItemMap; @@ -193,6 +194,6 @@ class AuctionHouseMgr ItemMap mAitems; }; -#define sAuctionMgr ACE_Singleton::instance() +#define sAuctionMgr AuctionHouseMgr::instance() #endif diff --git a/src/server/game/Battlefield/BattlefieldMgr.h b/src/server/game/Battlefield/BattlefieldMgr.h index bb8a076d5d0..9b51fd7710e 100644 --- a/src/server/game/Battlefield/BattlefieldMgr.h +++ b/src/server/game/Battlefield/BattlefieldMgr.h @@ -19,7 +19,6 @@ #define BATTLEFIELD_MGR_H_ #include "Battlefield.h" -#include class Player; class ZoneScript; @@ -28,11 +27,12 @@ class ZoneScript; class BattlefieldMgr { public: - // ctor - BattlefieldMgr(); - // dtor - ~BattlefieldMgr(); - + static BattlefieldMgr* instance() + { + static BattlefieldMgr* instance = new BattlefieldMgr(); + return instance; + } + // create battlefield events void InitBattlefield(); @@ -52,6 +52,9 @@ class BattlefieldMgr void Update(uint32 diff); private: + BattlefieldMgr(); + ~BattlefieldMgr(); + typedef std::vector BattlefieldSet; typedef std::map BattlefieldMap; // contains all initiated battlefield events @@ -64,6 +67,6 @@ class BattlefieldMgr uint32 _updateTimer; }; -#define sBattlefieldMgr ACE_Singleton::instance() +#define sBattlefieldMgr BattlefieldMgr::instance() #endif // BATTLEFIELD_MGR_H_ diff --git a/src/server/game/Battlegrounds/ArenaTeam.h b/src/server/game/Battlegrounds/ArenaTeam.h index cd9e2be4318..85372c35daa 100644 --- a/src/server/game/Battlegrounds/ArenaTeam.h +++ b/src/server/game/Battlegrounds/ArenaTeam.h @@ -20,7 +20,6 @@ #define TRINITYCORE_ARENATEAM_H #include "QueryResult.h" -#include #include #include diff --git a/src/server/game/Battlegrounds/ArenaTeamMgr.h b/src/server/game/Battlegrounds/ArenaTeamMgr.h index 946824fb656..9a4c1184133 100644 --- a/src/server/game/Battlegrounds/ArenaTeamMgr.h +++ b/src/server/game/Battlegrounds/ArenaTeamMgr.h @@ -22,11 +22,17 @@ class ArenaTeamMgr { - friend class ACE_Singleton; +private: ArenaTeamMgr(); ~ArenaTeamMgr(); public: + static ArenaTeamMgr* instance() + { + static ArenaTeamMgr* instance = new ArenaTeamMgr(); + return instance; + } + typedef std::unordered_map ArenaTeamContainer; ArenaTeam* GetArenaTeamById(uint32 arenaTeamId) const; @@ -50,6 +56,6 @@ protected: ArenaTeamContainer ArenaTeamStore; }; -#define sArenaTeamMgr ACE_Singleton::instance() +#define sArenaTeamMgr ArenaTeamMgr::instance() #endif diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.h b/src/server/game/Battlegrounds/BattlegroundMgr.h index 786e664c3f3..046e2588ad3 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.h +++ b/src/server/game/Battlegrounds/BattlegroundMgr.h @@ -23,7 +23,6 @@ #include "DBCEnums.h" #include "Battleground.h" #include "BattlegroundQueue.h" -#include typedef std::map BattlegroundContainer; typedef std::set BattlegroundClientIdsContainer; @@ -64,13 +63,17 @@ struct BattlegroundData class BattlegroundMgr { - friend class ACE_Singleton; - private: BattlegroundMgr(); ~BattlegroundMgr(); public: + static BattlegroundMgr* instance() + { + static BattlegroundMgr* instance = new BattlegroundMgr(); + return instance; + } + void Update(uint32 diff); /* Packet Building */ @@ -158,5 +161,5 @@ class BattlegroundMgr BattleMastersMap mBattleMastersMap; }; -#define sBattlegroundMgr ACE_Singleton::instance() +#define sBattlegroundMgr BattlegroundMgr::instance() #endif diff --git a/src/server/game/Calendar/CalendarMgr.h b/src/server/game/Calendar/CalendarMgr.h index 8f44b013e5c..9c7882fe4b7 100644 --- a/src/server/game/Calendar/CalendarMgr.h +++ b/src/server/game/Calendar/CalendarMgr.h @@ -18,7 +18,6 @@ #ifndef TRINITY_CALENDARMGR_H #define TRINITY_CALENDARMGR_H -#include #include "Common.h" #include "DatabaseEnv.h" #include "WorldPacket.h" @@ -268,8 +267,6 @@ typedef std::map CalendarEventInvite class CalendarMgr { - friend class ACE_Singleton; - private: CalendarMgr(); ~CalendarMgr(); @@ -283,6 +280,12 @@ class CalendarMgr uint64 _maxInviteId; public: + static CalendarMgr* instance() + { + static CalendarMgr* instance = new CalendarMgr(); + return instance; + } + void LoadFromDB(); CalendarEvent* GetEvent(uint64 eventId) const; @@ -329,6 +332,6 @@ class CalendarMgr void SendPacketToAllEventRelatives(WorldPacket packet, CalendarEvent const& calendarEvent); }; -#define sCalendarMgr ACE_Singleton::instance() +#define sCalendarMgr CalendarMgr::instance() #endif diff --git a/src/server/game/Chat/Channels/ChannelMgr.cpp b/src/server/game/Chat/Channels/ChannelMgr.cpp index 0975a690889..00824ae2056 100644 --- a/src/server/game/Chat/Channels/ChannelMgr.cpp +++ b/src/server/game/Chat/Channels/ChannelMgr.cpp @@ -29,13 +29,13 @@ ChannelMgr::~ChannelMgr() ChannelMgr* ChannelMgr::forTeam(uint32 team) { if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) - return ACE_Singleton::instance(); // cross-faction + return AllianceChannelMgr::instance(); // cross-faction if (team == ALLIANCE) - return ACE_Singleton::instance(); + return AllianceChannelMgr::instance(); if (team == HORDE) - return ACE_Singleton::instance(); + return HordeChannelMgr::instance(); return NULL; } diff --git a/src/server/game/Chat/Channels/ChannelMgr.h b/src/server/game/Chat/Channels/ChannelMgr.h index 603eb52f589..0fd5cdbfe24 100644 --- a/src/server/game/Chat/Channels/ChannelMgr.h +++ b/src/server/game/Chat/Channels/ChannelMgr.h @@ -20,7 +20,6 @@ #include "Common.h" #include "Channel.h" -#include #include #include @@ -31,12 +30,17 @@ class ChannelMgr { typedef std::map ChannelMap; - public: - ChannelMgr() : team(0) - { } - + protected: + ChannelMgr() : team(0) { } ~ChannelMgr(); + public: + static ChannelMgr* instance() + { + static ChannelMgr* instance = new ChannelMgr(); + return instance; + } + static ChannelMgr * forTeam(uint32 team); void setTeam(uint32 newTeam) { team = newTeam; } diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index 876b922d243..a78434776e0 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -21,7 +21,6 @@ #include "Define.h" #include "Errors.h" -#include #include #include @@ -223,13 +222,18 @@ typedef std::map ConditionReferenceContainer;//only used class ConditionMgr { - friend class ACE_Singleton; - private: ConditionMgr(); ~ConditionMgr(); public: + + static ConditionMgr* instance() + { + static ConditionMgr* instance = new ConditionMgr(); + return instance; + } + void LoadConditions(bool isReload = false); bool isConditionTypeValid(Condition* cond); ConditionList GetConditionReferences(uint32 refId); @@ -265,6 +269,6 @@ class ConditionMgr SmartEventConditionContainer SmartEventConditionStore; }; -#define sConditionMgr ACE_Singleton::instance() +#define sConditionMgr ConditionMgr::instance() #endif diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index 5d6c8c7aa89..ec9d2dafbd2 100644 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -535,7 +535,7 @@ struct AreaTableEntry { if (mapid == 609) return true; - return (flags & AREA_FLAG_SANCTUARY); + return (flags & AREA_FLAG_SANCTUARY) != 0; } }; @@ -1367,7 +1367,7 @@ struct MapEntry return MapID == 0 || MapID == 1 || MapID == 530 || MapID == 571; } - bool IsDynamicDifficultyMap() const { return Flags & MAP_FLAG_DYNAMIC_DIFFICULTY; } + bool IsDynamicDifficultyMap() const { return (Flags & MAP_FLAG_DYNAMIC_DIFFICULTY) != 0; } }; struct MapDifficultyEntry @@ -2047,12 +2047,12 @@ struct VehicleSeatEntry uint32 m_flagsB; // 45 // 46-57 added in 3.1, floats mostly - bool CanEnterOrExit() const { return m_flags & VEHICLE_SEAT_FLAG_CAN_ENTER_OR_EXIT; } - bool CanSwitchFromSeat() const { return m_flags & VEHICLE_SEAT_FLAG_CAN_SWITCH; } + bool CanEnterOrExit() const { return (m_flags & VEHICLE_SEAT_FLAG_CAN_ENTER_OR_EXIT) != 0; } + bool CanSwitchFromSeat() const { return (m_flags & VEHICLE_SEAT_FLAG_CAN_SWITCH) != 0; } bool IsUsableByOverride() const { return (m_flags & (VEHICLE_SEAT_FLAG_UNCONTROLLED | VEHICLE_SEAT_FLAG_UNK18) || (m_flagsB & (VEHICLE_SEAT_FLAG_B_USABLE_FORCED | VEHICLE_SEAT_FLAG_B_USABLE_FORCED_2 | VEHICLE_SEAT_FLAG_B_USABLE_FORCED_3 | VEHICLE_SEAT_FLAG_B_USABLE_FORCED_4))); } - bool IsEjectable() const { return m_flagsB & VEHICLE_SEAT_FLAG_B_EJECTABLE; } + bool IsEjectable() const { return (m_flagsB & VEHICLE_SEAT_FLAG_B_EJECTABLE) != 0; } }; struct WMOAreaTableEntry diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h index 2c31fe37d4d..03ac5254057 100644 --- a/src/server/game/DungeonFinding/LFGMgr.h +++ b/src/server/game/DungeonFinding/LFGMgr.h @@ -18,7 +18,6 @@ #ifndef _LFGMGR_H #define _LFGMGR_H -#include #include "DBCStructure.h" #include "Field.h" #include "LFG.h" @@ -292,13 +291,17 @@ struct LFGDungeonData class LFGMgr { - friend class ACE_Singleton; - private: LFGMgr(); ~LFGMgr(); public: + static LFGMgr* instance() + { + static LFGMgr* instance = new LFGMgr(); + return instance; + } + // Functions used outside lfg namespace void Update(uint32 diff); @@ -466,5 +469,5 @@ class LFGMgr } // namespace lfg -#define sLFGMgr ACE_Singleton::instance() +#define sLFGMgr lfg::LFGMgr::instance() #endif diff --git a/src/server/game/Entities/Creature/CreatureGroups.h b/src/server/game/Entities/Creature/CreatureGroups.h index b790853f5e1..29832e4ff76 100644 --- a/src/server/game/Entities/Creature/CreatureGroups.h +++ b/src/server/game/Entities/Creature/CreatureGroups.h @@ -40,10 +40,17 @@ typedef std::unordered_map CreatureGro class FormationMgr { - friend class ACE_Singleton; - public: + private: FormationMgr() { } ~FormationMgr(); + + public: + static FormationMgr* instance() + { + static FormationMgr* instance = new FormationMgr(); + return instance; + } + void AddCreatureToGroup(uint32 group_id, Creature* creature); void RemoveCreatureFromGroup(CreatureGroup* group, Creature* creature); void LoadCreatureFormations(); @@ -78,6 +85,6 @@ class CreatureGroup void MemberAttackStart(Creature* member, Unit* target); }; -#define sFormationMgr ACE_Singleton::instance() +#define sFormationMgr FormationMgr::instance() #endif diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index 4573b85c7f3..e041e063080 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -310,7 +310,7 @@ void Item::UpdateDuration(Player* owner, uint32 diff) void Item::SaveToDB(SQLTransaction& trans) { - bool isInTransaction = !(trans.null()); + bool isInTransaction = !trans; if (!isInTransaction) trans = CharacterDatabase.BeginTransaction(); @@ -1129,7 +1129,7 @@ void Item::SaveRefundDataToDB() void Item::DeleteRefundDataFromDB(SQLTransaction* trans) { - if (trans && !trans->null()) + if (trans) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_REFUND_INSTANCE); stmt->setUInt32(0, GetGUIDLow()); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 9733c0f2b52..f2823cc1435 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -7326,7 +7326,7 @@ void Player::ModifyHonorPoints(int32 value, SQLTransaction* trans /*=NULL*/) newValue = 0; SetHonorPoints(uint32(newValue)); - if (trans && !trans->null()) + if (trans && !trans) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_HONOR_POINTS); stmt->setUInt32(0, newValue); @@ -7342,7 +7342,7 @@ void Player::ModifyArenaPoints(int32 value, SQLTransaction* trans /*=NULL*/) newValue = 0; SetArenaPoints(uint32(newValue)); - if (trans && !trans->null()) + if (trans && !trans) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_ARENA_POINTS); stmt->setUInt32(0, newValue); @@ -19769,7 +19769,7 @@ void Player::_SaveMail(SQLTransaction& trans) void Player::_SaveQuestStatus(SQLTransaction& trans) { - bool isTransaction = !trans.null(); + bool isTransaction = !trans; if (!isTransaction) trans = CharacterDatabase.BeginTransaction(); diff --git a/src/server/game/Entities/Player/SocialMgr.h b/src/server/game/Entities/Player/SocialMgr.h index 910c9164738..68c25fbf648 100644 --- a/src/server/game/Entities/Player/SocialMgr.h +++ b/src/server/game/Entities/Player/SocialMgr.h @@ -19,7 +19,6 @@ #ifndef __TRINITY_SOCIALMGR_H #define __TRINITY_SOCIALMGR_H -#include #include "DatabaseEnv.h" #include "Common.h" @@ -123,13 +122,17 @@ class PlayerSocial class SocialMgr { - friend class ACE_Singleton; - private: SocialMgr(); ~SocialMgr(); public: + static SocialMgr* instance() + { + static SocialMgr* instance = new SocialMgr(); + return instance; + } + // Misc void RemovePlayerSocial(uint32 guid) { m_socialMap.erase(guid); } @@ -144,5 +147,5 @@ class SocialMgr SocialMap m_socialMap; }; -#define sSocialMgr ACE_Singleton::instance() +#define sSocialMgr SocialMgr::instance() #endif diff --git a/src/server/game/Events/GameEventMgr.h b/src/server/game/Events/GameEventMgr.h index df062c6f660..94beb9912d5 100644 --- a/src/server/game/Events/GameEventMgr.h +++ b/src/server/game/Events/GameEventMgr.h @@ -22,7 +22,6 @@ #include "Common.h" #include "SharedDefines.h" #include "Define.h" -#include #define max_ge_check_delay DAY // 1 day in seconds @@ -95,13 +94,17 @@ class Quest; class GameEventMgr { - friend class ACE_Singleton; - private: GameEventMgr(); ~GameEventMgr() { }; public: + static GameEventMgr* instance() + { + static GameEventMgr* instance = new GameEventMgr(); + return instance; + } + typedef std::set ActiveEvents; typedef std::vector GameEventDataMap; ActiveEvents const& GetActiveEventList() const { return m_ActiveEvents; } @@ -180,7 +183,7 @@ class GameEventMgr GameEventGuidMap mGameEventGameobjectGuids; }; -#define sGameEventMgr ACE_Singleton::instance() +#define sGameEventMgr GameEventMgr::instance() bool IsHolidayActive(HolidayIds id); bool IsEventActive(uint16 event_id); diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index ba5940d7e12..20941901731 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -35,7 +35,6 @@ #include "Map.h" #include "ObjectAccessor.h" #include "ObjectDefines.h" -#include #include "VehicleDefines.h" #include #include @@ -687,13 +686,18 @@ class PlayerDumpReader; class ObjectMgr { friend class PlayerDumpReader; - friend class ACE_Singleton; private: ObjectMgr(); ~ObjectMgr(); public: + static ObjectMgr* instance() + { + static ObjectMgr* instance = new ObjectMgr(); + return instance; + } + typedef std::unordered_map ItemMap; typedef std::unordered_map QuestMap; @@ -1442,6 +1446,6 @@ class ObjectMgr std::set _transportMaps; // Helper container storing map ids that are for transports only, loaded from gameobject_template }; -#define sObjectMgr ACE_Singleton::instance() +#define sObjectMgr ObjectMgr::instance() #endif diff --git a/src/server/game/Groups/GroupMgr.h b/src/server/game/Groups/GroupMgr.h index a805b7514da..4bf440c881e 100644 --- a/src/server/game/Groups/GroupMgr.h +++ b/src/server/game/Groups/GroupMgr.h @@ -22,12 +22,17 @@ class GroupMgr { - friend class ACE_Singleton; private: GroupMgr(); ~GroupMgr(); public: + static GroupMgr* instance() + { + static GroupMgr* instance = new GroupMgr(); + return instance; + } + typedef std::map GroupContainer; typedef std::vector GroupDbContainer; @@ -53,6 +58,6 @@ protected: GroupDbContainer GroupDbStore; }; -#define sGroupMgr ACE_Singleton::instance() +#define sGroupMgr GroupMgr::instance() #endif diff --git a/src/server/game/Guilds/GuildMgr.h b/src/server/game/Guilds/GuildMgr.h index e8e6acb1bf0..032a8864e3e 100644 --- a/src/server/game/Guilds/GuildMgr.h +++ b/src/server/game/Guilds/GuildMgr.h @@ -22,13 +22,17 @@ class GuildMgr { - friend class ACE_Singleton; - private: GuildMgr(); ~GuildMgr(); public: + static GuildMgr* instance() + { + static GuildMgr* instance = new GuildMgr(); + return instance; + } + Guild* GetGuildByLeader(uint64 guid) const; Guild* GetGuildById(uint32 guildId) const; Guild* GetGuildByName(std::string const& guildName) const; @@ -48,6 +52,6 @@ protected: GuildContainer GuildStore; }; -#define sGuildMgr ACE_Singleton::instance() +#define sGuildMgr GuildMgr::instance() #endif diff --git a/src/server/game/Handlers/AddonHandler.cpp b/src/server/game/Handlers/AddonHandler.cpp index 806cbd1c7fc..8a00ddc22f4 100644 --- a/src/server/game/Handlers/AddonHandler.cpp +++ b/src/server/game/Handlers/AddonHandler.cpp @@ -22,10 +22,6 @@ #include "Opcodes.h" #include "Log.h" -AddonHandler::AddonHandler() { } - -AddonHandler::~AddonHandler() { } - bool AddonHandler::BuildAddonPacket(WorldPacket* source, WorldPacket* target) { ByteBuffer AddOnPacked; diff --git a/src/server/game/Handlers/AddonHandler.h b/src/server/game/Handlers/AddonHandler.h index 97a541753d0..31bbfa01900 100644 --- a/src/server/game/Handlers/AddonHandler.h +++ b/src/server/game/Handlers/AddonHandler.h @@ -21,20 +21,23 @@ #include "Common.h" #include "Config.h" -#include #include "WorldPacket.h" class AddonHandler { - /* Construction */ - friend class ACE_Singleton; - AddonHandler(); - public: - ~AddonHandler(); - //build addon packet + static AddonHandler* instance() + { + static AddonHandler* instance = new AddonHandler(); + return instance; + } + bool BuildAddonPacket(WorldPacket* Source, WorldPacket* Target); + + private: + AddonHandler() { } + ~AddonHandler() { } }; -#define sAddOnHandler ACE_Singleton::instance() +#define sAddOnHandler AddonHandler::instance() #endif diff --git a/src/server/game/Maps/MapManager.h b/src/server/game/Maps/MapManager.h index 91becb88dfe..990d5e80c1a 100644 --- a/src/server/game/Maps/MapManager.h +++ b/src/server/game/Maps/MapManager.h @@ -24,18 +24,18 @@ #include "GridStates.h" #include "MapUpdater.h" -#include -#include - - class Transport; struct TransportCreatureProto; class MapManager { - friend class ACE_Singleton; - public: + static MapManager* instance() + { + static MapManager* instance = new MapManager(); + return instance; + } + Map* CreateBaseMap(uint32 mapId); Map* FindBaseNonInstanceMap(uint32 mapId) const; Map* CreateMap(uint32 mapId, Player* player); @@ -150,5 +150,5 @@ class MapManager uint32 _nextInstanceId; MapUpdater m_updater; }; -#define sMapMgr ACE_Singleton::instance() +#define sMapMgr MapManager::instance() #endif diff --git a/src/server/game/Maps/TransportMgr.h b/src/server/game/Maps/TransportMgr.h index 5da856b185c..6ebc6316710 100644 --- a/src/server/game/Maps/TransportMgr.h +++ b/src/server/game/Maps/TransportMgr.h @@ -18,7 +18,6 @@ #ifndef TRANSPORTMGR_H #define TRANSPORTMGR_H -#include #include #include "Spline.h" #include "DBCStores.h" @@ -96,10 +95,15 @@ typedef std::map TransportAnimationContainer; class TransportMgr { - friend class ACE_Singleton; friend void LoadDBCStores(std::string const&); public: + static TransportMgr* instance() + { + static TransportMgr* instance = new TransportMgr(); + return instance; + } + void Unload(); void LoadTransportTemplates(); @@ -155,6 +159,6 @@ class TransportMgr TransportAnimationContainer _transportAnimations; }; -#define sTransportMgr ACE_Singleton::instance() +#define sTransportMgr TransportMgr::instance() #endif // TRANSPORTMGR_H diff --git a/src/server/game/Movement/MovementGenerator.h b/src/server/game/Movement/MovementGenerator.h index 5c74bef8d8c..12116b5505d 100755 --- a/src/server/game/Movement/MovementGenerator.h +++ b/src/server/game/Movement/MovementGenerator.h @@ -20,7 +20,6 @@ #define TRINITY_MOVEMENTGENERATOR_H #include "Define.h" -#include #include "ObjectRegistry.h" #include "FactoryHolder.h" #include "Common.h" diff --git a/src/server/game/Movement/Waypoints/WaypointManager.h b/src/server/game/Movement/Waypoints/WaypointManager.h index bafc6322e71..b12396293aa 100644 --- a/src/server/game/Movement/Waypoints/WaypointManager.h +++ b/src/server/game/Movement/Waypoints/WaypointManager.h @@ -19,8 +19,6 @@ #ifndef TRINITY_WAYPOINTMANAGER_H #define TRINITY_WAYPOINTMANAGER_H -#include -#include #include struct WaypointData @@ -38,9 +36,13 @@ typedef std::unordered_map WaypointPathContainer; class WaypointMgr { - friend class ACE_Singleton; - public: + static WaypointMgr* instance() + { + static WaypointMgr* instance = new WaypointMgr(); + return instance; + } + // Attempts to reload a single path from database void ReloadPath(uint32 id); @@ -58,13 +60,12 @@ class WaypointMgr } private: - // Only allow instantiation from ACE_Singleton WaypointMgr(); ~WaypointMgr(); WaypointPathContainer _waypointStore; }; -#define sWaypointMgr ACE_Singleton::instance() +#define sWaypointMgr WaypointMgr::instance() #endif diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h index 54ea2f3ba1d..ab1908e273d 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h +++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h @@ -21,7 +21,6 @@ #define OUTDOORPVP_OBJECTIVE_UPDATE_INTERVAL 1000 #include "OutdoorPvP.h" -#include class Player; class GameObject; @@ -38,13 +37,17 @@ struct OutdoorPvPData // class to handle player enter / leave / areatrigger / GO use events class OutdoorPvPMgr { - friend class ACE_Singleton; - private: OutdoorPvPMgr(); ~OutdoorPvPMgr() { }; public: + static OutdoorPvPMgr* instance() + { + static OutdoorPvPMgr* instance = new OutdoorPvPMgr(); + return instance; + } + // create outdoor pvp events void InitOutdoorPvP(); @@ -101,6 +104,6 @@ class OutdoorPvPMgr uint32 m_UpdateTimer; }; -#define sOutdoorPvPMgr ACE_Singleton::instance() +#define sOutdoorPvPMgr OutdoorPvPMgr::instance() #endif /*OUTDOOR_PVP_MGR_H_*/ diff --git a/src/server/game/Pools/PoolMgr.h b/src/server/game/Pools/PoolMgr.h index 2bc404b3a36..0a3f52b55f6 100644 --- a/src/server/game/Pools/PoolMgr.h +++ b/src/server/game/Pools/PoolMgr.h @@ -20,7 +20,6 @@ #define TRINITY_POOLHANDLER_H #include "Define.h" -#include #include "Creature.h" #include "GameObject.h" #include "QuestDef.h" @@ -104,13 +103,17 @@ typedef std::pair class PoolMgr { - friend class ACE_Singleton; - private: PoolMgr(); ~PoolMgr() { }; public: + static PoolMgr* instance() + { + static PoolMgr* instance = new PoolMgr(); + return instance; + } + void LoadFromDB(); void LoadQuestPools(); void SaveQuestsToDB(); @@ -164,7 +167,7 @@ class PoolMgr ActivePoolData mSpawnedData; }; -#define sPoolMgr ACE_Singleton::instance() +#define sPoolMgr PoolMgr::instance() // Method that tell if the creature is part of a pool and return the pool id if yes template<> diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index ee95759c72e..4f6027bedec 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -20,7 +20,6 @@ #define SC_SCRIPTMGR_H #include "Common.h" -#include #include #include "DBCStores.h" @@ -869,20 +868,23 @@ class GroupScript : public ScriptObject }; // Placed here due to ScriptRegistry::AddScript dependency. -#define sScriptMgr ACE_Singleton::instance() +#define sScriptMgr ScriptMgr::instance() // Manages registration, loading, and execution of scripts. class ScriptMgr { - friend class ACE_Singleton; friend class ScriptObject; private: - ScriptMgr(); virtual ~ScriptMgr(); public: /* Initialization */ + static ScriptMgr* instance() + { + static ScriptMgr* instance = new ScriptMgr(); + return instance; + } void Initialize(); void LoadDatabase(); diff --git a/src/server/game/Scripting/ScriptSystem.h b/src/server/game/Scripting/ScriptSystem.h index 11120f3031b..636343838c1 100644 --- a/src/server/game/Scripting/ScriptSystem.h +++ b/src/server/game/Scripting/ScriptSystem.h @@ -6,7 +6,6 @@ #define SC_SYSTEM_H #include "ScriptMgr.h" -#include #define TEXT_SOURCE_RANGE -1000000 //the amount of entries each text source has available @@ -48,11 +47,17 @@ typedef std::vector ScriptPointVector; class SystemMgr { - friend class ACE_Singleton; + private: SystemMgr() { } ~SystemMgr() { } public: + static SystemMgr* instance() + { + static SystemMgr* instance = new SystemMgr(); + return instance; + } + typedef std::unordered_map PointMoveMap; //Database @@ -75,6 +80,6 @@ class SystemMgr static ScriptPointVector const _empty; }; -#define sScriptSystemMgr ACE_Singleton::instance() +#define sScriptSystemMgr SystemMgr::instance() #endif diff --git a/src/server/game/Server/Protocol/PacketLog.h b/src/server/game/Server/Protocol/PacketLog.h index 9c60655e627..71d87bf45ae 100644 --- a/src/server/game/Server/Protocol/PacketLog.h +++ b/src/server/game/Server/Protocol/PacketLog.h @@ -19,7 +19,6 @@ #define TRINITY_PACKETLOG_H #include "Common.h" -#include enum Direction { @@ -31,13 +30,17 @@ class WorldPacket; class PacketLog { - friend class ACE_Singleton; - private: PacketLog(); ~PacketLog(); public: + static PacketLog* instance() + { + static PacketLog* instance = new PacketLog(); + return instance; + } + void Initialize(); bool CanLogPacket() const { return (_file != NULL); } void LogPacket(WorldPacket const& packet, Direction direction); @@ -46,5 +49,5 @@ class PacketLog FILE* _file; }; -#define sPacketLog ACE_Singleton::instance() +#define sPacketLog PacketLog::instance() #endif diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 0c391993c0b..7fbc398a4da 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -780,7 +780,7 @@ void WorldSession::SaveTutorialsData(SQLTransaction &trans) PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_HAS_TUTORIALS); stmt->setUInt32(0, GetAccountId()); - bool hasTutorials = !CharacterDatabase.Query(stmt).null(); + bool hasTutorials = !CharacterDatabase.Query(stmt); // Modify data in DB stmt = CharacterDatabase.GetPreparedStatement(hasTutorials ? CHAR_UPD_TUTORIALS : CHAR_INS_TUTORIALS); for (uint8 i = 0; i < MAX_ACCOUNT_TUTORIAL_VALUES; ++i) diff --git a/src/server/game/Server/WorldSocketMgr.h b/src/server/game/Server/WorldSocketMgr.h index fb8ddb42b9e..2c91a164ff9 100644 --- a/src/server/game/Server/WorldSocketMgr.h +++ b/src/server/game/Server/WorldSocketMgr.h @@ -26,7 +26,6 @@ #define __WORLDSOCKETMGR_H #include -#include #include class WorldSocket; @@ -36,9 +35,14 @@ class ACE_Event_Handler; /// Manages all sockets connected to peers and network threads class WorldSocketMgr { -public: friend class WorldSocket; - friend class ACE_Singleton; + +public: + static WorldSocketMgr* instance() + { + static WorldSocketMgr* instance = new WorldSocketMgr(); + return instance; + } /// Start network, listen at address:port . int StartNetwork(ACE_UINT16 port, const char* address); @@ -68,7 +72,7 @@ private: class WorldSocketAcceptor* m_Acceptor; }; -#define sWorldSocketMgr ACE_Singleton::instance() +#define sWorldSocketMgr WorldSocketMgr::instance() #endif /// @} diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h index 757bd813613..53b4cef73e8 100644 --- a/src/server/game/Spells/SpellMgr.h +++ b/src/server/game/Spells/SpellMgr.h @@ -21,8 +21,6 @@ // For static or at-server-startup loaded spell data -#include - #include "Define.h" #include "DBCStructure.h" #include "SharedDefines.h" @@ -603,7 +601,6 @@ bool IsDiminishingReturnsGroupDurationLimited(DiminishingGroup group); class SpellMgr { - friend class ACE_Singleton; // Constructors private: SpellMgr(); @@ -611,6 +608,13 @@ class SpellMgr // Accessors (const or static functions) public: + static SpellMgr* instance() + { + static SpellMgr* instance = new SpellMgr(); + + return instance; + } + // Spell correctness for client using static bool IsSpellValid(SpellInfo const* spellInfo, Player* player = NULL, bool msg = true); @@ -766,6 +770,6 @@ class SpellMgr SpellInfoMap mSpellInfoMap; }; -#define sSpellMgr ACE_Singleton::instance() +#define sSpellMgr SpellMgr::instance() #endif diff --git a/src/server/game/Texts/CreatureTextMgr.h b/src/server/game/Texts/CreatureTextMgr.h index ab5b9f59032..f8c499f7ce6 100644 --- a/src/server/game/Texts/CreatureTextMgr.h +++ b/src/server/game/Texts/CreatureTextMgr.h @@ -82,11 +82,17 @@ typedef std::unordered_map CreatureTextRepeatMa class CreatureTextMgr { - friend class ACE_Singleton; - CreatureTextMgr() { }; + private: + CreatureTextMgr() { }; + ~CreatureTextMgr() { }; public: - ~CreatureTextMgr() { }; + static CreatureTextMgr* instance() + { + static CreatureTextMgr* instance = new CreatureTextMgr(); + return instance; + } + void LoadCreatureTexts(); void LoadCreatureTextLocales(); CreatureTextMap const& GetTextMap() const { return mTextMap; } @@ -113,7 +119,7 @@ class CreatureTextMgr LocaleCreatureTextMap mLocaleTextMap; }; -#define sCreatureTextMgr ACE_Singleton::instance() +#define sCreatureTextMgr CreatureTextMgr::instance() template class CreatureTextLocalizer diff --git a/src/server/game/Tickets/TicketMgr.h b/src/server/game/Tickets/TicketMgr.h index 5bfe78abbba..5f85ee307ed 100644 --- a/src/server/game/Tickets/TicketMgr.h +++ b/src/server/game/Tickets/TicketMgr.h @@ -19,7 +19,6 @@ #define _TICKETMGR_H #include -#include #include "ObjectMgr.h" @@ -174,13 +173,17 @@ typedef std::map GmTicketList; class TicketMgr { - friend class ACE_Singleton; - private: TicketMgr(); ~TicketMgr(); public: + static TicketMgr* instance() + { + static TicketMgr* instance = new TicketMgr(); + return instance; + } + void LoadTickets(); void LoadSurveys(); @@ -246,6 +249,6 @@ protected: uint64 _lastChange; }; -#define sTicketMgr ACE_Singleton::instance() +#define sTicketMgr TicketMgr::instance() #endif // _TICKETMGR_H diff --git a/src/server/game/Warden/WardenCheckMgr.h b/src/server/game/Warden/WardenCheckMgr.h index 8f2fa37400d..1108c9a6521 100644 --- a/src/server/game/Warden/WardenCheckMgr.h +++ b/src/server/game/Warden/WardenCheckMgr.h @@ -48,11 +48,17 @@ struct WardenCheckResult class WardenCheckMgr { - friend class ACE_Singleton; - WardenCheckMgr(); - ~WardenCheckMgr(); + private: + WardenCheckMgr(); + ~WardenCheckMgr(); public: + static WardenCheckMgr* instance() + { + static WardenCheckMgr* instance = new WardenCheckMgr(); + return instance; + } + // We have a linear key without any gaps, so we use vector for fast access typedef std::vector CheckContainer; typedef std::map CheckResultContainer; @@ -73,6 +79,6 @@ class WardenCheckMgr CheckResultContainer CheckResultStore; }; -#define sWardenCheckMgr ACE_Singleton::instance() +#define sWardenCheckMgr WardenCheckMgr::instance() #endif diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp index 5cf5cde75fd..5274dcd358d 100644 --- a/src/server/game/Weather/WeatherMgr.cpp +++ b/src/server/game/Weather/WeatherMgr.cpp @@ -34,7 +34,7 @@ namespace WeatherMgr namespace { - typedef std::unordered_map > WeatherMap; + typedef std::unordered_map > WeatherMap; typedef std::unordered_map WeatherZoneMap; WeatherMap m_weathers; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 234a366b08e..4a46412dff7 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -668,7 +668,7 @@ void World::LoadConfigSettings(bool reload) m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP] = sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Group", false); m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD] = sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Guild", false); m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION] = sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Auction", false); - m_bool_configs[CONFIG_ALLOW_TWO_SIDE_TRADE] = sConfigMgr->GetBoolDefault("AllowTwoSide.trade", false); + m_bool_configs[CONFIG_ALLOW_TWO_SIDE_TRADE] = sConfigMgr->GetBoolDefault("AllowTwoSide.Trade", false); m_int_configs[CONFIG_STRICT_PLAYER_NAMES] = sConfigMgr->GetIntDefault ("StrictPlayerNames", 0); m_int_configs[CONFIG_STRICT_CHARTER_NAMES] = sConfigMgr->GetIntDefault ("StrictCharterNames", 0); m_int_configs[CONFIG_STRICT_PET_NAMES] = sConfigMgr->GetIntDefault ("StrictPetNames", 0); @@ -1255,8 +1255,6 @@ void World::LoadConfigSettings(bool reload) m_bool_configs[CONFIG_IP_BASED_ACTION_LOGGING] = sConfigMgr->GetBoolDefault("Allow.IP.Based.Action.Logging", false); - m_bool_configs[CONFIG_IP_BASED_LOGIN_LOGGING] = sConfigMgr->GetBoolDefault("Wrong.Password.Login.Logging", false); - // call ScriptMgr if we're reloading the configuration if (reload) sScriptMgr->OnConfigLoad(reload); diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 4096dd7399a..f9528c793f7 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -25,9 +25,7 @@ #include "Common.h" #include "Timer.h" -#include #include -#include #include "SharedDefines.h" #include "QueryResult.h" #include "Callback.h" @@ -156,7 +154,6 @@ enum WorldBoolConfigs CONFIG_STATS_LIMITS_ENABLE, CONFIG_INSTANCES_RESET_ANNOUNCE, CONFIG_IP_BASED_ACTION_LOGGING, - CONFIG_IP_BASED_LOGIN_LOGGING, BOOL_CONFIG_VALUE_COUNT }; @@ -520,10 +517,13 @@ struct CharacterNameData class World { public: - static ACE_Atomic_Op m_worldLoopCounter; + static World* instance() + { + static World* instance = new World(); + return instance; + } - World(); - ~World(); + static ACE_Atomic_Op m_worldLoopCounter; WorldSession* FindSession(uint32 id) const; void AddSession(WorldSession* s); @@ -758,6 +758,9 @@ class World void ResetRandomBG(); void ResetGuildCap(); private: + World(); + ~World(); + static ACE_Atomic_Op m_stopEvent; static uint8 m_ExitCode; uint32 m_ShutdownTimer; @@ -845,6 +848,6 @@ class World extern uint32 realmID; -#define sWorld ACE_Singleton::instance() +#define sWorld World::instance() #endif /// @} diff --git a/src/server/shared/Cryptography/ARC4.h b/src/server/shared/Cryptography/ARC4.h index 5304b0730a6..11d3d4ba87b 100644 --- a/src/server/shared/Cryptography/ARC4.h +++ b/src/server/shared/Cryptography/ARC4.h @@ -19,8 +19,8 @@ #ifndef _AUTH_SARC4_H #define _AUTH_SARC4_H -#include "Define.h" #include +#include "Define.h" class ARC4 { diff --git a/src/server/shared/Cryptography/BigNumber.h b/src/server/shared/Cryptography/BigNumber.h index 848b3da3e2d..684a25e8801 100644 --- a/src/server/shared/Cryptography/BigNumber.h +++ b/src/server/shared/Cryptography/BigNumber.h @@ -22,7 +22,6 @@ #include #include "Define.h" - struct bignum_st; class BigNumber diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h index e56dcc329cd..4b9e887f341 100644 --- a/src/server/shared/Database/DatabaseWorkerPool.h +++ b/src/server/shared/Database/DatabaseWorkerPool.h @@ -18,8 +18,6 @@ #ifndef _DATABASEWORKERPOOL_H #define _DATABASEWORKERPOOL_H -#include - #include "Common.h" #include "Callback.h" #include "MySQLConnection.h" @@ -51,7 +49,6 @@ class DatabaseWorkerPool /* Activity state */ DatabaseWorkerPool() : _connectionInfo(NULL) { - _messageQueue = new ACE_Message_Queue(8 * 1024 * 1024, 8 * 1024 * 1024); _queue = new ProducerConsumerQueue(); memset(_connectionCount, 0, sizeof(_connectionCount)); _connections.resize(IDX_SIZE); @@ -125,9 +122,7 @@ class DatabaseWorkerPool for (uint8 i = 0; i < _connectionCount[IDX_SYNCH]; ++i) _connections[IDX_SYNCH][i]->Close(); - //! Deletes the ACE_Activation_Queue object and its underlying ACE_Message_Queue delete _queue; - delete _messageQueue; TC_LOG_INFO("sql.driver", "All connections on DatabasePool '%s' closed.", GetDatabaseName()); @@ -410,7 +405,7 @@ class DatabaseWorkerPool //! Will be wrapped in a transaction if valid object is present, otherwise executed standalone. void ExecuteOrAppend(SQLTransaction& trans, PreparedStatement* stmt) { - if (trans.null()) + if (!trans) Execute(stmt); else trans->Append(stmt); @@ -420,7 +415,7 @@ class DatabaseWorkerPool //! Will be wrapped in a transaction if valid object is present, otherwise executed standalone. void ExecuteOrAppend(SQLTransaction& trans, const char* sql) { - if (trans.null()) + if (!trans) Execute(sql); else trans->Append(sql); @@ -517,7 +512,6 @@ class DatabaseWorkerPool IDX_SIZE }; - ACE_Message_Queue* _messageQueue; //! Message Queue used by ACE_Activation_Queue ProducerConsumerQueue* _queue; //! Queue shared by async worker threads. std::vector< std::vector > _connections; uint32 _connectionCount[2]; //! Counter of MySQL connections; diff --git a/src/server/shared/Database/MySQLConnection.h b/src/server/shared/Database/MySQLConnection.h index 3b7efeb5846..61b3b37cbc2 100644 --- a/src/server/shared/Database/MySQLConnection.h +++ b/src/server/shared/Database/MySQLConnection.h @@ -15,8 +15,6 @@ * with this program. If not, see . */ -#include - #include "DatabaseWorkerPool.h" #include "Transaction.h" #include "Util.h" @@ -100,13 +98,13 @@ class MySQLConnection { /// Tries to acquire lock. If lock is acquired by another thread /// the calling parent will just try another connection - return m_Mutex.tryacquire() != -1; + return m_Mutex.try_lock(); } void Unlock() { /// Called by parent databasepool. Will let other threads access this connection - m_Mutex.release(); + m_Mutex.unlock(); } MYSQL* GetHandle() { return m_Mysql; } @@ -131,7 +129,7 @@ class MySQLConnection MYSQL * m_Mysql; //! MySQL Handle. MySQLConnectionInfo& m_connectionInfo; //! Connection info (used for logging) ConnectionFlags m_connectionFlags; //! Connection flags (for preparing relevant statements) - ACE_Thread_Mutex m_Mutex; + std::mutex m_Mutex; MySQLConnection(MySQLConnection const& right) = delete; MySQLConnection& operator=(MySQLConnection const& right) = delete; diff --git a/src/server/shared/Database/QueryResult.h b/src/server/shared/Database/QueryResult.h index 4795fef4a4c..e8c277c03cf 100644 --- a/src/server/shared/Database/QueryResult.h +++ b/src/server/shared/Database/QueryResult.h @@ -19,9 +19,7 @@ #ifndef QUERYRESULT_H #define QUERYRESULT_H -#include "AutoPtr.h" -#include - +#include #include "Field.h" #ifdef _WIN32 @@ -60,7 +58,7 @@ class ResultSet ResultSet& operator=(ResultSet const& right) = delete; }; -typedef Trinity::AutoPtr QueryResult; +typedef std::shared_ptr QueryResult; class PreparedResultSet { @@ -107,7 +105,7 @@ class PreparedResultSet PreparedResultSet& operator=(PreparedResultSet const& right) = delete; }; -typedef Trinity::AutoPtr PreparedQueryResult; +typedef std::shared_ptr PreparedQueryResult; #endif diff --git a/src/server/shared/Database/Transaction.h b/src/server/shared/Database/Transaction.h index cb28f0ad876..c7cbbbbe712 100644 --- a/src/server/shared/Database/Transaction.h +++ b/src/server/shared/Database/Transaction.h @@ -50,7 +50,7 @@ class Transaction bool _cleanedUp; }; -typedef Trinity::AutoPtr SQLTransaction; +typedef std::shared_ptr SQLTransaction; /*! Low level class*/ class TransactionTask : public SQLOperation diff --git a/src/server/shared/Debugging/Errors.cpp b/src/server/shared/Debugging/Errors.cpp index d656dc3fb4a..62e97d56d42 100644 --- a/src/server/shared/Debugging/Errors.cpp +++ b/src/server/shared/Debugging/Errors.cpp @@ -18,17 +18,15 @@ #include "Errors.h" -#include -#include #include +#include namespace Trinity { void Assert(char const* file, int line, char const* function, char const* message) { - ACE_Stack_Trace st; - fprintf(stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n", - file, line, function, message, st.c_str()); + fprintf(stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s\n", + file, line, function, message); *((volatile int*)NULL) = 0; exit(1); } @@ -37,7 +35,8 @@ void Fatal(char const* file, int line, char const* function, char const* message { fprintf(stderr, "\n%s:%i in %s FATAL ERROR:\n %s\n", file, line, function, message); - ACE_OS::sleep(10); + + std::this_thread::sleep_for(std::chrono::seconds(10)); *((volatile int*)NULL) = 0; exit(1); } diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index 84d0dc14eca..67213d0ddd0 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -18,10 +18,10 @@ #ifndef APPENDER_H #define APPENDER_H -#include "Define.h" -#include #include #include +#include +#include "Define.h" // Values assigned have their equivalent in enum ACE_Log_Priority enum LogLevel diff --git a/src/server/shared/Logging/AppenderConsole.h b/src/server/shared/Logging/AppenderConsole.h index 1aaa74e96ec..b8f15b4fa0f 100644 --- a/src/server/shared/Logging/AppenderConsole.h +++ b/src/server/shared/Logging/AppenderConsole.h @@ -18,8 +18,8 @@ #ifndef APPENDERCONSOLE_H #define APPENDERCONSOLE_H -#include "Appender.h" #include +#include "Appender.h" enum ColorTypes { diff --git a/src/server/shared/Logging/AppenderFile.h b/src/server/shared/Logging/AppenderFile.h index 592742c2184..a600c92d152 100644 --- a/src/server/shared/Logging/AppenderFile.h +++ b/src/server/shared/Logging/AppenderFile.h @@ -18,8 +18,8 @@ #ifndef APPENDERFILE_H #define APPENDERFILE_H -#include "Appender.h" #include +#include "Appender.h" class AppenderFile: public Appender { diff --git a/src/server/shared/Threading/Callback.h b/src/server/shared/Threading/Callback.h index a6aa11b3958..5d9dc9a760d 100644 --- a/src/server/shared/Threading/Callback.h +++ b/src/server/shared/Threading/Callback.h @@ -26,10 +26,6 @@ typedef std::promise QueryResultPromise; typedef std::future PreparedQueryResultFuture; typedef std::promise PreparedQueryResultPromise; -/*! A simple template using ACE_Future to manage callbacks from the thread and object that - issued the request. is variable type of parameter that is used as parameter - for the callback function. -*/ #define CALLBACK_STAGE_INVALID uint8(-1) template @@ -210,4 +206,4 @@ class QueryCallback_2 QueryCallback_2& operator=(QueryCallback_2 const& right) = delete; }; -#endif \ No newline at end of file +#endif diff --git a/src/server/shared/Threading/DelayExecutor.cpp b/src/server/shared/Threading/DelayExecutor.cpp index 0db45a8ff8f..ef3c028fd97 100644 --- a/src/server/shared/Threading/DelayExecutor.cpp +++ b/src/server/shared/Threading/DelayExecutor.cpp @@ -1,4 +1,20 @@ -#include +/* +* Copyright (C) 2008-2014 TrinityCore +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program. If not, see . +*/ + #include #include diff --git a/src/server/shared/Threading/DelayExecutor.h b/src/server/shared/Threading/DelayExecutor.h index 5eaaacdb98b..2a3721263fc 100644 --- a/src/server/shared/Threading/DelayExecutor.h +++ b/src/server/shared/Threading/DelayExecutor.h @@ -8,7 +8,6 @@ class DelayExecutor : protected ACE_Task_Base { public: - DelayExecutor(); virtual ~DelayExecutor(); @@ -25,7 +24,6 @@ class DelayExecutor : protected ACE_Task_Base virtual int svc(); private: - ACE_Activation_Queue queue_; ACE_Method_Request* pre_svc_hook_; ACE_Method_Request* post_svc_hook_; diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index 2a8fcdd431a..41060e37b38 100644 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -22,8 +22,6 @@ #include -#include - #include "Common.h" #include "SystemConfig.h" #include "SignalHandler.h" @@ -46,6 +44,7 @@ #include "BigNumber.h" #include "OpenSSLCrypto.h" +#include #ifdef _WIN32 #include "ServiceWin32.h" @@ -58,27 +57,22 @@ extern int m_ServiceStatus; #define PROCESS_HIGH_PRIORITY -15 // [-20, 19], default is 0 #endif -/// Handle worldservers's termination signals -class WorldServerSignalHandler : public Trinity::SignalHandler +boost::asio::io_service _ioService; + +void SignalHandler(const boost::system::error_code& error, int signalNumber) { - public: - virtual void HandleSignal(int sigNum) + if (!error) + { + switch (signalNumber) { - switch (sigNum) - { - case SIGINT: - World::StopNow(RESTART_EXIT_CODE); - break; - case SIGTERM: -#ifdef _WIN32 - case SIGBREAK: - if (m_ServiceStatus != 1) -#endif - World::StopNow(SHUTDOWN_EXIT_CODE); - break; - } + case SIGINT: + case SIGTERM: + _ioService.stop(); + break; } -}; + } +} + void FreezeDetectorThread(uint32 delayTime) { @@ -153,23 +147,12 @@ int Master::Run() ///- Initialize the World sWorld->SetInitialWorldSettings(); - ///- Initialize the signal handlers - WorldServerSignalHandler signalINT, signalTERM; - #ifdef _WIN32 - WorldServerSignalHandler signalBREAK; - #endif /* _WIN32 */ - - ///- Register worldserver's signal handlers - ACE_Sig_Handler handle; - handle.register_handler(SIGINT, &signalINT); - handle.register_handler(SIGTERM, &signalTERM); -#ifdef _WIN32 - handle.register_handler(SIGBREAK, &signalBREAK); -#endif + // Set signal handlers + boost::asio::signal_set signals(_ioService, SIGINT, SIGTERM); + signals.async_wait(SignalHandler); ///- Launch WorldRunnable thread - - std::thread worldThread(WorldThread); + std::thread worldThread(WorldThread, std::ref(_ioService)); std::thread* cliThread = nullptr; @@ -286,6 +269,8 @@ int Master::Run() TC_LOG_INFO("server.worldserver", "%s (worldserver-daemon) ready...", _FULLVERSION); + _ioService.run(); + // when the main thread closes the singletons get unloaded // since worldrunnable uses them, it will crash if unloaded after master worldThread.join(); diff --git a/src/server/worldserver/Master.h b/src/server/worldserver/Master.h index 9ee94a44acb..d2a51b85f4b 100644 --- a/src/server/worldserver/Master.h +++ b/src/server/worldserver/Master.h @@ -29,6 +29,12 @@ class Master { public: + static Master* instance() + { + static Master* instance = new Master(); + return instance; + } + int Run(); private: @@ -38,7 +44,7 @@ class Master void ClearOnlineAccounts(); }; -#define sMaster ACE_Singleton::instance() +#define sMaster Master::instance() #endif diff --git a/src/server/worldserver/WorldThread/WorldRunnable.cpp b/src/server/worldserver/WorldThread/WorldRunnable.cpp index 7722492b5a8..85c3e7a74b9 100644 --- a/src/server/worldserver/WorldThread/WorldRunnable.cpp +++ b/src/server/worldserver/WorldThread/WorldRunnable.cpp @@ -42,7 +42,7 @@ extern int m_ServiceStatus; #endif /// Heartbeat for the World -void WorldThread() +void WorldThread(boost::asio::io_service& ioService) { uint32 realCurrTime = 0; uint32 realPrevTime = getMSTime(); @@ -84,6 +84,8 @@ void WorldThread() #endif } + ioService.stop(); + sScriptMgr->OnShutdown(); sWorld->KickAll(); // save and kick all players diff --git a/src/server/worldserver/WorldThread/WorldRunnable.h b/src/server/worldserver/WorldThread/WorldRunnable.h index 915bd5b580a..3e2c07b8842 100644 --- a/src/server/worldserver/WorldThread/WorldRunnable.h +++ b/src/server/worldserver/WorldThread/WorldRunnable.h @@ -23,7 +23,9 @@ #ifndef __WORLDRUNNABLE_H #define __WORLDRUNNABLE_H -void WorldThread(); +#include + +void WorldThread(boost::asio::io_service& ioService); #endif -- cgit v1.2.3 From f8e829da65c41cb753cec6cd9c59ae8a65434bce Mon Sep 17 00:00:00 2001 From: leak Date: Tue, 1 Jul 2014 00:57:29 +0200 Subject: Removed useless SignalHandler class --- src/server/shared/Utilities/SignalHandler.h | 41 ----------------------------- 1 file changed, 41 deletions(-) delete mode 100644 src/server/shared/Utilities/SignalHandler.h (limited to 'src') diff --git a/src/server/shared/Utilities/SignalHandler.h b/src/server/shared/Utilities/SignalHandler.h deleted file mode 100644 index 41e867c3d1a..00000000000 --- a/src/server/shared/Utilities/SignalHandler.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2008-2014 TrinityCore - * Copyright (C) 2005-2010 MaNGOS - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef __SIGNAL_HANDLER_H__ -#define __SIGNAL_HANDLER_H__ - -#include - -namespace Trinity -{ - -/// Handle termination signals -class SignalHandler : public ACE_Event_Handler -{ - public: - int handle_signal(int SigNum, siginfo_t* = NULL, ucontext_t* = NULL) - { - HandleSignal(SigNum); - return 0; - } - virtual void HandleSignal(int /*SigNum*/) { }; -}; - -} - -#endif /* __SIGNAL_HANDLER_H__ */ -- cgit v1.2.3 From 25e633aa34ef227841b4092270d862b0864dc372 Mon Sep 17 00:00:00 2001 From: leak Date: Wed, 2 Jul 2014 00:41:30 +0200 Subject: Replaced ACE_Method_Request based DelayExecutor by PCQ impl Untested due to worldserver still breaking because of ACE threading fails --- src/server/game/Maps/MapManager.cpp | 4 +- src/server/game/Maps/MapUpdater.cpp | 71 ++++++++------- src/server/game/Maps/MapUpdater.h | 21 +++-- src/server/game/Weather/WeatherMgr.cpp | 1 - src/server/shared/AutoPtr.h | 53 ----------- src/server/shared/Threading/DelayExecutor.cpp | 126 -------------------------- src/server/shared/Threading/DelayExecutor.h | 35 ------- src/server/worldserver/Master.cpp | 1 - 8 files changed, 54 insertions(+), 258 deletions(-) delete mode 100644 src/server/shared/AutoPtr.h delete mode 100644 src/server/shared/Threading/DelayExecutor.cpp delete mode 100644 src/server/shared/Threading/DelayExecutor.h (limited to 'src') diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index 2b8dbde8280..1de13d137c4 100644 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -52,8 +52,8 @@ void MapManager::Initialize() int num_threads(sWorld->getIntConfig(CONFIG_NUMTHREADS)); // Start mtmaps if needed. - if (num_threads > 0 && m_updater.activate(num_threads) == -1) - abort(); + if (num_threads > 0) + m_updater.activate(num_threads); } void MapManager::InitializeVisibilityDistanceInfo() diff --git a/src/server/game/Maps/MapUpdater.cpp b/src/server/game/Maps/MapUpdater.cpp index 2a6b810fcef..4ab95d87d48 100644 --- a/src/server/game/Maps/MapUpdater.cpp +++ b/src/server/game/Maps/MapUpdater.cpp @@ -18,57 +18,61 @@ #include #include -#include #include "MapUpdater.h" -#include "DelayExecutor.h" #include "Map.h" -#include "DatabaseEnv.h" -class MapUpdateRequest : public ACE_Method_Request +class MapUpdateRequest { private: Map& m_map; MapUpdater& m_updater; - ACE_UINT32 m_diff; + uint32 m_diff; public: - MapUpdateRequest(Map& m, MapUpdater& u, ACE_UINT32 d) + MapUpdateRequest(Map& m, MapUpdater& u, uint32 d) : m_map(m), m_updater(u), m_diff(d) { } - virtual int call() + void call() { m_map.Update (m_diff); m_updater.update_finished(); - return 0; } }; -MapUpdater::MapUpdater(): m_executor(), pending_requests(0) { } +MapUpdater::MapUpdater(): pending_requests(0) { } MapUpdater::~MapUpdater() { deactivate(); } -int MapUpdater::activate(size_t num_threads) +void MapUpdater::activate(size_t num_threads) { - return m_executor.start((int)num_threads); + for (size_t i = 0; i < num_threads; ++i) + { + _workerThreads.push_back(std::thread(&MapUpdater::WorkerThread, this)); + } } -int MapUpdater::deactivate() +void MapUpdater::deactivate() { wait(); - return m_executor.deactivate(); + _queue.Cancel(); + + for (auto& thread : _workerThreads) + { + thread.join(); + } } -int MapUpdater::wait() +void MapUpdater::wait() { std::unique_lock lock(_lock); @@ -76,43 +80,44 @@ int MapUpdater::wait() _condition.wait(lock); lock.unlock(); - - return 0; } -int MapUpdater::schedule_update(Map& map, ACE_UINT32 diff) +void MapUpdater::schedule_update(Map& map, uint32 diff) { std::lock_guard lock(_lock); ++pending_requests; - if (m_executor.execute(new MapUpdateRequest(map, *this, diff)) == -1) - { - ACE_DEBUG((LM_ERROR, ACE_TEXT("(%t) \n"), ACE_TEXT("Failed to schedule Map Update"))); - - --pending_requests; - return -1; - } - - return 0; + _queue.Push(new MapUpdateRequest(map, *this, diff)); } bool MapUpdater::activated() { - return m_executor.activated(); + return _workerThreads.size() > 0; } void MapUpdater::update_finished() { std::lock_guard lock(_lock); - if (pending_requests == 0) - { - ACE_ERROR((LM_ERROR, ACE_TEXT("(%t)\n"), ACE_TEXT("MapUpdater::update_finished BUG, report to devs"))); - return; - } - --pending_requests; _condition.notify_all(); } + +void MapUpdater::WorkerThread() +{ + while (1) + { + MapUpdateRequest* request = nullptr; + + _queue.WaitAndPop(request); + + if (_cancelationToken) + return; + + request->call(); + + delete request; + } +} diff --git a/src/server/game/Maps/MapUpdater.h b/src/server/game/Maps/MapUpdater.h index 8461b53e992..ff1d85a23e9 100644 --- a/src/server/game/Maps/MapUpdater.h +++ b/src/server/game/Maps/MapUpdater.h @@ -19,10 +19,11 @@ #ifndef _MAP_UPDATER_H_INCLUDED #define _MAP_UPDATER_H_INCLUDED +#include "Define.h" #include +#include #include - -#include "DelayExecutor.h" +#include "ProducerConsumerQueue.h" class Map; @@ -35,24 +36,30 @@ class MapUpdater friend class MapUpdateRequest; - int schedule_update(Map& map, ACE_UINT32 diff); + void schedule_update(Map& map, uint32 diff); - int wait(); + void wait(); - int activate(size_t num_threads); + void activate(size_t num_threads); - int deactivate(); + void deactivate(); bool activated(); private: - DelayExecutor m_executor; + ProducerConsumerQueue _queue; + + std::vector _workerThreads; + std::atomic_bool _cancelationToken; + std::mutex _lock; std::condition_variable _condition; size_t pending_requests; void update_finished(); + + void WorkerThread(); }; #endif //_MAP_UPDATER_H_INCLUDED diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp index 5274dcd358d..938c91b0228 100644 --- a/src/server/game/Weather/WeatherMgr.cpp +++ b/src/server/game/Weather/WeatherMgr.cpp @@ -24,7 +24,6 @@ #include "Weather.h" #include "Log.h" #include "ObjectMgr.h" -#include "AutoPtr.h" #include "Player.h" #include "WorldPacket.h" #include "WorldSession.h" diff --git a/src/server/shared/AutoPtr.h b/src/server/shared/AutoPtr.h deleted file mode 100644 index 96ecbfc79fe..00000000000 --- a/src/server/shared/AutoPtr.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2008-2014 TrinityCore - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef _TRINITY_AUTO_PTR_H -#define _TRINITY_AUTO_PTR_H - -#include - -namespace Trinity -{ - -template -class AutoPtr : public ACE_Strong_Bound_Ptr -{ - typedef ACE_Strong_Bound_Ptr Base; - -public: - AutoPtr() - : Base() - { } - - AutoPtr(Pointer* x) - : Base(x) - { } - - operator bool() const - { - return !Base::null(); - } - - bool operator !() const - { - return Base::null(); - } -}; - -} // namespace Trinity - -#endif diff --git a/src/server/shared/Threading/DelayExecutor.cpp b/src/server/shared/Threading/DelayExecutor.cpp deleted file mode 100644 index ef3c028fd97..00000000000 --- a/src/server/shared/Threading/DelayExecutor.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* -* Copyright (C) 2008-2014 TrinityCore -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by the -* Free Software Foundation; either version 2 of the License, or (at your -* option) any later version. -* -* This program is distributed in the hope that it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -* more details. -* -* You should have received a copy of the GNU General Public License along -* with this program. If not, see . -*/ - -#include -#include - -#include "DelayExecutor.h" - -DelayExecutor* DelayExecutor::instance() -{ - static DelayExecutor* instance = new DelayExecutor(); - return instance; -} - -DelayExecutor::DelayExecutor() - : pre_svc_hook_(0), post_svc_hook_(0), activated_(false) { } - -DelayExecutor::~DelayExecutor() -{ - if (pre_svc_hook_) - delete pre_svc_hook_; - - if (post_svc_hook_) - delete post_svc_hook_; - - deactivate(); -} - -int DelayExecutor::deactivate() -{ - if (!activated()) - return -1; - - activated(false); - queue_.queue()->deactivate(); - wait(); - - return 0; -} - -int DelayExecutor::svc() -{ - if (pre_svc_hook_) - pre_svc_hook_->call(); - - for (;;) - { - ACE_Method_Request* rq = queue_.dequeue(); - - if (!rq) - break; - - rq->call(); - delete rq; - } - - if (post_svc_hook_) - post_svc_hook_->call(); - - return 0; -} - -int DelayExecutor::start(int num_threads, ACE_Method_Request* pre_svc_hook, ACE_Method_Request* post_svc_hook) -{ - if (activated()) - return -1; - - if (num_threads < 1) - return -1; - - if (pre_svc_hook_) - delete pre_svc_hook_; - - if (post_svc_hook_) - delete post_svc_hook_; - - pre_svc_hook_ = pre_svc_hook; - post_svc_hook_ = post_svc_hook; - - queue_.queue()->activate(); - - if (ACE_Task_Base::activate(THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED, num_threads) == -1) - return -1; - - activated(true); - - return true; -} - -int DelayExecutor::execute(ACE_Method_Request* new_req) -{ - if (new_req == NULL) - return -1; - - if (queue_.enqueue(new_req, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1) - { - delete new_req; - ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("(%t) %p\n"), ACE_TEXT("DelayExecutor::execute enqueue")), -1); - } - - return 0; -} - -bool DelayExecutor::activated() -{ - return activated_; -} - -void DelayExecutor::activated(bool s) -{ - activated_ = s; -} diff --git a/src/server/shared/Threading/DelayExecutor.h b/src/server/shared/Threading/DelayExecutor.h deleted file mode 100644 index 2a3721263fc..00000000000 --- a/src/server/shared/Threading/DelayExecutor.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef _M_DELAY_EXECUTOR_H -#define _M_DELAY_EXECUTOR_H - -#include -#include -#include - -class DelayExecutor : protected ACE_Task_Base -{ - public: - DelayExecutor(); - virtual ~DelayExecutor(); - - static DelayExecutor* instance(); - - int execute(ACE_Method_Request* new_req); - - int start(int num_threads = 1, ACE_Method_Request* pre_svc_hook = NULL, ACE_Method_Request* post_svc_hook = NULL); - - int deactivate(); - - bool activated(); - - virtual int svc(); - - private: - ACE_Activation_Queue queue_; - ACE_Method_Request* pre_svc_hook_; - ACE_Method_Request* post_svc_hook_; - bool activated_; - - void activated(bool s); -}; - -#endif // _M_DELAY_EXECUTOR_H diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index 41060e37b38..ecc3e31a349 100644 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -24,7 +24,6 @@ #include "Common.h" #include "SystemConfig.h" -#include "SignalHandler.h" #include "World.h" #include "WorldRunnable.h" #include "WorldSocket.h" -- cgit v1.2.3 From 66c94ce965b763a3c144c0e542e7329a24a3a2e3 Mon Sep 17 00:00:00 2001 From: leak Date: Wed, 2 Jul 2014 00:43:47 +0200 Subject: Delinking ACE from Shared and authserver --- src/server/authserver/CMakeLists.txt | 2 -- src/server/shared/CMakeLists.txt | 5 ----- 2 files changed, 7 deletions(-) (limited to 'src') diff --git a/src/server/authserver/CMakeLists.txt b/src/server/authserver/CMakeLists.txt index 6d11ce21c00..bde75654c92 100644 --- a/src/server/authserver/CMakeLists.txt +++ b/src/server/authserver/CMakeLists.txt @@ -56,7 +56,6 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/Authentication ${CMAKE_CURRENT_SOURCE_DIR}/Realms ${CMAKE_CURRENT_SOURCE_DIR}/Server - ${ACE_INCLUDE_DIR} ${MYSQL_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR} ) @@ -79,7 +78,6 @@ target_link_libraries(authserver ${MYSQL_LIBRARY} ${OPENSSL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} - ${ACE_LIBRARY} ${Boost_LIBRARIES} ) diff --git a/src/server/shared/CMakeLists.txt b/src/server/shared/CMakeLists.txt index af113801067..63aecab0fb7 100644 --- a/src/server/shared/CMakeLists.txt +++ b/src/server/shared/CMakeLists.txt @@ -72,7 +72,6 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/Threading ${CMAKE_CURRENT_SOURCE_DIR}/Utilities ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Object - ${ACE_INCLUDE_DIR} ${MYSQL_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR} ) @@ -82,10 +81,6 @@ add_library(shared STATIC ${shared_STAT_PCH_SRC} ) -target_link_libraries(shared - ${ACE_LIBRARY} -) - # Generate precompiled header if (USE_COREPCH) add_cxx_pch(shared ${shared_STAT_PCH_HDR} ${shared_STAT_PCH_SRC}) -- cgit v1.2.3 From e0aed65c8ce46053b078bce0ea237db249e5b1dc Mon Sep 17 00:00:00 2001 From: leak Date: Wed, 2 Jul 2014 02:20:53 +0200 Subject: ACE cleanup on game, now the major issue remains WorldSocket --- cmake/compiler/msvc/settings.cmake | 2 +- src/server/game/Battlegrounds/BattlegroundQueue.cpp | 1 - src/server/game/Maps/Map.h | 2 -- src/server/game/Scripting/ScriptMgr.cpp | 6 ++++-- src/server/game/Scripting/ScriptMgr.h | 5 ++--- src/server/game/Server/WorldSession.h | 5 +++-- src/server/game/Warden/WardenCheckMgr.cpp | 2 +- src/server/game/Warden/WardenCheckMgr.h | 4 +++- src/server/game/Warden/WardenWin.cpp | 4 ++-- src/server/game/World/World.cpp | 8 +++++--- src/server/game/World/World.h | 8 ++++---- 11 files changed, 25 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/cmake/compiler/msvc/settings.cmake b/cmake/compiler/msvc/settings.cmake index 3194967c346..700ab234d37 100644 --- a/cmake/compiler/msvc/settings.cmake +++ b/cmake/compiler/msvc/settings.cmake @@ -50,7 +50,7 @@ message(STATUS "MSVC: Disabled POSIX warnings") if(NOT WITH_WARNINGS) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267 /wd4619") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267 /wd4619") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267 /wd4619 /wd4800") message(STATUS "MSVC: Disabled generic compiletime warnings") endif() diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index 547d6e972c5..2f632377756 100644 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -191,7 +191,6 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, Battlegr //add GroupInfo to m_QueuedGroups { - //ACE_Guard guard(m_Lock); m_QueuedGroups[bracketId][index].push_back(ginfo); //announce to world, this code needs mutex diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 27c290264b2..b431ca4ba17 100644 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -20,8 +20,6 @@ #define TRINITY_MAP_H #include "Define.h" -#include -#include #include "DBCStructure.h" #include "GridDefines.h" diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 83f401d4e79..5821ae3eb3c 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -175,8 +175,10 @@ struct TSpellSummary uint8 Effects; // set of enum SelectEffect } *SpellSummary; -ScriptMgr::ScriptMgr() - : _scriptCount(0), _scheduledScripts(0) { } +ScriptMgr::ScriptMgr() : _scriptCount(0) +{ + _scheduledScripts = 0; +} ScriptMgr::~ScriptMgr() { } diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 4f6027bedec..0126c649019 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -19,9 +19,8 @@ #ifndef SC_SCRIPTMGR_H #define SC_SCRIPTMGR_H +#include #include "Common.h" -#include - #include "DBCStores.h" #include "QuestDef.h" #include "SharedDefines.h" @@ -1128,7 +1127,7 @@ class ScriptMgr uint32 _scriptCount; //atomic op counter for active scripts amount - ACE_Atomic_Op _scheduledScripts; + std::atomic_long _scheduledScripts; }; #endif diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 099a270e886..1240ec545ba 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -372,10 +372,11 @@ class WorldSession void SetLatency(uint32 latency) { m_latency = latency; } void ResetClientTimeDelay() { m_clientTimeDelay = 0; } - ACE_Atomic_Op m_timeOutTime; + std::atomic m_timeOutTime; + void UpdateTimeOutTime(uint32 diff) { - if (time_t(diff) > m_timeOutTime.value()) + if (time_t(diff) > m_timeOutTime) m_timeOutTime = 0; else m_timeOutTime -= diff; diff --git a/src/server/game/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp index 44bab1d31b3..98ed381a2b1 100644 --- a/src/server/game/Warden/WardenCheckMgr.cpp +++ b/src/server/game/Warden/WardenCheckMgr.cpp @@ -164,7 +164,7 @@ void WardenCheckMgr::LoadWardenOverrides() uint32 count = 0; - ACE_WRITE_GUARD(ACE_RW_Mutex, g, _checkStoreLock); + boost::unique_lock lock(sWardenCheckMgr->_checkStoreLock); do { diff --git a/src/server/game/Warden/WardenCheckMgr.h b/src/server/game/Warden/WardenCheckMgr.h index 1108c9a6521..c9e26283060 100644 --- a/src/server/game/Warden/WardenCheckMgr.h +++ b/src/server/game/Warden/WardenCheckMgr.h @@ -20,6 +20,8 @@ #define _WARDENCHECKMGR_H #include +#include +#include #include "Cryptography/BigNumber.h" enum WardenActions @@ -72,7 +74,7 @@ class WardenCheckMgr void LoadWardenChecks(); void LoadWardenOverrides(); - ACE_RW_Mutex _checkStoreLock; + boost::shared_mutex _checkStoreLock; private: CheckContainer CheckStore; diff --git a/src/server/game/Warden/WardenWin.cpp b/src/server/game/Warden/WardenWin.cpp index 18bf2897358..5c3a86988db 100644 --- a/src/server/game/Warden/WardenWin.cpp +++ b/src/server/game/Warden/WardenWin.cpp @@ -206,7 +206,7 @@ void WardenWin::RequestData() ByteBuffer buff; buff << uint8(WARDEN_SMSG_CHEAT_CHECKS_REQUEST); - ACE_READ_GUARD(ACE_RW_Mutex, g, sWardenCheckMgr->_checkStoreLock); + boost::shared_lock lock(sWardenCheckMgr->_checkStoreLock); for (uint32 i = 0; i < sWorld->getIntConfig(CONFIG_WARDEN_NUM_OTHER_CHECKS); ++i) { @@ -369,7 +369,7 @@ void WardenWin::HandleData(ByteBuffer &buff) uint8 type; uint16 checkFailed = 0; - ACE_READ_GUARD(ACE_RW_Mutex, g, sWardenCheckMgr->_checkStoreLock); + boost::shared_lock lock(sWardenCheckMgr->_checkStoreLock); for (std::list::iterator itr = _currentChecks.begin(); itr != _currentChecks.end(); ++itr) { diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 4a46412dff7..d917030bb19 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -20,6 +20,7 @@ \ingroup world */ +#include #include "Common.h" #include "Memory.h" #include "DatabaseEnv.h" @@ -81,9 +82,10 @@ #include "BattlefieldMgr.h" #include "TransportMgr.h" -ACE_Atomic_Op World::m_stopEvent = false; + +std::atomic World::m_stopEvent = false; uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE; -ACE_Atomic_Op World::m_worldLoopCounter = 0; +std::atomic_uint32_t World::m_worldLoopCounter = 0; float World::m_MaxVisibleDistanceOnContinents = DEFAULT_VISIBILITY_DISTANCE; float World::m_MaxVisibleDistanceInInstances = DEFAULT_VISIBILITY_INSTANCE; @@ -2590,7 +2592,7 @@ void World::ShutdownMsg(bool show, Player* player) void World::ShutdownCancel() { // nothing cancel or too later - if (!m_ShutdownTimer || m_stopEvent.value()) + if (!m_ShutdownTimer || m_stopEvent) return; ServerMessageType msgid = (m_ShutdownMask & SHUTDOWN_MASK_RESTART) ? SERVER_MSG_RESTART_CANCELLED : SERVER_MSG_SHUTDOWN_CANCELLED; diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index f9528c793f7..cdffbf3ee2a 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -25,11 +25,11 @@ #include "Common.h" #include "Timer.h" -#include #include "SharedDefines.h" #include "QueryResult.h" #include "Callback.h" +#include #include #include #include @@ -523,7 +523,7 @@ class World return instance; } - static ACE_Atomic_Op m_worldLoopCounter; + static std::atomic_uint32_t m_worldLoopCounter; WorldSession* FindSession(uint32 id) const; void AddSession(WorldSession* s); @@ -636,7 +636,7 @@ class World void ShutdownMsg(bool show = false, Player* player = NULL); static uint8 GetExitCode() { return m_ExitCode; } static void StopNow(uint8 exitcode) { m_stopEvent = true; m_ExitCode = exitcode; } - static bool IsStopped() { return m_stopEvent.value(); } + static bool IsStopped() { return m_stopEvent; } void Update(uint32 diff); @@ -761,7 +761,7 @@ class World World(); ~World(); - static ACE_Atomic_Op m_stopEvent; + static std::atomic m_stopEvent; static uint8 m_ExitCode; uint32 m_ShutdownTimer; uint32 m_ShutdownMask; -- cgit v1.2.3 From 433f0b25caa267054df679551806a317c2f215df Mon Sep 17 00:00:00 2001 From: leak Date: Wed, 2 Jul 2014 02:21:36 +0200 Subject: Forgotten change --- src/server/worldserver/Master.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index ecc3e31a349..920dc766900 100644 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -87,7 +87,7 @@ void FreezeDetectorThread(uint32 delayTime) std::this_thread::sleep_for(std::chrono::milliseconds(1000)); uint32 curtime = getMSTime(); // normal work - uint32 worldLoopCounter = World::m_worldLoopCounter.value(); + uint32 worldLoopCounter = World::m_worldLoopCounter; if (loops != worldLoopCounter) { lastChange = curtime; -- cgit v1.2.3 From b2657a809da7954f88d49bfce78d501382f1f7f7 Mon Sep 17 00:00:00 2001 From: Subv Date: Tue, 1 Jul 2014 20:40:56 -0500 Subject: Fixed the authserver compile --- src/server/shared/Database/DatabaseWorker.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/shared/Database/DatabaseWorker.h b/src/server/shared/Database/DatabaseWorker.h index 9b45318e39f..91aef2c7194 100644 --- a/src/server/shared/Database/DatabaseWorker.h +++ b/src/server/shared/Database/DatabaseWorker.h @@ -18,10 +18,10 @@ #ifndef _WORKERTHREAD_H #define _WORKERTHREAD_H -#include "Define.h" #include "ProducerConsumerQueue.h" class MySQLConnection; +class SQLOperation; class DatabaseWorker { -- cgit v1.2.3 From 9817f5e23e98b34348e2a69e52fa8046f8ab63fb Mon Sep 17 00:00:00 2001 From: Subv Date: Tue, 1 Jul 2014 22:01:10 -0500 Subject: Removed ACE from TCSoap Untested. Note: That was some rather awful use of a semaphore --- src/server/worldserver/TCSoap/TCSoap.cpp | 28 +++++++++------------------- src/server/worldserver/TCSoap/TCSoap.h | 10 ++++------ 2 files changed, 13 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/server/worldserver/TCSoap/TCSoap.cpp b/src/server/worldserver/TCSoap/TCSoap.cpp index 3d242859ff2..ba99967a485 100644 --- a/src/server/worldserver/TCSoap/TCSoap.cpp +++ b/src/server/worldserver/TCSoap/TCSoap.cpp @@ -48,28 +48,21 @@ void TCSoapThread(const std::string& host, uint16 port) TC_LOG_DEBUG("network.soap", "Accepted connection from IP=%d.%d.%d.%d", (int)(soap.ip>>24)&0xFF, (int)(soap.ip>>16)&0xFF, (int)(soap.ip>>8)&0xFF, (int)soap.ip&0xFF); struct soap* thread_soap = soap_copy(&soap);// make a safe copy - - ACE_Message_Block* mb = new ACE_Message_Block(sizeof(struct soap*)); - ACE_OS::memcpy(mb->wr_ptr(), &thread_soap, sizeof(struct soap*)); - process_message(mb); + process_message(thread_soap); } soap_done(&soap); } -void process_message(ACE_Message_Block* mb) +void process_message(struct soap* soap_message) { ACE_TRACE (ACE_TEXT ("SOAPWorkingThread::process_message")); - struct soap* soap; - ACE_OS::memcpy(&soap, mb->rd_ptr (), sizeof(struct soap*)); - mb->release(); - - soap_serve(soap); - soap_destroy(soap); // dealloc C++ data - soap_end(soap); // dealloc data and clean up - soap_done(soap); // detach soap struct - free(soap); + soap_serve(soap_message); + soap_destroy(soap_message); // dealloc C++ data + soap_end(soap_message); // dealloc data and clean up + soap_done(soap_message); // detach soap struct + free(soap_message); } /* Code used for generating stubs: @@ -118,10 +111,7 @@ int ns1__executeCommand(soap* soap, char* command, char** result) } // wait for callback to complete command - - int acc = connection.pendingCommands.acquire(); - if (acc) - TC_LOG_ERROR("network.soap", "Error while acquiring lock, acc = %i, errno = %u", acc, errno); + connection.pendingCommands.lock(); // alright, command finished @@ -139,7 +129,7 @@ void SOAPCommand::commandFinished(void* soapconnection, bool success) { SOAPCommand* con = (SOAPCommand*)soapconnection; con->setCommandSuccess(success); - con->pendingCommands.release(); + con->pendingCommands.unlock(); } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/server/worldserver/TCSoap/TCSoap.h b/src/server/worldserver/TCSoap/TCSoap.h index 937ceac6425..0de5d2874f6 100644 --- a/src/server/worldserver/TCSoap/TCSoap.h +++ b/src/server/worldserver/TCSoap/TCSoap.h @@ -19,18 +19,16 @@ #define _TCSOAP_H #include "Define.h" +#include -#include -#include - -void process_message(ACE_Message_Block* mb); +void process_message(struct soap* soap_message); void TCSoapThread(const std::string& host, uint16 port); class SOAPCommand { public: SOAPCommand(): - pendingCommands(0, USYNC_THREAD, "pendingCommands"), m_success(false) + m_success(false) { } @@ -43,7 +41,7 @@ class SOAPCommand m_printBuffer += msg; } - ACE_Semaphore pendingCommands; + std::mutex pendingCommands; void setCommandSuccess(bool val) { -- cgit v1.2.3 From c8fe4b8d5084dd26eb96a082422fcd68c090debc Mon Sep 17 00:00:00 2001 From: Subv Date: Tue, 1 Jul 2014 23:05:06 -0500 Subject: Corrected some things from the previous commit --- src/server/worldserver/TCSoap/TCSoap.cpp | 12 +++++------- src/server/worldserver/TCSoap/TCSoap.h | 5 +++-- 2 files changed, 8 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/server/worldserver/TCSoap/TCSoap.cpp b/src/server/worldserver/TCSoap/TCSoap.cpp index ba99967a485..5122752f3a4 100644 --- a/src/server/worldserver/TCSoap/TCSoap.cpp +++ b/src/server/worldserver/TCSoap/TCSoap.cpp @@ -56,7 +56,7 @@ void TCSoapThread(const std::string& host, uint16 port) void process_message(struct soap* soap_message) { - ACE_TRACE (ACE_TEXT ("SOAPWorkingThread::process_message")); + TC_LOG_TRACE("network.soap", "SOAPWorkingThread::process_message"); soap_serve(soap_message); soap_destroy(soap_message); // dealloc C++ data @@ -105,16 +105,15 @@ int ns1__executeCommand(soap* soap, char* command, char** result) // commands are executed in the world thread. We have to wait for them to be completed { - // CliCommandHolder will be deleted from world, accessing after queueing is NOT save + // CliCommandHolder will be deleted from world, accessing after queueing is NOT safe CliCommandHolder* cmd = new CliCommandHolder(&connection, command, &SOAPCommand::print, &SOAPCommand::commandFinished); sWorld->QueueCliCommand(cmd); } - // wait for callback to complete command - connection.pendingCommands.lock(); - - // alright, command finished + // Wait until the command has finished executing + connection.finishedPromise.get_future().wait(); + // The command has finished executing already char* printBuffer = soap_strdup(soap, connection.m_printBuffer.c_str()); if (connection.hasCommandSucceeded()) { @@ -129,7 +128,6 @@ void SOAPCommand::commandFinished(void* soapconnection, bool success) { SOAPCommand* con = (SOAPCommand*)soapconnection; con->setCommandSuccess(success); - con->pendingCommands.unlock(); } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/server/worldserver/TCSoap/TCSoap.h b/src/server/worldserver/TCSoap/TCSoap.h index 0de5d2874f6..999a03a9009 100644 --- a/src/server/worldserver/TCSoap/TCSoap.h +++ b/src/server/worldserver/TCSoap/TCSoap.h @@ -20,6 +20,7 @@ #include "Define.h" #include +#include void process_message(struct soap* soap_message); void TCSoapThread(const std::string& host, uint16 port); @@ -41,11 +42,10 @@ class SOAPCommand m_printBuffer += msg; } - std::mutex pendingCommands; - void setCommandSuccess(bool val) { m_success = val; + finishedPromise.set_value(); } bool hasCommandSucceeded() const @@ -62,6 +62,7 @@ class SOAPCommand bool m_success; std::string m_printBuffer; + std::promise finishedPromise; }; #endif -- cgit v1.2.3 From 310f5e68467ee61b66796fdd88c7c9691d4bd2a0 Mon Sep 17 00:00:00 2001 From: leak Date: Wed, 2 Jul 2014 17:38:44 +0200 Subject: Some ground work for ASIO based RemoteAccess handling --- src/server/authserver/Server/AuthServer.cpp | 3 -- src/server/shared/CMakeLists.txt | 3 ++ src/server/shared/Networking/AsyncAcceptor.h | 54 +++++++++++++++++++++ src/server/worldserver/CMakeLists.txt | 1 + src/server/worldserver/Main.cpp | 3 +- src/server/worldserver/Master.cpp | 21 +++++--- src/server/worldserver/Master.h | 2 + src/server/worldserver/RemoteAccess/RARunnable.cpp | 2 +- src/server/worldserver/RemoteAccess/RASession.cpp | 52 ++++++++++++++++++++ src/server/worldserver/RemoteAccess/RASession.h | 56 ++++++++++++++++++++++ 10 files changed, 184 insertions(+), 13 deletions(-) create mode 100644 src/server/shared/Networking/AsyncAcceptor.h create mode 100644 src/server/worldserver/RemoteAccess/RASession.cpp create mode 100644 src/server/worldserver/RemoteAccess/RASession.h (limited to 'src') diff --git a/src/server/authserver/Server/AuthServer.cpp b/src/server/authserver/Server/AuthServer.cpp index 5c3ef247254..c5a0cff186f 100644 --- a/src/server/authserver/Server/AuthServer.cpp +++ b/src/server/authserver/Server/AuthServer.cpp @@ -35,6 +35,3 @@ void AuthServer::AsyncAccept() AsyncAccept(); }); } - - - diff --git a/src/server/shared/CMakeLists.txt b/src/server/shared/CMakeLists.txt index 63aecab0fb7..a61248f01ea 100644 --- a/src/server/shared/CMakeLists.txt +++ b/src/server/shared/CMakeLists.txt @@ -18,6 +18,7 @@ file(GLOB_RECURSE sources_Database Database/*.cpp Database/*.h) file(GLOB_RECURSE sources_DataStores DataStores/*.cpp DataStores/*.h) file(GLOB_RECURSE sources_Dynamic Dynamic/*.cpp Dynamic/*.h) file(GLOB_RECURSE sources_Logging Logging/*.cpp Logging/*.h) +file(GLOB_RECURSE sources_Networking Networking/*.cpp Networking/*.h) file(GLOB_RECURSE sources_Packets Packets/*.cpp Packets/*.h) file(GLOB_RECURSE sources_Threading Threading/*.cpp Threading/*.h) file(GLOB_RECURSE sources_Utilities Utilities/*.cpp Utilities/*.h) @@ -47,6 +48,7 @@ set(shared_STAT_SRCS ${sources_Debugging} ${sources_Dynamic} ${sources_Logging} + ${sources_Networking} ${sources_Packets} ${sources_Threading} ${sources_Utilities} @@ -68,6 +70,7 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/Debugging ${CMAKE_CURRENT_SOURCE_DIR}/Dynamic ${CMAKE_CURRENT_SOURCE_DIR}/Logging + ${CMAKE_CURRENT_SOURCE_DIR}/Networking ${CMAKE_CURRENT_SOURCE_DIR}/Packets ${CMAKE_CURRENT_SOURCE_DIR}/Threading ${CMAKE_CURRENT_SOURCE_DIR}/Utilities diff --git a/src/server/shared/Networking/AsyncAcceptor.h b/src/server/shared/Networking/AsyncAcceptor.h new file mode 100644 index 00000000000..c54471fd01a --- /dev/null +++ b/src/server/shared/Networking/AsyncAcceptor.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2008-2014 TrinityCore +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program. If not, see . +*/ + +#ifndef __ASYNCACCEPT_H_ +#define __ASYNCACCEPT_H_ + +#include + +using boost::asio::ip::tcp; + +template +class AsyncAcceptor +{ +public: + AsyncAcceptor(boost::asio::io_service& ioService, std::string bindIp, int port) : + _socket(ioService), + _acceptor(ioService, tcp::endpoint(boost::asio::ip::address::from_string(bindIp), port)) + { + AsyncAccept(); + }; + +private: + void AsyncAcceptor::AsyncAccept() + { + _acceptor.async_accept(_socket, [this](boost::system::error_code error) + { + if (!error) + { + std::make_shared(std::move(_socket))->Start(); + } + + AsyncAccept(); + }); + } + + tcp::acceptor _acceptor; + tcp::socket _socket; +}; + +#endif /* __ASYNCACCEPT_H_ */ diff --git a/src/server/worldserver/CMakeLists.txt b/src/server/worldserver/CMakeLists.txt index c006e6c925c..9d2e859a7de 100644 --- a/src/server/worldserver/CMakeLists.txt +++ b/src/server/worldserver/CMakeLists.txt @@ -62,6 +62,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic/LinkedReference ${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic ${CMAKE_SOURCE_DIR}/src/server/shared/Logging + ${CMAKE_SOURCE_DIR}/src/server/shared/Networking ${CMAKE_SOURCE_DIR}/src/server/shared/Packets ${CMAKE_SOURCE_DIR}/src/server/shared/Threading ${CMAKE_SOURCE_DIR}/src/server/shared/Utilities diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp index 75d9ca5145d..bcc058c7fb3 100644 --- a/src/server/worldserver/Main.cpp +++ b/src/server/worldserver/Main.cpp @@ -22,7 +22,6 @@ #include #include -#include #include "Common.h" #include "Database/DatabaseEnv.h" @@ -135,7 +134,7 @@ extern int main(int argc, char** argv) TC_LOG_INFO("server.worldserver", "Using configuration file %s.", cfg_file); TC_LOG_INFO("server.worldserver", "Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); - TC_LOG_INFO("server.worldserver", "Using ACE version: %s", ACE_VERSION); + TC_LOG_INFO("server.worldserver", "Using Boost version: %s", BOOST_LIB_VERSION); ///- and run the 'Master' /// @todo Why do we need this 'Master'? Can't all of this be in the Main as for Realmd? diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index 920dc766900..5318652ad88 100644 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -22,7 +22,8 @@ #include -#include "Common.h" +#include "Master.h" + #include "SystemConfig.h" #include "World.h" #include "WorldRunnable.h" @@ -31,19 +32,17 @@ #include "Configuration/Config.h" #include "Database/DatabaseEnv.h" #include "Database/DatabaseWorkerPool.h" - #include "CliRunnable.h" #include "Log.h" -#include "Master.h" #include "RARunnable.h" #include "TCSoap.h" #include "Timer.h" #include "Util.h" #include "RealmList.h" - #include "BigNumber.h" #include "OpenSSLCrypto.h" -#include +#include "AsyncAcceptor.h" +#include "RASession.h" #ifdef _WIN32 #include "ServiceWin32.h" @@ -165,8 +164,8 @@ int Master::Run() cliThread = new std::thread(CliThread); } - // TODO C++11/Boost - // std::thread rarThread(RemoteAccessThread); + if (sConfigMgr->GetBoolDefault("Ra.Enable", false)) + StartRaSocketAcceptor(_ioService); #if defined(_WIN32) || defined(__linux__) @@ -470,3 +469,11 @@ void Master::ClearOnlineAccounts() // Battleground instance ids reset at server restart CharacterDatabase.DirectExecute("UPDATE character_battleground_data SET instanceId = 0"); } + +void Master::StartRaSocketAcceptor(boost::asio::io_service& ioService) +{ + uint16 raPort = uint16(sConfigMgr->GetIntDefault("Ra.Port", 3443)); + std::string raListener = sConfigMgr->GetStringDefault("Ra.IP", "0.0.0.0"); + + AsyncAcceptor raAcceptor(ioService, raListener, raPort); +} diff --git a/src/server/worldserver/Master.h b/src/server/worldserver/Master.h index d2a51b85f4b..3567d5ea933 100644 --- a/src/server/worldserver/Master.h +++ b/src/server/worldserver/Master.h @@ -23,6 +23,7 @@ #ifndef _MASTER_H #define _MASTER_H +#include #include "Common.h" /// Start the server @@ -42,6 +43,7 @@ class Master void _StopDB(); void ClearOnlineAccounts(); + void StartRaSocketAcceptor(boost::asio::io_service& ioService); }; #define sMaster Master::instance() diff --git a/src/server/worldserver/RemoteAccess/RARunnable.cpp b/src/server/worldserver/RemoteAccess/RARunnable.cpp index 4efeb07ef25..b3461af5a87 100644 --- a/src/server/worldserver/RemoteAccess/RARunnable.cpp +++ b/src/server/worldserver/RemoteAccess/RARunnable.cpp @@ -22,7 +22,7 @@ #include "Common.h" #include "Config.h" #include "Log.h" -#include "RARunnable.h" +#include "RARunnable.h", #include "World.h" #include diff --git a/src/server/worldserver/RemoteAccess/RASession.cpp b/src/server/worldserver/RemoteAccess/RASession.cpp new file mode 100644 index 00000000000..1438557e924 --- /dev/null +++ b/src/server/worldserver/RemoteAccess/RASession.cpp @@ -0,0 +1,52 @@ +/* +* Copyright (C) 2008-2014 TrinityCore +* Copyright (C) 2005-2009 MaNGOS +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program. If not, see . +*/ + +#include +#include +#include + +using boost::asio::ip::tcp; + +void RASession::AsyncRead() +{ + auto self(shared_from_this()); + + _socket.async_read_some(boost::asio::buffer(_readBuffer, 1), [this, self](boost::system::error_code error, size_t transferedBytes) + { + if (!error && transferedBytes == 1) + { + // let the magic happen + } + else + { + _socket.close(); + } + }); +} + +void RASession::AsyncWrite(std::size_t length) +{ + boost::asio::async_write(_socket, boost::asio::buffer(_writeBuffer, length), [this](boost::system::error_code error, std::size_t /*length*/) + { + if (error) + { + _socket.close(); + } + }); +} + diff --git a/src/server/worldserver/RemoteAccess/RASession.h b/src/server/worldserver/RemoteAccess/RASession.h new file mode 100644 index 00000000000..ed2a83a4f2c --- /dev/null +++ b/src/server/worldserver/RemoteAccess/RASession.h @@ -0,0 +1,56 @@ +/* +* Copyright (C) 2008-2014 TrinityCore +* Copyright (C) 2005-2009 MaNGOS +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program. If not, see . +*/ + +#ifndef __RASESSION_H__ +#define __RASESSION_H__ + +#include +#include +#include "Common.h" + +using boost::asio::ip::tcp; + +const size_t bufferSize = 4096; + +#define BUFFER_SIZE 4096 + +class RASession : public std::enable_shared_from_this +{ +public: + RASession(tcp::socket socket) : _socket(std::move(socket)) + { + } + + void Start() + { + AsyncRead(); + } + + const std::string GetRemoteIpAddress() const { return _socket.remote_endpoint().address().to_string(); }; + unsigned short GetRemotePort() const { return _socket.remote_endpoint().port(); } + +private: + void AsyncRead(); + void AsyncWrite(size_t length); + + tcp::socket _socket; + char _readBuffer[BUFFER_SIZE]; + char _writeBuffer[BUFFER_SIZE]; +}; + +#endif -- cgit v1.2.3 From c31c6f3ba3bd0be5e157e63bfc65d38f7d3e7624 Mon Sep 17 00:00:00 2001 From: leak Date: Wed, 2 Jul 2014 18:05:30 +0200 Subject: Backported AsyncAcceptor generalization to authserver --- src/server/authserver/CMakeLists.txt | 1 + src/server/authserver/Main.cpp | 5 ++-- src/server/authserver/Server/AuthServer.cpp | 37 ------------------------ src/server/authserver/Server/AuthServer.h | 44 ----------------------------- 4 files changed, 4 insertions(+), 83 deletions(-) delete mode 100644 src/server/authserver/Server/AuthServer.cpp delete mode 100644 src/server/authserver/Server/AuthServer.h (limited to 'src') diff --git a/src/server/authserver/CMakeLists.txt b/src/server/authserver/CMakeLists.txt index bde75654c92..d6f0515a8e1 100644 --- a/src/server/authserver/CMakeLists.txt +++ b/src/server/authserver/CMakeLists.txt @@ -50,6 +50,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/server/shared/Cryptography ${CMAKE_SOURCE_DIR}/src/server/shared/Cryptography/Authentication ${CMAKE_SOURCE_DIR}/src/server/shared/Logging + ${CMAKE_SOURCE_DIR}/src/server/shared/Networking ${CMAKE_SOURCE_DIR}/src/server/shared/Threading ${CMAKE_SOURCE_DIR}/src/server/shared/Utilities ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index ad04a52c7db..988ee901139 100644 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -39,7 +39,8 @@ #include "SystemConfig.h" #include "Util.h" #include "RealmList.h" -#include "AuthServer.h" +#include "AsyncAcceptor.h" +#include "AuthSession.h" #ifdef __linux__ @@ -170,7 +171,7 @@ int main(int argc, char** argv) std::string bindIp = sConfigMgr->GetStringDefault("BindIP", "0.0.0.0"); - AuthServer authServer(_ioService, bindIp, port); + AsyncAcceptor authServer(_ioService, bindIp, port); // Set signal handlers boost::asio::signal_set signals(_ioService, SIGINT, SIGTERM); diff --git a/src/server/authserver/Server/AuthServer.cpp b/src/server/authserver/Server/AuthServer.cpp deleted file mode 100644 index c5a0cff186f..00000000000 --- a/src/server/authserver/Server/AuthServer.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2008-2014 TrinityCore - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "AuthServer.h" -#include "AuthSession.h" - -#include -#include - -using boost::asio::ip::tcp; - -void AuthServer::AsyncAccept() -{ - _acceptor.async_accept(_socket, [this](boost::system::error_code error) - { - if (!error) - { - std::make_shared(std::move(_socket))->Start(); - } - - AsyncAccept(); - }); -} diff --git a/src/server/authserver/Server/AuthServer.h b/src/server/authserver/Server/AuthServer.h deleted file mode 100644 index 985a48ad243..00000000000 --- a/src/server/authserver/Server/AuthServer.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2008-2014 TrinityCore - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef __AUTHSERVER_H__ -#define __AUTHSERVER_H__ - -#include - -using boost::asio::ip::tcp; - -class AuthServer -{ -public: - AuthServer(boost::asio::io_service& ioService, std::string bindIp, int port) : _socket(ioService), _acceptor(ioService, tcp::endpoint(tcp::v4(), port)) - { - tcp::endpoint endpoint(boost::asio::ip::address::from_string(bindIp), port); - - _acceptor = tcp::acceptor(ioService, endpoint); - - AsyncAccept(); - }; - -private: - void AsyncAccept(); - - tcp::acceptor _acceptor; - tcp::socket _socket; -}; - -#endif /* __AUTHSERVER_H__ */ -- cgit v1.2.3 From 8df9e98ba5d7e230009f640a95289639ede8b0c1 Mon Sep 17 00:00:00 2001 From: leak Date: Wed, 2 Jul 2014 18:21:18 +0200 Subject: Remove unused RARunnable files --- src/server/worldserver/Master.cpp | 1 - src/server/worldserver/RemoteAccess/RARunnable.cpp | 80 ---------------------- src/server/worldserver/RemoteAccess/RARunnable.h | 29 -------- 3 files changed, 110 deletions(-) delete mode 100644 src/server/worldserver/RemoteAccess/RARunnable.cpp delete mode 100644 src/server/worldserver/RemoteAccess/RARunnable.h (limited to 'src') diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index 5318652ad88..4669168042c 100644 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -34,7 +34,6 @@ #include "Database/DatabaseWorkerPool.h" #include "CliRunnable.h" #include "Log.h" -#include "RARunnable.h" #include "TCSoap.h" #include "Timer.h" #include "Util.h" diff --git a/src/server/worldserver/RemoteAccess/RARunnable.cpp b/src/server/worldserver/RemoteAccess/RARunnable.cpp deleted file mode 100644 index b3461af5a87..00000000000 --- a/src/server/worldserver/RemoteAccess/RARunnable.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2008-2014 TrinityCore - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -/** \file - \ingroup Trinityd - */ - -#include "Common.h" -#include "Config.h" -#include "Log.h" -#include "RARunnable.h", -#include "World.h" - -#include -#include -#include -#include -#include - -#include "RASocket.h" - - -void RemoteAccessThread() -{ - ACE_Reactor_Impl* imp = nullptr; - -#if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) - imp = new ACE_Dev_Poll_Reactor(); - imp->max_notify_iterations(128); - imp->restart(1); -#else - imp = new ACE_TP_Reactor(); - imp->max_notify_iterations(128); -#endif - - ACE_Reactor* reactor = new ACE_Reactor(imp, 1); - - if (!sConfigMgr->GetBoolDefault("Ra.Enable", false)) - return; - - ACE_Acceptor acceptor; - - uint16 raPort = uint16(sConfigMgr->GetIntDefault("Ra.Port", 3443)); - std::string stringIp = sConfigMgr->GetStringDefault("Ra.IP", "0.0.0.0"); - ACE_INET_Addr listenAddress(raPort, stringIp.c_str()); - - if (acceptor.open(listenAddress, reactor) == -1) - { - TC_LOG_ERROR("server.worldserver", "Trinity RA can not bind to port %d on %s", raPort, stringIp.c_str()); - return; - } - - TC_LOG_INFO("server.worldserver", "Starting Trinity RA on port %d on %s", raPort, stringIp.c_str()); - - while (!World::IsStopped()) - { - ACE_Time_Value interval(0, 100000); - if (reactor->run_reactor_event_loop(interval) == -1) - break; - } - - delete imp; - delete reactor; - - TC_LOG_DEBUG("server.worldserver", "Trinity RA thread exiting"); -} diff --git a/src/server/worldserver/RemoteAccess/RARunnable.h b/src/server/worldserver/RemoteAccess/RARunnable.h deleted file mode 100644 index a65df077f97..00000000000 --- a/src/server/worldserver/RemoteAccess/RARunnable.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2008-2014 TrinityCore - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -/// \addtogroup Trinityd -/// @{ -/// \file - -#ifndef _TRINITY_RARUNNABLE_H_ -#define _TRINITY_RARUNNABLE_H_ - -void RemoteAccessThread(); - -#endif /* _TRINITY_RARUNNABLE_H_ */ - -/// @} -- cgit v1.2.3 From 2874014443cff95e34a75ffa3bfe816ed7143803 Mon Sep 17 00:00:00 2001 From: Subv Date: Wed, 2 Jul 2014 11:50:03 -0500 Subject: Cleaned up the authserver includes a bit. Fixed authserver pch build --- src/server/authserver/Main.cpp | 2 -- src/server/authserver/PrecompiledHeaders/authPCH.h | 1 - src/server/authserver/Realms/RealmList.cpp | 1 - src/server/authserver/Realms/RealmList.h | 2 +- src/server/authserver/Server/AuthSession.cpp | 2 +- src/server/authserver/Server/AuthSession.h | 2 +- src/server/worldserver/WorldThread/WorldRunnable.h | 2 +- 7 files changed, 4 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index 988ee901139..1fdd01ad968 100644 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -28,8 +28,6 @@ #include #include #include -#include -#include #include #include "Common.h" diff --git a/src/server/authserver/PrecompiledHeaders/authPCH.h b/src/server/authserver/PrecompiledHeaders/authPCH.h index 61059ae91b0..ef757a656d5 100644 --- a/src/server/authserver/PrecompiledHeaders/authPCH.h +++ b/src/server/authserver/PrecompiledHeaders/authPCH.h @@ -3,5 +3,4 @@ #include "Database/DatabaseEnv.h" #include "Log.h" #include "RealmList.h" -#include "AuthServer.h" #include "AuthSession.h" diff --git a/src/server/authserver/Realms/RealmList.cpp b/src/server/authserver/Realms/RealmList.cpp index 94d52fb3138..bf097abff9a 100644 --- a/src/server/authserver/Realms/RealmList.cpp +++ b/src/server/authserver/Realms/RealmList.cpp @@ -16,7 +16,6 @@ * with this program. If not, see . */ -#include #include "Common.h" #include "RealmList.h" #include "Database/DatabaseEnv.h" diff --git a/src/server/authserver/Realms/RealmList.h b/src/server/authserver/Realms/RealmList.h index b96d5523da9..e8e94376c20 100644 --- a/src/server/authserver/Realms/RealmList.h +++ b/src/server/authserver/Realms/RealmList.h @@ -19,7 +19,7 @@ #ifndef _REALMLIST_H #define _REALMLIST_H -#include +#include #include "Common.h" using namespace boost::asio; diff --git a/src/server/authserver/Server/AuthSession.cpp b/src/server/authserver/Server/AuthSession.cpp index ba31573cb4e..6646f1203b5 100644 --- a/src/server/authserver/Server/AuthSession.cpp +++ b/src/server/authserver/Server/AuthSession.cpp @@ -17,8 +17,8 @@ */ #include -#include #include +#include #include #include #include "ByteBuffer.h" diff --git a/src/server/authserver/Server/AuthSession.h b/src/server/authserver/Server/AuthSession.h index 32e81d5240e..3aef4262786 100644 --- a/src/server/authserver/Server/AuthSession.h +++ b/src/server/authserver/Server/AuthSession.h @@ -20,7 +20,7 @@ #define __AUTHSESSION_H__ #include -#include +#include #include "Common.h" #include "BigNumber.h" diff --git a/src/server/worldserver/WorldThread/WorldRunnable.h b/src/server/worldserver/WorldThread/WorldRunnable.h index 3e2c07b8842..c6d00d269e7 100644 --- a/src/server/worldserver/WorldThread/WorldRunnable.h +++ b/src/server/worldserver/WorldThread/WorldRunnable.h @@ -23,7 +23,7 @@ #ifndef __WORLDRUNNABLE_H #define __WORLDRUNNABLE_H -#include +#include void WorldThread(boost::asio::io_service& ioService); -- cgit v1.2.3 From bdc42f663ea2ba715a43c7f65f8d88a1df188e9d Mon Sep 17 00:00:00 2001 From: Subv Date: Wed, 2 Jul 2014 12:06:25 -0500 Subject: Cleaned up worldserver includes a bit --- src/server/worldserver/Master.h | 2 +- src/server/worldserver/RemoteAccess/RASession.cpp | 4 ++-- src/server/worldserver/RemoteAccess/RASession.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/worldserver/Master.h b/src/server/worldserver/Master.h index 3567d5ea933..0c6836f25b8 100644 --- a/src/server/worldserver/Master.h +++ b/src/server/worldserver/Master.h @@ -23,7 +23,7 @@ #ifndef _MASTER_H #define _MASTER_H -#include +#include #include "Common.h" /// Start the server diff --git a/src/server/worldserver/RemoteAccess/RASession.cpp b/src/server/worldserver/RemoteAccess/RASession.cpp index 1438557e924..359b18f1039 100644 --- a/src/server/worldserver/RemoteAccess/RASession.cpp +++ b/src/server/worldserver/RemoteAccess/RASession.cpp @@ -17,8 +17,8 @@ */ #include -#include -#include +#include +#include "RASession.h" using boost::asio::ip::tcp; diff --git a/src/server/worldserver/RemoteAccess/RASession.h b/src/server/worldserver/RemoteAccess/RASession.h index ed2a83a4f2c..a467c387858 100644 --- a/src/server/worldserver/RemoteAccess/RASession.h +++ b/src/server/worldserver/RemoteAccess/RASession.h @@ -20,7 +20,7 @@ #define __RASESSION_H__ #include -#include +#include #include "Common.h" using boost::asio::ip::tcp; -- cgit v1.2.3 From 15352a9302d3204be055748e6188318df1fef0ee Mon Sep 17 00:00:00 2001 From: Subv Date: Wed, 2 Jul 2014 18:38:22 -0500 Subject: Fixed an uninitialized value that made the MapUpdater worker threads exit on launch --- src/server/game/Maps/MapUpdater.cpp | 4 +++- src/server/game/Maps/MapUpdater.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Maps/MapUpdater.cpp b/src/server/game/Maps/MapUpdater.cpp index 4ab95d87d48..0a007b3484e 100644 --- a/src/server/game/Maps/MapUpdater.cpp +++ b/src/server/game/Maps/MapUpdater.cpp @@ -45,7 +45,7 @@ class MapUpdateRequest } }; -MapUpdater::MapUpdater(): pending_requests(0) { } +MapUpdater::MapUpdater() : pending_requests(0), _cancelationToken(false) {} MapUpdater::~MapUpdater() { @@ -62,6 +62,8 @@ void MapUpdater::activate(size_t num_threads) void MapUpdater::deactivate() { + _cancelationToken = true; + wait(); _queue.Cancel(); diff --git a/src/server/game/Maps/MapUpdater.h b/src/server/game/Maps/MapUpdater.h index ff1d85a23e9..7b9c4443a54 100644 --- a/src/server/game/Maps/MapUpdater.h +++ b/src/server/game/Maps/MapUpdater.h @@ -51,7 +51,7 @@ class MapUpdater ProducerConsumerQueue _queue; std::vector _workerThreads; - std::atomic_bool _cancelationToken; + std::atomic _cancelationToken; std::mutex _lock; std::condition_variable _condition; -- cgit v1.2.3 From b516926da83a56b1318c4d94b4d4f3bac5510cce Mon Sep 17 00:00:00 2001 From: Subv Date: Wed, 2 Jul 2014 18:58:48 -0500 Subject: Enabled RA and removed all ACE from it --- src/server/worldserver/Master.cpp | 15 +- src/server/worldserver/Master.h | 6 +- src/server/worldserver/RemoteAccess/RASession.cpp | 204 ++++++++++- src/server/worldserver/RemoteAccess/RASession.h | 23 +- src/server/worldserver/RemoteAccess/RASocket.cpp | 425 ---------------------- src/server/worldserver/RemoteAccess/RASocket.h | 64 ---- 6 files changed, 214 insertions(+), 523 deletions(-) delete mode 100644 src/server/worldserver/RemoteAccess/RASocket.cpp delete mode 100644 src/server/worldserver/RemoteAccess/RASocket.h (limited to 'src') diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index 4669168042c..c529e6b6478 100644 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -41,7 +41,6 @@ #include "BigNumber.h" #include "OpenSSLCrypto.h" #include "AsyncAcceptor.h" -#include "RASession.h" #ifdef _WIN32 #include "ServiceWin32.h" @@ -163,8 +162,10 @@ int Master::Run() cliThread = new std::thread(CliThread); } + AsyncAcceptor* raAcceptor = nullptr; + if (sConfigMgr->GetBoolDefault("Ra.Enable", false)) - StartRaSocketAcceptor(_ioService); + raAcceptor = StartRaSocketAcceptor(_ioService); #if defined(_WIN32) || defined(__linux__) @@ -246,9 +247,7 @@ int Master::Run() ///- Start up freeze catcher thread if (uint32 freezeDelay = sConfigMgr->GetIntDefault("MaxCoreStuckTime", 0)) - { freezeDetectorThread = new std::thread(FreezeDetectorThread, freezeDelay); - } ///- Launch the world listener socket uint16 worldPort = uint16(sWorld->getIntConfig(CONFIG_PORT_WORLD)); @@ -271,7 +270,6 @@ int Master::Run() // when the main thread closes the singletons get unloaded // since worldrunnable uses them, it will crash if unloaded after master worldThread.join(); - //rarThread.join(); if (soapThread != nullptr) { @@ -279,6 +277,9 @@ int Master::Run() delete soapThread; } + if (raAcceptor != nullptr) + delete raAcceptor; + // set server offline LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, realmID); @@ -469,10 +470,10 @@ void Master::ClearOnlineAccounts() CharacterDatabase.DirectExecute("UPDATE character_battleground_data SET instanceId = 0"); } -void Master::StartRaSocketAcceptor(boost::asio::io_service& ioService) +AsyncAcceptor* Master::StartRaSocketAcceptor(boost::asio::io_service& ioService) { uint16 raPort = uint16(sConfigMgr->GetIntDefault("Ra.Port", 3443)); std::string raListener = sConfigMgr->GetStringDefault("Ra.IP", "0.0.0.0"); - AsyncAcceptor raAcceptor(ioService, raListener, raPort); + return new AsyncAcceptor(ioService, raListener, raPort); } diff --git a/src/server/worldserver/Master.h b/src/server/worldserver/Master.h index 0c6836f25b8..86059e6417a 100644 --- a/src/server/worldserver/Master.h +++ b/src/server/worldserver/Master.h @@ -25,6 +25,10 @@ #include #include "Common.h" +#include "RASession.h" + +template +class AsyncAcceptor; /// Start the server class Master @@ -43,7 +47,7 @@ class Master void _StopDB(); void ClearOnlineAccounts(); - void StartRaSocketAcceptor(boost::asio::io_service& ioService); + AsyncAcceptor* StartRaSocketAcceptor(boost::asio::io_service& ioService); }; #define sMaster Master::instance() diff --git a/src/server/worldserver/RemoteAccess/RASession.cpp b/src/server/worldserver/RemoteAccess/RASession.cpp index 359b18f1039..536ce22839b 100644 --- a/src/server/worldserver/RemoteAccess/RASession.cpp +++ b/src/server/worldserver/RemoteAccess/RASession.cpp @@ -18,35 +18,201 @@ #include #include +#include +#include #include "RASession.h" +#include "AccountMgr.h" using boost::asio::ip::tcp; -void RASession::AsyncRead() +void RASession::Start() { - auto self(shared_from_this()); + boost::asio::socket_base::bytes_readable command(true); + _socket.io_control(command); + std::size_t bytes_readable = command.get(); - _socket.async_read_some(boost::asio::buffer(_readBuffer, 1), [this, self](boost::system::error_code error, size_t transferedBytes) + // Check if there are bytes available, if they are, then the client is requesting the negotiation + if (bytes_readable > 0) { - if (!error && transferedBytes == 1) - { - // let the magic happen - } - else - { - _socket.close(); - } - }); + // Handle subnegotiation + boost::array buf; + std::size_t length = _socket.read_some(boost::asio::buffer(buf)); + + // Send the end-of-negotiation packet + uint8 const reply[2] = { 0xFF, 0xF0 }; + _socket.write_some(boost::asio::buffer(reply)); + } + + Send("Authentication Required\r\n"); + Send("Username: "); + + std::string username = ReadString(); + + if (username.empty()) + return; + + TC_LOG_INFO("commands.ra", "Accepting RA connection from user %s (IP: %s)", username.c_str(), GetRemoteIpAddress().c_str()); + + Send("Password: "); + + std::string password = ReadString(); + if (password.empty()) + return; + + if (!CheckAccessLevel(username) || !CheckPassword(username, password)) + { + Send("Authentication failed\r\n"); + _socket.close(); + return; + } + + TC_LOG_INFO("commands.ra", "User %s (IP: %s) authenticated correctly to RA", username.c_str(), GetRemoteIpAddress().c_str()); + + // Authentication successful, send the motd + Send(std::string(std::string(sWorld->GetMotd()) + "\r\n").c_str()); + + // Read commands + while (true) + { + Send("TC>"); + std::string command = ReadString(); + + if (ProcessCommand(command)) + break; + } + + _socket.close(); +} + +int RASession::Send(const char* data) +{ + std::ostream os(&_writeBuffer); + os << data; + size_t written = _socket.send(_writeBuffer.data()); + _writeBuffer.consume(written); + return written; +} + +std::string RASession::ReadString() +{ + boost::system::error_code error; + size_t read = boost::asio::read_until(_socket, _readBuffer, "\r\n", error); + if (!read) + { + _socket.close(); + return ""; + } + + std::string line; + std::istream is(&_readBuffer); + std::getline(is, line); + + if (*line.rbegin() == '\r') + line.erase(line.length() - 1); + + return line; +} + +bool RASession::CheckAccessLevel(const std::string& user) +{ + std::string safeUser = user; + + AccountMgr::normalizeString(safeUser); + + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_ACCESS); + stmt->setString(0, safeUser); + PreparedQueryResult result = LoginDatabase.Query(stmt); + + if (!result) + { + TC_LOG_INFO("commands.ra", "User %s does not exist in database", user.c_str()); + return false; + } + + Field* fields = result->Fetch(); + + if (fields[1].GetUInt8() < sConfigMgr->GetIntDefault("RA.MinLevel", 3)) + { + TC_LOG_INFO("commands.ra", "User %s has no privilege to login", user.c_str()); + return false; + } + else if (fields[2].GetInt32() != -1) + { + TC_LOG_INFO("commands.ra", "User %s has to be assigned on all realms (with RealmID = '-1')", user.c_str()); + return false; + } + + return true; } -void RASession::AsyncWrite(std::size_t length) +bool RASession::CheckPassword(const std::string& user, const std::string& pass) { - boost::asio::async_write(_socket, boost::asio::buffer(_writeBuffer, length), [this](boost::system::error_code error, std::size_t /*length*/) + std::string safe_user = user; + std::transform(safe_user.begin(), safe_user.end(), safe_user.begin(), ::toupper); + AccountMgr::normalizeString(safe_user); + + std::string safe_pass = pass; + AccountMgr::normalizeString(safe_pass); + std::transform(safe_pass.begin(), safe_pass.end(), safe_pass.begin(), ::toupper); + + std::string hash = AccountMgr::CalculateShaPassHash(safe_user, safe_pass); + + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_CHECK_PASSWORD_BY_NAME); + + stmt->setString(0, safe_user); + stmt->setString(1, hash); + + PreparedQueryResult result = LoginDatabase.Query(stmt); + + if (!result) { - if (error) - { - _socket.close(); - } - }); + TC_LOG_INFO("commands.ra", "Wrong password for user: %s", user.c_str()); + return false; + } + + return true; } +bool RASession::ProcessCommand(std::string& command) +{ + if (command.length() == 0) + return true; + + TC_LOG_INFO("commands.ra", "Received command: %s", command.c_str()); + + // handle quit, exit and logout commands to terminate connection + if (command == "quit" || command == "exit" || command == "logout") + { + Send("Bye\r\n"); + return true; + } + + // Obtain a new promise per command + if (_commandExecuting != nullptr) + delete _commandExecuting; + + _commandExecuting = new std::promise(); + + CliCommandHolder* cmd = new CliCommandHolder(this, command.c_str(), &RASession::CommandPrint, &RASession::CommandFinished); + sWorld->QueueCliCommand(cmd); + + // Wait for the command to finish + _commandExecuting->get_future().wait(); + + return false; +} + +void RASession::CommandPrint(void* callbackArg, const char* text) +{ + if (!text || !*text) + return; + + RASession* session = static_cast(callbackArg); + session->Send(text); +} + +void RASession::CommandFinished(void* callbackArg, bool success) +{ + RASession* session = static_cast(callbackArg); + session->_commandExecuting->set_value(); +} diff --git a/src/server/worldserver/RemoteAccess/RASession.h b/src/server/worldserver/RemoteAccess/RASession.h index a467c387858..f3ef2a6a86a 100644 --- a/src/server/worldserver/RemoteAccess/RASession.h +++ b/src/server/worldserver/RemoteAccess/RASession.h @@ -21,8 +21,11 @@ #include #include +#include #include "Common.h" +#include + using boost::asio::ip::tcp; const size_t bufferSize = 4096; @@ -32,25 +35,31 @@ const size_t bufferSize = 4096; class RASession : public std::enable_shared_from_this { public: - RASession(tcp::socket socket) : _socket(std::move(socket)) + RASession(tcp::socket socket) : _socket(std::move(socket)), _commandExecuting(nullptr) { } - void Start() - { - AsyncRead(); - } + void Start(); const std::string GetRemoteIpAddress() const { return _socket.remote_endpoint().address().to_string(); }; unsigned short GetRemotePort() const { return _socket.remote_endpoint().port(); } private: + int Send(const char* data); void AsyncRead(); void AsyncWrite(size_t length); + std::string ReadString(); + bool CheckAccessLevel(const std::string& user); + bool CheckPassword(const std::string& user, const std::string& pass); + bool ProcessCommand(std::string& command); + + static void CommandPrint(void* callbackArg, const char* text); + static void CommandFinished(void* callbackArg, bool success); tcp::socket _socket; - char _readBuffer[BUFFER_SIZE]; - char _writeBuffer[BUFFER_SIZE]; + boost::asio::streambuf _readBuffer; + boost::asio::streambuf _writeBuffer; + std::promise* _commandExecuting; }; #endif diff --git a/src/server/worldserver/RemoteAccess/RASocket.cpp b/src/server/worldserver/RemoteAccess/RASocket.cpp deleted file mode 100644 index 698d3c949cd..00000000000 --- a/src/server/worldserver/RemoteAccess/RASocket.cpp +++ /dev/null @@ -1,425 +0,0 @@ -/* - * Copyright (C) 2008-2014 TrinityCore - * Copyright (C) 2005-2009 MaNGOS - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -/** \file - \ingroup Trinityd -*/ - -#include "Common.h" -#include "Configuration/Config.h" -#include "Database/DatabaseEnv.h" -#include "AccountMgr.h" -#include "Log.h" -#include "RASocket.h" -#include "Util.h" -#include "World.h" -#include "SHA1.h" -#include "ace/OS_NS_unistd.h" - -RASocket::RASocket() -{ - _minLevel = uint8(sConfigMgr->GetIntDefault("RA.MinLevel", 3)); - _commandExecuting = false; -} - -int RASocket::open(void *) -{ - ACE_INET_Addr remoteAddress; - - if (peer().get_remote_addr(remoteAddress) == -1) - { - TC_LOG_ERROR("server.worldserver", "RASocket::open: peer().get_remote_addr error is %s", ACE_OS::strerror(errno)); - return -1; - } - - TC_LOG_INFO("commands.ra", "Incoming connection from %s", remoteAddress.get_host_addr()); - - return activate(); -} - -int RASocket::handle_close(ACE_HANDLE /*handle*/, ACE_Reactor_Mask /*mask*/) -{ - TC_LOG_INFO("commands.ra", "Closing connection"); - peer().close_reader(); - wait(); - // While the above wait() will wait for the ::svc() to finish, it will not wait for the async event - // RASocket::commandfinished to be completed. Calling destroy() before the latter function ends - // will lead to using a freed pointer -> crash. - while (_commandExecuting.value()) - ACE_OS::sleep(1); - - destroy(); - return 0; -} - -int RASocket::send(const std::string& line) -{ -#ifdef MSG_NOSIGNAL - ssize_t n = peer().send(line.c_str(), line.length(), MSG_NOSIGNAL); -#else - ssize_t n = peer().send(line.c_str(), line.length()); -#endif // MSG_NOSIGNAL - - return n == ssize_t(line.length()) ? 0 : -1; -} - -int RASocket::recv_line(ACE_Message_Block& buffer) -{ - char byte; - for (;;) - { - ssize_t n = peer().recv(&byte, sizeof(byte)); - - if (n < 0) - return -1; - - if (n == 0) - { - // EOF, connection was closed - errno = ECONNRESET; - return -1; - } - - ACE_ASSERT(n == sizeof(byte)); - - if (byte == '\n') - break; - else if (byte == '\r') /* Ignore CR */ - continue; - else if (buffer.copy(&byte, sizeof(byte)) == -1) - return -1; - } - - const char nullTerm = '\0'; - if (buffer.copy(&nullTerm, sizeof(nullTerm)) == -1) - return -1; - - return 0; -} - -int RASocket::recv_line(std::string& out_line) -{ - char buf[4096]; - - ACE_Data_Block db(sizeof (buf), - ACE_Message_Block::MB_DATA, - buf, - 0, - 0, - ACE_Message_Block::DONT_DELETE, - 0); - - ACE_Message_Block message_block(&db, - ACE_Message_Block::DONT_DELETE, - 0); - - if (recv_line(message_block) == -1) - { - TC_LOG_DEBUG("commands.ra", "Recv error %s", ACE_OS::strerror(errno)); - return -1; - } - - out_line = message_block.rd_ptr(); - - return 0; -} - -int RASocket::process_command(const std::string& command) -{ - if (command.length() == 0) - return 0; - - TC_LOG_INFO("commands.ra", "Received command: %s", command.c_str()); - - // handle quit, exit and logout commands to terminate connection - if (command == "quit" || command == "exit" || command == "logout") { - (void) send("Bye\r\n"); - return -1; - } - - _commandExecuting = true; - CliCommandHolder* cmd = new CliCommandHolder(this, command.c_str(), &RASocket::zprint, &RASocket::commandFinished); - sWorld->QueueCliCommand(cmd); - - // wait for result - ACE_Message_Block* mb; - for (;;) - { - if (getq(mb) == -1) - return -1; - - if (mb->msg_type() == ACE_Message_Block::MB_BREAK) - { - mb->release(); - break; - } - - if (send(std::string(mb->rd_ptr(), mb->length())) == -1) - { - mb->release(); - return -1; - } - - mb->release(); - } - - return 0; -} - -int RASocket::check_access_level(const std::string& user) -{ - std::string safeUser = user; - - AccountMgr::normalizeString(safeUser); - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_ACCESS); - stmt->setString(0, safeUser); - PreparedQueryResult result = LoginDatabase.Query(stmt); - - if (!result) - { - TC_LOG_INFO("commands.ra", "User %s does not exist in database", user.c_str()); - return -1; - } - - Field* fields = result->Fetch(); - - if (fields[1].GetUInt8() < _minLevel) - { - TC_LOG_INFO("commands.ra", "User %s has no privilege to login", user.c_str()); - return -1; - } - else if (fields[2].GetInt32() != -1) - { - TC_LOG_INFO("commands.ra", "User %s has to be assigned on all realms (with RealmID = '-1')", user.c_str()); - return -1; - } - - return 0; -} - -int RASocket::check_password(const std::string& user, const std::string& pass) -{ - std::string safe_user = user; - AccountMgr::normalizeString(safe_user); - - std::string safe_pass = pass; - AccountMgr::normalizeString(safe_pass); - - std::string hash = AccountMgr::CalculateShaPassHash(safe_user, safe_pass); - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_CHECK_PASSWORD_BY_NAME); - - stmt->setString(0, safe_user); - stmt->setString(1, hash); - - PreparedQueryResult result = LoginDatabase.Query(stmt); - - if (!result) - { - TC_LOG_INFO("commands.ra", "Wrong password for user: %s", user.c_str()); - return -1; - } - - return 0; -} - -int RASocket::authenticate() -{ - if (send(std::string("Username: ")) == -1) - return -1; - - std::string user; - if (recv_line(user) == -1) - return -1; - - if (send(std::string("Password: ")) == -1) - return -1; - - std::string pass; - if (recv_line(pass) == -1) - return -1; - - TC_LOG_INFO("commands.ra", "Login attempt for user: %s", user.c_str()); - - if (check_access_level(user) == -1) - return -1; - - if (check_password(user, pass) == -1) - return -1; - - TC_LOG_INFO("commands.ra", "User login: %s", user.c_str()); - - return 0; -} - - -int RASocket::subnegotiate() -{ - char buf[1024]; - - ACE_Data_Block db(sizeof (buf), - ACE_Message_Block::MB_DATA, - buf, - 0, - 0, - ACE_Message_Block::DONT_DELETE, - 0); - - ACE_Message_Block message_block(&db, - ACE_Message_Block::DONT_DELETE, - 0); - - const size_t recv_size = message_block.space(); - - // Wait a maximum of 1000ms for negotiation packet - not all telnet clients may send it - ACE_Time_Value waitTime = ACE_Time_Value(1); - const ssize_t n = peer().recv(message_block.wr_ptr(), - recv_size, &waitTime); - - if (n <= 0) - return int(n); - - if (n >= 1024) - { - TC_LOG_DEBUG("commands.ra", "RASocket::subnegotiate: allocated buffer 1024 bytes was too small for negotiation packet, size: %u", uint32(n)); - return -1; - } - - buf[n] = '\0'; - - #ifdef _DEBUG - for (uint8 i = 0; i < n; ) - { - uint8 iac = buf[i]; - if (iac == 0xFF) // "Interpret as Command" (IAC) - { - uint8 command = buf[++i]; - std::stringstream ss; - switch (command) - { - case 0xFB: // WILL - ss << "WILL "; - break; - case 0xFC: // WON'T - ss << "WON'T "; - break; - case 0xFD: // DO - ss << "DO "; - break; - case 0xFE: // DON'T - ss << "DON'T "; - break; - default: - return -1; // not allowed - } - - uint8 param = buf[++i]; - ss << uint32(param); - TC_LOG_DEBUG("commands.ra", ss.str().c_str()); - } - ++i; - } - #endif - - //! Just send back end of subnegotiation packet - uint8 const reply[2] = {0xFF, 0xF0}; - -#ifdef MSG_NOSIGNAL - return int(peer().send(reply, 2, MSG_NOSIGNAL)); -#else - return int(peer().send(reply, 2)); -#endif // MSG_NOSIGNAL -} - -int RASocket::svc(void) -{ - //! Subnegotiation may differ per client - do not react on it - subnegotiate(); - - if (send("Authentication required\r\n") == -1) - return -1; - - if (authenticate() == -1) - { - (void) send("Authentication failed\r\n"); - return -1; - } - - // send motd - if (send(std::string(sWorld->GetMotd()) + "\r\n") == -1) - return -1; - - for (;;) - { - // show prompt - if (send("TC> ") == -1) - return -1; - - std::string line; - - if (recv_line(line) == -1) - return -1; - - if (process_command(line) == -1) - return -1; - } - - return 0; -} - -void RASocket::zprint(void* callbackArg, const char * szText) -{ - if (!szText || !callbackArg) - return; - - RASocket* socket = static_cast(callbackArg); - size_t sz = strlen(szText); - - ACE_Message_Block* mb = new ACE_Message_Block(sz); - mb->copy(szText, sz); - - ACE_Time_Value tv = ACE_Time_Value::zero; - if (socket->putq(mb, &tv) == -1) - { - TC_LOG_DEBUG("commands.ra", "Failed to enqueue message, queue is full or closed. Error is %s", ACE_OS::strerror(errno)); - mb->release(); - } -} - -void RASocket::commandFinished(void* callbackArg, bool /*success*/) -{ - if (!callbackArg) - return; - - RASocket* socket = static_cast(callbackArg); - - ACE_Message_Block* mb = new ACE_Message_Block(); - - mb->msg_type(ACE_Message_Block::MB_BREAK); - - // the message is 0 size control message to tell that command output is finished - // hence we don't put timeout, because it shouldn't increase queue size and shouldn't block - if (socket->putq(mb->duplicate()) == -1) - // getting here is bad, command can't be marked as complete - TC_LOG_DEBUG("commands.ra", "Failed to enqueue command end message. Error is %s", ACE_OS::strerror(errno)); - - mb->release(); - - socket->_commandExecuting = false; -} diff --git a/src/server/worldserver/RemoteAccess/RASocket.h b/src/server/worldserver/RemoteAccess/RASocket.h deleted file mode 100644 index 2cbb14b3578..00000000000 --- a/src/server/worldserver/RemoteAccess/RASocket.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2008-2014 TrinityCore - * Copyright (C) 2005-2009 MaNGOS - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -/// \addtogroup Trinityd -/// @{ -/// \file - -#ifndef _RASOCKET_H -#define _RASOCKET_H - -#include "Common.h" - -#include -#include -#include -#include - -/// Remote Administration socket -class RASocket : public ACE_Svc_Handler -{ - public: - RASocket(); - virtual ~RASocket() { } - - virtual int svc() override; - virtual int open(void* = 0) override; - virtual int handle_close(ACE_HANDLE = ACE_INVALID_HANDLE, ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK) override; - - private: - int recv_line(std::string& outLine); - int recv_line(ACE_Message_Block& buffer); - int process_command(const std::string& command); - int authenticate(); - int subnegotiate(); ///< Used by telnet protocol RFC 854 / 855 - int check_access_level(const std::string& user); - int check_password(const std::string& user, const std::string& pass); - int send(const std::string& line); - - static void zprint(void* callbackArg, const char* szText); - static void commandFinished(void* callbackArg, bool success); - - private: - uint8 _minLevel; ///< Minimum security level required to connect - ACE_Atomic_Op _commandExecuting; -}; - -#endif - -/// @} -- cgit v1.2.3 From 87b72f41ca0a0bce6ef8843e3df53578c2e6667d Mon Sep 17 00:00:00 2001 From: Subv Date: Wed, 2 Jul 2014 21:56:40 -0500 Subject: Fixed login and some errors --- src/server/game/Server/WorldSession.cpp | 8 ++++---- src/server/shared/Database/AdhocStatement.cpp | 20 +++++++++----------- src/server/shared/Database/AdhocStatement.h | 6 +++--- src/server/shared/Database/DatabaseWorkerPool.h | 15 ++++++--------- src/server/shared/Database/PreparedStatement.cpp | 22 +++++++++++----------- src/server/shared/Database/PreparedStatement.h | 6 +++--- src/server/shared/Database/QueryHolder.h | 8 +++++--- src/server/shared/Threading/Callback.h | 4 ++-- src/server/worldserver/RemoteAccess/RASession.h | 2 -- 9 files changed, 43 insertions(+), 48 deletions(-) (limited to 'src') diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 7fbc398a4da..444c06e41b8 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -1105,7 +1105,7 @@ void WorldSession::ProcessQueryCallbacks() PreparedQueryResult result; //! HandleCharEnumOpcode - if (_charEnumCallback.wait_for(std::chrono::seconds(0)) == std::future_status::ready) + if (_charEnumCallback.valid() && _charEnumCallback.wait_for(std::chrono::seconds(0)) == std::future_status::ready) { result = _charEnumCallback.get(); HandleCharEnum(result); @@ -1118,7 +1118,7 @@ void WorldSession::ProcessQueryCallbacks() } //! HandlePlayerLoginOpcode - if (_charLoginCallback.wait_for(std::chrono::seconds(0)) == std::future_status::ready) + if (_charLoginCallback.valid() && _charLoginCallback.wait_for(std::chrono::seconds(0)) == std::future_status::ready) { SQLQueryHolder* param = _charLoginCallback.get(); HandlePlayerLogin((LoginQueryHolder*)param); @@ -1143,7 +1143,7 @@ void WorldSession::ProcessQueryCallbacks() } //- HandleCharAddIgnoreOpcode - if (_addIgnoreCallback.wait_for(std::chrono::seconds(0)) == std::future_status::ready) + if (_addIgnoreCallback.valid() && _addIgnoreCallback.wait_for(std::chrono::seconds(0)) == std::future_status::ready) { result = _addIgnoreCallback.get(); HandleAddIgnoreOpcodeCallBack(result); @@ -1159,7 +1159,7 @@ void WorldSession::ProcessQueryCallbacks() } //- HandleStablePet - if (_stablePetCallback.wait_for(std::chrono::seconds(0)) == std::future_status::ready) + if (_stablePetCallback.valid() && _stablePetCallback.wait_for(std::chrono::seconds(0)) == std::future_status::ready) { result = _stablePetCallback.get(); HandleStablePetCallback(result); diff --git a/src/server/shared/Database/AdhocStatement.cpp b/src/server/shared/Database/AdhocStatement.cpp index 65c41823ccb..7fae9173d20 100644 --- a/src/server/shared/Database/AdhocStatement.cpp +++ b/src/server/shared/Database/AdhocStatement.cpp @@ -19,22 +19,20 @@ #include "MySQLConnection.h" /*! Basic, ad-hoc queries. */ -BasicStatementTask::BasicStatementTask(const char* sql) : -m_has_result(false) -{ - m_sql = strdup(sql); -} - -BasicStatementTask::BasicStatementTask(const char* sql, QueryResultPromise& result) : -m_has_result(true), -m_result(std::move(result)) +BasicStatementTask::BasicStatementTask(const char* sql, bool async) : +m_result(nullptr) { m_sql = strdup(sql); + m_has_result = async; // If the operation is async, then there's a result + if (async) + m_result = new QueryResultPromise(); } BasicStatementTask::~BasicStatementTask() { free((void*)m_sql); + if (m_has_result && m_result != nullptr) + delete m_result; } bool BasicStatementTask::Execute() @@ -45,11 +43,11 @@ bool BasicStatementTask::Execute() if (!result || !result->GetRowCount() || !result->NextRow()) { delete result; - m_result.set_value(QueryResult(NULL)); + m_result->set_value(QueryResult(NULL)); return false; } - m_result.set_value(QueryResult(result)); + m_result->set_value(QueryResult(result)); return true; } diff --git a/src/server/shared/Database/AdhocStatement.h b/src/server/shared/Database/AdhocStatement.h index a67caaa160f..40c1dbb7098 100644 --- a/src/server/shared/Database/AdhocStatement.h +++ b/src/server/shared/Database/AdhocStatement.h @@ -28,16 +28,16 @@ typedef std::promise QueryResultPromise; class BasicStatementTask : public SQLOperation { public: - BasicStatementTask(const char* sql); - BasicStatementTask(const char* sql, QueryResultPromise& result); + BasicStatementTask(const char* sql, bool async = false); ~BasicStatementTask(); bool Execute() override; + QueryResultFuture GetFuture() { return m_result->get_future(); } private: const char* m_sql; //- Raw query to be executed bool m_has_result; - QueryResultPromise m_result; + QueryResultPromise* m_result; }; #endif \ No newline at end of file diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h index 4b9e887f341..f0b540022da 100644 --- a/src/server/shared/Database/DatabaseWorkerPool.h +++ b/src/server/shared/Database/DatabaseWorkerPool.h @@ -296,10 +296,9 @@ class DatabaseWorkerPool //! The return value is then processed in ProcessQueryCallback methods. QueryResultFuture AsyncQuery(const char* sql) { - QueryResultPromise res; - BasicStatementTask* task = new BasicStatementTask(sql, res); + BasicStatementTask* task = new BasicStatementTask(sql, true); Enqueue(task); - return res.get_future(); //! Actual return value has no use yet + return task->GetFuture(); //! Actual return value has no use yet } //! Enqueues a query in string format -with variable args- that will set the value of the QueryResultFuture return object as soon as the query is executed. @@ -320,10 +319,9 @@ class DatabaseWorkerPool //! Statement must be prepared with CONNECTION_ASYNC flag. PreparedQueryResultFuture AsyncQuery(PreparedStatement* stmt) { - PreparedQueryResultPromise res; - PreparedStatementTask* task = new PreparedStatementTask(stmt, res); + PreparedStatementTask* task = new PreparedStatementTask(stmt, true); Enqueue(task); - return res.get_future(); + return task->GetFuture(); } //! Enqueues a vector of SQL operations (can be both adhoc and prepared) that will set the value of the QueryResultHolderFuture @@ -332,10 +330,9 @@ class DatabaseWorkerPool //! Any prepared statements added to this holder need to be prepared with the CONNECTION_ASYNC flag. QueryResultHolderFuture DelayQueryHolder(SQLQueryHolder* holder) { - QueryResultHolderPromise res; - SQLQueryHolderTask* task = new SQLQueryHolderTask(holder, res); + SQLQueryHolderTask* task = new SQLQueryHolderTask(holder); Enqueue(task); - return res.get_future(); //! Fool compiler, has no use yet + return task->GetFuture(); } /** diff --git a/src/server/shared/Database/PreparedStatement.cpp b/src/server/shared/Database/PreparedStatement.cpp index 4b2b55f25e5..fb1bfa687d0 100644 --- a/src/server/shared/Database/PreparedStatement.cpp +++ b/src/server/shared/Database/PreparedStatement.cpp @@ -445,19 +445,19 @@ std::string MySQLPreparedStatement::getQueryString(std::string const& sqlPattern } //- Execution -PreparedStatementTask::PreparedStatementTask(PreparedStatement* stmt) : -m_stmt(stmt), -m_has_result(false) { } - -PreparedStatementTask::PreparedStatementTask(PreparedStatement* stmt, PreparedQueryResultPromise& result) : -m_stmt(stmt), -m_has_result(true), -m_result(std::move(result)) { } - +PreparedStatementTask::PreparedStatementTask(PreparedStatement* stmt, bool async) : +m_stmt(stmt) +{ + m_has_result = async; // If it's async, then there's a result + if (async) + m_result = new PreparedQueryResultPromise(); +} PreparedStatementTask::~PreparedStatementTask() { delete m_stmt; + if (m_has_result && m_result != nullptr) + delete m_result; } bool PreparedStatementTask::Execute() @@ -468,10 +468,10 @@ bool PreparedStatementTask::Execute() if (!result || !result->GetRowCount()) { delete result; - m_result.set_value(PreparedQueryResult(NULL)); + m_result->set_value(PreparedQueryResult(NULL)); return false; } - m_result.set_value(PreparedQueryResult(result)); + m_result->set_value(PreparedQueryResult(result)); return true; } diff --git a/src/server/shared/Database/PreparedStatement.h b/src/server/shared/Database/PreparedStatement.h index d69ee52a3e7..16f7a9141d3 100644 --- a/src/server/shared/Database/PreparedStatement.h +++ b/src/server/shared/Database/PreparedStatement.h @@ -160,15 +160,15 @@ typedef std::promise PreparedQueryResultPromise; class PreparedStatementTask : public SQLOperation { public: - PreparedStatementTask(PreparedStatement* stmt); - PreparedStatementTask(PreparedStatement* stmt, PreparedQueryResultPromise& result); + PreparedStatementTask(PreparedStatement* stmt, bool async = false); ~PreparedStatementTask(); bool Execute(); + PreparedQueryResultFuture GetFuture() { return m_result->get_future(); } protected: PreparedStatement* m_stmt; bool m_has_result; - PreparedQueryResultPromise m_result; + PreparedQueryResultPromise* m_result; }; #endif diff --git a/src/server/shared/Database/QueryHolder.h b/src/server/shared/Database/QueryHolder.h index 5751675fe5f..37e23ecd653 100644 --- a/src/server/shared/Database/QueryHolder.h +++ b/src/server/shared/Database/QueryHolder.h @@ -45,13 +45,15 @@ typedef std::promise QueryResultHolderPromise; class SQLQueryHolderTask : public SQLOperation { private: - SQLQueryHolder * m_holder; + SQLQueryHolder* m_holder; QueryResultHolderPromise m_result; public: - SQLQueryHolderTask(SQLQueryHolder *holder, QueryResultHolderPromise& res) - : m_holder(holder), m_result(std::move(res)){ }; + SQLQueryHolderTask(SQLQueryHolder* holder) + : m_holder(holder) { }; + bool Execute(); + QueryResultHolderFuture GetFuture() { return m_result.get_future(); } }; diff --git a/src/server/shared/Threading/Callback.h b/src/server/shared/Threading/Callback.h index 5d9dc9a760d..80c865b5710 100644 --- a/src/server/shared/Threading/Callback.h +++ b/src/server/shared/Threading/Callback.h @@ -47,7 +47,7 @@ class QueryCallback int IsReady() { - return _result.wait_for(std::chrono::seconds(0)) == std::future_status::ready; + return _result.valid() && _result.wait_for(std::chrono::seconds(0)) == std::future_status::ready; } void GetResult(Result& res) @@ -130,7 +130,7 @@ class QueryCallback_2 int IsReady() { - return _result.wait_for(std::chrono::seconds(0)) == std::future_status::ready; + return _result.valid() && _result.wait_for(std::chrono::seconds(0)) == std::future_status::ready; } void GetResult(Result& res) diff --git a/src/server/worldserver/RemoteAccess/RASession.h b/src/server/worldserver/RemoteAccess/RASession.h index f3ef2a6a86a..d06ebfa31a7 100644 --- a/src/server/worldserver/RemoteAccess/RASession.h +++ b/src/server/worldserver/RemoteAccess/RASession.h @@ -46,8 +46,6 @@ public: private: int Send(const char* data); - void AsyncRead(); - void AsyncWrite(size_t length); std::string ReadString(); bool CheckAccessLevel(const std::string& user); bool CheckPassword(const std::string& user, const std::string& pass); -- cgit v1.2.3 From 25debd75777fef2cd3e3903eba814ee882e19a68 Mon Sep 17 00:00:00 2001 From: leak Date: Thu, 3 Jul 2014 19:05:42 +0200 Subject: Fix non-PCH compile --- src/server/worldserver/RemoteAccess/RASession.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/server/worldserver/RemoteAccess/RASession.cpp b/src/server/worldserver/RemoteAccess/RASession.cpp index 536ce22839b..d065ae822a9 100644 --- a/src/server/worldserver/RemoteAccess/RASession.cpp +++ b/src/server/worldserver/RemoteAccess/RASession.cpp @@ -22,6 +22,10 @@ #include #include "RASession.h" #include "AccountMgr.h" +#include "Log.h" +#include "DatabaseEnv.h" +#include "World.h" +#include "Config.h" using boost::asio::ip::tcp; -- cgit v1.2.3 From 0a07fd5fc38f5b3beac187de88dcd26cb60d9f76 Mon Sep 17 00:00:00 2001 From: Subv Date: Thu, 3 Jul 2014 15:08:10 -0500 Subject: Some changes here and there in shared --- src/server/shared/Configuration/Config.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/server/shared/Configuration/Config.cpp b/src/server/shared/Configuration/Config.cpp index b6690d02155..aea9d4c1366 100644 --- a/src/server/shared/Configuration/Config.cpp +++ b/src/server/shared/Configuration/Config.cpp @@ -38,12 +38,11 @@ bool ConfigMgr::LoadInitial(char const* file) ptree fullTree; boost::property_tree::ini_parser::read_ini(file, fullTree); + if (fullTree.empty()) + return false; + // Since we're using only one section per config file, we skip the section and have direct property access - for (auto section : fullTree) - { - _config = section.second; - break; - } + _config = fullTree.begin().second; } catch (std::exception const& /*ex*/) { @@ -58,9 +57,9 @@ bool ConfigMgr::Reload() return LoadInitial(_filename.c_str()); } -std::string ConfigMgr::GetStringDefault(const char* name, const std::string &def) +std::string ConfigMgr::GetStringDefault(const char* name, const std::string& def) { - std::string value = _config.get(ptree::path_type(name,'/'), def); + std::string value = _config.get(ptree::path_type(name, '/'), def); value.erase(std::remove(value.begin(), value.end(), '"'), value.end()); @@ -104,12 +103,8 @@ std::list ConfigMgr::GetKeysByString(std::string const& name) std::list keys; for (const ptree::value_type& child : _config) - { if (child.first.compare(0, name.length(), name) == 0) - { keys.push_back(child.first); - } - } return keys; } -- cgit v1.2.3 From 4f2f9e08f80f46149dbbe8e5ca469267f39ae438 Mon Sep 17 00:00:00 2001 From: leak Date: Fri, 4 Jul 2014 15:20:23 +0200 Subject: Fixed compilation and some copy paste error --- src/server/authserver/Server/AuthSession.cpp | 2 +- src/server/game/World/World.cpp | 2 -- src/server/shared/Configuration/Config.cpp | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/authserver/Server/AuthSession.cpp b/src/server/authserver/Server/AuthSession.cpp index 6646f1203b5..f518dc7593b 100644 --- a/src/server/authserver/Server/AuthSession.cpp +++ b/src/server/authserver/Server/AuthSession.cpp @@ -595,7 +595,7 @@ bool AuthSession::_HandleLogonProof() uint32 MaxWrongPassCount = sConfigMgr->GetIntDefault("WrongPass.MaxCount", 0); // We can not include the failed account login hook. However, this is a workaround to still log this. - if (sConfigMgr->GetBoolDefault("Additional.IP.Based.Login.Logging", false)) + if (sConfigMgr->GetBoolDefault("Wrong.Password.Login.Logging", false)) { PreparedStatement* logstmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_FALP_IP_LOGGING); logstmt->setString(0, _login); diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 48dd6565f95..ad23e016e32 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1259,8 +1259,6 @@ void World::LoadConfigSettings(bool reload) m_bool_configs[CONFIG_IP_BASED_ACTION_LOGGING] = sConfigMgr->GetBoolDefault("Allow.IP.Based.Action.Logging", false); - m_bool_configs[CONFIG_IP_BASED_LOGIN_LOGGING] = sConfigMgr->GetBoolDefault("Wrong.Password.Login.Logging", false); - // call ScriptMgr if we're reloading the configuration if (reload) sScriptMgr->OnConfigLoad(reload); diff --git a/src/server/shared/Configuration/Config.cpp b/src/server/shared/Configuration/Config.cpp index aea9d4c1366..fe61cde5594 100644 --- a/src/server/shared/Configuration/Config.cpp +++ b/src/server/shared/Configuration/Config.cpp @@ -42,7 +42,7 @@ bool ConfigMgr::LoadInitial(char const* file) return false; // Since we're using only one section per config file, we skip the section and have direct property access - _config = fullTree.begin().second; + _config = fullTree.begin()->second; } catch (std::exception const& /*ex*/) { -- cgit v1.2.3 From 021e18d152b68b9d2a0c5887bab7eb7b61ecd2ca Mon Sep 17 00:00:00 2001 From: leak Date: Fri, 4 Jul 2014 15:22:06 +0200 Subject: Refactored both world and auth main - Master/Worldrunable removed - World Update loop now running on main (which was doing nothing before) - Processpriority moved to shared - Added a preliminary thread pool for boost::asio::io_service --- src/server/authserver/Main.cpp | 160 ++----- src/server/shared/Threading/ProcessPriority.h | 100 +++++ src/server/worldserver/CMakeLists.txt | 3 - src/server/worldserver/Main.cpp | 487 +++++++++++++++++++-- src/server/worldserver/Master.cpp | 479 -------------------- src/server/worldserver/Master.h | 57 --- .../worldserver/WorldThread/WorldRunnable.cpp | 103 ----- src/server/worldserver/WorldThread/WorldRunnable.h | 32 -- src/server/worldserver/worldserver.conf.dist | 23 +- 9 files changed, 616 insertions(+), 828 deletions(-) create mode 100644 src/server/shared/Threading/ProcessPriority.h delete mode 100644 src/server/worldserver/Master.cpp delete mode 100644 src/server/worldserver/Master.h delete mode 100644 src/server/worldserver/WorldThread/WorldRunnable.cpp delete mode 100644 src/server/worldserver/WorldThread/WorldRunnable.h (limited to 'src') diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index 4e39ae0aca1..c7f71edbd0c 100644 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -24,28 +24,24 @@ * authentication server */ -#include -#include -#include #include #include +#include +#include +#include +#include "AsyncAcceptor.h" +#include "AuthSession.h" #include "Common.h" -#include "Database/DatabaseEnv.h" #include "Configuration/Config.h" +#include "Database/DatabaseEnv.h" #include "Log.h" +#include "ProcessPriority.h" +#include "RealmList.h" #include "SystemConfig.h" #include "Util.h" -#include "RealmList.h" -#include "AsyncAcceptor.h" -#include "AuthSession.h" - -#ifdef __linux__ -#include -#include -#define PROCESS_HIGH_PRIORITY -15 // [-20, 19], default is 0 -#endif +using boost::asio::ip::tcp; #ifndef _TRINITY_REALM_CONFIG # define _TRINITY_REALM_CONFIG "authserver.conf" @@ -53,51 +49,15 @@ bool StartDB(); void StopDB(); -void SetProcessPriority(); +void SignalHandler(const boost::system::error_code& error, int signalNumber); +void KeepDatabaseAliveHandler(const boost::system::error_code& error); +void usage(const char* prog); boost::asio::io_service _ioService; boost::asio::deadline_timer _dbPingTimer(_ioService); uint32 _dbPingInterval; +LoginDatabaseWorkerPool LoginDatabase; -LoginDatabaseWorkerPool LoginDatabase; // Accessor to the authserver database - -using boost::asio::ip::tcp; - - -void SignalHandler(const boost::system::error_code& error, int signalNumber) -{ - if (!error) - { - switch (signalNumber) - { - case SIGINT: - case SIGTERM: - _ioService.stop(); - break; - } - } -} - -void KeepDatabaseAliveHandler(const boost::system::error_code& error) -{ - if (!error) - { - TC_LOG_INFO("server.authserver", "Ping MySQL to keep connection alive"); - LoginDatabase.KeepAlive(); - - _dbPingTimer.expires_from_now(boost::posix_time::minutes(_dbPingInterval)); - } -} - -/// Print out the usage string for this program on the console. -void usage(const char* prog) -{ - TC_LOG_INFO("server.authserver", "Usage: \n %s []\n" - " -c config_file use config_file as configuration file\n\r", - prog); -} - -/// Launch the auth server int main(int argc, char** argv) { // Command line parsing to get the configuration file name @@ -129,7 +89,6 @@ int main(int argc, char** argv) TC_LOG_INFO("server.authserver", "%s (authserver)", _FULLVERSION); TC_LOG_INFO("server.authserver", " to stop.\n"); TC_LOG_INFO("server.authserver", "Using configuration file %s.", configFile); - TC_LOG_INFO("server.authserver", "%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); // authserver PID file creation @@ -158,31 +117,30 @@ int main(int argc, char** argv) return 1; } - // Launch the listening network socket - + // Start the listening port (acceptor) for auth connections int32 port = sConfigMgr->GetIntDefault("RealmServerPort", 3724); if (port < 0 || port > 0xFFFF) { TC_LOG_ERROR("server.authserver", "Specified port out of allowed range (1-65535)"); return 1; } - + std::string bindIp = sConfigMgr->GetStringDefault("BindIP", "0.0.0.0"); - AsyncAcceptor authServer(_ioService, bindIp, port); // Set signal handlers boost::asio::signal_set signals(_ioService, SIGINT, SIGTERM); signals.async_wait(SignalHandler); - SetProcessPriority(); + // Set process priority according to configuration settings + SetProcessPriority("server.authserver"); + // Enabled a timed callback for handling the database keep alive ping _dbPingInterval = sConfigMgr->GetIntDefault("MaxPingTime", 30); - _dbPingTimer.expires_from_now(boost::posix_time::seconds(_dbPingInterval)); _dbPingTimer.async_wait(KeepDatabaseAliveHandler); - // Start the io service + // Start the io service worker loop _ioService.run(); // Close the Database Pool and library @@ -238,73 +196,35 @@ void StopDB() MySQL::Library_End(); } -void SetProcessPriority() +void SignalHandler(const boost::system::error_code& error, int signalNumber) { -#if defined(_WIN32) || defined(__linux__) - - ///- Handle affinity for multiple processors and process priority - uint32 affinity = sConfigMgr->GetIntDefault("UseProcessors", 0); - bool highPriority = sConfigMgr->GetBoolDefault("ProcessPriority", false); - -#ifdef _WIN32 // Windows - - HANDLE hProcess = GetCurrentProcess(); - if (affinity > 0) + if (!error) { - ULONG_PTR appAff; - ULONG_PTR sysAff; - - if (GetProcessAffinityMask(hProcess, &appAff, &sysAff)) + switch (signalNumber) { - // remove non accessible processors - ULONG_PTR currentAffinity = affinity & appAff; - - if (!currentAffinity) - TC_LOG_ERROR("server.authserver", "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the authserver. Accessible processors bitmask (hex): %x", affinity, appAff); - else if (SetProcessAffinityMask(hProcess, currentAffinity)) - TC_LOG_INFO("server.authserver", "Using processors (bitmask, hex): %x", currentAffinity); - else - TC_LOG_ERROR("server.authserver", "Can't set used processors (hex): %x", currentAffinity); + case SIGINT: + case SIGTERM: + _ioService.stop(); + break; } } +} - if (highPriority) - { - if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS)) - TC_LOG_INFO("server.authserver", "authserver process priority class set to HIGH"); - else - TC_LOG_ERROR("server.authserver", "Can't set authserver process priority class."); - } - -#else // Linux - - if (affinity > 0) +void KeepDatabaseAliveHandler(const boost::system::error_code& error) +{ + if (!error) { - cpu_set_t mask; - CPU_ZERO(&mask); - - for (unsigned int i = 0; i < sizeof(affinity) * 8; ++i) - if (affinity & (1 << i)) - CPU_SET(i, &mask); - - if (sched_setaffinity(0, sizeof(mask), &mask)) - TC_LOG_ERROR("server.authserver", "Can't set used processors (hex): %x, error: %s", affinity, strerror(errno)); - else - { - CPU_ZERO(&mask); - sched_getaffinity(0, sizeof(mask), &mask); - TC_LOG_INFO("server.authserver", "Using processors (bitmask, hex): %lx", *(__cpu_mask*)(&mask)); - } - } + TC_LOG_INFO("server.authserver", "Ping MySQL to keep connection alive"); + LoginDatabase.KeepAlive(); - if (highPriority) - { - if (setpriority(PRIO_PROCESS, 0, PROCESS_HIGH_PRIORITY)) - TC_LOG_ERROR("server.authserver", "Can't set authserver process priority class, error: %s", strerror(errno)); - else - TC_LOG_INFO("server.authserver", "authserver process priority class set to %i", getpriority(PRIO_PROCESS, 0)); + _dbPingTimer.expires_from_now(boost::posix_time::minutes(_dbPingInterval)); } +} -#endif -#endif +/// Print out the usage string for this program on the console. +void usage(const char* prog) +{ + TC_LOG_INFO("server.authserver", "Usage: \n %s []\n" + " -c config_file use config_file as configuration file\n\r", + prog); } diff --git a/src/server/shared/Threading/ProcessPriority.h b/src/server/shared/Threading/ProcessPriority.h new file mode 100644 index 00000000000..cd116ccbbc8 --- /dev/null +++ b/src/server/shared/Threading/ProcessPriority.h @@ -0,0 +1,100 @@ +/* +* Copyright (C) 2008-2014 TrinityCore +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program. If not, see . +*/ + +#ifndef _PROCESSPRIO_H +#define _PROCESSPRIO_H + +#include "Configuration/Config.h" + +#ifdef __linux__ +#include +#include +#define PROCESS_HIGH_PRIORITY -15 // [-20, 19], default is 0 +#endif + +void SetProcessPriority(const std::string logChannel) +{ +#if defined(_WIN32) || defined(__linux__) + + ///- Handle affinity for multiple processors and process priority + uint32 affinity = sConfigMgr->GetIntDefault("UseProcessors", 0); + bool highPriority = sConfigMgr->GetBoolDefault("ProcessPriority", false); + +#ifdef _WIN32 // Windows + + HANDLE hProcess = GetCurrentProcess(); + if (affinity > 0) + { + ULONG_PTR appAff; + ULONG_PTR sysAff; + + if (GetProcessAffinityMask(hProcess, &appAff, &sysAff)) + { + // remove non accessible processors + ULONG_PTR currentAffinity = affinity & appAff; + + if (!currentAffinity) + TC_LOG_ERROR(logChannel, "Processors marked in UseProcessors bitmask (hex) %x are not accessible. Accessible processors bitmask (hex): %x", affinity, appAff); + else if (SetProcessAffinityMask(hProcess, currentAffinity)) + TC_LOG_INFO(logChannel, "Using processors (bitmask, hex): %x", currentAffinity); + else + TC_LOG_ERROR(logChannel, "Can't set used processors (hex): %x", currentAffinity); + } + } + + if (highPriority) + { + if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS)) + TC_LOG_INFO(logChannel, "Process priority class set to HIGH"); + else + TC_LOG_ERROR(logChannel, "Can't set process priority class."); + } + +#else // Linux + + if (affinity > 0) + { + cpu_set_t mask; + CPU_ZERO(&mask); + + for (unsigned int i = 0; i < sizeof(affinity) * 8; ++i) + if (affinity & (1 << i)) + CPU_SET(i, &mask); + + if (sched_setaffinity(0, sizeof(mask), &mask)) + TC_LOG_ERROR(logChannel, "Can't set used processors (hex): %x, error: %s", affinity, strerror(errno)); + else + { + CPU_ZERO(&mask); + sched_getaffinity(0, sizeof(mask), &mask); + TC_LOG_INFO(logChannel, "Using processors (bitmask, hex): %lx", *(__cpu_mask*)(&mask)); + } + } + + if (highPriority) + { + if (setpriority(PRIO_PROCESS, 0, PROCESS_HIGH_PRIORITY)) + TC_LOG_ERROR(logChannel, "Can't set process priority class, error: %s", strerror(errno)); + else + TC_LOG_INFO(logChannel, "Process priority class set to %i", getpriority(PRIO_PROCESS, 0)); + } + +#endif +#endif +} + +#endif diff --git a/src/server/worldserver/CMakeLists.txt b/src/server/worldserver/CMakeLists.txt index 9d2e859a7de..b7a158ab3ce 100644 --- a/src/server/worldserver/CMakeLists.txt +++ b/src/server/worldserver/CMakeLists.txt @@ -11,7 +11,6 @@ file(GLOB_RECURSE sources_CommandLine CommandLine/*.cpp CommandLine/*.h) file(GLOB_RECURSE sources_RemoteAccess RemoteAccess/*.cpp RemoteAccess/*.h) file(GLOB_RECURSE sources_TCSoap TCSoap/*.cpp TCSoap/*.h) -file(GLOB_RECURSE sources_WorldThread WorldThread/*.cpp WorldThread/*.h) file(GLOB sources_localdir *.cpp *.h) if (USE_COREPCH) @@ -24,7 +23,6 @@ set(worldserver_SRCS ${sources_CommandLine} ${sources_RemoteAccess} ${sources_TCSoap} - ${sources_WorldThread} ${sources_localdir} ) @@ -138,7 +136,6 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/CommandLine ${CMAKE_CURRENT_SOURCE_DIR}/RemoteAccess ${CMAKE_CURRENT_SOURCE_DIR}/TCSoap - ${CMAKE_CURRENT_SOURCE_DIR}/WorldThread ${ACE_INCLUDE_DIR} ${MYSQL_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR} diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp index bcc058c7fb3..0fc2c1a7221 100644 --- a/src/server/worldserver/Main.cpp +++ b/src/server/worldserver/Main.cpp @@ -22,17 +22,30 @@ #include #include +#include #include "Common.h" -#include "Database/DatabaseEnv.h" +#include "DatabaseEnv.h" +#include "AsyncAcceptor.h" +#include "RASession.h" #include "Configuration/Config.h" +#include "OpenSSLCrypto.h" +#include "ProcessPriority.h" +#include "BigNumber.h" +#include "RealmList.h" +#include "World.h" +#include "MapManager.h" +#include "ObjectAccessor.h" +#include "ScriptMgr.h" +#include "WorldSocketMgr.h" +#include "OutdoorPvP/OutdoorPvPMgr.h" +#include "BattlegroundMgr.h" +#include "TCSoap.h" +#include "CliRunnable.h" +#include "SystemConfig.h" -#include "Log.h" -#include "Master.h" - -#ifndef _TRINITY_CORE_CONFIG -# define _TRINITY_CORE_CONFIG "worldserver.conf" -#endif +#define TRINITY_CORE_CONFIG "worldserver.conf" +#define WORLD_SLEEP_CONST 50 #ifdef _WIN32 #include "ServiceWin32.h" @@ -48,31 +61,26 @@ char serviceDescription[] = "TrinityCore World of Warcraft emulator world servic int m_ServiceStatus = -1; #endif +boost::asio::io_service _ioService; WorldDatabaseWorkerPool WorldDatabase; ///< Accessor to the world database CharacterDatabaseWorkerPool CharacterDatabase; ///< Accessor to the character database LoginDatabaseWorkerPool LoginDatabase; ///< Accessor to the realm/login database - uint32 realmID; ///< Id of the realm -/// Print out the usage string for this program on the console. -void usage(const char* prog) -{ - printf("Usage:\n"); - printf(" %s []\n", prog); - printf(" -c config_file use config_file as configuration file\n"); -#ifdef _WIN32 - printf(" Running as service functions:\n"); - printf(" --service run as service\n"); - printf(" -s install install service\n"); - printf(" -s uninstall uninstall service\n"); -#endif -} +void usage(const char* prog); +void SignalHandler(const boost::system::error_code& error, int signalNumber); +void FreezeDetectorThread(uint32 delayTime); +AsyncAcceptor* StartRaSocketAcceptor(boost::asio::io_service& ioService); +bool StartDB(); +void StopDB(); +void WorldUpdateLoop(); +void ClearOnlineAccounts(); /// Launch the Trinity server extern int main(int argc, char** argv) { ///- Command line parsing to get the configuration file name - char const* cfg_file = _TRINITY_CORE_CONFIG; + char const* cfg_file = TRINITY_CORE_CONFIG; int c = 1; while (c < argc) { @@ -131,21 +139,442 @@ extern int main(int argc, char** argv) return 1; } + TC_LOG_INFO("server.worldserver", "%s (worldserver-daemon)", _FULLVERSION); + TC_LOG_INFO("server.worldserver", " to stop.\n"); + TC_LOG_INFO("server.worldserver", " ______ __"); + TC_LOG_INFO("server.worldserver", "/\\__ _\\ __ __/\\ \\__"); + TC_LOG_INFO("server.worldserver", "\\/_/\\ \\/ _ __ /\\_\\ ___ /\\_\\ \\, _\\ __ __"); + TC_LOG_INFO("server.worldserver", " \\ \\ \\/\\`'__\\/\\ \\ /' _ `\\/\\ \\ \\ \\/ /\\ \\/\\ \\"); + TC_LOG_INFO("server.worldserver", " \\ \\ \\ \\ \\/ \\ \\ \\/\\ \\/\\ \\ \\ \\ \\ \\_\\ \\ \\_\\ \\"); + TC_LOG_INFO("server.worldserver", " \\ \\_\\ \\_\\ \\ \\_\\ \\_\\ \\_\\ \\_\\ \\__\\\\/`____ \\"); + TC_LOG_INFO("server.worldserver", " \\/_/\\/_/ \\/_/\\/_/\\/_/\\/_/\\/__/ `/___/> \\"); + TC_LOG_INFO("server.worldserver", " C O R E /\\___/"); + TC_LOG_INFO("server.worldserver", "http://TrinityCore.org \\/__/\n"); TC_LOG_INFO("server.worldserver", "Using configuration file %s.", cfg_file); - TC_LOG_INFO("server.worldserver", "Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); - TC_LOG_INFO("server.worldserver", "Using Boost version: %s", BOOST_LIB_VERSION); + TC_LOG_INFO("server.worldserver", "Using Boost version: %i.%i.%i", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100); + + OpenSSLCrypto::threadsSetup(); + BigNumber seed1; + seed1.SetRand(16 * 8); + + /// worldserver PID file creation + std::string pidFile = sConfigMgr->GetStringDefault("PidFile", ""); + if (!pidFile.empty()) + { + if (uint32 pid = CreatePIDFile(pidFile)) + TC_LOG_INFO("server.worldserver", "Daemon PID: %u\n", pid); + else + { + TC_LOG_ERROR("server.worldserver", "Cannot create PID file %s.\n", pidFile.c_str()); + return 1; + } + } + + // Set signal handlers (this must be done before starting io_service threads, because otherwise they would unblock and exit) + boost::asio::signal_set signals(_ioService, SIGINT, SIGTERM); + signals.async_wait(SignalHandler); + + // Start the Boost based thread pool + int numThreads = sConfigMgr->GetIntDefault("ThreadPool", 1); + std::vector threadPool; + + if (numThreads < 1) + numThreads = 1; + + for (int i = 0; i < numThreads; ++i) + threadPool.push_back(std::thread(boost::bind(&boost::asio::io_service::run, &_ioService))); + + // Set process priority according to configuration settings + SetProcessPriority("server.worldserver"); + + // Start the databases + if (!StartDB()) + return 1; + + // Set server offline (not connectable) + LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = (flag & ~%u) | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, REALM_FLAG_INVALID, realmID); + + // Initialize the World + sWorld->SetInitialWorldSettings(); + + // Launch CliRunnable thread + std::thread* cliThread = nullptr; +#ifdef _WIN32 + if (sConfigMgr->GetBoolDefault("Console.Enable", true) && (m_ServiceStatus == -1)/* need disable console in service mode*/) +#else + if (sConfigMgr->GetBoolDefault("Console.Enable", true)) +#endif + { + cliThread = new std::thread(CliThread); + } + + // Start the Remote Access port (acceptor) if enabled + AsyncAcceptor* raAcceptor = nullptr; + if (sConfigMgr->GetBoolDefault("Ra.Enable", false)) + raAcceptor = StartRaSocketAcceptor(_ioService); + + // Start soap serving thread if enabled + std::thread* soapThread = nullptr; + if (sConfigMgr->GetBoolDefault("SOAP.Enabled", false)) + { + soapThread = new std::thread(TCSoapThread, sConfigMgr->GetStringDefault("SOAP.IP", "127.0.0.1"), uint16(sConfigMgr->GetIntDefault("SOAP.Port", 7878))); + } + + // Start up freeze catcher thread + std::thread* freezeDetectorThread = nullptr; + if (uint32 freezeDelay = sConfigMgr->GetIntDefault("MaxCoreStuckTime", 0)) + freezeDetectorThread = new std::thread(FreezeDetectorThread, freezeDelay); + + // Launch the worldserver listener socket + uint16 worldPort = uint16(sWorld->getIntConfig(CONFIG_PORT_WORLD)); + std::string bindIp = sConfigMgr->GetStringDefault("BindIP", "0.0.0.0"); + + if (sWorldSocketMgr->StartNetwork(worldPort, bindIp.c_str()) == -1) + { + TC_LOG_ERROR("server.worldserver", "Failed to start network"); + return ERROR_EXIT_CODE; + } - ///- and run the 'Master' - /// @todo Why do we need this 'Master'? Can't all of this be in the Main as for Realmd? - int ret = sMaster->Run(); + // Set server online (allow connecting now) + LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag & ~%u, population = 0 WHERE id = '%u'", REALM_FLAG_INVALID, realmID); + + TC_LOG_INFO("server.worldserver", "%s (worldserver-daemon) ready...", _FULLVERSION); + + sScriptMgr->OnStartup(); + + WorldUpdateLoop(); + + // Shutdown starts here + + _ioService.stop(); + + for (auto& thread : threadPool) + { + thread.join(); + } + + sScriptMgr->OnShutdown(); + + sWorld->KickAll(); // save and kick all players + sWorld->UpdateSessions(1); // real players unload required UpdateSessions call + + // unload battleground templates before different singletons destroyed + sBattlegroundMgr->DeleteAllBattlegrounds(); + + sWorldSocketMgr->StopNetwork(); + + sMapMgr->UnloadAll(); // unload all grids (including locked in memory) + sObjectAccessor->UnloadAll(); // unload 'i_player2corpse' storage and remove from world + sScriptMgr->Unload(); + sOutdoorPvPMgr->Die(); + + // set server offline + LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, realmID); + + // Clean up threads if any + if (soapThread != nullptr) + { + soapThread->join(); + delete soapThread; + } + + if (raAcceptor != nullptr) + delete raAcceptor; + + ///- Clean database before leaving + ClearOnlineAccounts(); + + StopDB(); + + TC_LOG_INFO("server.worldserver", "Halting process..."); + + if (cliThread != nullptr) + { +#ifdef _WIN32 + + // this only way to terminate CLI thread exist at Win32 (alt. way exist only in Windows Vista API) + //_exit(1); + // send keyboard input to safely unblock the CLI thread + INPUT_RECORD b[4]; + HANDLE hStdIn = GetStdHandle(STD_INPUT_HANDLE); + b[0].EventType = KEY_EVENT; + b[0].Event.KeyEvent.bKeyDown = TRUE; + b[0].Event.KeyEvent.uChar.AsciiChar = 'X'; + b[0].Event.KeyEvent.wVirtualKeyCode = 'X'; + b[0].Event.KeyEvent.wRepeatCount = 1; + + b[1].EventType = KEY_EVENT; + b[1].Event.KeyEvent.bKeyDown = FALSE; + b[1].Event.KeyEvent.uChar.AsciiChar = 'X'; + b[1].Event.KeyEvent.wVirtualKeyCode = 'X'; + b[1].Event.KeyEvent.wRepeatCount = 1; + + b[2].EventType = KEY_EVENT; + b[2].Event.KeyEvent.bKeyDown = TRUE; + b[2].Event.KeyEvent.dwControlKeyState = 0; + b[2].Event.KeyEvent.uChar.AsciiChar = '\r'; + b[2].Event.KeyEvent.wVirtualKeyCode = VK_RETURN; + b[2].Event.KeyEvent.wRepeatCount = 1; + b[2].Event.KeyEvent.wVirtualScanCode = 0x1c; + + b[3].EventType = KEY_EVENT; + b[3].Event.KeyEvent.bKeyDown = FALSE; + b[3].Event.KeyEvent.dwControlKeyState = 0; + b[3].Event.KeyEvent.uChar.AsciiChar = '\r'; + b[3].Event.KeyEvent.wVirtualKeyCode = VK_RETURN; + b[3].Event.KeyEvent.wVirtualScanCode = 0x1c; + b[3].Event.KeyEvent.wRepeatCount = 1; + DWORD numb; + WriteConsoleInput(hStdIn, b, 4, &numb); + + cliThread->join(); + +#endif + + delete cliThread; + } + + delete freezeDetectorThread; + + OpenSSLCrypto::threadsCleanup(); - // at sMaster return function exist with codes // 0 - normal shutdown // 1 - shutdown at error // 2 - restart command used, this code can be used by restarter for restart Trinityd - return ret; + return World::GetExitCode(); +} + + +void WorldUpdateLoop() +{ + uint32 realCurrTime = 0; + uint32 realPrevTime = getMSTime(); + + uint32 prevSleepTime = 0; // used for balanced full tick time length near WORLD_SLEEP_CONST + + ///- While we have not World::m_stopEvent, update the world + while (!World::IsStopped()) + { + ++World::m_worldLoopCounter; + realCurrTime = getMSTime(); + + uint32 diff = getMSTimeDiff(realPrevTime, realCurrTime); + + sWorld->Update(diff); + realPrevTime = realCurrTime; + + // diff (D0) include time of previous sleep (d0) + tick time (t0) + // we want that next d1 + t1 == WORLD_SLEEP_CONST + // we can't know next t1 and then can use (t0 + d1) == WORLD_SLEEP_CONST requirement + // d1 = WORLD_SLEEP_CONST - t0 = WORLD_SLEEP_CONST - (D0 - d0) = WORLD_SLEEP_CONST + d0 - D0 + if (diff <= WORLD_SLEEP_CONST + prevSleepTime) + { + prevSleepTime = WORLD_SLEEP_CONST + prevSleepTime - diff; + + std::this_thread::sleep_for(std::chrono::milliseconds(prevSleepTime)); + } + else + prevSleepTime = 0; + +#ifdef _WIN32 + if (m_ServiceStatus == 0) + World::StopNow(SHUTDOWN_EXIT_CODE); + + while (m_ServiceStatus == 2) + Sleep(1000); +#endif + } +} + +/// Print out the usage string for this program on the console. +void usage(const char* prog) +{ + printf("Usage:\n"); + printf(" %s []\n", prog); + printf(" -c config_file use config_file as configuration file\n"); +#ifdef _WIN32 + printf(" Running as service functions:\n"); + printf(" --service run as service\n"); + printf(" -s install install service\n"); + printf(" -s uninstall uninstall service\n"); +#endif +} + +void SignalHandler(const boost::system::error_code& error, int signalNumber) +{ + if (!error) + { + switch (signalNumber) + { + case SIGINT: + case SIGTERM: + World::StopNow(SHUTDOWN_EXIT_CODE); + break; + } + } +} + +void FreezeDetectorThread(uint32 delayTime) +{ + if (!delayTime) + return; + + TC_LOG_INFO("server.worldserver", "Starting up anti-freeze thread (%u seconds max stuck time)...", delayTime / 1000); + uint32 loops = 0; + uint32 lastChange = 0; + + while (!World::IsStopped()) + { + std::this_thread::sleep_for(std::chrono::milliseconds(1000)); + uint32 curtime = getMSTime(); + // normal work + uint32 worldLoopCounter = World::m_worldLoopCounter; + if (loops != worldLoopCounter) + { + lastChange = curtime; + loops = worldLoopCounter; + } + // possible freeze + else if (getMSTimeDiff(lastChange, curtime) > delayTime) + { + TC_LOG_ERROR("server.worldserver", "World Thread hangs, kicking out server!"); + ASSERT(false); + } + } + TC_LOG_INFO("server.worldserver", "Anti-freeze thread exiting without problems."); +} + +AsyncAcceptor* StartRaSocketAcceptor(boost::asio::io_service& ioService) +{ + uint16 raPort = uint16(sConfigMgr->GetIntDefault("Ra.Port", 3443)); + std::string raListener = sConfigMgr->GetStringDefault("Ra.IP", "0.0.0.0"); + + return new AsyncAcceptor(ioService, raListener, raPort); +} + +/// Initialize connection to the databases +bool StartDB() +{ + MySQL::Library_Init(); + + std::string dbString; + uint8 asyncThreads, synchThreads; + + dbString = sConfigMgr->GetStringDefault("WorldDatabaseInfo", ""); + if (dbString.empty()) + { + TC_LOG_ERROR("server.worldserver", "World database not specified in configuration file"); + return false; + } + + asyncThreads = uint8(sConfigMgr->GetIntDefault("WorldDatabase.WorkerThreads", 1)); + if (asyncThreads < 1 || asyncThreads > 32) + { + TC_LOG_ERROR("server.worldserver", "World database: invalid number of worker threads specified. " + "Please pick a value between 1 and 32."); + return false; + } + + synchThreads = uint8(sConfigMgr->GetIntDefault("WorldDatabase.SynchThreads", 1)); + ///- Initialize the world database + if (!WorldDatabase.Open(dbString, asyncThreads, synchThreads)) + { + TC_LOG_ERROR("server.worldserver", "Cannot connect to world database %s", dbString.c_str()); + return false; + } + + ///- Get character database info from configuration file + dbString = sConfigMgr->GetStringDefault("CharacterDatabaseInfo", ""); + if (dbString.empty()) + { + TC_LOG_ERROR("server.worldserver", "Character database not specified in configuration file"); + return false; + } + + asyncThreads = uint8(sConfigMgr->GetIntDefault("CharacterDatabase.WorkerThreads", 1)); + if (asyncThreads < 1 || asyncThreads > 32) + { + TC_LOG_ERROR("server.worldserver", "Character database: invalid number of worker threads specified. " + "Please pick a value between 1 and 32."); + return false; + } + + synchThreads = uint8(sConfigMgr->GetIntDefault("CharacterDatabase.SynchThreads", 2)); + + ///- Initialize the Character database + if (!CharacterDatabase.Open(dbString, asyncThreads, synchThreads)) + { + TC_LOG_ERROR("server.worldserver", "Cannot connect to Character database %s", dbString.c_str()); + return false; + } + + ///- Get login database info from configuration file + dbString = sConfigMgr->GetStringDefault("LoginDatabaseInfo", ""); + if (dbString.empty()) + { + TC_LOG_ERROR("server.worldserver", "Login database not specified in configuration file"); + return false; + } + + asyncThreads = uint8(sConfigMgr->GetIntDefault("LoginDatabase.WorkerThreads", 1)); + if (asyncThreads < 1 || asyncThreads > 32) + { + TC_LOG_ERROR("server.worldserver", "Login database: invalid number of worker threads specified. " + "Please pick a value between 1 and 32."); + return false; + } + + synchThreads = uint8(sConfigMgr->GetIntDefault("LoginDatabase.SynchThreads", 1)); + ///- Initialise the login database + if (!LoginDatabase.Open(dbString, asyncThreads, synchThreads)) + { + TC_LOG_ERROR("server.worldserver", "Cannot connect to login database %s", dbString.c_str()); + return false; + } + + ///- Get the realm Id from the configuration file + realmID = sConfigMgr->GetIntDefault("RealmID", 0); + if (!realmID) + { + TC_LOG_ERROR("server.worldserver", "Realm ID not defined in configuration file"); + return false; + } + TC_LOG_INFO("server.worldserver", "Realm running as realm ID %d", realmID); + + ///- Clean the database before starting + ClearOnlineAccounts(); + + ///- Insert version info into DB + WorldDatabase.PExecute("UPDATE version SET core_version = '%s', core_revision = '%s'", _FULLVERSION, _HASH); // One-time query + + sWorld->LoadDBVersion(); + + TC_LOG_INFO("server.worldserver", "Using World DB: %s", sWorld->GetDBVersion()); + return true; +} + +void StopDB() +{ + CharacterDatabase.Close(); + WorldDatabase.Close(); + LoginDatabase.Close(); + + MySQL::Library_End(); +} + +/// Clear 'online' status for all accounts with characters in this realm +void ClearOnlineAccounts() +{ + // Reset online status for all accounts with characters on the current realm + LoginDatabase.DirectPExecute("UPDATE account SET online = 0 WHERE online > 0 AND id IN (SELECT acctid FROM realmcharacters WHERE realmid = %d)", realmID); + + // Reset online status for all characters + CharacterDatabase.DirectExecute("UPDATE characters SET online = 0 WHERE online <> 0"); + + // Battleground instance ids reset at server restart + CharacterDatabase.DirectExecute("UPDATE character_battleground_data SET instanceId = 0"); } /// @} diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp deleted file mode 100644 index c529e6b6478..00000000000 --- a/src/server/worldserver/Master.cpp +++ /dev/null @@ -1,479 +0,0 @@ -/* - * Copyright (C) 2008-2014 TrinityCore - * Copyright (C) 2005-2009 MaNGOS - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -/** \file - \ingroup Trinityd -*/ - -#include - -#include "Master.h" - -#include "SystemConfig.h" -#include "World.h" -#include "WorldRunnable.h" -#include "WorldSocket.h" -#include "WorldSocketMgr.h" -#include "Configuration/Config.h" -#include "Database/DatabaseEnv.h" -#include "Database/DatabaseWorkerPool.h" -#include "CliRunnable.h" -#include "Log.h" -#include "TCSoap.h" -#include "Timer.h" -#include "Util.h" -#include "RealmList.h" -#include "BigNumber.h" -#include "OpenSSLCrypto.h" -#include "AsyncAcceptor.h" - -#ifdef _WIN32 -#include "ServiceWin32.h" -extern int m_ServiceStatus; -#endif - -#ifdef __linux__ -#include -#include -#define PROCESS_HIGH_PRIORITY -15 // [-20, 19], default is 0 -#endif - -boost::asio::io_service _ioService; - -void SignalHandler(const boost::system::error_code& error, int signalNumber) -{ - if (!error) - { - switch (signalNumber) - { - case SIGINT: - case SIGTERM: - _ioService.stop(); - break; - } - } -} - - -void FreezeDetectorThread(uint32 delayTime) -{ - if (!delayTime) - return; - - TC_LOG_INFO("server.worldserver", "Starting up anti-freeze thread (%u seconds max stuck time)...", delayTime / 1000); - uint32 loops = 0; - uint32 lastChange = 0; - - while (!World::IsStopped()) - { - std::this_thread::sleep_for(std::chrono::milliseconds(1000)); - uint32 curtime = getMSTime(); - // normal work - uint32 worldLoopCounter = World::m_worldLoopCounter; - if (loops != worldLoopCounter) - { - lastChange = curtime; - loops = worldLoopCounter; - } - // possible freeze - else if (getMSTimeDiff(lastChange, curtime) > delayTime) - { - TC_LOG_ERROR("server.worldserver", "World Thread hangs, kicking out server!"); - ASSERT(false); - } - } - TC_LOG_INFO("server.worldserver", "Anti-freeze thread exiting without problems."); -} - -/// Main function -int Master::Run() -{ - OpenSSLCrypto::threadsSetup(); - BigNumber seed1; - seed1.SetRand(16 * 8); - - TC_LOG_INFO("server.worldserver", "%s (worldserver-daemon)", _FULLVERSION); - TC_LOG_INFO("server.worldserver", " to stop.\n"); - - TC_LOG_INFO("server.worldserver", " ______ __"); - TC_LOG_INFO("server.worldserver", "/\\__ _\\ __ __/\\ \\__"); - TC_LOG_INFO("server.worldserver", "\\/_/\\ \\/ _ __ /\\_\\ ___ /\\_\\ \\, _\\ __ __"); - TC_LOG_INFO("server.worldserver", " \\ \\ \\/\\`'__\\/\\ \\ /' _ `\\/\\ \\ \\ \\/ /\\ \\/\\ \\"); - TC_LOG_INFO("server.worldserver", " \\ \\ \\ \\ \\/ \\ \\ \\/\\ \\/\\ \\ \\ \\ \\ \\_\\ \\ \\_\\ \\"); - TC_LOG_INFO("server.worldserver", " \\ \\_\\ \\_\\ \\ \\_\\ \\_\\ \\_\\ \\_\\ \\__\\\\/`____ \\"); - TC_LOG_INFO("server.worldserver", " \\/_/\\/_/ \\/_/\\/_/\\/_/\\/_/\\/__/ `/___/> \\"); - TC_LOG_INFO("server.worldserver", " C O R E /\\___/"); - TC_LOG_INFO("server.worldserver", "http://TrinityCore.org \\/__/\n"); - - /// worldserver PID file creation - std::string pidFile = sConfigMgr->GetStringDefault("PidFile", ""); - if (!pidFile.empty()) - { - if (uint32 pid = CreatePIDFile(pidFile)) - TC_LOG_INFO("server.worldserver", "Daemon PID: %u\n", pid); - else - { - TC_LOG_ERROR("server.worldserver", "Cannot create PID file %s.\n", pidFile.c_str()); - return 1; - } - } - - ///- Start the databases - if (!_StartDB()) - return 1; - - // set server offline (not connectable) - LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = (flag & ~%u) | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, REALM_FLAG_INVALID, realmID); - - ///- Initialize the World - sWorld->SetInitialWorldSettings(); - - // Set signal handlers - boost::asio::signal_set signals(_ioService, SIGINT, SIGTERM); - signals.async_wait(SignalHandler); - - ///- Launch WorldRunnable thread - std::thread worldThread(WorldThread, std::ref(_ioService)); - - std::thread* cliThread = nullptr; - -#ifdef _WIN32 - if (sConfigMgr->GetBoolDefault("Console.Enable", true) && (m_ServiceStatus == -1)/* need disable console in service mode*/) -#else - if (sConfigMgr->GetBoolDefault("Console.Enable", true)) -#endif - { - ///- Launch CliRunnable thread - cliThread = new std::thread(CliThread); - } - - AsyncAcceptor* raAcceptor = nullptr; - - if (sConfigMgr->GetBoolDefault("Ra.Enable", false)) - raAcceptor = StartRaSocketAcceptor(_ioService); - -#if defined(_WIN32) || defined(__linux__) - - ///- Handle affinity for multiple processors and process priority - uint32 affinity = sConfigMgr->GetIntDefault("UseProcessors", 0); - bool highPriority = sConfigMgr->GetBoolDefault("ProcessPriority", false); - -#ifdef _WIN32 // Windows - - HANDLE hProcess = GetCurrentProcess(); - - if (affinity > 0) - { - ULONG_PTR appAff; - ULONG_PTR sysAff; - - if (GetProcessAffinityMask(hProcess, &appAff, &sysAff)) - { - ULONG_PTR currentAffinity = affinity & appAff; // remove non accessible processors - - if (!currentAffinity) - TC_LOG_ERROR("server.worldserver", "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the worldserver. Accessible processors bitmask (hex): %x", affinity, appAff); - else if (SetProcessAffinityMask(hProcess, currentAffinity)) - TC_LOG_INFO("server.worldserver", "Using processors (bitmask, hex): %x", currentAffinity); - else - TC_LOG_ERROR("server.worldserver", "Can't set used processors (hex): %x", currentAffinity); - } - } - - if (highPriority) - { - if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS)) - TC_LOG_INFO("server.worldserver", "worldserver process priority class set to HIGH"); - else - TC_LOG_ERROR("server.worldserver", "Can't set worldserver process priority class."); - } - -#else // Linux - - if (affinity > 0) - { - cpu_set_t mask; - CPU_ZERO(&mask); - - for (unsigned int i = 0; i < sizeof(affinity) * 8; ++i) - if (affinity & (1 << i)) - CPU_SET(i, &mask); - - if (sched_setaffinity(0, sizeof(mask), &mask)) - TC_LOG_ERROR("server.worldserver", "Can't set used processors (hex): %x, error: %s", affinity, strerror(errno)); - else - { - CPU_ZERO(&mask); - sched_getaffinity(0, sizeof(mask), &mask); - TC_LOG_INFO("server.worldserver", "Using processors (bitmask, hex): %lx", *(__cpu_mask*)(&mask)); - } - } - - if (highPriority) - { - if (setpriority(PRIO_PROCESS, 0, PROCESS_HIGH_PRIORITY)) - TC_LOG_ERROR("server.worldserver", "Can't set worldserver process priority class, error: %s", strerror(errno)); - else - TC_LOG_INFO("server.worldserver", "worldserver process priority class set to %i", getpriority(PRIO_PROCESS, 0)); - } - -#endif -#endif - - //Start soap serving thread - std::thread* soapThread = nullptr; - - if (sConfigMgr->GetBoolDefault("SOAP.Enabled", false)) - { - soapThread = new std::thread(TCSoapThread, sConfigMgr->GetStringDefault("SOAP.IP", "127.0.0.1"), uint16(sConfigMgr->GetIntDefault("SOAP.Port", 7878))); - } - - std::thread* freezeDetectorThread = nullptr; - - ///- Start up freeze catcher thread - if (uint32 freezeDelay = sConfigMgr->GetIntDefault("MaxCoreStuckTime", 0)) - freezeDetectorThread = new std::thread(FreezeDetectorThread, freezeDelay); - - ///- Launch the world listener socket - uint16 worldPort = uint16(sWorld->getIntConfig(CONFIG_PORT_WORLD)); - std::string bindIp = sConfigMgr->GetStringDefault("BindIP", "0.0.0.0"); - - if (sWorldSocketMgr->StartNetwork(worldPort, bindIp.c_str()) == -1) - { - TC_LOG_ERROR("server.worldserver", "Failed to start network"); - World::StopNow(ERROR_EXIT_CODE); - // go down and shutdown the server - } - - // set server online (allow connecting now) - LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag & ~%u, population = 0 WHERE id = '%u'", REALM_FLAG_INVALID, realmID); - - TC_LOG_INFO("server.worldserver", "%s (worldserver-daemon) ready...", _FULLVERSION); - - _ioService.run(); - - // when the main thread closes the singletons get unloaded - // since worldrunnable uses them, it will crash if unloaded after master - worldThread.join(); - - if (soapThread != nullptr) - { - soapThread->join(); - delete soapThread; - } - - if (raAcceptor != nullptr) - delete raAcceptor; - - // set server offline - LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, realmID); - - ///- Clean database before leaving - ClearOnlineAccounts(); - - _StopDB(); - - TC_LOG_INFO("server.worldserver", "Halting process..."); - - if (cliThread != nullptr) - { - #ifdef _WIN32 - - // this only way to terminate CLI thread exist at Win32 (alt. way exist only in Windows Vista API) - //_exit(1); - // send keyboard input to safely unblock the CLI thread - INPUT_RECORD b[4]; - HANDLE hStdIn = GetStdHandle(STD_INPUT_HANDLE); - b[0].EventType = KEY_EVENT; - b[0].Event.KeyEvent.bKeyDown = TRUE; - b[0].Event.KeyEvent.uChar.AsciiChar = 'X'; - b[0].Event.KeyEvent.wVirtualKeyCode = 'X'; - b[0].Event.KeyEvent.wRepeatCount = 1; - - b[1].EventType = KEY_EVENT; - b[1].Event.KeyEvent.bKeyDown = FALSE; - b[1].Event.KeyEvent.uChar.AsciiChar = 'X'; - b[1].Event.KeyEvent.wVirtualKeyCode = 'X'; - b[1].Event.KeyEvent.wRepeatCount = 1; - - b[2].EventType = KEY_EVENT; - b[2].Event.KeyEvent.bKeyDown = TRUE; - b[2].Event.KeyEvent.dwControlKeyState = 0; - b[2].Event.KeyEvent.uChar.AsciiChar = '\r'; - b[2].Event.KeyEvent.wVirtualKeyCode = VK_RETURN; - b[2].Event.KeyEvent.wRepeatCount = 1; - b[2].Event.KeyEvent.wVirtualScanCode = 0x1c; - - b[3].EventType = KEY_EVENT; - b[3].Event.KeyEvent.bKeyDown = FALSE; - b[3].Event.KeyEvent.dwControlKeyState = 0; - b[3].Event.KeyEvent.uChar.AsciiChar = '\r'; - b[3].Event.KeyEvent.wVirtualKeyCode = VK_RETURN; - b[3].Event.KeyEvent.wVirtualScanCode = 0x1c; - b[3].Event.KeyEvent.wRepeatCount = 1; - DWORD numb; - WriteConsoleInput(hStdIn, b, 4, &numb); - - cliThread->join(); - - #endif - - delete cliThread; - } - - delete freezeDetectorThread; - - // for some unknown reason, unloading scripts here and not in worldrunnable - // fixes a memory leak related to detaching threads from the module - //UnloadScriptingModule(); - - OpenSSLCrypto::threadsCleanup(); - // Exit the process with specified return value - return World::GetExitCode(); -} - -/// Initialize connection to the databases -bool Master::_StartDB() -{ - MySQL::Library_Init(); - - std::string dbString; - uint8 asyncThreads, synchThreads; - - dbString = sConfigMgr->GetStringDefault("WorldDatabaseInfo", ""); - if (dbString.empty()) - { - TC_LOG_ERROR("server.worldserver", "World database not specified in configuration file"); - return false; - } - - asyncThreads = uint8(sConfigMgr->GetIntDefault("WorldDatabase.WorkerThreads", 1)); - if (asyncThreads < 1 || asyncThreads > 32) - { - TC_LOG_ERROR("server.worldserver", "World database: invalid number of worker threads specified. " - "Please pick a value between 1 and 32."); - return false; - } - - synchThreads = uint8(sConfigMgr->GetIntDefault("WorldDatabase.SynchThreads", 1)); - ///- Initialize the world database - if (!WorldDatabase.Open(dbString, asyncThreads, synchThreads)) - { - TC_LOG_ERROR("server.worldserver", "Cannot connect to world database %s", dbString.c_str()); - return false; - } - - ///- Get character database info from configuration file - dbString = sConfigMgr->GetStringDefault("CharacterDatabaseInfo", ""); - if (dbString.empty()) - { - TC_LOG_ERROR("server.worldserver", "Character database not specified in configuration file"); - return false; - } - - asyncThreads = uint8(sConfigMgr->GetIntDefault("CharacterDatabase.WorkerThreads", 1)); - if (asyncThreads < 1 || asyncThreads > 32) - { - TC_LOG_ERROR("server.worldserver", "Character database: invalid number of worker threads specified. " - "Please pick a value between 1 and 32."); - return false; - } - - synchThreads = uint8(sConfigMgr->GetIntDefault("CharacterDatabase.SynchThreads", 2)); - - ///- Initialize the Character database - if (!CharacterDatabase.Open(dbString, asyncThreads, synchThreads)) - { - TC_LOG_ERROR("server.worldserver", "Cannot connect to Character database %s", dbString.c_str()); - return false; - } - - ///- Get login database info from configuration file - dbString = sConfigMgr->GetStringDefault("LoginDatabaseInfo", ""); - if (dbString.empty()) - { - TC_LOG_ERROR("server.worldserver", "Login database not specified in configuration file"); - return false; - } - - asyncThreads = uint8(sConfigMgr->GetIntDefault("LoginDatabase.WorkerThreads", 1)); - if (asyncThreads < 1 || asyncThreads > 32) - { - TC_LOG_ERROR("server.worldserver", "Login database: invalid number of worker threads specified. " - "Please pick a value between 1 and 32."); - return false; - } - - synchThreads = uint8(sConfigMgr->GetIntDefault("LoginDatabase.SynchThreads", 1)); - ///- Initialise the login database - if (!LoginDatabase.Open(dbString, asyncThreads, synchThreads)) - { - TC_LOG_ERROR("server.worldserver", "Cannot connect to login database %s", dbString.c_str()); - return false; - } - - ///- Get the realm Id from the configuration file - realmID = sConfigMgr->GetIntDefault("RealmID", 0); - if (!realmID) - { - TC_LOG_ERROR("server.worldserver", "Realm ID not defined in configuration file"); - return false; - } - TC_LOG_INFO("server.worldserver", "Realm running as realm ID %d", realmID); - - ///- Clean the database before starting - ClearOnlineAccounts(); - - ///- Insert version info into DB - WorldDatabase.PExecute("UPDATE version SET core_version = '%s', core_revision = '%s'", _FULLVERSION, _HASH); // One-time query - - sWorld->LoadDBVersion(); - - TC_LOG_INFO("server.worldserver", "Using World DB: %s", sWorld->GetDBVersion()); - return true; -} - -void Master::_StopDB() -{ - CharacterDatabase.Close(); - WorldDatabase.Close(); - LoginDatabase.Close(); - - MySQL::Library_End(); -} - -/// Clear 'online' status for all accounts with characters in this realm -void Master::ClearOnlineAccounts() -{ - // Reset online status for all accounts with characters on the current realm - LoginDatabase.DirectPExecute("UPDATE account SET online = 0 WHERE online > 0 AND id IN (SELECT acctid FROM realmcharacters WHERE realmid = %d)", realmID); - - // Reset online status for all characters - CharacterDatabase.DirectExecute("UPDATE characters SET online = 0 WHERE online <> 0"); - - // Battleground instance ids reset at server restart - CharacterDatabase.DirectExecute("UPDATE character_battleground_data SET instanceId = 0"); -} - -AsyncAcceptor* Master::StartRaSocketAcceptor(boost::asio::io_service& ioService) -{ - uint16 raPort = uint16(sConfigMgr->GetIntDefault("Ra.Port", 3443)); - std::string raListener = sConfigMgr->GetStringDefault("Ra.IP", "0.0.0.0"); - - return new AsyncAcceptor(ioService, raListener, raPort); -} diff --git a/src/server/worldserver/Master.h b/src/server/worldserver/Master.h deleted file mode 100644 index 86059e6417a..00000000000 --- a/src/server/worldserver/Master.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2008-2014 TrinityCore - * Copyright (C) 2005-2009 MaNGOS - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -/// \addtogroup Trinityd -/// @{ -/// \file - -#ifndef _MASTER_H -#define _MASTER_H - -#include -#include "Common.h" -#include "RASession.h" - -template -class AsyncAcceptor; - -/// Start the server -class Master -{ - public: - static Master* instance() - { - static Master* instance = new Master(); - return instance; - } - - int Run(); - - private: - bool _StartDB(); - void _StopDB(); - - void ClearOnlineAccounts(); - AsyncAcceptor* StartRaSocketAcceptor(boost::asio::io_service& ioService); -}; - -#define sMaster Master::instance() - -#endif - -/// @} diff --git a/src/server/worldserver/WorldThread/WorldRunnable.cpp b/src/server/worldserver/WorldThread/WorldRunnable.cpp deleted file mode 100644 index 85c3e7a74b9..00000000000 --- a/src/server/worldserver/WorldThread/WorldRunnable.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (C) 2008-2014 TrinityCore - * Copyright (C) 2005-2009 MaNGOS - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -/** \file - \ingroup Trinityd -*/ - -#include - -#include "Common.h" -#include "ObjectAccessor.h" -#include "World.h" -#include "WorldSocketMgr.h" -#include "Database/DatabaseEnv.h" -#include "ScriptMgr.h" -#include "BattlegroundMgr.h" -#include "MapManager.h" -#include "Timer.h" -#include "WorldRunnable.h" -#include "OutdoorPvPMgr.h" - -#define WORLD_SLEEP_CONST 50 - -#ifdef _WIN32 -#include "ServiceWin32.h" -extern int m_ServiceStatus; -#endif - -/// Heartbeat for the World -void WorldThread(boost::asio::io_service& ioService) -{ - uint32 realCurrTime = 0; - uint32 realPrevTime = getMSTime(); - - uint32 prevSleepTime = 0; // used for balanced full tick time length near WORLD_SLEEP_CONST - - sScriptMgr->OnStartup(); - - ///- While we have not World::m_stopEvent, update the world - while (!World::IsStopped()) - { - ++World::m_worldLoopCounter; - realCurrTime = getMSTime(); - - uint32 diff = getMSTimeDiff(realPrevTime, realCurrTime); - - sWorld->Update( diff ); - realPrevTime = realCurrTime; - - // diff (D0) include time of previous sleep (d0) + tick time (t0) - // we want that next d1 + t1 == WORLD_SLEEP_CONST - // we can't know next t1 and then can use (t0 + d1) == WORLD_SLEEP_CONST requirement - // d1 = WORLD_SLEEP_CONST - t0 = WORLD_SLEEP_CONST - (D0 - d0) = WORLD_SLEEP_CONST + d0 - D0 - if (diff <= WORLD_SLEEP_CONST+prevSleepTime) - { - prevSleepTime = WORLD_SLEEP_CONST+prevSleepTime-diff; - - std::this_thread::sleep_for(std::chrono::milliseconds(prevSleepTime)); - } - else - prevSleepTime = 0; - - #ifdef _WIN32 - if (m_ServiceStatus == 0) - World::StopNow(SHUTDOWN_EXIT_CODE); - - while (m_ServiceStatus == 2) - Sleep(1000); - #endif - } - - ioService.stop(); - - sScriptMgr->OnShutdown(); - - sWorld->KickAll(); // save and kick all players - sWorld->UpdateSessions( 1 ); // real players unload required UpdateSessions call - - // unload battleground templates before different singletons destroyed - sBattlegroundMgr->DeleteAllBattlegrounds(); - - sWorldSocketMgr->StopNetwork(); - - sMapMgr->UnloadAll(); // unload all grids (including locked in memory) - sObjectAccessor->UnloadAll(); // unload 'i_player2corpse' storage and remove from world - sScriptMgr->Unload(); - sOutdoorPvPMgr->Die(); -} diff --git a/src/server/worldserver/WorldThread/WorldRunnable.h b/src/server/worldserver/WorldThread/WorldRunnable.h deleted file mode 100644 index c6d00d269e7..00000000000 --- a/src/server/worldserver/WorldThread/WorldRunnable.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2008-2014 TrinityCore - * Copyright (C) 2005-2009 MaNGOS - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -/// \addtogroup Trinityd -/// @{ -/// \file - -#ifndef __WORLDRUNNABLE_H -#define __WORLDRUNNABLE_H - -#include - -void WorldThread(boost::asio::io_service& ioService); - -#endif - -/// @} diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 90f330bac42..c4e3ad832a7 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -143,6 +143,14 @@ WorldServerPort = 8085 BindIP = "0.0.0.0" +# +# ThreadPool +# Description: Number of threads to be used for the global thread pool +# The thread pool is currently used for the signal handler and remote access +# Default: 1 + +ThreadPool = 1 + # ################################################################################################### @@ -161,7 +169,8 @@ UseProcessors = 0 # # ProcessPriority # Description: Process priority setting for Windows and Linux based systems. -# Details: On Linux, a nice value of -15 is used. (requires superuser). On Windows, process is set to HIGH class. +# Details: On Linux, a nice value of -15 is used. (requires superuser). +# On Windows, process is set to HIGH class. # Default: 0 - (Normal) # 1 - (High) @@ -1069,7 +1078,8 @@ Account.PasswordChangeSecurity = 0 # # BirthdayTime -# Description: Set to date of project's birth in UNIX time. By default the date when TrinityCore was started (Thu Oct 2, 2008) +# Description: Set to date of project's birth in UNIX time. By default the date when +# TrinityCore was started (Thu Oct 2, 2008) # Default: 1222964635 # # @@ -2627,8 +2637,10 @@ UI.ShowQuestLevelsInDialogs = 0 # 1 - Prefix Timestamp to the text # 2 - Prefix Log Level to the text # 4 - Prefix Log Filter type to the text -# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2) -# 16 - Make a backup of existing file before overwrite (Only used with Mode = w) +# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS +# (Only used with Type = 2) +# 16 - Make a backup of existing file before overwrite +# (Only used with Mode = w) # # Colors (read as optional1 if Type = Console) # Format: "fatal error warn info debug trace" @@ -2744,7 +2756,8 @@ Log.Async.Enable = 0 # # Allow.IP.Based.Action.Logging -# Description: Logs actions, e.g. account login and logout to name a few, based on IP of current session. +# Description: Logs actions, e.g. account login and logout to name a few, based on IP of +# current session. # Default: 0 - (Disabled) # 1 - (Enabled) -- cgit v1.2.3 From 7befb26625dd1eeb237e223296d9ed8817297025 Mon Sep 17 00:00:00 2001 From: leak Date: Sun, 6 Jul 2014 01:26:29 +0200 Subject: Some groundwork for replacing the ACE based WorldSocket handling --- src/server/game/Scripting/ScriptMgr.cpp | 10 +- src/server/game/Scripting/ScriptMgr.h | 24 +- src/server/game/Server/Protocol/ServerPktHeader.h | 59 ++ src/server/game/Server/WorldSession.cpp | 20 +- src/server/game/Server/WorldSession.h | 6 +- src/server/game/Server/WorldSocket.cpp | 1050 --------------------- src/server/game/Server/WorldSocket.h | 218 ----- src/server/game/Server/WorldSocketAcceptor.h | 67 -- src/server/game/Server/WorldSocketMgr.cpp | 360 ------- src/server/game/Server/WorldSocketMgr.h | 78 -- src/server/game/Server/WorldTcpSession.cpp | 407 ++++++++ src/server/game/Server/WorldTcpSession.h | 81 ++ src/server/worldserver/Main.cpp | 18 +- 13 files changed, 579 insertions(+), 1819 deletions(-) create mode 100644 src/server/game/Server/Protocol/ServerPktHeader.h delete mode 100644 src/server/game/Server/WorldSocket.cpp delete mode 100644 src/server/game/Server/WorldSocket.h delete mode 100644 src/server/game/Server/WorldSocketAcceptor.h delete mode 100644 src/server/game/Server/WorldSocketMgr.cpp delete mode 100644 src/server/game/Server/WorldSocketMgr.h create mode 100644 src/server/game/Server/WorldTcpSession.cpp create mode 100644 src/server/game/Server/WorldTcpSession.h (limited to 'src') diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 5821ae3eb3c..06f6094c511 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -400,35 +400,35 @@ void ScriptMgr::OnNetworkStop() FOREACH_SCRIPT(ServerScript)->OnNetworkStop(); } -void ScriptMgr::OnSocketOpen(WorldSocket* socket) +void ScriptMgr::OnSocketOpen(WorldTcpSession* socket) { ASSERT(socket); FOREACH_SCRIPT(ServerScript)->OnSocketOpen(socket); } -void ScriptMgr::OnSocketClose(WorldSocket* socket, bool wasNew) +void ScriptMgr::OnSocketClose(WorldTcpSession* socket, bool wasNew) { ASSERT(socket); FOREACH_SCRIPT(ServerScript)->OnSocketClose(socket, wasNew); } -void ScriptMgr::OnPacketReceive(WorldSocket* socket, WorldPacket packet) +void ScriptMgr::OnPacketReceive(WorldTcpSession* socket, WorldPacket packet) { ASSERT(socket); FOREACH_SCRIPT(ServerScript)->OnPacketReceive(socket, packet); } -void ScriptMgr::OnPacketSend(WorldSocket* socket, WorldPacket packet) +void ScriptMgr::OnPacketSend(WorldTcpSession* socket, WorldPacket packet) { ASSERT(socket); FOREACH_SCRIPT(ServerScript)->OnPacketSend(socket, packet); } -void ScriptMgr::OnUnknownPacketReceive(WorldSocket* socket, WorldPacket packet) +void ScriptMgr::OnUnknownPacketReceive(WorldTcpSession* socket, WorldPacket packet) { ASSERT(socket); diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 0126c649019..530d99b9ad2 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -57,7 +57,7 @@ class Transport; class Unit; class Vehicle; class WorldPacket; -class WorldSocket; +class WorldTcpSession; class WorldObject; struct AchievementCriteriaData; @@ -214,30 +214,30 @@ class ServerScript : public ScriptObject public: - // Called when reactive socket I/O is started (WorldSocketMgr). + // Called when reactive socket I/O is started (WorldTcpSessionMgr). virtual void OnNetworkStart() { } // Called when reactive I/O is stopped. virtual void OnNetworkStop() { } // Called when a remote socket establishes a connection to the server. Do not store the socket object. - virtual void OnSocketOpen(WorldSocket* /*socket*/) { } + virtual void OnSocketOpen(WorldTcpSession* /*socket*/) { } // Called when a socket is closed. Do not store the socket object, and do not rely on the connection // being open; it is not. - virtual void OnSocketClose(WorldSocket* /*socket*/, bool /*wasNew*/) { } + virtual void OnSocketClose(WorldTcpSession* /*socket*/, bool /*wasNew*/) { } // Called when a packet is sent to a client. The packet object is a copy of the original packet, so reading // and modifying it is safe. - virtual void OnPacketSend(WorldSocket* /*socket*/, WorldPacket& /*packet*/) { } + virtual void OnPacketSend(WorldTcpSession* /*socket*/, WorldPacket& /*packet*/) { } // Called when a (valid) packet is received by a client. The packet object is a copy of the original packet, so // reading and modifying it is safe. - virtual void OnPacketReceive(WorldSocket* /*socket*/, WorldPacket& /*packet*/) { } + virtual void OnPacketReceive(WorldTcpSession* /*socket*/, WorldPacket& /*packet*/) { } // Called when an invalid (unknown opcode) packet is received by a client. The packet is a reference to the orignal // packet; not a copy. This allows you to actually handle unknown packets (for whatever purpose). - virtual void OnUnknownPacketReceive(WorldSocket* /*socket*/, WorldPacket& /*packet*/) { } + virtual void OnUnknownPacketReceive(WorldTcpSession* /*socket*/, WorldPacket& /*packet*/) { } }; class WorldScript : public ScriptObject @@ -908,11 +908,11 @@ class ScriptMgr void OnNetworkStart(); void OnNetworkStop(); - void OnSocketOpen(WorldSocket* socket); - void OnSocketClose(WorldSocket* socket, bool wasNew); - void OnPacketReceive(WorldSocket* socket, WorldPacket packet); - void OnPacketSend(WorldSocket* socket, WorldPacket packet); - void OnUnknownPacketReceive(WorldSocket* socket, WorldPacket packet); + void OnSocketOpen(WorldTcpSession* socket); + void OnSocketClose(WorldTcpSession* socket, bool wasNew); + void OnPacketReceive(WorldTcpSession* socket, WorldPacket packet); + void OnPacketSend(WorldTcpSession* socket, WorldPacket packet); + void OnUnknownPacketReceive(WorldTcpSession* socket, WorldPacket packet); public: /* WorldScript */ diff --git a/src/server/game/Server/Protocol/ServerPktHeader.h b/src/server/game/Server/Protocol/ServerPktHeader.h new file mode 100644 index 00000000000..4b0dae9f0f3 --- /dev/null +++ b/src/server/game/Server/Protocol/ServerPktHeader.h @@ -0,0 +1,59 @@ +/* +* Copyright (C) 2008-2014 TrinityCore +* Copyright (C) 2005-2009 MaNGOS +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program. If not, see . +*/ + +#ifndef __SERVERPKTHDR_H__ +#define __SERVERPKTHDR_H__ + +#include "Log.h" + +struct ServerPktHeader +{ + /** + * size is the length of the payload _plus_ the length of the opcode + */ + ServerPktHeader(uint32 size, uint16 cmd) : size(size) + { + uint8 headerIndex=0; + if (isLargePacket()) + { + TC_LOG_DEBUG("network", "initializing large server to client packet. Size: %u, cmd: %u", size, cmd); + header[headerIndex++] = 0x80 | (0xFF & (size >> 16)); + } + header[headerIndex++] = 0xFF &(size >> 8); + header[headerIndex++] = 0xFF & size; + + header[headerIndex++] = 0xFF & cmd; + header[headerIndex++] = 0xFF & (cmd >> 8); + } + + uint8 getHeaderLength() + { + // cmd = 2 bytes, size= 2||3bytes + return 2 + (isLargePacket() ? 3 : 2); + } + + bool isLargePacket() const + { + return size > 0x7FFF; + } + + const uint32 size; + uint8 header[5]; +}; + +#endif diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 444c06e41b8..4f3112403db 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -20,7 +20,7 @@ \ingroup u2w */ -#include "WorldSocket.h" // must be first to make ACE happy with ACE includes in it +#include "WorldTcpSession.h" #include "Config.h" #include "Common.h" #include "DatabaseEnv.h" @@ -97,7 +97,7 @@ bool WorldSessionFilter::Process(WorldPacket* packet) } /// WorldSession constructor -WorldSession::WorldSession(uint32 id, WorldSocket* sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale, uint32 recruiter, bool isARecruiter): +WorldSession::WorldSession(uint32 id, WorldTcpSession* sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale, uint32 recruiter, bool isARecruiter): m_muteTime(mute_time), m_timeOutTime(0), AntiDOS(this), @@ -130,8 +130,7 @@ WorldSession::WorldSession(uint32 id, WorldSocket* sock, AccountTypes sec, uint8 if (sock) { - m_Address = sock->GetRemoteAddress(); - sock->AddReference(); + m_Address = sock->GetRemoteIpAddress(); ResetTimeOutTime(); LoginDatabase.PExecute("UPDATE account SET online = 1 WHERE id = %u;", GetAccountId()); // One-time query } @@ -150,7 +149,6 @@ WorldSession::~WorldSession() if (m_Socket) { m_Socket->CloseSocket(); - m_Socket->RemoveReference(); m_Socket = NULL; } @@ -227,8 +225,7 @@ void WorldSession::SendPacket(WorldPacket const* packet) } #endif // !TRINITY_DEBUG - if (m_Socket->SendPacket(*packet) == -1) - m_Socket->CloseSocket(); + m_Socket->AsyncWrite(*packet); } /// Add an incoming packet to the queue @@ -281,9 +278,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) uint32 processedPackets = 0; time_t currentTime = time(NULL); - while (m_Socket && !m_Socket->IsClosed() && - !_recvQueue.empty() && _recvQueue.peek(true) != firstDelayedPacket && - _recvQueue.next(packet, updater)) + while (m_Socket && !_recvQueue.empty() && _recvQueue.peek(true) != firstDelayedPacket && _recvQueue.next(packet, updater)) { if (!AntiDOS.EvaluateOpcode(*packet, currentTime)) { @@ -402,7 +397,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) break; } - if (m_Socket && !m_Socket->IsClosed() && _warden) + if (m_Socket && m_Socket->IsOpen() && _warden) _warden->Update(); ProcessQueryCallbacks(); @@ -420,12 +415,11 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) _warden->Update(); ///- Cleanup socket pointer if need - if (m_Socket && m_Socket->IsClosed()) + if (m_Socket && !m_Socket->IsOpen()) { expireTime -= expireTime > diff ? diff : expireTime; if (expireTime < diff || forceExit) { - m_Socket->RemoveReference(); m_Socket = NULL; } } diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 4cb6ec2d7af..709650a8119 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -46,7 +46,7 @@ class SpellCastTargets; class Unit; class Warden; class WorldPacket; -class WorldSocket; +class WorldTcpSession; struct AreaTableEntry; struct AuctionEntry; struct DeclinedName; @@ -208,7 +208,7 @@ struct PacketCounter class WorldSession { public: - WorldSession(uint32 id, WorldSocket* sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale, uint32 recruiter, bool isARecruiter); + WorldSession(uint32 id, WorldTcpSession* sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale, uint32 recruiter, bool isARecruiter); ~WorldSession(); bool PlayerLoading() const { return m_playerLoading; } @@ -981,7 +981,7 @@ class WorldSession uint32 m_GUIDLow; // set logined or recently logout player (while m_playerRecentlyLogout set) Player* _player; - WorldSocket* m_Socket; + WorldTcpSession* m_Socket; std::string m_Address; // Current Remote Address // std::string m_LAddress; // Last Attempted Remote Adress - we can not set attempted ip for a non-existing session! diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp deleted file mode 100644 index d35ee80099d..00000000000 --- a/src/server/game/Server/WorldSocket.cpp +++ /dev/null @@ -1,1050 +0,0 @@ -/* - * Copyright (C) 2008-2014 TrinityCore - * Copyright (C) 2005-2009 MaNGOS - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "WorldSocket.h" -#include "Common.h" -#include "Player.h" -#include "Util.h" -#include "World.h" -#include "WorldPacket.h" -#include "SharedDefines.h" -#include "ByteBuffer.h" -#include "Opcodes.h" -#include "DatabaseEnv.h" -#include "BigNumber.h" -#include "SHA1.h" -#include "WorldSession.h" -#include "WorldSocketMgr.h" -#include "Log.h" -#include "PacketLog.h" -#include "ScriptMgr.h" -#include "AccountMgr.h" - -#if defined(__GNUC__) -#pragma pack(1) -#else -#pragma pack(push, 1) -#endif - -struct ServerPktHeader -{ - /** - * size is the length of the payload _plus_ the length of the opcode - */ - ServerPktHeader(uint32 size, uint16 cmd) : size(size) - { - uint8 headerIndex=0; - if (isLargePacket()) - { - TC_LOG_DEBUG("network", "initializing large server to client packet. Size: %u, cmd: %u", size, cmd); - header[headerIndex++] = 0x80 | (0xFF & (size >> 16)); - } - header[headerIndex++] = 0xFF &(size >> 8); - header[headerIndex++] = 0xFF & size; - - header[headerIndex++] = 0xFF & cmd; - header[headerIndex++] = 0xFF & (cmd >> 8); - } - - uint8 getHeaderLength() - { - // cmd = 2 bytes, size= 2||3bytes - return 2 + (isLargePacket() ? 3 : 2); - } - - bool isLargePacket() const - { - return size > 0x7FFF; - } - - const uint32 size; - uint8 header[5]; -}; - -struct ClientPktHeader -{ - uint16 size; - uint32 cmd; -}; - -#if defined(__GNUC__) -#pragma pack() -#else -#pragma pack(pop) -#endif - -WorldSocket::WorldSocket (void): WorldHandler(), -m_LastPingTime(ACE_Time_Value::zero), m_OverSpeedPings(0), m_Session(0), -m_RecvWPct(0), m_RecvPct(), m_Header(sizeof (ClientPktHeader)), -m_OutBuffer(0), m_OutBufferSize(65536), m_OutActive(false), -m_Seed(static_cast (rand32())) -{ - reference_counting_policy().value (ACE_Event_Handler::Reference_Counting_Policy::ENABLED); - - msg_queue()->high_water_mark(8 * 1024 * 1024); - msg_queue()->low_water_mark(8 * 1024 * 1024); -} - -WorldSocket::~WorldSocket (void) -{ - delete m_RecvWPct; - - if (m_OutBuffer) - m_OutBuffer->release(); - - closing_ = true; - - peer().close(); -} - -bool WorldSocket::IsClosed (void) const -{ - return closing_; -} - -void WorldSocket::CloseSocket (void) -{ - { - ACE_GUARD (LockType, Guard, m_OutBufferLock); - - if (closing_) - return; - - closing_ = true; - peer().close_writer(); - } - - { - ACE_GUARD (LockType, Guard, m_SessionLock); - - m_Session = NULL; - } -} - -const std::string& WorldSocket::GetRemoteAddress (void) const -{ - return m_Address; -} - -int WorldSocket::SendPacket(WorldPacket const& pct) -{ - ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1); - - if (closing_) - return -1; - - // Dump outgoing packet - if (sPacketLog->CanLogPacket()) - sPacketLog->LogPacket(pct, SERVER_TO_CLIENT); - - WorldPacket const* pkt = &pct; - - - if (m_Session) - TC_LOG_TRACE("network.opcode", "S->C: %s %s", m_Session->GetPlayerInfo().c_str(), GetOpcodeNameForLogging(pkt->GetOpcode()).c_str()); - - sScriptMgr->OnPacketSend(this, *pkt); - - ServerPktHeader header(pkt->size()+2, pkt->GetOpcode()); - m_Crypt.EncryptSend ((uint8*)header.header, header.getHeaderLength()); - - if (m_OutBuffer->space() >= pkt->size() + header.getHeaderLength() && msg_queue()->is_empty()) - { - // Put the packet on the buffer. - if (m_OutBuffer->copy((char*) header.header, header.getHeaderLength()) == -1) - ACE_ASSERT (false); - - if (!pkt->empty()) - if (m_OutBuffer->copy((char*) pkt->contents(), pkt->size()) == -1) - ACE_ASSERT (false); - } - else - { - // Enqueue the packet. - ACE_Message_Block* mb; - - ACE_NEW_RETURN(mb, ACE_Message_Block(pkt->size() + header.getHeaderLength()), -1); - - mb->copy((char*) header.header, header.getHeaderLength()); - - if (!pkt->empty()) - mb->copy((const char*)pkt->contents(), pkt->size()); - - if (msg_queue()->enqueue_tail(mb, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1) - { - TC_LOG_ERROR("network", "WorldSocket::SendPacket enqueue_tail failed"); - mb->release(); - return -1; - } - } - - return 0; -} - -long WorldSocket::AddReference (void) -{ - return static_cast (add_reference()); -} - -long WorldSocket::RemoveReference (void) -{ - return static_cast (remove_reference()); -} - -int WorldSocket::open (void *a) -{ - ACE_UNUSED_ARG (a); - - // Prevent double call to this func. - if (m_OutBuffer) - return -1; - - // This will also prevent the socket from being Updated - // while we are initializing it. - m_OutActive = true; - - // Hook for the manager. - if (sWorldSocketMgr->OnSocketOpen(this) == -1) - return -1; - - // Allocate the buffer. - ACE_NEW_RETURN (m_OutBuffer, ACE_Message_Block (m_OutBufferSize), -1); - - // Store peer address. - ACE_INET_Addr remote_addr; - - if (peer().get_remote_addr(remote_addr) == -1) - { - TC_LOG_ERROR("network", "WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno)); - return -1; - } - - m_Address = remote_addr.get_host_addr(); - - if (HandleSendAuthSession() == -1) - return -1; - - // Register with ACE Reactor - if (reactor()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1) - { - TC_LOG_ERROR("network", "WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno)); - return -1; - } - - // reactor takes care of the socket from now on - remove_reference(); - - return 0; -} - -int WorldSocket::close(u_long) -{ - shutdown(); - - closing_ = true; - - remove_reference(); - - return 0; -} - -int WorldSocket::handle_input(ACE_HANDLE) -{ - if (closing_) - return -1; - - switch (handle_input_missing_data()) - { - case -1 : - { - if ((errno == EWOULDBLOCK) || - (errno == EAGAIN)) - { - return Update(); // interesting line, isn't it ? - } - - TC_LOG_DEBUG("network", "WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno)); - - errno = ECONNRESET; - return -1; - } - case 0: - { - TC_LOG_DEBUG("network", "WorldSocket::handle_input: Peer has closed connection"); - - errno = ECONNRESET; - return -1; - } - case 1: - return 1; - default: - return Update(); // another interesting line ;) - } - - ACE_NOTREACHED(return -1); -} - -int WorldSocket::handle_output(ACE_HANDLE) -{ - ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1); - - if (closing_) - return -1; - - size_t send_len = m_OutBuffer->length(); - - if (send_len == 0) - return handle_output_queue(Guard); - -#ifdef MSG_NOSIGNAL - ssize_t n = peer().send (m_OutBuffer->rd_ptr(), send_len, MSG_NOSIGNAL); -#else - ssize_t n = peer().send (m_OutBuffer->rd_ptr(), send_len); -#endif // MSG_NOSIGNAL - - if (n == 0) - return -1; - else if (n == -1) - { - if (errno == EWOULDBLOCK || errno == EAGAIN) - return schedule_wakeup_output (Guard); - - return -1; - } - else if (n < (ssize_t)send_len) //now n > 0 - { - m_OutBuffer->rd_ptr (static_cast (n)); - - // move the data to the base of the buffer - m_OutBuffer->crunch(); - - return schedule_wakeup_output (Guard); - } - else //now n == send_len - { - m_OutBuffer->reset(); - - return handle_output_queue (Guard); - } - - ACE_NOTREACHED (return 0); -} - -int WorldSocket::handle_output_queue(GuardType& g) -{ - if (msg_queue()->is_empty()) - return cancel_wakeup_output(g); - - ACE_Message_Block* mblk; - - if (msg_queue()->dequeue_head(mblk, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1) - { - TC_LOG_ERROR("network", "WorldSocket::handle_output_queue dequeue_head"); - return -1; - } - - const size_t send_len = mblk->length(); - -#ifdef MSG_NOSIGNAL - ssize_t n = peer().send(mblk->rd_ptr(), send_len, MSG_NOSIGNAL); -#else - ssize_t n = peer().send(mblk->rd_ptr(), send_len); -#endif // MSG_NOSIGNAL - - if (n == 0) - { - mblk->release(); - - return -1; - } - else if (n == -1) - { - if (errno == EWOULDBLOCK || errno == EAGAIN) - { - msg_queue()->enqueue_head(mblk, (ACE_Time_Value*) &ACE_Time_Value::zero); - return schedule_wakeup_output (g); - } - - mblk->release(); - return -1; - } - else if (n < (ssize_t)send_len) //now n > 0 - { - mblk->rd_ptr(static_cast (n)); - - if (msg_queue()->enqueue_head(mblk, (ACE_Time_Value*) &ACE_Time_Value::zero) == -1) - { - TC_LOG_ERROR("network", "WorldSocket::handle_output_queue enqueue_head"); - mblk->release(); - return -1; - } - - return schedule_wakeup_output (g); - } - else //now n == send_len - { - mblk->release(); - - return msg_queue()->is_empty() ? cancel_wakeup_output(g) : ACE_Event_Handler::WRITE_MASK; - } - - ACE_NOTREACHED(return -1); -} - -int WorldSocket::handle_close(ACE_HANDLE h, ACE_Reactor_Mask) -{ - // Critical section - { - ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1); - - closing_ = true; - - if (h == ACE_INVALID_HANDLE) - peer().close_writer(); - } - - // Critical section - { - ACE_GUARD_RETURN (LockType, Guard, m_SessionLock, -1); - - m_Session = NULL; - } - - reactor()->remove_handler(this, ACE_Event_Handler::DONT_CALL | ACE_Event_Handler::ALL_EVENTS_MASK); - return 0; -} - -int WorldSocket::Update (void) -{ - if (closing_) - return -1; - - if (m_OutActive) - return 0; - - { - ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, 0); - if (m_OutBuffer->length() == 0 && msg_queue()->is_empty()) - return 0; - } - - int ret; - do - ret = handle_output(get_handle()); - while (ret > 0); - - return ret; -} - -int WorldSocket::handle_input_header (void) -{ - ACE_ASSERT(m_RecvWPct == NULL); - - ACE_ASSERT(m_Header.length() == sizeof(ClientPktHeader)); - - m_Crypt.DecryptRecv ((uint8*)m_Header.rd_ptr(), sizeof(ClientPktHeader)); - - ClientPktHeader& header = *((ClientPktHeader*)m_Header.rd_ptr()); - - EndianConvertReverse(header.size); - EndianConvert(header.cmd); - - if ((header.size < 4) || (header.size > 10240) || (header.cmd > 10240)) - { - Player* _player = m_Session ? m_Session->GetPlayer() : NULL; - TC_LOG_ERROR("network", "WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)", - m_Session ? m_Session->GetAccountId() : 0, - _player ? _player->GetGUIDLow() : 0, - _player ? _player->GetName().c_str() : "", - header.size, header.cmd); - - errno = EINVAL; - return -1; - } - - header.size -= 4; - - ACE_NEW_RETURN(m_RecvWPct, WorldPacket ((uint16)header.cmd, header.size), -1); - - if (header.size > 0) - { - m_RecvWPct->resize(header.size); - m_RecvPct.base ((char*) m_RecvWPct->contents(), m_RecvWPct->size()); - } - else - { - ACE_ASSERT(m_RecvPct.space() == 0); - } - - return 0; -} - -int WorldSocket::handle_input_payload (void) -{ - // set errno properly here on error !!! - // now have a header and payload - - ACE_ASSERT (m_RecvPct.space() == 0); - ACE_ASSERT (m_Header.space() == 0); - ACE_ASSERT (m_RecvWPct != NULL); - - const int ret = ProcessIncoming (m_RecvWPct); - - m_RecvPct.base (NULL, 0); - m_RecvPct.reset(); - m_RecvWPct = NULL; - - m_Header.reset(); - - if (ret == -1) - errno = EINVAL; - - return ret; -} - -int WorldSocket::handle_input_missing_data (void) -{ - char buf [4096]; - - ACE_Data_Block db (sizeof (buf), - ACE_Message_Block::MB_DATA, - buf, - 0, - 0, - ACE_Message_Block::DONT_DELETE, - 0); - - ACE_Message_Block message_block(&db, - ACE_Message_Block::DONT_DELETE, - 0); - - const size_t recv_size = message_block.space(); - - const ssize_t n = peer().recv (message_block.wr_ptr(), - recv_size); - - if (n <= 0) - return int(n); - - message_block.wr_ptr (n); - - while (message_block.length() > 0) - { - if (m_Header.space() > 0) - { - //need to receive the header - const size_t to_header = (message_block.length() > m_Header.space() ? m_Header.space() : message_block.length()); - m_Header.copy (message_block.rd_ptr(), to_header); - message_block.rd_ptr (to_header); - - if (m_Header.space() > 0) - { - // Couldn't receive the whole header this time. - ACE_ASSERT (message_block.length() == 0); - errno = EWOULDBLOCK; - return -1; - } - - // We just received nice new header - if (handle_input_header() == -1) - { - ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN)); - return -1; - } - } - - // Its possible on some error situations that this happens - // for example on closing when epoll receives more chunked data and stuff - // hope this is not hack, as proper m_RecvWPct is asserted around - if (!m_RecvWPct) - { - TC_LOG_ERROR("network", "Forcing close on input m_RecvWPct = NULL"); - errno = EINVAL; - return -1; - } - - // We have full read header, now check the data payload - if (m_RecvPct.space() > 0) - { - //need more data in the payload - const size_t to_data = (message_block.length() > m_RecvPct.space() ? m_RecvPct.space() : message_block.length()); - m_RecvPct.copy (message_block.rd_ptr(), to_data); - message_block.rd_ptr (to_data); - - if (m_RecvPct.space() > 0) - { - // Couldn't receive the whole data this time. - ACE_ASSERT (message_block.length() == 0); - errno = EWOULDBLOCK; - return -1; - } - } - - //just received fresh new payload - if (handle_input_payload() == -1) - { - ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN)); - return -1; - } - } - - return size_t(n) == recv_size ? 1 : 2; -} - -int WorldSocket::cancel_wakeup_output(GuardType& g) -{ - if (!m_OutActive) - return 0; - - m_OutActive = false; - - g.release(); - - if (reactor()->cancel_wakeup - (this, ACE_Event_Handler::WRITE_MASK) == -1) - { - // would be good to store errno from reactor with errno guard - TC_LOG_ERROR("network", "WorldSocket::cancel_wakeup_output"); - return -1; - } - - return 0; -} - -int WorldSocket::schedule_wakeup_output(GuardType& g) -{ - if (m_OutActive) - return 0; - - m_OutActive = true; - - g.release(); - - if (reactor()->schedule_wakeup - (this, ACE_Event_Handler::WRITE_MASK) == -1) - { - TC_LOG_ERROR("network", "WorldSocket::schedule_wakeup_output"); - return -1; - } - - return 0; -} - -int WorldSocket::ProcessIncoming(WorldPacket* new_pct) -{ - ACE_ASSERT (new_pct); - - // manage memory ;) - ACE_Auto_Ptr aptr(new_pct); - - const ACE_UINT16 opcode = new_pct->GetOpcode(); - - if (closing_) - return -1; - - // Dump received packet. - if (sPacketLog->CanLogPacket()) - sPacketLog->LogPacket(*new_pct, CLIENT_TO_SERVER); - - std::string opcodeName = GetOpcodeNameForLogging(opcode); - if (m_Session) - TC_LOG_TRACE("network.opcode", "C->S: %s %s", m_Session->GetPlayerInfo().c_str(), opcodeName.c_str()); - - try - { - switch (opcode) - { - case CMSG_PING: - return HandlePing(*new_pct); - case CMSG_AUTH_SESSION: - if (m_Session) - { - TC_LOG_ERROR("network", "WorldSocket::ProcessIncoming: received duplicate CMSG_AUTH_SESSION from %s", m_Session->GetPlayerInfo().c_str()); - return -1; - } - - sScriptMgr->OnPacketReceive(this, WorldPacket(*new_pct)); - return HandleAuthSession(*new_pct); - case CMSG_KEEP_ALIVE: - TC_LOG_DEBUG("network", "%s", opcodeName.c_str()); - sScriptMgr->OnPacketReceive(this, WorldPacket(*new_pct)); - return 0; - default: - { - ACE_GUARD_RETURN(LockType, Guard, m_SessionLock, -1); - if (!m_Session) - { - TC_LOG_ERROR("network.opcode", "ProcessIncoming: Client not authed opcode = %u", uint32(opcode)); - return -1; - } - - // Our Idle timer will reset on any non PING opcodes. - // Catches people idling on the login screen and any lingering ingame connections. - m_Session->ResetTimeOutTime(); - - // OK, give the packet to WorldSession - aptr.release(); - // WARNING here we call it with locks held. - // Its possible to cause deadlock if QueuePacket calls back - m_Session->QueuePacket(new_pct); - return 0; - } - } - } - catch (ByteBufferException &) - { - TC_LOG_ERROR("network", "WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet %s from client %s, accountid=%i. Disconnected client.", - opcodeName.c_str(), GetRemoteAddress().c_str(), m_Session ? int32(m_Session->GetAccountId()) : -1); - new_pct->hexlike(); - return -1; - } - - ACE_NOTREACHED (return 0); -} - -int WorldSocket::HandleSendAuthSession() -{ - WorldPacket packet(SMSG_AUTH_CHALLENGE, 37); - packet << uint32(1); // 1...31 - packet << uint32(m_Seed); - - BigNumber seed1; - seed1.SetRand(16 * 8); - packet.append(seed1.AsByteArray(16).get(), 16); // new encryption seeds - - BigNumber seed2; - seed2.SetRand(16 * 8); - packet.append(seed2.AsByteArray(16).get(), 16); // new encryption seeds - return SendPacket(packet); -} - -int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) -{ - uint8 digest[20]; - uint32 clientSeed; - uint8 security; - uint32 id; - LocaleConstant locale; - std::string account; - SHA1Hash sha; - uint32 clientBuild; - uint32 unk2, unk3, unk5, unk6, unk7; - uint64 unk4; - WorldPacket packet, SendAddonPacked; - BigNumber k; - bool wardenActive = sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED); - - if (sWorld->IsClosed()) - { - SendAuthResponseError(AUTH_REJECT); - TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteAddress().c_str()); - return -1; - } - - // Read the content of the packet - recvPacket >> clientBuild; - recvPacket >> unk2; - recvPacket >> account; - recvPacket >> unk3; - recvPacket >> clientSeed; - recvPacket >> unk5 >> unk6 >> unk7; - recvPacket >> unk4; - recvPacket.read(digest, 20); - - TC_LOG_DEBUG("network", "WorldSocket::HandleAuthSession: client %u, unk2 %u, account %s, unk3 %u, clientseed %u", - clientBuild, - unk2, - account.c_str(), - unk3, - clientSeed); - - // Get the account information from the realmd database - // 0 1 2 3 4 5 6 7 8 - // SELECT id, sessionkey, last_ip, locked, expansion, mutetime, locale, recruiter, os FROM account WHERE username = ? - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_INFO_BY_NAME); - - stmt->setString(0, account); - - PreparedQueryResult result = LoginDatabase.Query(stmt); - - // Stop if the account is not found - if (!result) - { - // We can not log here, as we do not know the account. Thus, no accountId. - SendAuthResponseError(AUTH_UNKNOWN_ACCOUNT); - TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Sent Auth Response (unknown account)."); - return -1; - } - - Field* fields = result->Fetch(); - - uint8 expansion = fields[4].GetUInt8(); - uint32 world_expansion = sWorld->getIntConfig(CONFIG_EXPANSION); - if (expansion > world_expansion) - expansion = world_expansion; - - // For hook purposes, we get Remoteaddress at this point. - std::string address = GetRemoteAddress(); - - // As we don't know if attempted login process by ip works, we update last_attempt_ip right away - stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LAST_ATTEMPT_IP); - - stmt->setString(0, address); - stmt->setString(1, account); - - LoginDatabase.Execute(stmt); - // This also allows to check for possible "hack" attempts on account - - // id has to be fetched at this point, so that first actual account response that fails can be logged - id = fields[0].GetUInt32(); - - ///- Re-check ip locking (same check as in realmd). - if (fields[3].GetUInt8() == 1) // if ip is locked - { - if (strcmp (fields[2].GetCString(), address.c_str())) - { - SendAuthResponseError(AUTH_FAILED); - TC_LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs. Original IP: %s, new IP: %s).", fields[2].GetCString(), address.c_str()); - // We could log on hook only instead of an additional db log, however action logger is config based. Better keep DB logging as well - sScriptMgr->OnFailedAccountLogin(id); - return -1; - } - } - - k.SetHexStr(fields[1].GetCString()); - - int64 mutetime = fields[5].GetInt64(); - //! Negative mutetime indicates amount of seconds to be muted effective on next login - which is now. - if (mutetime < 0) - { - mutetime = time(NULL) + llabs(mutetime); - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME_LOGIN); - - stmt->setInt64(0, mutetime); - stmt->setUInt32(1, id); - - LoginDatabase.Execute(stmt); - } - - locale = LocaleConstant (fields[6].GetUInt8()); - if (locale >= TOTAL_LOCALES) - locale = LOCALE_enUS; - - uint32 recruiter = fields[7].GetUInt32(); - std::string os = fields[8].GetString(); - - // Must be done before WorldSession is created - if (wardenActive && os != "Win" && os != "OSX") - { - SendAuthResponseError(AUTH_REJECT); - TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Client %s attempted to log in using invalid client OS (%s).", address.c_str(), os.c_str()); - return -1; - } - - // Checks gmlevel per Realm - stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_GMLEVEL_BY_REALMID); - - stmt->setUInt32(0, id); - stmt->setInt32(1, int32(realmID)); - - result = LoginDatabase.Query(stmt); - - if (!result) - security = 0; - else - { - fields = result->Fetch(); - security = fields[0].GetUInt8(); - } - - // Re-check account ban (same check as in realmd) - stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BANS); - - stmt->setUInt32(0, id); - stmt->setString(1, address); - - PreparedQueryResult banresult = LoginDatabase.Query(stmt); - - if (banresult) // if account banned - { - SendAuthResponseError(AUTH_BANNED); - TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account banned)."); - sScriptMgr->OnFailedAccountLogin(id); - return -1; - } - - // Check locked state for server - AccountTypes allowedAccountType = sWorld->GetPlayerSecurityLimit(); - TC_LOG_DEBUG("network", "Allowed Level: %u Player Level %u", allowedAccountType, AccountTypes(security)); - if (allowedAccountType > SEC_PLAYER && AccountTypes(security) < allowedAccountType) - { - SendAuthResponseError(AUTH_UNAVAILABLE); - TC_LOG_INFO("network", "WorldSocket::HandleAuthSession: User tries to login but his security level is not enough"); - sScriptMgr->OnFailedAccountLogin(id); - return -1; - } - - // Check that Key and account name are the same on client and server - uint32 t = 0; - uint32 seed = m_Seed; - - sha.UpdateData(account); - sha.UpdateData((uint8*)&t, 4); - sha.UpdateData((uint8*)&clientSeed, 4); - sha.UpdateData((uint8*)&seed, 4); - sha.UpdateBigNumbers(&k, NULL); - sha.Finalize(); - - if (memcmp(sha.GetDigest(), digest, 20)) - { - SendAuthResponseError(AUTH_FAILED); - TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", id, account.c_str(), address.c_str()); - return -1; - } - - TC_LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.", - account.c_str(), - address.c_str()); - - // Check if this user is by any chance a recruiter - stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_RECRUITER); - - stmt->setUInt32(0, id); - - result = LoginDatabase.Query(stmt); - - bool isRecruiter = false; - if (result) - isRecruiter = true; - - // Update the last_ip in the database as it was successful for login - stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LAST_IP); - - stmt->setString(0, address); - stmt->setString(1, account); - - LoginDatabase.Execute(stmt); - - // NOTE ATM the socket is single-threaded, have this in mind ... - ACE_NEW_RETURN(m_Session, WorldSession(id, this, AccountTypes(security), expansion, mutetime, locale, recruiter, isRecruiter), -1); - - m_Crypt.Init(&k); - - m_Session->LoadGlobalAccountData(); - m_Session->LoadTutorialsData(); - m_Session->ReadAddonsInfo(recvPacket); - m_Session->LoadPermissions(); - - // At this point, we can safely hook a successful login - sScriptMgr->OnAccountLogin(id); - - // Initialize Warden system only if it is enabled by config - if (wardenActive) - m_Session->InitWarden(&k, os); - - // Sleep this Network thread for - uint32 sleepTime = sWorld->getIntConfig(CONFIG_SESSION_ADD_DELAY); - ACE_OS::sleep(ACE_Time_Value(0, sleepTime)); - - sWorld->AddSession(m_Session); - return 0; -} - -int WorldSocket::HandlePing(WorldPacket& recvPacket) -{ - uint32 ping; - uint32 latency; - - // Get the ping packet content - recvPacket >> ping; - recvPacket >> latency; - - if (m_LastPingTime == ACE_Time_Value::zero) - m_LastPingTime = ACE_OS::gettimeofday(); // for 1st ping - else - { - ACE_Time_Value cur_time = ACE_OS::gettimeofday(); - ACE_Time_Value diff_time (cur_time); - diff_time -= m_LastPingTime; - m_LastPingTime = cur_time; - - if (diff_time < ACE_Time_Value (27)) - { - ++m_OverSpeedPings; - - uint32 max_count = sWorld->getIntConfig (CONFIG_MAX_OVERSPEED_PINGS); - - if (max_count && m_OverSpeedPings > max_count) - { - ACE_GUARD_RETURN (LockType, Guard, m_SessionLock, -1); - - if (m_Session && !m_Session->HasPermission(rbac::RBAC_PERM_SKIP_CHECK_OVERSPEED_PING)) - { - TC_LOG_ERROR("network", "WorldSocket::HandlePing: %s kicked for over-speed pings (address: %s)", - m_Session->GetPlayerInfo().c_str(), GetRemoteAddress().c_str()); - - return -1; - } - } - } - else - m_OverSpeedPings = 0; - } - - // critical section - { - ACE_GUARD_RETURN (LockType, Guard, m_SessionLock, -1); - - if (m_Session) - { - m_Session->SetLatency (latency); - m_Session->ResetClientTimeDelay(); - } - else - { - TC_LOG_ERROR("network", "WorldSocket::HandlePing: peer sent CMSG_PING, " - "but is not authenticated or got recently kicked, " - " address = %s", - GetRemoteAddress().c_str()); - return -1; - } - } - - WorldPacket packet(SMSG_PONG, 4); - packet << ping; - return SendPacket(packet); -} - -void WorldSocket::SendAuthResponseError(uint8 code) -{ - WorldPacket packet(SMSG_AUTH_RESPONSE, 1); - packet << uint8(code); - SendPacket(packet); -} diff --git a/src/server/game/Server/WorldSocket.h b/src/server/game/Server/WorldSocket.h deleted file mode 100644 index 1f98be0152b..00000000000 --- a/src/server/game/Server/WorldSocket.h +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (C) 2008-2014 TrinityCore - * Copyright (C) 2005-2009 MaNGOS - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -/** \addtogroup u2w User to World Communication - * @{ - * \file WorldSocket.h - * \author Derex - */ - -#ifndef _WORLDSOCKET_H -#define _WORLDSOCKET_H - -#include -#include -#include -#include -#include -#include -#include -#include - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "Common.h" -#include "AuthCrypt.h" - -class ACE_Message_Block; -class WorldPacket; -class WorldSession; - -/// Handler that can communicate over stream sockets. -typedef ACE_Svc_Handler WorldHandler; - -/** - * WorldSocket. - * - * This class is responsible for the communication with - * remote clients. - * Most methods return -1 on failure. - * The class uses reference counting. - * - * For output the class uses one buffer (64K usually) and - * a queue where it stores packet if there is no place on - * the queue. The reason this is done, is because the server - * does really a lot of small-size writes to it, and it doesn't - * scale well to allocate memory for every. When something is - * written to the output buffer the socket is not immediately - * activated for output (again for the same reason), there - * is 10ms celling (thats why there is Update() method). - * This concept is similar to TCP_CORK, but TCP_CORK - * uses 200ms celling. As result overhead generated by - * sending packets from "producer" threads is minimal, - * and doing a lot of writes with small size is tolerated. - * - * The calls to Update() method are managed by WorldSocketMgr - * and ReactorRunnable. - * - * For input, the class uses one 4096 bytes buffer on stack - * to which it does recv() calls. And then received data is - * distributed where its needed. 4096 matches pretty well the - * traffic generated by client for now. - * - * The input/output do speculative reads/writes (AKA it tryes - * to read all data available in the kernel buffer or tryes to - * write everything available in userspace buffer), - * which is ok for using with Level and Edge Triggered IO - * notification. - * - */ -class WorldSocket : public WorldHandler -{ - public: - WorldSocket (void); - virtual ~WorldSocket (void); - - friend class WorldSocketMgr; - - /// Mutex type used for various synchronizations. - typedef ACE_Thread_Mutex LockType; - typedef ACE_Guard GuardType; - - /// Check if socket is closed. - bool IsClosed(void) const; - - /// Close the socket. - void CloseSocket(void); - - /// Get address of connected peer. - const std::string& GetRemoteAddress(void) const; - - /// Send A packet on the socket, this function is reentrant. - /// @param pct packet to send - /// @return -1 of failure - int SendPacket(const WorldPacket& pct); - - /// Add reference to this object. - long AddReference(void); - - /// Remove reference to this object. - long RemoveReference(void); - - /// things called by ACE framework. - - /// Called on open, the void* is the acceptor. - virtual int open(void *); - - /// Called on failures inside of the acceptor, don't call from your code. - virtual int close(u_long); - - /// Called when we can read from the socket. - virtual int handle_input(ACE_HANDLE = ACE_INVALID_HANDLE); - - /// Called when the socket can write. - virtual int handle_output(ACE_HANDLE = ACE_INVALID_HANDLE); - - /// Called when connection is closed or error happens. - virtual int handle_close(ACE_HANDLE = ACE_INVALID_HANDLE, - ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); - - /// Called by WorldSocketMgr/ReactorRunnable. - int Update(void); - - private: - /// Helper functions for processing incoming data. - int handle_input_header(void); - int handle_input_payload(void); - int handle_input_missing_data(void); - - /// Help functions to mark/unmark the socket for output. - /// @param g the guard is for m_OutBufferLock, the function will release it - int cancel_wakeup_output(GuardType& g); - int schedule_wakeup_output(GuardType& g); - - /// Drain the queue if its not empty. - int handle_output_queue(GuardType& g); - - /// process one incoming packet. - /// @param new_pct received packet, note that you need to delete it. - int ProcessIncoming(WorldPacket* new_pct); - - /// Called by ProcessIncoming() on CMSG_AUTH_SESSION. - int HandleAuthSession(WorldPacket& recvPacket); - - /// Called by ProcessIncoming() on CMSG_PING. - int HandlePing(WorldPacket& recvPacket); - - int HandleSendAuthSession(); - - private: - void SendAuthResponseError(uint8); - /// Time in which the last ping was received - ACE_Time_Value m_LastPingTime; - - /// Keep track of over-speed pings, to prevent ping flood. - uint32 m_OverSpeedPings; - - /// Address of the remote peer - std::string m_Address; - - /// Class used for managing encryption of the headers - AuthCrypt m_Crypt; - - /// Mutex lock to protect m_Session - LockType m_SessionLock; - - /// Session to which received packets are routed - WorldSession* m_Session; - - /// here are stored the fragments of the received data - WorldPacket* m_RecvWPct; - - /// This block actually refers to m_RecvWPct contents, - /// which allows easy and safe writing to it. - /// It wont free memory when its deleted. m_RecvWPct takes care of freeing. - ACE_Message_Block m_RecvPct; - - /// Fragment of the received header. - ACE_Message_Block m_Header; - - /// Mutex for protecting output related data. - LockType m_OutBufferLock; - - /// Buffer used for writing output. - ACE_Message_Block* m_OutBuffer; - - /// Size of the m_OutBuffer. - size_t m_OutBufferSize; - - /// True if the socket is registered with the reactor for output - bool m_OutActive; - - uint32 m_Seed; - - WorldSocket(WorldSocket const& right) = delete; - WorldSocket& operator=(WorldSocket const& right) = delete; -}; - -#endif /* _WORLDSOCKET_H */ - -/// @} - diff --git a/src/server/game/Server/WorldSocketAcceptor.h b/src/server/game/Server/WorldSocketAcceptor.h deleted file mode 100644 index 0b07196a0cd..00000000000 --- a/src/server/game/Server/WorldSocketAcceptor.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2008-2014 TrinityCore - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -/** \addtogroup u2w User to World Communication - * @{ - * \file WorldSocketMgr.h - */ - -#ifndef __WORLDSOCKETACCEPTOR_H_ -#define __WORLDSOCKETACCEPTOR_H_ - -#include "Common.h" - -#include -#include - -#include "WorldSocket.h" - -class WorldSocketAcceptor : public ACE_Acceptor -{ -public: - WorldSocketAcceptor(void) { } - virtual ~WorldSocketAcceptor(void) - { - if (reactor()) - reactor()->cancel_timer(this, 1); - } - -protected: - - virtual int handle_timeout(const ACE_Time_Value& /*current_time*/, const void* /*act = 0*/) - { - TC_LOG_DEBUG("misc", "Resuming acceptor"); - reactor()->cancel_timer(this, 1); - return reactor()->register_handler(this, ACE_Event_Handler::ACCEPT_MASK); - } - - virtual int handle_accept_error(void) - { -#if defined(ENFILE) && defined(EMFILE) - if (errno == ENFILE || errno == EMFILE) - { - TC_LOG_ERROR("misc", "Out of file descriptors, suspending incoming connections for 10 seconds"); - reactor()->remove_handler(this, ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); - reactor()->schedule_timer(this, NULL, ACE_Time_Value(10)); - } -#endif - return 0; - } -}; - -#endif /* __WORLDSOCKETACCEPTOR_H_ */ -/// @} diff --git a/src/server/game/Server/WorldSocketMgr.cpp b/src/server/game/Server/WorldSocketMgr.cpp deleted file mode 100644 index 3c1db3551d0..00000000000 --- a/src/server/game/Server/WorldSocketMgr.cpp +++ /dev/null @@ -1,360 +0,0 @@ -/* - * Copyright (C) 2008-2014 TrinityCore - * Copyright (C) 2005-2008 MaNGOS - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -/** \file WorldSocketMgr.cpp -* \ingroup u2w -* \author Derex -*/ - -#include "WorldSocketMgr.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "Log.h" -#include "Common.h" -#include "Config.h" -#include "DatabaseEnv.h" -#include "WorldSocket.h" -#include "WorldSocketAcceptor.h" -#include "ScriptMgr.h" - -/** -* This is a helper class to WorldSocketMgr, that manages -* network threads, and assigning connections from acceptor thread -* to other network threads -*/ -class ReactorRunnable : protected ACE_Task_Base -{ - public: - - ReactorRunnable() : - m_Reactor(0), - m_Connections(0), - m_ThreadId(-1) - { - ACE_Reactor_Impl* imp; - - #if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) - - imp = new ACE_Dev_Poll_Reactor(); - - imp->max_notify_iterations (128); - imp->restart (1); - - #else - - imp = new ACE_TP_Reactor(); - imp->max_notify_iterations (128); - - #endif - - m_Reactor = new ACE_Reactor (imp, 1); - } - - virtual ~ReactorRunnable() - { - Stop(); - Wait(); - - delete m_Reactor; - } - - void Stop() - { - m_Reactor->end_reactor_event_loop(); - } - - int Start() - { - if (m_ThreadId != -1) - return -1; - - return (m_ThreadId = activate()); - } - - void Wait() { ACE_Task_Base::wait(); } - - long Connections() - { - return static_cast (m_Connections.value()); - } - - int AddSocket (WorldSocket* sock) - { - std::lock_guard lock(newSocketsLock); - - ++m_Connections; - sock->AddReference(); - sock->reactor (m_Reactor); - m_NewSockets.insert (sock); - - sScriptMgr->OnSocketOpen(sock); - - return 0; - } - - ACE_Reactor* GetReactor() - { - return m_Reactor; - } - - protected: - - void AddNewSockets() - { - std::lock_guard lock(newSocketsLock); - - if (m_NewSockets.empty()) - return; - - for (SocketSet::const_iterator i = m_NewSockets.begin(); i != m_NewSockets.end(); ++i) - { - WorldSocket* sock = (*i); - - if (sock->IsClosed()) - { - sScriptMgr->OnSocketClose(sock, true); - - sock->RemoveReference(); - --m_Connections; - } - else - m_Sockets.insert (sock); - } - - m_NewSockets.clear(); - } - - virtual int svc() - { - TC_LOG_DEBUG("misc", "Network Thread Starting"); - - ACE_ASSERT (m_Reactor); - - SocketSet::iterator i, t; - - while (!m_Reactor->reactor_event_loop_done()) - { - // dont be too smart to move this outside the loop - // the run_reactor_event_loop will modify interval - ACE_Time_Value interval (0, 10000); - - if (m_Reactor->run_reactor_event_loop (interval) == -1) - break; - - AddNewSockets(); - - for (i = m_Sockets.begin(); i != m_Sockets.end();) - { - if ((*i)->Update() == -1) - { - t = i; - ++i; - - (*t)->CloseSocket(); - - sScriptMgr->OnSocketClose((*t), false); - - (*t)->RemoveReference(); - --m_Connections; - m_Sockets.erase (t); - } - else - ++i; - } - } - - TC_LOG_DEBUG("misc", "Network Thread exits"); - - return 0; - } - - private: - typedef ACE_Atomic_Op AtomicInt; - typedef std::set SocketSet; - - ACE_Reactor* m_Reactor; - AtomicInt m_Connections; - int m_ThreadId; - - SocketSet m_Sockets; - - SocketSet m_NewSockets; - std::mutex newSocketsLock; -}; - -WorldSocketMgr::WorldSocketMgr() : - m_NetThreads(0), - m_NetThreadsCount(0), - m_SockOutKBuff(-1), - m_SockOutUBuff(65536), - m_UseNoDelay(true), - m_Acceptor (0) { } - -WorldSocketMgr::~WorldSocketMgr() -{ - delete [] m_NetThreads; - delete m_Acceptor; -} - -int -WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address) -{ - m_UseNoDelay = sConfigMgr->GetBoolDefault ("Network.TcpNodelay", true); - - int num_threads = sConfigMgr->GetIntDefault ("Network.Threads", 1); - - if (num_threads <= 0) - { - TC_LOG_ERROR("misc", "Network.Threads is wrong in your config file"); - return -1; - } - - m_NetThreadsCount = static_cast (num_threads + 1); - - m_NetThreads = new ReactorRunnable[m_NetThreadsCount]; - - TC_LOG_DEBUG("misc", "Max allowed socket connections %d", ACE::max_handles()); - - // -1 means use default - m_SockOutKBuff = sConfigMgr->GetIntDefault ("Network.OutKBuff", -1); - - m_SockOutUBuff = sConfigMgr->GetIntDefault ("Network.OutUBuff", 65536); - - if (m_SockOutUBuff <= 0) - { - TC_LOG_ERROR("misc", "Network.OutUBuff is wrong in your config file"); - return -1; - } - - m_Acceptor = new WorldSocketAcceptor; - - ACE_INET_Addr listen_addr (port, address); - - if (m_Acceptor->open(listen_addr, m_NetThreads[0].GetReactor(), ACE_NONBLOCK) == -1) - { - TC_LOG_ERROR("misc", "Failed to open acceptor, check if the port is free"); - return -1; - } - - for (size_t i = 0; i < m_NetThreadsCount; ++i) - m_NetThreads[i].Start(); - - return 0; -} - -int -WorldSocketMgr::StartNetwork (ACE_UINT16 port, const char* address) -{ - if (!sLog->ShouldLog("misc", LOG_LEVEL_DEBUG)) - ACE_Log_Msg::instance()->priority_mask (LM_ERROR, ACE_Log_Msg::PROCESS); - - if (StartReactiveIO(port, address) == -1) - return -1; - - sScriptMgr->OnNetworkStart(); - - return 0; -} - -void -WorldSocketMgr::StopNetwork() -{ - if (m_Acceptor) - { - m_Acceptor->close(); - } - - if (m_NetThreadsCount != 0) - { - for (size_t i = 0; i < m_NetThreadsCount; ++i) - m_NetThreads[i].Stop(); - } - - Wait(); - - sScriptMgr->OnNetworkStop(); -} - -void -WorldSocketMgr::Wait() -{ - if (m_NetThreadsCount != 0) - { - for (size_t i = 0; i < m_NetThreadsCount; ++i) - m_NetThreads[i].Wait(); - } -} - -int -WorldSocketMgr::OnSocketOpen (WorldSocket* sock) -{ - // set some options here - if (m_SockOutKBuff >= 0) - { - if (sock->peer().set_option (SOL_SOCKET, - SO_SNDBUF, - (void*) & m_SockOutKBuff, - sizeof (int)) == -1 && errno != ENOTSUP) - { - TC_LOG_ERROR("misc", "WorldSocketMgr::OnSocketOpen set_option SO_SNDBUF"); - return -1; - } - } - - static const int ndoption = 1; - - // Set TCP_NODELAY. - if (m_UseNoDelay) - { - if (sock->peer().set_option (ACE_IPPROTO_TCP, - TCP_NODELAY, - (void*)&ndoption, - sizeof (int)) == -1) - { - TC_LOG_ERROR("misc", "WorldSocketMgr::OnSocketOpen: peer().set_option TCP_NODELAY errno = %s", ACE_OS::strerror (errno)); - return -1; - } - } - - sock->m_OutBufferSize = static_cast (m_SockOutUBuff); - - // we skip the Acceptor Thread - size_t min = 1; - - ACE_ASSERT (m_NetThreadsCount >= 1); - - for (size_t i = 1; i < m_NetThreadsCount; ++i) - if (m_NetThreads[i].Connections() < m_NetThreads[min].Connections()) - min = i; - - return m_NetThreads[min].AddSocket (sock); -} diff --git a/src/server/game/Server/WorldSocketMgr.h b/src/server/game/Server/WorldSocketMgr.h deleted file mode 100644 index 2c91a164ff9..00000000000 --- a/src/server/game/Server/WorldSocketMgr.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2008-2014 TrinityCore - * Copyright (C) 2005-2009 MaNGOS - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -/** \addtogroup u2w User to World Communication - * @{ - * \file WorldSocketMgr.h - * \author Derex - */ - -#ifndef __WORLDSOCKETMGR_H -#define __WORLDSOCKETMGR_H - -#include -#include - -class WorldSocket; -class ReactorRunnable; -class ACE_Event_Handler; - -/// Manages all sockets connected to peers and network threads -class WorldSocketMgr -{ - friend class WorldSocket; - -public: - static WorldSocketMgr* instance() - { - static WorldSocketMgr* instance = new WorldSocketMgr(); - return instance; - } - - /// Start network, listen at address:port . - int StartNetwork(ACE_UINT16 port, const char* address); - - /// Stops all network threads, It will wait for all running threads . - void StopNetwork(); - - /// Wait untill all network threads have "joined" . - void Wait(); - -private: - int OnSocketOpen(WorldSocket* sock); - - int StartReactiveIO(ACE_UINT16 port, const char* address); - -private: - WorldSocketMgr(); - virtual ~WorldSocketMgr(); - - ReactorRunnable* m_NetThreads; - size_t m_NetThreadsCount; - - int m_SockOutKBuff; - int m_SockOutUBuff; - bool m_UseNoDelay; - - class WorldSocketAcceptor* m_Acceptor; -}; - -#define sWorldSocketMgr WorldSocketMgr::instance() - -#endif -/// @} diff --git a/src/server/game/Server/WorldTcpSession.cpp b/src/server/game/Server/WorldTcpSession.cpp new file mode 100644 index 00000000000..0efd7ab8042 --- /dev/null +++ b/src/server/game/Server/WorldTcpSession.cpp @@ -0,0 +1,407 @@ +/* +* Copyright (C) 2008-2014 TrinityCore +* Copyright (C) 2005-2009 MaNGOS +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program. If not, see . +*/ + +#include +#include +#include "WorldTcpSession.h" +#include "ServerPktHeader.h" +#include "BigNumber.h" +#include "Opcodes.h" +#include "ScriptMgr.h" +#include "SHA1.h" + +using boost::asio::ip::tcp; +using boost::asio::streambuf; + +void WorldTcpSession::Start() +{ + AsyncReadHeader(); + HandleSendAuthSession(); +} + +void WorldTcpSession::HandleSendAuthSession() +{ + WorldPacket packet(SMSG_AUTH_CHALLENGE, 37); + packet << uint32(1); // 1...31 + packet << uint32(_authSeed); + + BigNumber seed1; + seed1.SetRand(16 * 8); + packet.append(seed1.AsByteArray(16).get(), 16); // new encryption seeds + + BigNumber seed2; + seed2.SetRand(16 * 8); + packet.append(seed2.AsByteArray(16).get(), 16); // new encryption seeds + + AsyncWrite(packet); +} + + +void WorldTcpSession::AsyncReadHeader() +{ + auto self(shared_from_this()); + + _socket.async_read_some(boost::asio::buffer(_readBuffer, sizeof(ClientPktHeader)), [this, self](boost::system::error_code error, size_t transferedBytes) + { + if (!error && transferedBytes == sizeof(ClientPktHeader)) + { + ClientPktHeader* header = (ClientPktHeader*)&_readBuffer; + + EndianConvertReverse(header->size); + EndianConvert(header->cmd); + + AsyncReadData(header->size - sizeof(ClientPktHeader)); + } + else + { + _socket.close(); + } + }); +} + +void WorldTcpSession::AsyncReadData(size_t dataSize) +{ + auto self(shared_from_this()); + + _socket.async_read_some(boost::asio::buffer(&_readBuffer[sizeof(ClientPktHeader)], dataSize), [this, self, dataSize](boost::system::error_code error, size_t transferedBytes) + { + if (!error && transferedBytes == dataSize) + { + ClientPktHeader* header = (ClientPktHeader*)&_readBuffer; + + header->size -= sizeof(ClientPktHeader); + + uint16 opcode = (uint16)header->cmd; + + std::string opcodeName = GetOpcodeNameForLogging(opcode); + + WorldPacket* packet = new WorldPacket(opcode, header->size); + + packet->resize(header->size); + + std::memcpy(packet->contents(), &_readBuffer[sizeof(ClientPktHeader)], header->size); + + switch (opcode) + { + case CMSG_PING: + //return HandlePing(*new_pct); + break; + case CMSG_AUTH_SESSION: + if (_worldSession) + { + TC_LOG_ERROR("network", "WorldSocket::ProcessIncoming: received duplicate CMSG_AUTH_SESSION from %s", _worldSession->GetPlayerInfo().c_str()); + break; + } + + // sScriptMgr->OnPacketReceive(this, packet); + HandleAuthSession(*packet); + break; + case CMSG_KEEP_ALIVE: + TC_LOG_DEBUG("network", "%s", opcodeName.c_str()); + //sScriptMgr->OnPacketReceive(this, packet); + break; + default: + { + //ACE_GUARD_RETURN(LockType, Guard, m_SessionLock, -1); + + if (!_worldSession) + { + TC_LOG_ERROR("network.opcode", "ProcessIncoming: Client not authed opcode = %u", uint32(opcode)); + break; + } + + // Our Idle timer will reset on any non PING opcodes. + // Catches people idling on the login screen and any lingering ingame connections. + _worldSession->ResetTimeOutTime(); + + // WARNING here we call it with locks held. + // Its possible to cause deadlock if QueuePacket calls back + _worldSession->QueuePacket(packet); + + break; + } + } + + + AsyncReadHeader(); + } + else + { + _socket.close(); + } + }); +} + +void WorldTcpSession::AsyncWrite(WorldPacket const& packet) +{ + ServerPktHeader header(packet.size() + 2, packet.GetOpcode()); + _authCrypt.EncryptSend((uint8*)header.header, header.getHeaderLength()); + + std::memcpy(_writeBuffer, (char*)header.header, header.getHeaderLength()); + + std::memcpy(_writeBuffer + header.getHeaderLength(), (char const*)packet.contents(), packet.size()); + + boost::asio::async_write(_socket, boost::asio::buffer(_writeBuffer, header.getHeaderLength() + packet.size()), [this](boost::system::error_code error, std::size_t /*length*/) + { + if (error) + { + _socket.close(); + } + }); +} + +int WorldTcpSession::HandleAuthSession(WorldPacket& recvPacket) +{ + uint8 digest[20]; + uint32 clientSeed; + uint8 security; + uint32 id; + LocaleConstant locale; + std::string account; + SHA1Hash sha; + uint32 clientBuild; + uint32 unk2, unk3, unk5, unk6, unk7; + uint64 unk4; + WorldPacket packet, SendAddonPacked; + BigNumber k; + bool wardenActive = sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED); + + if (sWorld->IsClosed()) + { + SendAuthResponseError(AUTH_REJECT); + TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteIpAddress().c_str()); + return -1; + } + + // Read the content of the packet + recvPacket >> clientBuild; + recvPacket >> unk2; + recvPacket >> account; + recvPacket >> unk3; + recvPacket >> clientSeed; + recvPacket >> unk5 >> unk6 >> unk7; + recvPacket >> unk4; + recvPacket.read(digest, 20); + + TC_LOG_DEBUG("network", "WorldSocket::HandleAuthSession: client %u, unk2 %u, account %s, unk3 %u, clientseed %u", + clientBuild, + unk2, + account.c_str(), + unk3, + clientSeed); + + // Get the account information from the realmd database + // 0 1 2 3 4 5 6 7 8 + // SELECT id, sessionkey, last_ip, locked, expansion, mutetime, locale, recruiter, os FROM account WHERE username = ? + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_INFO_BY_NAME); + + stmt->setString(0, account); + + PreparedQueryResult result = LoginDatabase.Query(stmt); + + // Stop if the account is not found + if (!result) + { + // We can not log here, as we do not know the account. Thus, no accountId. + SendAuthResponseError(AUTH_UNKNOWN_ACCOUNT); + TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Sent Auth Response (unknown account)."); + return -1; + } + + Field* fields = result->Fetch(); + + uint8 expansion = fields[4].GetUInt8(); + uint32 world_expansion = sWorld->getIntConfig(CONFIG_EXPANSION); + if (expansion > world_expansion) + expansion = world_expansion; + + // For hook purposes, we get Remoteaddress at this point. + std::string address = GetRemoteIpAddress(); + + // As we don't know if attempted login process by ip works, we update last_attempt_ip right away + stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LAST_ATTEMPT_IP); + + stmt->setString(0, address); + stmt->setString(1, account); + + LoginDatabase.Execute(stmt); + // This also allows to check for possible "hack" attempts on account + + // id has to be fetched at this point, so that first actual account response that fails can be logged + id = fields[0].GetUInt32(); + + ///- Re-check ip locking (same check as in realmd). + if (fields[3].GetUInt8() == 1) // if ip is locked + { + if (strcmp(fields[2].GetCString(), address.c_str())) + { + SendAuthResponseError(AUTH_FAILED); + TC_LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs. Original IP: %s, new IP: %s).", fields[2].GetCString(), address.c_str()); + // We could log on hook only instead of an additional db log, however action logger is config based. Better keep DB logging as well + sScriptMgr->OnFailedAccountLogin(id); + return -1; + } + } + + k.SetHexStr(fields[1].GetCString()); + + int64 mutetime = fields[5].GetInt64(); + //! Negative mutetime indicates amount of seconds to be muted effective on next login - which is now. + if (mutetime < 0) + { + mutetime = time(NULL) + llabs(mutetime); + + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME_LOGIN); + + stmt->setInt64(0, mutetime); + stmt->setUInt32(1, id); + + LoginDatabase.Execute(stmt); + } + + locale = LocaleConstant(fields[6].GetUInt8()); + if (locale >= TOTAL_LOCALES) + locale = LOCALE_enUS; + + uint32 recruiter = fields[7].GetUInt32(); + std::string os = fields[8].GetString(); + + // Must be done before WorldSession is created + if (wardenActive && os != "Win" && os != "OSX") + { + SendAuthResponseError(AUTH_REJECT); + TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Client %s attempted to log in using invalid client OS (%s).", address.c_str(), os.c_str()); + return -1; + } + + // Checks gmlevel per Realm + stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_GMLEVEL_BY_REALMID); + + stmt->setUInt32(0, id); + stmt->setInt32(1, int32(realmID)); + + result = LoginDatabase.Query(stmt); + + if (!result) + security = 0; + else + { + fields = result->Fetch(); + security = fields[0].GetUInt8(); + } + + // Re-check account ban (same check as in realmd) + stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BANS); + + stmt->setUInt32(0, id); + stmt->setString(1, address); + + PreparedQueryResult banresult = LoginDatabase.Query(stmt); + + if (banresult) // if account banned + { + SendAuthResponseError(AUTH_BANNED); + TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account banned)."); + sScriptMgr->OnFailedAccountLogin(id); + return -1; + } + + // Check locked state for server + AccountTypes allowedAccountType = sWorld->GetPlayerSecurityLimit(); + TC_LOG_DEBUG("network", "Allowed Level: %u Player Level %u", allowedAccountType, AccountTypes(security)); + if (allowedAccountType > SEC_PLAYER && AccountTypes(security) < allowedAccountType) + { + SendAuthResponseError(AUTH_UNAVAILABLE); + TC_LOG_INFO("network", "WorldSocket::HandleAuthSession: User tries to login but his security level is not enough"); + sScriptMgr->OnFailedAccountLogin(id); + return -1; + } + + // Check that Key and account name are the same on client and server + uint32 t = 0; + + sha.UpdateData(account); + sha.UpdateData((uint8*)&t, 4); + sha.UpdateData((uint8*)&clientSeed, 4); + sha.UpdateData((uint8*)&_authSeed, 4); + sha.UpdateBigNumbers(&k, NULL); + sha.Finalize(); + + if (memcmp(sha.GetDigest(), digest, 20)) + { + SendAuthResponseError(AUTH_FAILED); + TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", id, account.c_str(), address.c_str()); + return -1; + } + + TC_LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.", + account.c_str(), + address.c_str()); + + // Check if this user is by any chance a recruiter + stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_RECRUITER); + + stmt->setUInt32(0, id); + + result = LoginDatabase.Query(stmt); + + bool isRecruiter = false; + if (result) + isRecruiter = true; + + // Update the last_ip in the database as it was successful for login + stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LAST_IP); + + stmt->setString(0, address); + stmt->setString(1, account); + + LoginDatabase.Execute(stmt); + + // NOTE ATM the socket is single-threaded, have this in mind ... + _worldSession = new WorldSession(id, this, AccountTypes(security), expansion, mutetime, locale, recruiter, isRecruiter); + + _authCrypt.Init(&k); + + _worldSession->LoadGlobalAccountData(); + _worldSession->LoadTutorialsData(); + _worldSession->ReadAddonsInfo(recvPacket); + _worldSession->LoadPermissions(); + + // At this point, we can safely hook a successful login + sScriptMgr->OnAccountLogin(id); + + // Initialize Warden system only if it is enabled by config + if (wardenActive) + _worldSession->InitWarden(&k, os); + + // Sleep this Network thread for + // uint32 sleepTime = sWorld->getIntConfig(CONFIG_SESSION_ADD_DELAY); + // ACE_OS::sleep(ACE_Time_Value(0, sleepTime)); + + sWorld->AddSession(_worldSession); + + return 0; +} + +void WorldTcpSession::SendAuthResponseError(uint8 code) +{ + WorldPacket packet(SMSG_AUTH_RESPONSE, 1); + packet << uint8(code); + + AsyncWrite(packet); +} diff --git a/src/server/game/Server/WorldTcpSession.h b/src/server/game/Server/WorldTcpSession.h new file mode 100644 index 00000000000..fde37a642e5 --- /dev/null +++ b/src/server/game/Server/WorldTcpSession.h @@ -0,0 +1,81 @@ +/* +* Copyright (C) 2008-2014 TrinityCore +* Copyright (C) 2005-2009 MaNGOS +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program. If not, see . +*/ + +#ifndef __WORLDTCPSESSION_H__ +#define __WORLDTCPSESSION_H__ + +#include +#include +#include +#include "Common.h" +#include "AuthCrypt.h" +#include "Util.h" +#include "WorldPacket.h" +#include "WorldSession.h" + +using boost::asio::ip::tcp; + +#pragma pack(push, 1) + +struct ClientPktHeader +{ + uint16 size; + uint32 cmd; +}; + +#pragma pack(pop) + +class WorldTcpSession : public std::enable_shared_from_this +{ +public: + WorldTcpSession(tcp::socket socket) : _socket(std::move(socket)), _authSeed(static_cast (rand32())) + { + + } + + void Start(); + + const std::string GetRemoteIpAddress() const { return _socket.remote_endpoint().address().to_string(); }; + unsigned short GetRemotePort() const { return _socket.remote_endpoint().port(); } + + void CloseSocket() { _socket.close(); }; + bool IsOpen() { return _socket.is_open(); }; + + void WorldTcpSession::AsyncWrite(WorldPacket const& packet); + +private: + + void WorldTcpSession::HandleSendAuthSession(); + int WorldTcpSession::HandleAuthSession(WorldPacket& recvPacket); + void WorldTcpSession::SendAuthResponseError(uint8 code); + + void WorldTcpSession::AsyncReadHeader(); + void WorldTcpSession::AsyncReadData(size_t dataSize); + + tcp::socket _socket; + + char _readBuffer[4096]; + char _writeBuffer[4096]; + + uint32 _authSeed; + AuthCrypt _authCrypt; + + WorldSession* _worldSession; +}; + +#endif diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp index 0fc2c1a7221..7ac60c631b3 100644 --- a/src/server/worldserver/Main.cpp +++ b/src/server/worldserver/Main.cpp @@ -37,12 +37,12 @@ #include "MapManager.h" #include "ObjectAccessor.h" #include "ScriptMgr.h" -#include "WorldSocketMgr.h" #include "OutdoorPvP/OutdoorPvPMgr.h" #include "BattlegroundMgr.h" #include "TCSoap.h" #include "CliRunnable.h" #include "SystemConfig.h" +#include "WorldTcpSession.h" #define TRINITY_CORE_CONFIG "worldserver.conf" #define WORLD_SLEEP_CONST 50 @@ -155,8 +155,6 @@ extern int main(int argc, char** argv) TC_LOG_INFO("server.worldserver", "Using Boost version: %i.%i.%i", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100); OpenSSLCrypto::threadsSetup(); - BigNumber seed1; - seed1.SetRand(16 * 8); /// worldserver PID file creation std::string pidFile = sConfigMgr->GetStringDefault("PidFile", ""); @@ -228,21 +226,17 @@ extern int main(int argc, char** argv) // Launch the worldserver listener socket uint16 worldPort = uint16(sWorld->getIntConfig(CONFIG_PORT_WORLD)); - std::string bindIp = sConfigMgr->GetStringDefault("BindIP", "0.0.0.0"); + std::string worldListener = sConfigMgr->GetStringDefault("BindIP", "0.0.0.0"); - if (sWorldSocketMgr->StartNetwork(worldPort, bindIp.c_str()) == -1) - { - TC_LOG_ERROR("server.worldserver", "Failed to start network"); - return ERROR_EXIT_CODE; - } + AsyncAcceptor worldAcceptor(_ioService, worldListener, worldPort); + + sScriptMgr->OnStartup(); // Set server online (allow connecting now) LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag & ~%u, population = 0 WHERE id = '%u'", REALM_FLAG_INVALID, realmID); TC_LOG_INFO("server.worldserver", "%s (worldserver-daemon) ready...", _FULLVERSION); - sScriptMgr->OnStartup(); - WorldUpdateLoop(); // Shutdown starts here @@ -262,8 +256,6 @@ extern int main(int argc, char** argv) // unload battleground templates before different singletons destroyed sBattlegroundMgr->DeleteAllBattlegrounds(); - sWorldSocketMgr->StopNetwork(); - sMapMgr->UnloadAll(); // unload all grids (including locked in memory) sObjectAccessor->UnloadAll(); // unload 'i_player2corpse' storage and remove from world sScriptMgr->Unload(); -- cgit v1.2.3 From da3f6e923a0cb72976d7b56ace49023ecf58ceaa Mon Sep 17 00:00:00 2001 From: leak Date: Sun, 6 Jul 2014 01:42:12 +0200 Subject: Completely remove ACE as dependency for TC - kkthxbye --- CMakeLists.txt | 2 - README.md | 2 +- cmake/macros/FindACE.cmake | 84 - cmake/platform/win/settings.cmake | 2 - dep/CMakeLists.txt | 1 - dep/PackageList.txt | 6 +- dep/acelite/AUTHORS | 13 - dep/acelite/CMakeLists.txt | 11 - dep/acelite/COPYING | 111 - dep/acelite/ChangeLog | 2590 ---------- dep/acelite/NEWS | 1853 ------- dep/acelite/README | 224 - dep/acelite/THANKS | 2399 --------- dep/acelite/VERSION | 8 - dep/acelite/ace-v6.1.4_hotfix1.diff | 418 -- dep/acelite/ace-v6.1.4_hotfix2.diff | 15 - dep/acelite/ace/ACE.cpp | 3426 ------------- dep/acelite/ace/ACE.h | 891 ---- dep/acelite/ace/ACE.inl | 333 -- dep/acelite/ace/ACE_crc32.cpp | 156 - dep/acelite/ace/ACE_crc_ccitt.cpp | 124 - dep/acelite/ace/ACE_export.h | 74 - dep/acelite/ace/ARGV.cpp | 381 -- dep/acelite/ace/ARGV.h | 333 -- dep/acelite/ace/ARGV.inl | 104 - dep/acelite/ace/ATM_Acceptor.cpp | 309 -- dep/acelite/ace/ATM_Acceptor.h | 123 - dep/acelite/ace/ATM_Acceptor.inl | 43 - dep/acelite/ace/ATM_Addr.cpp | 522 -- dep/acelite/ace/ATM_Addr.h | 197 - dep/acelite/ace/ATM_Addr.inl | 37 - dep/acelite/ace/ATM_Connector.cpp | 138 - dep/acelite/ace/ATM_Connector.h | 164 - dep/acelite/ace/ATM_Connector.inl | 132 - dep/acelite/ace/ATM_Params.cpp | 20 - dep/acelite/ace/ATM_Params.h | 214 - dep/acelite/ace/ATM_Params.inl | 235 - dep/acelite/ace/ATM_QoS.cpp | 631 --- dep/acelite/ace/ATM_QoS.h | 115 - dep/acelite/ace/ATM_QoS.inl | 29 - dep/acelite/ace/ATM_Stream.cpp | 288 -- dep/acelite/ace/ATM_Stream.h | 107 - dep/acelite/ace/ATM_Stream.inl | 132 - dep/acelite/ace/Abstract_Timer_Queue.cpp | 26 - dep/acelite/ace/Abstract_Timer_Queue.h | 230 - dep/acelite/ace/Acceptor.cpp | 1249 ----- dep/acelite/ace/Acceptor.h | 695 --- dep/acelite/ace/Activation_Queue.cpp | 136 - dep/acelite/ace/Activation_Queue.h | 168 - dep/acelite/ace/Activation_Queue.inl | 31 - dep/acelite/ace/Active_Map_Manager.cpp | 7 - dep/acelite/ace/Active_Map_Manager.h | 116 - dep/acelite/ace/Active_Map_Manager.inl | 95 - dep/acelite/ace/Active_Map_Manager_T.cpp | 22 - dep/acelite/ace/Active_Map_Manager_T.h | 211 - dep/acelite/ace/Active_Map_Manager_T.inl | 311 -- dep/acelite/ace/Addr.cpp | 67 - dep/acelite/ace/Addr.h | 103 - dep/acelite/ace/Addr.inl | 57 - dep/acelite/ace/Arg_Shifter.cpp | 226 - dep/acelite/ace/Arg_Shifter.h | 234 - dep/acelite/ace/Argv_Type_Converter.cpp | 192 - dep/acelite/ace/Argv_Type_Converter.h | 119 - dep/acelite/ace/Argv_Type_Converter.inl | 44 - dep/acelite/ace/Array_Base.cpp | 235 - dep/acelite/ace/Array_Base.h | 256 - dep/acelite/ace/Array_Base.inl | 146 - dep/acelite/ace/Array_Map.cpp | 262 - dep/acelite/ace/Array_Map.h | 291 -- dep/acelite/ace/Array_Map.inl | 133 - dep/acelite/ace/Assert.cpp | 22 - dep/acelite/ace/Assert.h | 40 - dep/acelite/ace/Asynch_Acceptor.cpp | 508 -- dep/acelite/ace/Asynch_Acceptor.h | 276 - dep/acelite/ace/Asynch_Connector.cpp | 270 - dep/acelite/ace/Asynch_Connector.h | 171 - dep/acelite/ace/Asynch_IO.cpp | 1412 ----- dep/acelite/ace/Asynch_IO.h | 1761 ------- dep/acelite/ace/Asynch_IO_Impl.cpp | 117 - dep/acelite/ace/Asynch_IO_Impl.h | 816 --- dep/acelite/ace/Asynch_IO_Impl.inl | 106 - dep/acelite/ace/Asynch_Pseudo_Task.cpp | 128 - dep/acelite/ace/Asynch_Pseudo_Task.h | 73 - dep/acelite/ace/Atomic_Op.cpp | 306 -- dep/acelite/ace/Atomic_Op.h | 361 -- dep/acelite/ace/Atomic_Op.inl | 613 --- dep/acelite/ace/Atomic_Op_GCC_T.cpp | 25 - dep/acelite/ace/Atomic_Op_GCC_T.h | 139 - dep/acelite/ace/Atomic_Op_GCC_T.inl | 154 - dep/acelite/ace/Atomic_Op_Sparc.c | 187 - dep/acelite/ace/Atomic_Op_Sparc.h | 14 - dep/acelite/ace/Atomic_Op_T.cpp | 82 - dep/acelite/ace/Atomic_Op_T.h | 359 -- dep/acelite/ace/Atomic_Op_T.inl | 349 -- dep/acelite/ace/Auto_Event.cpp | 45 - dep/acelite/ace/Auto_Event.h | 73 - dep/acelite/ace/Auto_Event.inl | 12 - dep/acelite/ace/Auto_Functor.cpp | 39 - dep/acelite/ace/Auto_Functor.h | 121 - dep/acelite/ace/Auto_Functor.inl | 120 - dep/acelite/ace/Auto_IncDec_T.cpp | 34 - dep/acelite/ace/Auto_IncDec_T.h | 75 - dep/acelite/ace/Auto_IncDec_T.inl | 25 - dep/acelite/ace/Auto_Ptr.cpp | 21 - dep/acelite/ace/Auto_Ptr.h | 228 - dep/acelite/ace/Auto_Ptr.inl | 171 - dep/acelite/ace/Barrier.cpp | 172 - dep/acelite/ace/Barrier.h | 192 - dep/acelite/ace/Barrier.inl | 22 - dep/acelite/ace/Base_Thread_Adapter.cpp | 130 - dep/acelite/ace/Base_Thread_Adapter.h | 199 - dep/acelite/ace/Base_Thread_Adapter.inl | 48 - dep/acelite/ace/Based_Pointer_Repository.cpp | 119 - dep/acelite/ace/Based_Pointer_Repository.h | 94 - dep/acelite/ace/Based_Pointer_T.cpp | 121 - dep/acelite/ace/Based_Pointer_T.h | 205 - dep/acelite/ace/Based_Pointer_T.inl | 139 - dep/acelite/ace/Basic_Stats.cpp | 76 - dep/acelite/ace/Basic_Stats.h | 92 - dep/acelite/ace/Basic_Stats.inl | 53 - dep/acelite/ace/Basic_Types.cpp | 3 - dep/acelite/ace/Basic_Types.h | 683 --- dep/acelite/ace/Bound_Ptr.h | 388 -- dep/acelite/ace/Bound_Ptr.inl | 494 -- dep/acelite/ace/CDR_Base.cpp | 777 --- dep/acelite/ace/CDR_Base.h | 376 -- dep/acelite/ace/CDR_Base.inl | 255 - dep/acelite/ace/CDR_Size.cpp | 260 - dep/acelite/ace/CDR_Size.h | 241 - dep/acelite/ace/CDR_Size.inl | 424 -- dep/acelite/ace/CDR_Stream.cpp | 2300 --------- dep/acelite/ace/CDR_Stream.h | 1417 ----- dep/acelite/ace/CDR_Stream.inl | 1727 ------- dep/acelite/ace/CE_Screen_Output.cpp | 158 - dep/acelite/ace/CE_Screen_Output.h | 109 - dep/acelite/ace/CMakeLists.txt | 352 -- dep/acelite/ace/CORBA_macros.h | 90 - dep/acelite/ace/Cache_Map_Manager_T.cpp | 414 -- dep/acelite/ace/Cache_Map_Manager_T.h | 405 -- dep/acelite/ace/Cache_Map_Manager_T.inl | 245 - dep/acelite/ace/Cached_Connect_Strategy_T.cpp | 730 --- dep/acelite/ace/Cached_Connect_Strategy_T.h | 263 - dep/acelite/ace/Caching_Strategies_T.cpp | 59 - dep/acelite/ace/Caching_Strategies_T.h | 552 -- dep/acelite/ace/Caching_Strategies_T.inl | 456 -- dep/acelite/ace/Caching_Utility_T.cpp | 500 -- dep/acelite/ace/Caching_Utility_T.h | 313 -- dep/acelite/ace/Capabilities.cpp | 352 -- dep/acelite/ace/Capabilities.h | 221 - dep/acelite/ace/Capabilities.inl | 52 - dep/acelite/ace/Cleanup.cpp | 177 - dep/acelite/ace/Cleanup.h | 160 - dep/acelite/ace/Cleanup.inl | 30 - dep/acelite/ace/Cleanup_Strategies_T.cpp | 95 - dep/acelite/ace/Cleanup_Strategies_T.h | 149 - dep/acelite/ace/Codecs.cpp | 232 - dep/acelite/ace/Codecs.h | 121 - dep/acelite/ace/Codeset_IBM1047.cpp | 305 -- dep/acelite/ace/Codeset_IBM1047.h | 127 - dep/acelite/ace/Codeset_Registry.cpp | 107 - dep/acelite/ace/Codeset_Registry.h | 100 - dep/acelite/ace/Codeset_Registry.inl | 66 - dep/acelite/ace/Codeset_Registry_db.cpp | 33 - dep/acelite/ace/Codeset_Symbols.h | 220 - .../ace/Compression/ACE_Compression_export.h | 58 - dep/acelite/ace/Compression/Compressor.cpp | 63 - dep/acelite/ace/Compression/Compressor.h | 137 - dep/acelite/ace/Compression/Compressor.inl | 18 - .../Compression/rle/ACE_RLECompression_export.h | 57 - dep/acelite/ace/Compression/rle/RLECompressor.cpp | 158 - dep/acelite/ace/Compression/rle/RLECompressor.h | 108 - dep/acelite/ace/Condition_Attributes.cpp | 21 - dep/acelite/ace/Condition_Attributes.h | 101 - dep/acelite/ace/Condition_Attributes.inl | 40 - .../ace/Condition_Recursive_Thread_Mutex.cpp | 133 - dep/acelite/ace/Condition_Recursive_Thread_Mutex.h | 114 - dep/acelite/ace/Condition_T.cpp | 144 - dep/acelite/ace/Condition_T.h | 172 - dep/acelite/ace/Condition_T.inl | 51 - dep/acelite/ace/Condition_Thread_Mutex.cpp | 124 - dep/acelite/ace/Condition_Thread_Mutex.h | 146 - dep/acelite/ace/Condition_Thread_Mutex.inl | 41 - dep/acelite/ace/Configuration.cpp | 2132 -------- dep/acelite/ace/Configuration.h | 900 ---- dep/acelite/ace/Configuration.inl | 13 - dep/acelite/ace/Configuration_Import_Export.cpp | 671 --- dep/acelite/ace/Configuration_Import_Export.h | 215 - dep/acelite/ace/Connection_Recycling_Strategy.cpp | 11 - dep/acelite/ace/Connection_Recycling_Strategy.h | 63 - dep/acelite/ace/Connector.cpp | 1006 ---- dep/acelite/ace/Connector.h | 572 --- dep/acelite/ace/Containers.cpp | 8 - dep/acelite/ace/Containers.h | 71 - dep/acelite/ace/Containers.inl | 25 - dep/acelite/ace/Containers_T.cpp | 1903 ------- dep/acelite/ace/Containers_T.h | 2068 -------- dep/acelite/ace/Containers_T.inl | 479 -- dep/acelite/ace/Copy_Disabled.cpp | 17 - dep/acelite/ace/Copy_Disabled.h | 65 - dep/acelite/ace/Countdown_Time.h | 36 - dep/acelite/ace/Countdown_Time_T.cpp | 65 - dep/acelite/ace/Countdown_Time_T.h | 100 - dep/acelite/ace/Countdown_Time_T.inl | 26 - dep/acelite/ace/DEV.cpp | 43 - dep/acelite/ace/DEV.h | 65 - dep/acelite/ace/DEV.inl | 18 - dep/acelite/ace/DEV_Addr.cpp | 104 - dep/acelite/ace/DEV_Addr.h | 90 - dep/acelite/ace/DEV_Addr.inl | 51 - dep/acelite/ace/DEV_Connector.cpp | 47 - dep/acelite/ace/DEV_Connector.h | 110 - dep/acelite/ace/DEV_Connector.inl | 33 - dep/acelite/ace/DEV_IO.cpp | 131 - dep/acelite/ace/DEV_IO.h | 185 - dep/acelite/ace/DEV_IO.inl | 126 - dep/acelite/ace/DLL.cpp | 267 - dep/acelite/ace/DLL.h | 209 - dep/acelite/ace/DLL_Manager.cpp | 781 --- dep/acelite/ace/DLL_Manager.h | 299 -- dep/acelite/ace/Date_Time.cpp | 10 - dep/acelite/ace/Date_Time.h | 125 - dep/acelite/ace/Date_Time.inl | 219 - dep/acelite/ace/Default_Constants.h | 590 --- dep/acelite/ace/Dev_Poll_Reactor.cpp | 2583 ---------- dep/acelite/ace/Dev_Poll_Reactor.h | 1211 ----- dep/acelite/ace/Dev_Poll_Reactor.inl | 134 - dep/acelite/ace/Dirent.cpp | 7 - dep/acelite/ace/Dirent.h | 122 - dep/acelite/ace/Dirent.inl | 99 - dep/acelite/ace/Dirent_Selector.cpp | 55 - dep/acelite/ace/Dirent_Selector.h | 75 - dep/acelite/ace/Dirent_Selector.inl | 19 - dep/acelite/ace/Dump.cpp | 141 - dep/acelite/ace/Dump.h | 172 - dep/acelite/ace/Dump_T.cpp | 48 - dep/acelite/ace/Dump_T.h | 83 - dep/acelite/ace/Dynamic.cpp | 34 - dep/acelite/ace/Dynamic.h | 75 - dep/acelite/ace/Dynamic.inl | 34 - dep/acelite/ace/Dynamic_Message_Strategy.cpp | 203 - dep/acelite/ace/Dynamic_Message_Strategy.h | 215 - dep/acelite/ace/Dynamic_Message_Strategy.inl | 75 - dep/acelite/ace/Dynamic_Service.cpp | 63 - dep/acelite/ace/Dynamic_Service.h | 89 - dep/acelite/ace/Dynamic_Service.inl | 39 - dep/acelite/ace/Dynamic_Service_Base.cpp | 104 - dep/acelite/ace/Dynamic_Service_Base.h | 73 - dep/acelite/ace/Dynamic_Service_Dependency.cpp | 47 - dep/acelite/ace/Dynamic_Service_Dependency.h | 70 - dep/acelite/ace/ETCL/ETCL_Constraint.cpp | 655 --- dep/acelite/ace/ETCL/ETCL_Constraint.h | 416 -- dep/acelite/ace/ETCL/ETCL_Constraint.inl | 349 -- dep/acelite/ace/ETCL/ETCL_Constraint_Visitor.cpp | 117 - dep/acelite/ace/ETCL/ETCL_Constraint_Visitor.h | 70 - dep/acelite/ace/ETCL/ETCL_Interpreter.cpp | 113 - dep/acelite/ace/ETCL/ETCL_Interpreter.h | 117 - dep/acelite/ace/ETCL/ETCL_l.cpp | 1877 ------- dep/acelite/ace/ETCL/ETCL_y.cpp | 1288 ----- dep/acelite/ace/ETCL/ETCL_y.h | 45 - dep/acelite/ace/ETCL/ace_etcl_export.h | 40 - dep/acelite/ace/ETCL/etcl_parser_export.h | 40 - dep/acelite/ace/Encoding_Converter.cpp | 12 - dep/acelite/ace/Encoding_Converter.h | 70 - dep/acelite/ace/Encoding_Converter_Factory.cpp | 74 - dep/acelite/ace/Encoding_Converter_Factory.h | 54 - dep/acelite/ace/Env_Value_T.cpp | 12 - dep/acelite/ace/Env_Value_T.h | 162 - dep/acelite/ace/Env_Value_T.inl | 60 - dep/acelite/ace/Event.cpp | 93 - dep/acelite/ace/Event.h | 143 - dep/acelite/ace/Event.inl | 18 - dep/acelite/ace/Event_Handler.cpp | 394 -- dep/acelite/ace/Event_Handler.h | 390 -- dep/acelite/ace/Event_Handler.inl | 12 - .../ace/Event_Handler_Handle_Timeout_Upcall.cpp | 99 - .../ace/Event_Handler_Handle_Timeout_Upcall.h | 103 - .../ace/Event_Handler_Handle_Timeout_Upcall.inl | 71 - dep/acelite/ace/Event_Handler_T.cpp | 121 - dep/acelite/ace/Event_Handler_T.h | 188 - dep/acelite/ace/Event_Handler_T.inl | 134 - dep/acelite/ace/FIFO.cpp | 76 - dep/acelite/ace/FIFO.h | 99 - dep/acelite/ace/FIFO.inl | 25 - dep/acelite/ace/FIFO_Recv.cpp | 88 - dep/acelite/ace/FIFO_Recv.h | 96 - dep/acelite/ace/FIFO_Recv.inl | 24 - dep/acelite/ace/FIFO_Recv_Msg.cpp | 65 - dep/acelite/ace/FIFO_Recv_Msg.h | 138 - dep/acelite/ace/FIFO_Recv_Msg.inl | 137 - dep/acelite/ace/FIFO_Send.cpp | 58 - dep/acelite/ace/FIFO_Send.h | 81 - dep/acelite/ace/FIFO_Send.inl | 24 - dep/acelite/ace/FIFO_Send_Msg.cpp | 80 - dep/acelite/ace/FIFO_Send_Msg.h | 91 - dep/acelite/ace/FIFO_Send_Msg.inl | 53 - dep/acelite/ace/FILE.cpp | 147 - dep/acelite/ace/FILE.h | 126 - dep/acelite/ace/FILE.inl | 18 - dep/acelite/ace/FILE_Addr.cpp | 124 - dep/acelite/ace/FILE_Addr.h | 89 - dep/acelite/ace/FILE_Addr.inl | 34 - dep/acelite/ace/FILE_Connector.cpp | 84 - dep/acelite/ace/FILE_Connector.h | 113 - dep/acelite/ace/FILE_Connector.inl | 35 - dep/acelite/ace/FILE_IO.cpp | 145 - dep/acelite/ace/FILE_IO.h | 170 - dep/acelite/ace/FILE_IO.inl | 152 - dep/acelite/ace/File_Lock.cpp | 72 - dep/acelite/ace/File_Lock.h | 170 - dep/acelite/ace/File_Lock.inl | 96 - dep/acelite/ace/Filecache.cpp | 743 --- dep/acelite/ace/Filecache.h | 356 -- dep/acelite/ace/FlReactor/ACE_FlReactor_export.h | 58 - dep/acelite/ace/FlReactor/FlReactor.cpp | 328 -- dep/acelite/ace/FlReactor/FlReactor.h | 110 - dep/acelite/ace/Flag_Manip.cpp | 91 - dep/acelite/ace/Flag_Manip.h | 58 - dep/acelite/ace/Flag_Manip.inl | 26 - dep/acelite/ace/FoxReactor/ACE_FoxReactor_export.h | 58 - dep/acelite/ace/FoxReactor/FoxReactor.cpp | 327 -- dep/acelite/ace/FoxReactor/FoxReactor.h | 112 - dep/acelite/ace/Framework_Component.cpp | 276 - dep/acelite/ace/Framework_Component.h | 200 - dep/acelite/ace/Framework_Component.inl | 38 - dep/acelite/ace/Framework_Component_T.cpp | 33 - dep/acelite/ace/Framework_Component_T.h | 71 - dep/acelite/ace/Free_List.cpp | 163 - dep/acelite/ace/Free_List.h | 150 - dep/acelite/ace/Functor.cpp | 53 - dep/acelite/ace/Functor.h | 477 -- dep/acelite/ace/Functor.inl | 248 - dep/acelite/ace/Functor_String.cpp | 9 - dep/acelite/ace/Functor_String.h | 168 - dep/acelite/ace/Functor_String.inl | 76 - dep/acelite/ace/Functor_T.cpp | 49 - dep/acelite/ace/Functor_T.h | 194 - dep/acelite/ace/Functor_T.inl | 63 - dep/acelite/ace/Future.cpp | 432 -- dep/acelite/ace/Future.h | 387 -- dep/acelite/ace/Future_Set.cpp | 136 - dep/acelite/ace/Future_Set.h | 143 - dep/acelite/ace/Get_Opt.cpp | 730 --- dep/acelite/ace/Get_Opt.h | 494 -- dep/acelite/ace/Get_Opt.inl | 96 - dep/acelite/ace/Global_Macros.h | 1020 ---- dep/acelite/ace/Guard_T.cpp | 62 - dep/acelite/ace/Guard_T.h | 404 -- dep/acelite/ace/Guard_T.inl | 171 - dep/acelite/ace/Handle_Gobbler.h | 68 - dep/acelite/ace/Handle_Gobbler.inl | 79 - dep/acelite/ace/Handle_Ops.cpp | 44 - dep/acelite/ace/Handle_Ops.h | 50 - dep/acelite/ace/Handle_Set.cpp | 520 -- dep/acelite/ace/Handle_Set.h | 235 - dep/acelite/ace/Handle_Set.inl | 183 - dep/acelite/ace/Hash_Cache_Map_Manager_T.cpp | 226 - dep/acelite/ace/Hash_Cache_Map_Manager_T.h | 210 - dep/acelite/ace/Hash_Cache_Map_Manager_T.inl | 72 - dep/acelite/ace/Hash_Map_Manager.h | 31 - dep/acelite/ace/Hash_Map_Manager_T.cpp | 542 -- dep/acelite/ace/Hash_Map_Manager_T.h | 1306 ----- dep/acelite/ace/Hash_Map_Manager_T.inl | 1246 ----- dep/acelite/ace/Hash_Map_With_Allocator_T.cpp | 35 - dep/acelite/ace/Hash_Map_With_Allocator_T.h | 112 - dep/acelite/ace/Hash_Map_With_Allocator_T.inl | 82 - dep/acelite/ace/Hash_Multi_Map_Manager_T.cpp | 601 --- dep/acelite/ace/Hash_Multi_Map_Manager_T.h | 966 ---- dep/acelite/ace/Hash_Multi_Map_Manager_T.inl | 994 ---- dep/acelite/ace/Hashable.cpp | 30 - dep/acelite/ace/Hashable.h | 65 - dep/acelite/ace/Hashable.inl | 12 - dep/acelite/ace/High_Res_Timer.cpp | 523 -- dep/acelite/ace/High_Res_Timer.h | 309 -- dep/acelite/ace/High_Res_Timer.inl | 167 - dep/acelite/ace/ICMP_Socket.cpp | 180 - dep/acelite/ace/ICMP_Socket.h | 110 - dep/acelite/ace/INET_Addr.cpp | 1139 ----- dep/acelite/ace/INET_Addr.h | 390 -- dep/acelite/ace/INET_Addr.inl | 252 - dep/acelite/ace/IOStream.cpp | 663 --- dep/acelite/ace/IOStream.h | 504 -- dep/acelite/ace/IOStream_T.cpp | 247 - dep/acelite/ace/IOStream_T.h | 297 -- dep/acelite/ace/IOStream_T.inl | 123 - dep/acelite/ace/IO_Cntl_Msg.cpp | 7 - dep/acelite/ace/IO_Cntl_Msg.h | 112 - dep/acelite/ace/IO_Cntl_Msg.inl | 61 - dep/acelite/ace/IO_SAP.cpp | 140 - dep/acelite/ace/IO_SAP.h | 96 - dep/acelite/ace/IO_SAP.inl | 41 - dep/acelite/ace/IPC_SAP.cpp | 193 - dep/acelite/ace/IPC_SAP.h | 96 - dep/acelite/ace/IPC_SAP.inl | 40 - dep/acelite/ace/If_Then_Else.h | 89 - dep/acelite/ace/Init_ACE.cpp | 41 - dep/acelite/ace/Init_ACE.h | 70 - dep/acelite/ace/Intrusive_Auto_Ptr.cpp | 22 - dep/acelite/ace/Intrusive_Auto_Ptr.h | 165 - dep/acelite/ace/Intrusive_Auto_Ptr.inl | 147 - dep/acelite/ace/Intrusive_List.cpp | 122 - dep/acelite/ace/Intrusive_List.h | 140 - dep/acelite/ace/Intrusive_List.inl | 34 - dep/acelite/ace/Intrusive_List_Node.cpp | 27 - dep/acelite/ace/Intrusive_List_Node.h | 84 - dep/acelite/ace/Intrusive_List_Node.inl | 31 - dep/acelite/ace/LOCK_SOCK_Acceptor.cpp | 35 - dep/acelite/ace/LOCK_SOCK_Acceptor.h | 67 - dep/acelite/ace/LSOCK.cpp | 185 - dep/acelite/ace/LSOCK.h | 84 - dep/acelite/ace/LSOCK.inl | 43 - dep/acelite/ace/LSOCK_Acceptor.cpp | 143 - dep/acelite/ace/LSOCK_Acceptor.h | 95 - dep/acelite/ace/LSOCK_CODgram.cpp | 62 - dep/acelite/ace/LSOCK_CODgram.h | 109 - dep/acelite/ace/LSOCK_CODgram.inl | 30 - dep/acelite/ace/LSOCK_Connector.cpp | 59 - dep/acelite/ace/LSOCK_Connector.h | 91 - dep/acelite/ace/LSOCK_Connector.inl | 27 - dep/acelite/ace/LSOCK_Dgram.cpp | 71 - dep/acelite/ace/LSOCK_Dgram.h | 74 - dep/acelite/ace/LSOCK_Dgram.inl | 22 - dep/acelite/ace/LSOCK_Stream.cpp | 137 - dep/acelite/ace/LSOCK_Stream.h | 82 - dep/acelite/ace/LSOCK_Stream.inl | 25 - dep/acelite/ace/Lib_Find.cpp | 777 --- dep/acelite/ace/Lib_Find.h | 131 - dep/acelite/ace/Local_Memory_Pool.cpp | 144 - dep/acelite/ace/Local_Memory_Pool.h | 133 - dep/acelite/ace/Local_Name_Space.cpp | 167 - dep/acelite/ace/Local_Name_Space.h | 132 - dep/acelite/ace/Local_Name_Space_T.cpp | 966 ---- dep/acelite/ace/Local_Name_Space_T.h | 267 - dep/acelite/ace/Local_Tokens.cpp | 1619 ------ dep/acelite/ace/Local_Tokens.h | 1123 ---- dep/acelite/ace/Local_Tokens.inl | 275 - dep/acelite/ace/Lock.cpp | 88 - dep/acelite/ace/Lock.h | 161 - dep/acelite/ace/Lock.inl | 12 - dep/acelite/ace/Lock_Adapter_T.cpp | 106 - dep/acelite/ace/Lock_Adapter_T.h | 123 - dep/acelite/ace/Lock_Adapter_T.inl | 28 - dep/acelite/ace/Log_Msg.cpp | 2602 ---------- dep/acelite/ace/Log_Msg.h | 751 --- dep/acelite/ace/Log_Msg.inl | 235 - dep/acelite/ace/Log_Msg_Backend.cpp | 14 - dep/acelite/ace/Log_Msg_Backend.h | 88 - dep/acelite/ace/Log_Msg_Callback.cpp | 13 - dep/acelite/ace/Log_Msg_Callback.h | 69 - dep/acelite/ace/Log_Msg_IPC.cpp | 114 - dep/acelite/ace/Log_Msg_IPC.h | 81 - dep/acelite/ace/Log_Msg_NT_Event_Log.cpp | 170 - dep/acelite/ace/Log_Msg_NT_Event_Log.h | 72 - dep/acelite/ace/Log_Msg_UNIX_Syslog.cpp | 207 - dep/acelite/ace/Log_Msg_UNIX_Syslog.h | 77 - dep/acelite/ace/Log_Priority.h | 85 - dep/acelite/ace/Log_Record.cpp | 400 -- dep/acelite/ace/Log_Record.h | 209 - dep/acelite/ace/Log_Record.inl | 90 - dep/acelite/ace/Logging_Strategy.cpp | 610 --- dep/acelite/ace/Logging_Strategy.h | 214 - dep/acelite/ace/MEM_Acceptor.cpp | 266 - dep/acelite/ace/MEM_Acceptor.h | 188 - dep/acelite/ace/MEM_Acceptor.inl | 94 - dep/acelite/ace/MEM_Addr.cpp | 166 - dep/acelite/ace/MEM_Addr.h | 155 - dep/acelite/ace/MEM_Addr.inl | 111 - dep/acelite/ace/MEM_Connector.cpp | 149 - dep/acelite/ace/MEM_Connector.h | 175 - dep/acelite/ace/MEM_Connector.inl | 21 - dep/acelite/ace/MEM_IO.cpp | 438 -- dep/acelite/ace/MEM_IO.h | 310 -- dep/acelite/ace/MEM_IO.inl | 247 - dep/acelite/ace/MEM_SAP.cpp | 97 - dep/acelite/ace/MEM_SAP.h | 164 - dep/acelite/ace/MEM_SAP.inl | 64 - dep/acelite/ace/MEM_Stream.cpp | 47 - dep/acelite/ace/MEM_Stream.h | 119 - dep/acelite/ace/MEM_Stream.inl | 76 - dep/acelite/ace/MMAP_Memory_Pool.cpp | 589 --- dep/acelite/ace/MMAP_Memory_Pool.h | 347 -- dep/acelite/ace/MMAP_Memory_Pool.inl | 21 - dep/acelite/ace/Malloc.cpp | 181 - dep/acelite/ace/Malloc.h | 396 -- dep/acelite/ace/Malloc.inl | 26 - dep/acelite/ace/Malloc_Allocator.cpp | 359 -- dep/acelite/ace/Malloc_Allocator.h | 146 - dep/acelite/ace/Malloc_Allocator.inl | 16 - dep/acelite/ace/Malloc_Base.h | 168 - dep/acelite/ace/Malloc_T.cpp | 1259 ----- dep/acelite/ace/Malloc_T.h | 893 ---- dep/acelite/ace/Malloc_T.inl | 157 - dep/acelite/ace/Managed_Object.cpp | 25 - dep/acelite/ace/Managed_Object.h | 168 - dep/acelite/ace/Managed_Object.inl | 23 - dep/acelite/ace/Manual_Event.cpp | 48 - dep/acelite/ace/Manual_Event.h | 74 - dep/acelite/ace/Manual_Event.inl | 12 - dep/acelite/ace/Map_Manager.cpp | 669 --- dep/acelite/ace/Map_Manager.h | 720 --- dep/acelite/ace/Map_Manager.inl | 756 --- dep/acelite/ace/Map_T.cpp | 1343 ----- dep/acelite/ace/Map_T.h | 1610 ------ dep/acelite/ace/Map_T.inl | 415 -- dep/acelite/ace/Mem_Map.cpp | 335 -- dep/acelite/ace/Mem_Map.h | 232 - dep/acelite/ace/Mem_Map.inl | 238 - dep/acelite/ace/Memory_Pool.h | 31 - dep/acelite/ace/Message_Block.cpp | 1283 ----- dep/acelite/ace/Message_Block.h | 871 ---- dep/acelite/ace/Message_Block.inl | 508 -- dep/acelite/ace/Message_Block_T.cpp | 54 - dep/acelite/ace/Message_Block_T.h | 88 - dep/acelite/ace/Message_Block_T.inl | 31 - dep/acelite/ace/Message_Queue.cpp | 24 - dep/acelite/ace/Message_Queue.h | 229 - dep/acelite/ace/Message_Queue.inl | 12 - dep/acelite/ace/Message_Queue_NT.cpp | 236 - dep/acelite/ace/Message_Queue_NT.h | 231 - dep/acelite/ace/Message_Queue_NT.inl | 131 - dep/acelite/ace/Message_Queue_T.cpp | 3026 ----------- dep/acelite/ace/Message_Queue_T.h | 1593 ------ dep/acelite/ace/Message_Queue_Vx.cpp | 356 -- dep/acelite/ace/Message_Queue_Vx.h | 226 - dep/acelite/ace/Message_Queue_Vx.inl | 19 - dep/acelite/ace/Method_Request.cpp | 27 - dep/acelite/ace/Method_Request.h | 100 - dep/acelite/ace/Metrics_Cache.h | 140 - dep/acelite/ace/Metrics_Cache_T.cpp | 234 - dep/acelite/ace/Metrics_Cache_T.h | 243 - dep/acelite/ace/Metrics_Cache_T.inl | 244 - dep/acelite/ace/Min_Max.h | 70 - dep/acelite/ace/Module.cpp | 275 - dep/acelite/ace/Module.h | 215 - dep/acelite/ace/Module.inl | 65 - dep/acelite/ace/Monitor_Admin.cpp | 113 - dep/acelite/ace/Monitor_Admin.h | 109 - dep/acelite/ace/Monitor_Admin_Manager.cpp | 42 - dep/acelite/ace/Monitor_Admin_Manager.h | 70 - dep/acelite/ace/Monitor_Base.cpp | 402 -- dep/acelite/ace/Monitor_Base.h | 152 - dep/acelite/ace/Monitor_Base.inl | 59 - .../ace/Monitor_Control/Auto_Update_Starter.cpp | 35 - .../ace/Monitor_Control/Auto_Update_Starter.h | 61 - .../BSD_Network_Interface_Monitor.cpp | 136 - .../BSD_Network_Interface_Monitor.h | 70 - .../ace/Monitor_Control/Bytes_Received_Monitor.cpp | 60 - .../ace/Monitor_Control/Bytes_Received_Monitor.h | 94 - .../ace/Monitor_Control/Bytes_Sent_Monitor.cpp | 60 - .../ace/Monitor_Control/Bytes_Sent_Monitor.h | 94 - .../ace/Monitor_Control/CPU_Load_Monitor.cpp | 254 - dep/acelite/ace/Monitor_Control/CPU_Load_Monitor.h | 106 - .../ace/Monitor_Control/Constraint_Interpreter.cpp | 62 - .../ace/Monitor_Control/Constraint_Interpreter.h | 74 - .../ace/Monitor_Control/Constraint_Visitor.cpp | 304 -- .../ace/Monitor_Control/Constraint_Visitor.h | 86 - .../FreeBSD_Network_Interface_Monitor.cpp | 124 - .../FreeBSD_Network_Interface_Monitor.h | 70 - .../Linux_Network_Interface_Monitor.cpp | 124 - .../Linux_Network_Interface_Monitor.h | 76 - .../ace/Monitor_Control/Memory_Usage_Monitor.cpp | 78 - .../ace/Monitor_Control/Memory_Usage_Monitor.h | 80 - dep/acelite/ace/Monitor_Control/Monitor_Control.h | 46 - .../ace/Monitor_Control/Monitor_Control_export.h | 49 - .../ace/Monitor_Control/Monitor_Control_utils.h | 92 - dep/acelite/ace/Monitor_Control/Monitor_Group.cpp | 67 - dep/acelite/ace/Monitor_Control/Monitor_Group.h | 72 - dep/acelite/ace/Monitor_Control/Monitor_Query.cpp | 82 - dep/acelite/ace/Monitor_Control/Monitor_Query.h | 75 - .../Null_Network_Interface_Monitor.cpp | 30 - .../Null_Network_Interface_Monitor.h | 61 - .../ace/Monitor_Control/Num_Threads_Monitor.cpp | 96 - .../ace/Monitor_Control/Num_Threads_Monitor.h | 88 - .../Monitor_Control/Packets_Received_Monitor.cpp | 60 - .../ace/Monitor_Control/Packets_Received_Monitor.h | 94 - .../ace/Monitor_Control/Packets_Sent_Monitor.cpp | 60 - .../ace/Monitor_Control/Packets_Sent_Monitor.h | 94 - .../Solaris_Network_Interface_Monitor.cpp | 223 - .../Solaris_Network_Interface_Monitor.h | 91 - .../ace/Monitor_Control/Windows_Monitor.cpp | 76 - dep/acelite/ace/Monitor_Control/Windows_Monitor.h | 78 - .../Windows_Multi_Instance_Monitor.cpp | 110 - .../Windows_Multi_Instance_Monitor.h | 75 - dep/acelite/ace/Monitor_Control_Action.cpp | 45 - dep/acelite/ace/Monitor_Control_Action.h | 65 - dep/acelite/ace/Monitor_Control_Types.cpp | 81 - dep/acelite/ace/Monitor_Control_Types.h | 116 - dep/acelite/ace/Monitor_Point_Registry.cpp | 172 - dep/acelite/ace/Monitor_Point_Registry.h | 100 - dep/acelite/ace/Monitor_Size.cpp | 47 - dep/acelite/ace/Monitor_Size.h | 64 - dep/acelite/ace/Monotonic_Time_Policy.cpp | 7 - dep/acelite/ace/Monotonic_Time_Policy.h | 50 - dep/acelite/ace/Monotonic_Time_Policy.inl | 32 - dep/acelite/ace/Msg_WFMO_Reactor.cpp | 85 - dep/acelite/ace/Msg_WFMO_Reactor.h | 120 - dep/acelite/ace/Msg_WFMO_Reactor.inl | 35 - dep/acelite/ace/Multihomed_INET_Addr.cpp | 296 -- dep/acelite/ace/Multihomed_INET_Addr.h | 197 - dep/acelite/ace/Multihomed_INET_Addr.inl | 15 - dep/acelite/ace/Mutex.cpp | 122 - dep/acelite/ace/Mutex.h | 193 - dep/acelite/ace/Mutex.inl | 186 - dep/acelite/ace/NT_Service.cpp | 618 --- dep/acelite/ace/NT_Service.h | 440 -- dep/acelite/ace/NT_Service.inl | 85 - dep/acelite/ace/Name_Proxy.cpp | 209 - dep/acelite/ace/Name_Proxy.h | 101 - dep/acelite/ace/Name_Request_Reply.cpp | 576 --- dep/acelite/ace/Name_Request_Reply.h | 265 - dep/acelite/ace/Name_Space.cpp | 75 - dep/acelite/ace/Name_Space.h | 165 - dep/acelite/ace/Naming_Context.cpp | 649 --- dep/acelite/ace/Naming_Context.h | 387 -- dep/acelite/ace/Naming_Context.inl | 44 - dep/acelite/ace/Netlink_Addr.cpp | 68 - dep/acelite/ace/Netlink_Addr.h | 118 - dep/acelite/ace/Netlink_Addr.inl | 51 - dep/acelite/ace/Node.cpp | 46 - dep/acelite/ace/Node.h | 85 - dep/acelite/ace/Notification_Queue.cpp | 225 - dep/acelite/ace/Notification_Queue.h | 157 - dep/acelite/ace/Notification_Queue.inl | 46 - dep/acelite/ace/Notification_Strategy.cpp | 22 - dep/acelite/ace/Notification_Strategy.h | 75 - dep/acelite/ace/Notification_Strategy.inl | 31 - dep/acelite/ace/Null_Barrier.h | 56 - dep/acelite/ace/Null_Condition.h | 93 - dep/acelite/ace/Null_Mutex.h | 198 - dep/acelite/ace/Null_Semaphore.h | 103 - dep/acelite/ace/Numeric_Limits.h | 252 - dep/acelite/ace/OS.h | 106 - dep/acelite/ace/OS_Errno.cpp | 45 - dep/acelite/ace/OS_Errno.h | 100 - dep/acelite/ace/OS_Errno.inl | 67 - dep/acelite/ace/OS_Log_Msg_Attributes.cpp | 9 - dep/acelite/ace/OS_Log_Msg_Attributes.h | 87 - dep/acelite/ace/OS_Log_Msg_Attributes.inl | 22 - dep/acelite/ace/OS_Memory.h | 340 -- dep/acelite/ace/OS_NS_Thread.cpp | 5404 -------------------- dep/acelite/ace/OS_NS_Thread.h | 1999 -------- dep/acelite/ace/OS_NS_Thread.inl | 3723 -------------- dep/acelite/ace/OS_NS_arpa_inet.cpp | 51 - dep/acelite/ace/OS_NS_arpa_inet.h | 74 - dep/acelite/ace/OS_NS_arpa_inet.inl | 96 - dep/acelite/ace/OS_NS_ctype.cpp | 9 - dep/acelite/ace/OS_NS_ctype.h | 146 - dep/acelite/ace/OS_NS_ctype.inl | 231 - dep/acelite/ace/OS_NS_dirent.cpp | 274 - dep/acelite/ace/OS_NS_dirent.h | 153 - dep/acelite/ace/OS_NS_dirent.inl | 184 - dep/acelite/ace/OS_NS_dlfcn.cpp | 10 - dep/acelite/ace/OS_NS_dlfcn.h | 69 - dep/acelite/ace/OS_NS_dlfcn.inl | 273 - dep/acelite/ace/OS_NS_errno.cpp | 9 - dep/acelite/ace/OS_NS_errno.h | 104 - dep/acelite/ace/OS_NS_errno.inl | 83 - dep/acelite/ace/OS_NS_fcntl.cpp | 243 - dep/acelite/ace/OS_NS_fcntl.h | 79 - dep/acelite/ace/OS_NS_fcntl.inl | 23 - dep/acelite/ace/OS_NS_macros.h | 114 - dep/acelite/ace/OS_NS_math.cpp | 8 - dep/acelite/ace/OS_NS_math.h | 143 - dep/acelite/ace/OS_NS_math.inl | 16 - dep/acelite/ace/OS_NS_netdb.cpp | 283 - dep/acelite/ace/OS_NS_netdb.h | 130 - dep/acelite/ace/OS_NS_netdb.inl | 739 --- dep/acelite/ace/OS_NS_poll.cpp | 8 - dep/acelite/ace/OS_NS_poll.h | 66 - dep/acelite/ace/OS_NS_poll.inl | 45 - dep/acelite/ace/OS_NS_pwd.cpp | 8 - dep/acelite/ace/OS_NS_pwd.h | 76 - dep/acelite/ace/OS_NS_pwd.inl | 75 - dep/acelite/ace/OS_NS_regex.cpp | 8 - dep/acelite/ace/OS_NS_regex.h | 65 - dep/acelite/ace/OS_NS_regex.inl | 38 - dep/acelite/ace/OS_NS_signal.cpp | 24 - dep/acelite/ace/OS_NS_signal.h | 233 - dep/acelite/ace/OS_NS_signal.inl | 242 - dep/acelite/ace/OS_NS_stdio.cpp | 421 -- dep/acelite/ace/OS_NS_stdio.h | 563 -- dep/acelite/ace/OS_NS_stdio.inl | 1201 ----- dep/acelite/ace/OS_NS_stdlib.cpp | 1207 ----- dep/acelite/ace/OS_NS_stdlib.h | 453 -- dep/acelite/ace/OS_NS_stdlib.inl | 619 --- dep/acelite/ace/OS_NS_string.cpp | 416 -- dep/acelite/ace/OS_NS_string.h | 477 -- dep/acelite/ace/OS_NS_string.inl | 555 -- dep/acelite/ace/OS_NS_strings.cpp | 84 - dep/acelite/ace/OS_NS_strings.h | 86 - dep/acelite/ace/OS_NS_strings.inl | 59 - dep/acelite/ace/OS_NS_stropts.cpp | 193 - dep/acelite/ace/OS_NS_stropts.h | 170 - dep/acelite/ace/OS_NS_stropts.inl | 201 - dep/acelite/ace/OS_NS_sys_mman.cpp | 8 - dep/acelite/ace/OS_NS_sys_mman.h | 97 - dep/acelite/ace/OS_NS_sys_mman.inl | 308 -- dep/acelite/ace/OS_NS_sys_msg.cpp | 8 - dep/acelite/ace/OS_NS_sys_msg.h | 77 - dep/acelite/ace/OS_NS_sys_msg.inl | 78 - dep/acelite/ace/OS_NS_sys_resource.cpp | 8 - dep/acelite/ace/OS_NS_sys_resource.h | 67 - dep/acelite/ace/OS_NS_sys_resource.inl | 98 - dep/acelite/ace/OS_NS_sys_select.cpp | 8 - dep/acelite/ace/OS_NS_sys_select.h | 77 - dep/acelite/ace/OS_NS_sys_select.inl | 74 - dep/acelite/ace/OS_NS_sys_sendfile.cpp | 53 - dep/acelite/ace/OS_NS_sys_sendfile.h | 66 - dep/acelite/ace/OS_NS_sys_sendfile.inl | 24 - dep/acelite/ace/OS_NS_sys_shm.cpp | 10 - dep/acelite/ace/OS_NS_sys_shm.h | 72 - dep/acelite/ace/OS_NS_sys_shm.inl | 76 - dep/acelite/ace/OS_NS_sys_socket.cpp | 280 - dep/acelite/ace/OS_NS_sys_socket.h | 310 -- dep/acelite/ace/OS_NS_sys_socket.inl | 1021 ---- dep/acelite/ace/OS_NS_sys_stat.cpp | 10 - dep/acelite/ace/OS_NS_sys_stat.h | 149 - dep/acelite/ace/OS_NS_sys_stat.inl | 295 -- dep/acelite/ace/OS_NS_sys_time.cpp | 8 - dep/acelite/ace/OS_NS_sys_time.h | 55 - dep/acelite/ace/OS_NS_sys_time.inl | 75 - dep/acelite/ace/OS_NS_sys_uio.cpp | 130 - dep/acelite/ace/OS_NS_sys_uio.h | 80 - dep/acelite/ace/OS_NS_sys_uio.inl | 55 - dep/acelite/ace/OS_NS_sys_utsname.cpp | 237 - dep/acelite/ace/OS_NS_sys_utsname.h | 71 - dep/acelite/ace/OS_NS_sys_wait.cpp | 7 - dep/acelite/ace/OS_NS_sys_wait.h | 87 - dep/acelite/ace/OS_NS_sys_wait.inl | 99 - dep/acelite/ace/OS_NS_time.cpp | 602 --- dep/acelite/ace/OS_NS_time.h | 302 -- dep/acelite/ace/OS_NS_time.inl | 496 -- dep/acelite/ace/OS_NS_unistd.cpp | 922 ---- dep/acelite/ace/OS_NS_unistd.h | 375 -- dep/acelite/ace/OS_NS_unistd.inl | 1230 ----- dep/acelite/ace/OS_NS_wchar.cpp | 375 -- dep/acelite/ace/OS_NS_wchar.h | 199 - dep/acelite/ace/OS_NS_wchar.inl | 87 - dep/acelite/ace/OS_NS_wctype.cpp | 9 - dep/acelite/ace/OS_NS_wctype.h | 71 - dep/acelite/ace/OS_NS_wctype.inl | 24 - dep/acelite/ace/OS_QoS.cpp | 476 -- dep/acelite/ace/OS_QoS.h | 449 -- dep/acelite/ace/OS_TLI.cpp | 9 - dep/acelite/ace/OS_TLI.h | 279 - dep/acelite/ace/OS_TLI.inl | 390 -- dep/acelite/ace/OS_Thread_Adapter.cpp | 166 - dep/acelite/ace/OS_Thread_Adapter.h | 72 - dep/acelite/ace/OS_main.cpp | 157 - dep/acelite/ace/OS_main.h | 310 -- dep/acelite/ace/Obchunk.cpp | 34 - dep/acelite/ace/Obchunk.h | 77 - dep/acelite/ace/Obchunk.inl | 12 - dep/acelite/ace/Object_Manager.cpp | 968 ---- dep/acelite/ace/Object_Manager.h | 475 -- dep/acelite/ace/Object_Manager.inl | 51 - dep/acelite/ace/Object_Manager_Base.cpp | 500 -- dep/acelite/ace/Object_Manager_Base.h | 248 - dep/acelite/ace/Obstack.h | 31 - dep/acelite/ace/Obstack_T.cpp | 226 - dep/acelite/ace/Obstack_T.h | 129 - dep/acelite/ace/Obstack_T.inl | 12 - dep/acelite/ace/PI_Malloc.cpp | 163 - dep/acelite/ace/PI_Malloc.h | 213 - dep/acelite/ace/PI_Malloc.inl | 33 - dep/acelite/ace/POSIX_Asynch_IO.cpp | 2416 --------- dep/acelite/ace/POSIX_Asynch_IO.h | 1298 ----- dep/acelite/ace/POSIX_CB_Proactor.cpp | 176 - dep/acelite/ace/POSIX_CB_Proactor.h | 97 - dep/acelite/ace/POSIX_Proactor.cpp | 2032 -------- dep/acelite/ace/POSIX_Proactor.h | 659 --- dep/acelite/ace/POSIX_Proactor.inl | 13 - dep/acelite/ace/Pagefile_Memory_Pool.cpp | 389 -- dep/acelite/ace/Pagefile_Memory_Pool.h | 204 - dep/acelite/ace/Pagefile_Memory_Pool.inl | 54 - dep/acelite/ace/Pair_T.cpp | 16 - dep/acelite/ace/Pair_T.h | 80 - dep/acelite/ace/Pair_T.inl | 34 - dep/acelite/ace/Parse_Node.cpp | 925 ---- dep/acelite/ace/Parse_Node.h | 523 -- dep/acelite/ace/Ping_Socket.cpp | 370 -- dep/acelite/ace/Ping_Socket.h | 118 - dep/acelite/ace/Ping_Socket.inl | 13 - dep/acelite/ace/Pipe.cpp | 364 -- dep/acelite/ace/Pipe.h | 168 - dep/acelite/ace/Pipe.inl | 203 - dep/acelite/ace/PrecompiledHeaders/WinAcePCH.cpp | 3 - dep/acelite/ace/PrecompiledHeaders/WinAcePCH.h | 17 - dep/acelite/ace/Priority_Reactor.cpp | 188 - dep/acelite/ace/Priority_Reactor.h | 100 - dep/acelite/ace/Proactor.cpp | 1175 ----- dep/acelite/ace/Proactor.h | 679 --- dep/acelite/ace/Proactor.inl | 80 - dep/acelite/ace/Proactor_Impl.cpp | 17 - dep/acelite/ace/Proactor_Impl.h | 265 - dep/acelite/ace/Process.cpp | 1409 ----- dep/acelite/ace/Process.h | 657 --- dep/acelite/ace/Process.inl | 421 -- dep/acelite/ace/Process_Manager.cpp | 1008 ---- dep/acelite/ace/Process_Manager.h | 468 -- dep/acelite/ace/Process_Manager.inl | 13 - dep/acelite/ace/Process_Mutex.cpp | 90 - dep/acelite/ace/Process_Mutex.h | 233 - dep/acelite/ace/Process_Mutex.inl | 118 - dep/acelite/ace/Process_Semaphore.cpp | 111 - dep/acelite/ace/Process_Semaphore.h | 159 - dep/acelite/ace/Process_Semaphore.inl | 66 - dep/acelite/ace/Profile_Timer.cpp | 439 -- dep/acelite/ace/Profile_Timer.h | 139 - dep/acelite/ace/Profile_Timer.inl | 129 - dep/acelite/ace/QoS/ACE_QoS_Export.h | 46 - dep/acelite/ace/QoS/QoS_Decorator.cpp | 163 - dep/acelite/ace/QoS/QoS_Decorator.h | 179 - dep/acelite/ace/QoS/QoS_Manager.cpp | 39 - dep/acelite/ace/QoS/QoS_Manager.h | 74 - dep/acelite/ace/QoS/QoS_Session.h | 183 - dep/acelite/ace/QoS/QoS_Session_Factory.cpp | 103 - dep/acelite/ace/QoS/QoS_Session_Factory.h | 96 - dep/acelite/ace/QoS/QoS_Session_Impl.cpp | 716 --- dep/acelite/ace/QoS/QoS_Session_Impl.h | 265 - dep/acelite/ace/QoS/QoS_Session_Impl.inl | 229 - dep/acelite/ace/QoS/README | 55 - dep/acelite/ace/QoS/SOCK_Dgram_Mcast_QoS.cpp | 254 - dep/acelite/ace/QoS/SOCK_Dgram_Mcast_QoS.h | 142 - dep/acelite/ace/QoS/SOCK_Dgram_Mcast_QoS.inl | 57 - dep/acelite/ace/QtReactor/ACE_QtReactor_export.h | 58 - dep/acelite/ace/QtReactor/QtReactor.cpp | 644 --- dep/acelite/ace/QtReactor/QtReactor.h | 226 - dep/acelite/ace/RB_Tree.cpp | 1249 ----- dep/acelite/ace/RB_Tree.h | 904 ---- dep/acelite/ace/RB_Tree.inl | 1161 ----- dep/acelite/ace/README | 1756 ------- dep/acelite/ace/RW_Mutex.cpp | 55 - dep/acelite/ace/RW_Mutex.h | 141 - dep/acelite/ace/RW_Mutex.inl | 83 - dep/acelite/ace/RW_Process_Mutex.cpp | 54 - dep/acelite/ace/RW_Process_Mutex.h | 137 - dep/acelite/ace/RW_Process_Mutex.inl | 77 - dep/acelite/ace/RW_Thread_Mutex.cpp | 45 - dep/acelite/ace/RW_Thread_Mutex.h | 74 - dep/acelite/ace/RW_Thread_Mutex.inl | 19 - dep/acelite/ace/Reactor.cpp | 510 -- dep/acelite/ace/Reactor.h | 891 ---- dep/acelite/ace/Reactor.inl | 498 -- dep/acelite/ace/Reactor_Impl.cpp | 11 - dep/acelite/ace/Reactor_Impl.h | 569 --- dep/acelite/ace/Reactor_Notification_Strategy.cpp | 38 - dep/acelite/ace/Reactor_Notification_Strategy.h | 66 - dep/acelite/ace/Reactor_Notification_Strategy.inl | 19 - dep/acelite/ace/Reactor_Timer_Interface.cpp | 11 - dep/acelite/ace/Reactor_Timer_Interface.h | 60 - dep/acelite/ace/Reactor_Token_T.cpp | 80 - dep/acelite/ace/Reactor_Token_T.h | 93 - dep/acelite/ace/Read_Buffer.cpp | 176 - dep/acelite/ace/Read_Buffer.h | 129 - dep/acelite/ace/Read_Buffer.inl | 32 - dep/acelite/ace/Recursive_Thread_Mutex.cpp | 123 - dep/acelite/ace/Recursive_Thread_Mutex.h | 194 - dep/acelite/ace/Recursive_Thread_Mutex.inl | 95 - dep/acelite/ace/Recyclable.cpp | 22 - dep/acelite/ace/Recyclable.h | 77 - dep/acelite/ace/Recyclable.inl | 20 - dep/acelite/ace/Refcountable_T.cpp | 21 - dep/acelite/ace/Refcountable_T.h | 68 - dep/acelite/ace/Refcountable_T.inl | 35 - dep/acelite/ace/Refcounted_Auto_Ptr.cpp | 18 - dep/acelite/ace/Refcounted_Auto_Ptr.h | 199 - dep/acelite/ace/Refcounted_Auto_Ptr.inl | 190 - dep/acelite/ace/Registry.cpp | 1125 ---- dep/acelite/ace/Registry.h | 562 -- dep/acelite/ace/Registry_Name_Space.cpp | 296 -- dep/acelite/ace/Registry_Name_Space.h | 140 - dep/acelite/ace/Remote_Name_Space.cpp | 377 -- dep/acelite/ace/Remote_Name_Space.h | 147 - dep/acelite/ace/Remote_Tokens.cpp | 525 -- dep/acelite/ace/Remote_Tokens.h | 321 -- dep/acelite/ace/Remote_Tokens.inl | 48 - dep/acelite/ace/Reverse_Lock_T.cpp | 93 - dep/acelite/ace/Reverse_Lock_T.h | 139 - dep/acelite/ace/Reverse_Lock_T.inl | 19 - dep/acelite/ace/Rtems_init.c | 219 - dep/acelite/ace/SOCK.cpp | 185 - dep/acelite/ace/SOCK.h | 137 - dep/acelite/ace/SOCK.inl | 39 - dep/acelite/ace/SOCK_Acceptor.cpp | 406 -- dep/acelite/ace/SOCK_Acceptor.h | 178 - dep/acelite/ace/SOCK_Acceptor.inl | 13 - dep/acelite/ace/SOCK_CODgram.cpp | 149 - dep/acelite/ace/SOCK_CODgram.h | 143 - dep/acelite/ace/SOCK_CODgram.inl | 19 - dep/acelite/ace/SOCK_Connector.cpp | 352 -- dep/acelite/ace/SOCK_Connector.h | 320 -- dep/acelite/ace/SOCK_Connector.inl | 38 - dep/acelite/ace/SOCK_Dgram.cpp | 679 --- dep/acelite/ace/SOCK_Dgram.h | 238 - dep/acelite/ace/SOCK_Dgram.inl | 167 - dep/acelite/ace/SOCK_Dgram_Bcast.cpp | 371 -- dep/acelite/ace/SOCK_Dgram_Bcast.h | 140 - dep/acelite/ace/SOCK_Dgram_Bcast.inl | 37 - dep/acelite/ace/SOCK_Dgram_Mcast.cpp | 929 ---- dep/acelite/ace/SOCK_Dgram_Mcast.h | 412 -- dep/acelite/ace/SOCK_Dgram_Mcast.inl | 64 - dep/acelite/ace/SOCK_IO.cpp | 153 - dep/acelite/ace/SOCK_IO.h | 136 - dep/acelite/ace/SOCK_IO.inl | 123 - dep/acelite/ace/SOCK_Netlink.cpp | 113 - dep/acelite/ace/SOCK_Netlink.h | 106 - dep/acelite/ace/SOCK_Netlink.inl | 37 - dep/acelite/ace/SOCK_SEQPACK_Acceptor.cpp | 596 --- dep/acelite/ace/SOCK_SEQPACK_Acceptor.h | 189 - dep/acelite/ace/SOCK_SEQPACK_Acceptor.inl | 13 - dep/acelite/ace/SOCK_SEQPACK_Association.cpp | 348 -- dep/acelite/ace/SOCK_SEQPACK_Association.h | 202 - dep/acelite/ace/SOCK_SEQPACK_Association.inl | 177 - dep/acelite/ace/SOCK_SEQPACK_Connector.cpp | 442 -- dep/acelite/ace/SOCK_SEQPACK_Connector.h | 331 -- dep/acelite/ace/SOCK_SEQPACK_Connector.inl | 38 - dep/acelite/ace/SOCK_Stream.cpp | 40 - dep/acelite/ace/SOCK_Stream.h | 187 - dep/acelite/ace/SOCK_Stream.inl | 177 - dep/acelite/ace/SPIPE.cpp | 82 - dep/acelite/ace/SPIPE.h | 116 - dep/acelite/ace/SPIPE.inl | 18 - dep/acelite/ace/SPIPE_Acceptor.cpp | 337 -- dep/acelite/ace/SPIPE_Acceptor.h | 168 - dep/acelite/ace/SPIPE_Addr.cpp | 167 - dep/acelite/ace/SPIPE_Addr.h | 122 - dep/acelite/ace/SPIPE_Addr.inl | 59 - dep/acelite/ace/SPIPE_Connector.cpp | 160 - dep/acelite/ace/SPIPE_Connector.h | 118 - dep/acelite/ace/SPIPE_Connector.inl | 14 - dep/acelite/ace/SPIPE_Stream.cpp | 104 - dep/acelite/ace/SPIPE_Stream.h | 171 - dep/acelite/ace/SPIPE_Stream.inl | 275 - dep/acelite/ace/SSL/SSL_Asynch_BIO.cpp | 249 - dep/acelite/ace/SSL/SSL_Asynch_BIO.h | 42 - dep/acelite/ace/SSL/SSL_Asynch_Stream.cpp | 1082 ---- dep/acelite/ace/SSL/SSL_Asynch_Stream.h | 466 -- dep/acelite/ace/SSL/SSL_Asynch_Stream.inl | 13 - dep/acelite/ace/SSL/SSL_Context.cpp | 649 --- dep/acelite/ace/SSL/SSL_Context.h | 411 -- dep/acelite/ace/SSL/SSL_Context.inl | 125 - dep/acelite/ace/SSL/SSL_Export.h | 44 - dep/acelite/ace/SSL/SSL_Initializer.cpp | 44 - dep/acelite/ace/SSL/SSL_Initializer.h | 52 - dep/acelite/ace/SSL/SSL_SOCK.cpp | 67 - dep/acelite/ace/SSL/SSL_SOCK.h | 93 - dep/acelite/ace/SSL/SSL_SOCK.inl | 71 - dep/acelite/ace/SSL/SSL_SOCK_Acceptor.cpp | 246 - dep/acelite/ace/SSL/SSL_SOCK_Acceptor.h | 197 - dep/acelite/ace/SSL/SSL_SOCK_Acceptor.inl | 85 - dep/acelite/ace/SSL/SSL_SOCK_Connector.cpp | 421 -- dep/acelite/ace/SSL/SSL_SOCK_Connector.h | 318 -- dep/acelite/ace/SSL/SSL_SOCK_Connector.inl | 28 - dep/acelite/ace/SSL/SSL_SOCK_Stream.cpp | 626 --- dep/acelite/ace/SSL/SSL_SOCK_Stream.h | 348 -- dep/acelite/ace/SSL/SSL_SOCK_Stream.inl | 350 -- dep/acelite/ace/SSL/sslconf.h | 57 - dep/acelite/ace/SString.cpp | 336 -- dep/acelite/ace/SString.h | 303 -- dep/acelite/ace/SString.inl | 299 -- dep/acelite/ace/SStringfwd.h | 55 - dep/acelite/ace/SUN_Proactor.cpp | 318 -- dep/acelite/ace/SUN_Proactor.h | 126 - dep/acelite/ace/SV_Message.cpp | 24 - dep/acelite/ace/SV_Message.h | 67 - dep/acelite/ace/SV_Message.inl | 37 - dep/acelite/ace/SV_Message_Queue.cpp | 44 - dep/acelite/ace/SV_Message_Queue.h | 105 - dep/acelite/ace/SV_Message_Queue.inl | 81 - dep/acelite/ace/SV_Semaphore_Complex.cpp | 256 - dep/acelite/ace/SV_Semaphore_Complex.h | 159 - dep/acelite/ace/SV_Semaphore_Complex.inl | 84 - dep/acelite/ace/SV_Semaphore_Simple.cpp | 235 - dep/acelite/ace/SV_Semaphore_Simple.h | 197 - dep/acelite/ace/SV_Semaphore_Simple.inl | 128 - dep/acelite/ace/SV_Shared_Memory.cpp | 88 - dep/acelite/ace/SV_Shared_Memory.h | 121 - dep/acelite/ace/SV_Shared_Memory.inl | 118 - dep/acelite/ace/Sample_History.cpp | 59 - dep/acelite/ace/Sample_History.h | 97 - dep/acelite/ace/Sample_History.inl | 37 - dep/acelite/ace/Sbrk_Memory_Pool.cpp | 124 - dep/acelite/ace/Sbrk_Memory_Pool.h | 118 - dep/acelite/ace/Sched_Params.cpp | 335 -- dep/acelite/ace/Sched_Params.h | 232 - dep/acelite/ace/Sched_Params.inl | 134 - dep/acelite/ace/Select_Reactor.h | 75 - dep/acelite/ace/Select_Reactor_Base.cpp | 1132 ---- dep/acelite/ace/Select_Reactor_Base.h | 614 --- dep/acelite/ace/Select_Reactor_Base.inl | 152 - dep/acelite/ace/Select_Reactor_T.cpp | 1619 ------ dep/acelite/ace/Select_Reactor_T.h | 722 --- dep/acelite/ace/Select_Reactor_T.inl | 236 - dep/acelite/ace/Semaphore.cpp | 60 - dep/acelite/ace/Semaphore.h | 183 - dep/acelite/ace/Semaphore.inl | 119 - dep/acelite/ace/Service_Config.cpp | 608 --- dep/acelite/ace/Service_Config.h | 692 --- dep/acelite/ace/Service_Config.inl | 208 - dep/acelite/ace/Service_Gestalt.cpp | 1331 ----- dep/acelite/ace/Service_Gestalt.h | 525 -- dep/acelite/ace/Service_Gestalt.inl | 78 - dep/acelite/ace/Service_Manager.cpp | 433 -- dep/acelite/ace/Service_Manager.h | 120 - dep/acelite/ace/Service_Object.cpp | 179 - dep/acelite/ace/Service_Object.h | 206 - dep/acelite/ace/Service_Object.inl | 79 - dep/acelite/ace/Service_Repository.cpp | 626 --- dep/acelite/ace/Service_Repository.h | 271 - dep/acelite/ace/Service_Repository.inl | 38 - dep/acelite/ace/Service_Types.cpp | 457 -- dep/acelite/ace/Service_Types.h | 221 - dep/acelite/ace/Service_Types.inl | 43 - dep/acelite/ace/Shared_Memory.cpp | 13 - dep/acelite/ace/Shared_Memory.h | 58 - dep/acelite/ace/Shared_Memory_MM.cpp | 106 - dep/acelite/ace/Shared_Memory_MM.h | 120 - dep/acelite/ace/Shared_Memory_MM.inl | 42 - dep/acelite/ace/Shared_Memory_Pool.cpp | 447 -- dep/acelite/ace/Shared_Memory_Pool.h | 210 - dep/acelite/ace/Shared_Memory_SV.cpp | 83 - dep/acelite/ace/Shared_Memory_SV.h | 101 - dep/acelite/ace/Shared_Memory_SV.inl | 30 - dep/acelite/ace/Shared_Object.cpp | 50 - dep/acelite/ace/Shared_Object.h | 62 - dep/acelite/ace/Shared_Object.inl | 12 - dep/acelite/ace/Sig_Adapter.cpp | 80 - dep/acelite/ace/Sig_Adapter.h | 81 - dep/acelite/ace/Sig_Handler.cpp | 615 --- dep/acelite/ace/Sig_Handler.h | 237 - dep/acelite/ace/Sig_Handler.inl | 15 - dep/acelite/ace/Signal.cpp | 221 - dep/acelite/ace/Signal.h | 254 - dep/acelite/ace/Signal.inl | 249 - dep/acelite/ace/Singleton.cpp | 544 -- dep/acelite/ace/Singleton.h | 330 -- dep/acelite/ace/Singleton.inl | 42 - dep/acelite/ace/Sock_Connect.cpp | 1476 ------ dep/acelite/ace/Sock_Connect.h | 107 - dep/acelite/ace/Stack_Trace.cpp | 739 --- dep/acelite/ace/Stack_Trace.h | 107 - dep/acelite/ace/Static_Object_Lock.h | 78 - dep/acelite/ace/Stats.cpp | 414 -- dep/acelite/ace/Stats.h | 222 - dep/acelite/ace/Stats.inl | 104 - dep/acelite/ace/Strategies_T.cpp | 1505 ------ dep/acelite/ace/Strategies_T.h | 1076 ---- dep/acelite/ace/Strategies_T.inl | 230 - dep/acelite/ace/Stream.cpp | 638 --- dep/acelite/ace/Stream.h | 252 - dep/acelite/ace/Stream.inl | 51 - dep/acelite/ace/Stream_Modules.cpp | 381 -- dep/acelite/ace/Stream_Modules.h | 166 - dep/acelite/ace/String_Base.cpp | 665 --- dep/acelite/ace/String_Base.h | 891 ---- dep/acelite/ace/String_Base.inl | 461 -- dep/acelite/ace/String_Base_Const.cpp | 20 - dep/acelite/ace/String_Base_Const.h | 52 - dep/acelite/ace/Svc_Conf.h | 110 - dep/acelite/ace/Svc_Conf.y | 371 -- dep/acelite/ace/Svc_Conf_Lexer.cpp | 674 --- dep/acelite/ace/Svc_Conf_Lexer.h | 70 - dep/acelite/ace/Svc_Conf_Param.h | 142 - dep/acelite/ace/Svc_Conf_Token_Table.h | 84 - dep/acelite/ace/Svc_Conf_Tokens.h | 29 - dep/acelite/ace/Svc_Conf_y.cpp | 1995 -------- dep/acelite/ace/Svc_Handler.cpp | 528 -- dep/acelite/ace/Svc_Handler.h | 345 -- dep/acelite/ace/Synch.h | 53 - dep/acelite/ace/Synch_Options.cpp | 108 - dep/acelite/ace/Synch_Options.h | 163 - dep/acelite/ace/Synch_Traits.h | 116 - dep/acelite/ace/System_Time.cpp | 140 - dep/acelite/ace/System_Time.h | 99 - dep/acelite/ace/TLI.cpp | 273 - dep/acelite/ace/TLI.h | 116 - dep/acelite/ace/TLI.inl | 48 - dep/acelite/ace/TLI_Acceptor.cpp | 553 -- dep/acelite/ace/TLI_Acceptor.h | 123 - dep/acelite/ace/TLI_Connector.cpp | 256 - dep/acelite/ace/TLI_Connector.h | 130 - dep/acelite/ace/TLI_Connector.inl | 48 - dep/acelite/ace/TLI_Stream.cpp | 229 - dep/acelite/ace/TLI_Stream.h | 141 - dep/acelite/ace/TLI_Stream.inl | 25 - dep/acelite/ace/TP_Reactor.cpp | 656 --- dep/acelite/ace/TP_Reactor.h | 320 -- dep/acelite/ace/TP_Reactor.inl | 119 - dep/acelite/ace/TSS_Adapter.cpp | 40 - dep/acelite/ace/TSS_Adapter.h | 60 - dep/acelite/ace/TSS_T.cpp | 662 --- dep/acelite/ace/TSS_T.h | 269 - dep/acelite/ace/TSS_T.inl | 103 - dep/acelite/ace/TTY_IO.cpp | 701 --- dep/acelite/ace/TTY_IO.h | 113 - dep/acelite/ace/Task.cpp | 284 - dep/acelite/ace/Task.h | 306 -- dep/acelite/ace/Task.inl | 77 - dep/acelite/ace/Task_Ex_T.cpp | 114 - dep/acelite/ace/Task_Ex_T.h | 194 - dep/acelite/ace/Task_Ex_T.inl | 102 - dep/acelite/ace/Task_T.cpp | 109 - dep/acelite/ace/Task_T.h | 199 - dep/acelite/ace/Task_T.inl | 116 - dep/acelite/ace/Test_and_Set.cpp | 51 - dep/acelite/ace/Test_and_Set.h | 75 - dep/acelite/ace/Thread.cpp | 97 - dep/acelite/ace/Thread.h | 282 - dep/acelite/ace/Thread.inl | 286 -- dep/acelite/ace/Thread_Adapter.cpp | 240 - dep/acelite/ace/Thread_Adapter.h | 97 - dep/acelite/ace/Thread_Adapter.inl | 13 - dep/acelite/ace/Thread_Control.cpp | 82 - dep/acelite/ace/Thread_Control.h | 101 - dep/acelite/ace/Thread_Control.inl | 47 - dep/acelite/ace/Thread_Exit.cpp | 121 - dep/acelite/ace/Thread_Exit.h | 111 - dep/acelite/ace/Thread_Hook.cpp | 30 - dep/acelite/ace/Thread_Hook.h | 62 - dep/acelite/ace/Thread_Manager.cpp | 2249 -------- dep/acelite/ace/Thread_Manager.h | 1272 ----- dep/acelite/ace/Thread_Manager.inl | 305 -- dep/acelite/ace/Thread_Mutex.cpp | 62 - dep/acelite/ace/Thread_Mutex.h | 175 - dep/acelite/ace/Thread_Mutex.inl | 104 - dep/acelite/ace/Thread_Semaphore.cpp | 62 - dep/acelite/ace/Thread_Semaphore.h | 87 - dep/acelite/ace/Thread_Semaphore.inl | 12 - dep/acelite/ace/Throughput_Stats.cpp | 92 - dep/acelite/ace/Throughput_Stats.h | 74 - dep/acelite/ace/Time_Policy.cpp | 34 - dep/acelite/ace/Time_Policy.h | 172 - dep/acelite/ace/Time_Policy.inl | 95 - dep/acelite/ace/Time_Policy_T.cpp | 27 - dep/acelite/ace/Time_Policy_T.h | 77 - dep/acelite/ace/Time_Policy_T.inl | 32 - dep/acelite/ace/Time_Value.cpp | 357 -- dep/acelite/ace/Time_Value.h | 431 -- dep/acelite/ace/Time_Value.inl | 398 -- dep/acelite/ace/Time_Value_T.cpp | 52 - dep/acelite/ace/Time_Value_T.h | 194 - dep/acelite/ace/Time_Value_T.inl | 94 - dep/acelite/ace/Timeprobe.cpp | 15 - dep/acelite/ace/Timeprobe.h | 201 - dep/acelite/ace/Timeprobe.inl | 14 - dep/acelite/ace/Timeprobe_T.cpp | 428 -- dep/acelite/ace/Timeprobe_T.h | 220 - dep/acelite/ace/Timer_Hash.h | 77 - dep/acelite/ace/Timer_Hash_T.cpp | 870 ---- dep/acelite/ace/Timer_Hash_T.h | 352 -- dep/acelite/ace/Timer_Heap.h | 48 - dep/acelite/ace/Timer_Heap_T.cpp | 895 ---- dep/acelite/ace/Timer_Heap_T.h | 342 -- dep/acelite/ace/Timer_List.h | 43 - dep/acelite/ace/Timer_List_T.cpp | 433 -- dep/acelite/ace/Timer_List_T.h | 232 - dep/acelite/ace/Timer_Queue.h | 50 - dep/acelite/ace/Timer_Queue_Adapters.cpp | 376 -- dep/acelite/ace/Timer_Queue_Adapters.h | 261 - dep/acelite/ace/Timer_Queue_Adapters.inl | 31 - dep/acelite/ace/Timer_Queue_Iterator.cpp | 58 - dep/acelite/ace/Timer_Queue_Iterator.h | 200 - dep/acelite/ace/Timer_Queue_Iterator.inl | 135 - dep/acelite/ace/Timer_Queue_T.cpp | 447 -- dep/acelite/ace/Timer_Queue_T.h | 254 - dep/acelite/ace/Timer_Queue_T.inl | 94 - dep/acelite/ace/Timer_Queuefwd.h | 32 - dep/acelite/ace/Timer_Wheel.h | 44 - dep/acelite/ace/Timer_Wheel_T.cpp | 980 ---- dep/acelite/ace/Timer_Wheel_T.h | 230 - dep/acelite/ace/TkReactor/ACE_TkReactor_export.h | 58 - dep/acelite/ace/TkReactor/TkReactor.cpp | 438 -- dep/acelite/ace/TkReactor/TkReactor.h | 136 - dep/acelite/ace/Token.cpp | 542 -- dep/acelite/ace/Token.h | 376 -- dep/acelite/ace/Token.inl | 176 - dep/acelite/ace/Token_Collection.cpp | 291 -- dep/acelite/ace/Token_Collection.h | 231 - dep/acelite/ace/Token_Collection.inl | 17 - dep/acelite/ace/Token_Invariants.cpp | 354 -- dep/acelite/ace/Token_Invariants.h | 217 - dep/acelite/ace/Token_Manager.cpp | 272 - dep/acelite/ace/Token_Manager.h | 136 - dep/acelite/ace/Token_Manager.inl | 25 - dep/acelite/ace/Token_Request_Reply.cpp | 186 - dep/acelite/ace/Token_Request_Reply.h | 270 - dep/acelite/ace/Token_Request_Reply.inl | 205 - dep/acelite/ace/Tokenizer_T.cpp | 242 - dep/acelite/ace/Tokenizer_T.h | 241 - dep/acelite/ace/Trace.cpp | 132 - dep/acelite/ace/Trace.h | 96 - dep/acelite/ace/Truncate.h | 473 -- dep/acelite/ace/Typed_SV_Message.cpp | 30 - dep/acelite/ace/Typed_SV_Message.h | 107 - dep/acelite/ace/Typed_SV_Message.inl | 96 - dep/acelite/ace/Typed_SV_Message_Queue.cpp | 56 - dep/acelite/ace/Typed_SV_Message_Queue.h | 92 - dep/acelite/ace/Typed_SV_Message_Queue.inl | 80 - dep/acelite/ace/UNIX_Addr.cpp | 151 - dep/acelite/ace/UNIX_Addr.h | 117 - dep/acelite/ace/UNIX_Addr.inl | 57 - dep/acelite/ace/UPIPE_Acceptor.cpp | 129 - dep/acelite/ace/UPIPE_Acceptor.h | 99 - dep/acelite/ace/UPIPE_Acceptor.inl | 14 - dep/acelite/ace/UPIPE_Addr.h | 33 - dep/acelite/ace/UPIPE_Connector.cpp | 101 - dep/acelite/ace/UPIPE_Connector.h | 115 - dep/acelite/ace/UPIPE_Connector.inl | 34 - dep/acelite/ace/UPIPE_Stream.cpp | 234 - dep/acelite/ace/UPIPE_Stream.h | 140 - dep/acelite/ace/UPIPE_Stream.inl | 14 - dep/acelite/ace/UTF16_Encoding_Converter.cpp | 364 -- dep/acelite/ace/UTF16_Encoding_Converter.h | 86 - dep/acelite/ace/UTF16_Encoding_Converter.inl | 76 - dep/acelite/ace/UTF32_Encoding_Converter.cpp | 254 - dep/acelite/ace/UTF32_Encoding_Converter.h | 67 - dep/acelite/ace/UTF8_Encoding_Converter.cpp | 92 - dep/acelite/ace/UTF8_Encoding_Converter.h | 72 - dep/acelite/ace/UUID.cpp | 495 -- dep/acelite/ace/UUID.h | 282 - dep/acelite/ace/UUID.inl | 204 - dep/acelite/ace/Unbounded_Queue.cpp | 433 -- dep/acelite/ace/Unbounded_Queue.h | 297 -- dep/acelite/ace/Unbounded_Queue.inl | 27 - dep/acelite/ace/Unbounded_Set.cpp | 18 - dep/acelite/ace/Unbounded_Set.h | 103 - dep/acelite/ace/Unbounded_Set.inl | 49 - dep/acelite/ace/Unbounded_Set_Ex.cpp | 499 -- dep/acelite/ace/Unbounded_Set_Ex.h | 376 -- dep/acelite/ace/Unbounded_Set_Ex.inl | 23 - dep/acelite/ace/Value_Ptr.h | 142 - dep/acelite/ace/Vector_T.cpp | 91 - dep/acelite/ace/Vector_T.h | 264 - dep/acelite/ace/Vector_T.inl | 107 - dep/acelite/ace/Version.h | 9 - dep/acelite/ace/Versioned_Namespace.h | 51 - dep/acelite/ace/WFMO_Reactor.cpp | 2763 ---------- dep/acelite/ace/WFMO_Reactor.h | 1368 ----- dep/acelite/ace/WFMO_Reactor.inl | 1202 ----- dep/acelite/ace/WIN32_Asynch_IO.cpp | 3784 -------------- dep/acelite/ace/WIN32_Asynch_IO.h | 1937 ------- dep/acelite/ace/WIN32_Proactor.cpp | 804 --- dep/acelite/ace/WIN32_Proactor.h | 325 -- dep/acelite/ace/XML_Svc_Conf.cpp | 15 - dep/acelite/ace/XML_Svc_Conf.h | 65 - dep/acelite/ace/XML_Utils/XMLSchema/Traversal.hpp | 76 - dep/acelite/ace/XML_Utils/XMLSchema/Traversal.ipp | 10 - dep/acelite/ace/XML_Utils/XMLSchema/TypeInfo.hpp | 22 - dep/acelite/ace/XML_Utils/XMLSchema/TypeInfo.ipp | 7 - dep/acelite/ace/XML_Utils/XMLSchema/TypeInfo.tpp | 98 - dep/acelite/ace/XML_Utils/XMLSchema/Types.hpp | 669 --- dep/acelite/ace/XML_Utils/XMLSchema/Types.ipp | 8 - dep/acelite/ace/XML_Utils/XMLSchema/Writer.hpp | 158 - dep/acelite/ace/XML_Utils/XMLSchema/Writer.ipp | 10 - dep/acelite/ace/XML_Utils/XMLSchema/id_map.hpp | 144 - dep/acelite/ace/XML_Utils/XML_Error_Handler.cpp | 77 - dep/acelite/ace/XML_Utils/XML_Error_Handler.h | 60 - dep/acelite/ace/XML_Utils/XML_Helper.h | 99 - dep/acelite/ace/XML_Utils/XML_Schema_Resolver.cpp | 77 - dep/acelite/ace/XML_Utils/XML_Schema_Resolver.h | 110 - dep/acelite/ace/XML_Utils/XML_Typedefs.cpp | 8 - dep/acelite/ace/XML_Utils/XML_Typedefs.h | 32 - dep/acelite/ace/XML_Utils/XML_Utils_Export.h | 58 - dep/acelite/ace/XML_Utils/XSCRT/Elements.hpp | 569 --- .../ace/XML_Utils/XSCRT/ExtendedTypeInfo.hpp | 182 - .../ace/XML_Utils/XSCRT/ExtendedTypeInfo.ipp | 141 - dep/acelite/ace/XML_Utils/XSCRT/Parser.hpp | 64 - dep/acelite/ace/XML_Utils/XSCRT/Traversal.hpp | 265 - dep/acelite/ace/XML_Utils/XSCRT/Traversal.tpp | 195 - dep/acelite/ace/XML_Utils/XSCRT/Writer.hpp | 78 - dep/acelite/ace/XML_Utils/XSCRT/XML.hpp | 490 -- dep/acelite/ace/XML_Utils/XSCRT/XMLSchema.hpp | 588 --- dep/acelite/ace/XML_Utils/XercesString.cpp | 167 - dep/acelite/ace/XML_Utils/XercesString.h | 82 - dep/acelite/ace/XTI_ATM_Mcast.cpp | 70 - dep/acelite/ace/XTI_ATM_Mcast.h | 137 - dep/acelite/ace/XTI_ATM_Mcast.inl | 65 - dep/acelite/ace/XtReactor/ACE_XtReactor_export.h | 58 - dep/acelite/ace/XtReactor/XtReactor.cpp | 468 -- dep/acelite/ace/XtReactor/XtReactor.h | 147 - dep/acelite/ace/ace.rc | 38 - dep/acelite/ace/ace_message_table.bin | Bin 28 -> 0 bytes dep/acelite/ace/ace_wchar.cpp | 17 - dep/acelite/ace/ace_wchar.h | 342 -- dep/acelite/ace/ace_wchar.inl | 183 - dep/acelite/ace/checked_iterator.h | 58 - dep/acelite/ace/config-WinCE.h | 229 - dep/acelite/ace/config-aix-5.x.h | 324 -- dep/acelite/ace/config-aix-7.h | 29 - dep/acelite/ace/config-all.h | 93 - dep/acelite/ace/config-android.h | 377 -- dep/acelite/ace/config-cygwin32.h | 213 - dep/acelite/ace/config-freebsd.h | 187 - dep/acelite/ace/config-g++-common.h | 171 - dep/acelite/ace/config-hpux-11.00.h | 436 -- dep/acelite/ace/config-icc-common.h | 101 - dep/acelite/ace/config-integritySCA.h | 223 - dep/acelite/ace/config-kfreebsd.h | 618 --- dep/acelite/ace/config-linux.h | 453 -- dep/acelite/ace/config-lite.h | 158 - dep/acelite/ace/config-lynxos.h | 187 - dep/acelite/ace/config-macosx-iOS-hardware.h | 15 - dep/acelite/ace/config-macosx-iOS-simulator.h | 9 - dep/acelite/ace/config-macosx-leopard.h | 230 - dep/acelite/ace/config-macosx-lion.h | 19 - dep/acelite/ace/config-macosx-panther.h | 182 - dep/acelite/ace/config-macosx-snowleopard.h | 19 - dep/acelite/ace/config-macosx-tiger.h | 212 - dep/acelite/ace/config-macosx.h | 183 - dep/acelite/ace/config-macros.h | 512 -- dep/acelite/ace/config-netbsd.h | 161 - dep/acelite/ace/config-openbsd.h | 141 - dep/acelite/ace/config-openvms.h | 192 - dep/acelite/ace/config-pharlap.h | 91 - dep/acelite/ace/config-posix-nonetworking.h | 86 - dep/acelite/ace/config-posix.h | 73 - dep/acelite/ace/config-qnx.h | 196 - dep/acelite/ace/config-rtems.h | 162 - dep/acelite/ace/config-suncc-common.h | 55 - dep/acelite/ace/config-sunos5.10.h | 61 - dep/acelite/ace/config-sunos5.11.h | 15 - dep/acelite/ace/config-sunos5.4-g++.h | 173 - dep/acelite/ace/config-sunos5.4-sunc++-4.x.h | 181 - dep/acelite/ace/config-sunos5.5.h | 364 -- dep/acelite/ace/config-sunos5.6.h | 116 - dep/acelite/ace/config-sunos5.7.h | 67 - dep/acelite/ace/config-sunos5.8.h | 39 - dep/acelite/ace/config-sunos5.9.h | 18 - dep/acelite/ace/config-vxworks.h | 61 - dep/acelite/ace/config-vxworks6.4.h | 344 -- dep/acelite/ace/config-vxworks6.5.h | 25 - dep/acelite/ace/config-vxworks6.6.h | 34 - dep/acelite/ace/config-vxworks6.7.h | 23 - dep/acelite/ace/config-vxworks6.8.h | 29 - dep/acelite/ace/config-vxworks6.9.h | 33 - dep/acelite/ace/config-win32-cegcc.h | 107 - dep/acelite/ace/config-win32-common.h | 699 --- dep/acelite/ace/config-win32-dmc.h | 100 - dep/acelite/ace/config-win32-interix.h | 124 - dep/acelite/ace/config-win32-mingw.h | 123 - dep/acelite/ace/config-win32-msvc-10.h | 147 - dep/acelite/ace/config-win32-msvc-7.h | 122 - dep/acelite/ace/config-win32-msvc-8.h | 157 - dep/acelite/ace/config-win32-msvc-9.h | 146 - dep/acelite/ace/config-win32-msvc.h | 172 - dep/acelite/ace/config-win32.h | 42 - dep/acelite/ace/config-windows.h | 5 - dep/acelite/ace/iosfwd.h | 100 - dep/acelite/ace/os_include/arpa/os_inet.h | 74 - dep/acelite/ace/os_include/net/os_if.h | 108 - dep/acelite/ace/os_include/netinet/os_in.h | 179 - dep/acelite/ace/os_include/netinet/os_tcp.h | 46 - dep/acelite/ace/os_include/os_aio.h | 47 - dep/acelite/ace/os_include/os_assert.h | 46 - dep/acelite/ace/os_include/os_byteswap.h | 41 - dep/acelite/ace/os_include/os_complex.h | 42 - dep/acelite/ace/os_include/os_cpio.h | 42 - dep/acelite/ace/os_include/os_ctype.h | 48 - dep/acelite/ace/os_include/os_dirent.h | 106 - dep/acelite/ace/os_include/os_dlfcn.h | 110 - dep/acelite/ace/os_include/os_errno.h | 458 -- dep/acelite/ace/os_include/os_fcntl.h | 101 - dep/acelite/ace/os_include/os_fenv.h | 42 - dep/acelite/ace/os_include/os_float.h | 42 - dep/acelite/ace/os_include/os_fmtmsg.h | 42 - dep/acelite/ace/os_include/os_fnmatch.h | 42 - dep/acelite/ace/os_include/os_ftw.h | 44 - dep/acelite/ace/os_include/os_glob.h | 42 - dep/acelite/ace/os_include/os_grp.h | 44 - dep/acelite/ace/os_include/os_iconv.h | 44 - dep/acelite/ace/os_include/os_ifaddrs.h | 43 - dep/acelite/ace/os_include/os_intrin.h | 57 - dep/acelite/ace/os_include/os_inttypes.h | 46 - dep/acelite/ace/os_include/os_iso646.h | 42 - dep/acelite/ace/os_include/os_kstat.h | 43 - dep/acelite/ace/os_include/os_langinfo.h | 44 - dep/acelite/ace/os_include/os_libgen.h | 42 - dep/acelite/ace/os_include/os_limits.h | 138 - dep/acelite/ace/os_include/os_local.h | 44 - dep/acelite/ace/os_include/os_math.h | 44 - dep/acelite/ace/os_include/os_monetary.h | 44 - dep/acelite/ace/os_include/os_mqueue.h | 44 - dep/acelite/ace/os_include/os_ndbm.h | 44 - dep/acelite/ace/os_include/os_netdb.h | 96 - dep/acelite/ace/os_include/os_nl_types.h | 42 - dep/acelite/ace/os_include/os_pdh.h | 45 - dep/acelite/ace/os_include/os_pdhmsg.h | 41 - dep/acelite/ace/os_include/os_poll.h | 42 - dep/acelite/ace/os_include/os_pthread.h | 392 -- dep/acelite/ace/os_include/os_pwd.h | 45 - dep/acelite/ace/os_include/os_regex.h | 48 - dep/acelite/ace/os_include/os_sched.h | 56 - dep/acelite/ace/os_include/os_search.h | 44 - dep/acelite/ace/os_include/os_semaphore.h | 77 - dep/acelite/ace/os_include/os_setjmp.h | 42 - dep/acelite/ace/os_include/os_signal.h | 216 - dep/acelite/ace/os_include/os_spawn.h | 46 - dep/acelite/ace/os_include/os_stdarg.h | 50 - dep/acelite/ace/os_include/os_stdbool.h | 42 - dep/acelite/ace/os_include/os_stddef.h | 75 - dep/acelite/ace/os_include/os_stdint.h | 141 - dep/acelite/ace/os_include/os_stdio.h | 84 - dep/acelite/ace/os_include/os_stdlib.h | 73 - dep/acelite/ace/os_include/os_string.h | 49 - dep/acelite/ace/os_include/os_strings.h | 52 - dep/acelite/ace/os_include/os_stropts.h | 114 - dep/acelite/ace/os_include/os_syslog.h | 42 - dep/acelite/ace/os_include/os_tar.h | 42 - dep/acelite/ace/os_include/os_termios.h | 46 - dep/acelite/ace/os_include/os_tgmath.h | 45 - dep/acelite/ace/os_include/os_time.h | 112 - dep/acelite/ace/os_include/os_trace.h | 44 - dep/acelite/ace/os_include/os_typeinfo.h | 39 - dep/acelite/ace/os_include/os_ucontext.h | 48 - dep/acelite/ace/os_include/os_ulimit.h | 42 - dep/acelite/ace/os_include/os_unistd.h | 181 - dep/acelite/ace/os_include/os_utime.h | 44 - dep/acelite/ace/os_include/os_utmpx.h | 44 - dep/acelite/ace/os_include/os_wchar.h | 49 - dep/acelite/ace/os_include/os_wctype.h | 45 - dep/acelite/ace/os_include/os_wordexp.h | 44 - dep/acelite/ace/os_include/sys/os_ipc.h | 74 - dep/acelite/ace/os_include/sys/os_loadavg.h | 41 - dep/acelite/ace/os_include/sys/os_mman.h | 114 - dep/acelite/ace/os_include/sys/os_msg.h | 55 - dep/acelite/ace/os_include/sys/os_pstat.h | 42 - dep/acelite/ace/os_include/sys/os_resource.h | 93 - dep/acelite/ace/os_include/sys/os_select.h | 61 - dep/acelite/ace/os_include/sys/os_sem.h | 90 - dep/acelite/ace/os_include/sys/os_shm.h | 48 - dep/acelite/ace/os_include/sys/os_socket.h | 307 -- dep/acelite/ace/os_include/sys/os_stat.h | 158 - dep/acelite/ace/os_include/sys/os_statvfs.h | 42 - dep/acelite/ace/os_include/sys/os_sysctl.h | 41 - dep/acelite/ace/os_include/sys/os_sysinfo.h | 39 - dep/acelite/ace/os_include/sys/os_time.h | 60 - dep/acelite/ace/os_include/sys/os_timeb.h | 44 - dep/acelite/ace/os_include/sys/os_times.h | 44 - dep/acelite/ace/os_include/sys/os_types.h | 153 - dep/acelite/ace/os_include/sys/os_uio.h | 77 - dep/acelite/ace/os_include/sys/os_un.h | 52 - dep/acelite/ace/os_include/sys/os_utsname.h | 42 - dep/acelite/ace/os_include/sys/os_wait.h | 97 - dep/acelite/ace/post.h | 22 - dep/acelite/ace/pre.h | 24 - dep/acelite/ace/streams.h | 138 - dep/acelite/ace/svc_export.h | 44 - src/server/collision/CMakeLists.txt | 1 - src/server/game/CMakeLists.txt | 1 - src/server/scripts/CMakeLists.txt | 1 - src/server/scripts/Commands/cs_misc.cpp | 1 - src/server/worldserver/CMakeLists.txt | 2 - 1452 files changed, 4 insertions(+), 347484 deletions(-) delete mode 100644 cmake/macros/FindACE.cmake delete mode 100644 dep/acelite/AUTHORS delete mode 100644 dep/acelite/CMakeLists.txt delete mode 100644 dep/acelite/COPYING delete mode 100644 dep/acelite/ChangeLog delete mode 100644 dep/acelite/NEWS delete mode 100644 dep/acelite/README delete mode 100644 dep/acelite/THANKS delete mode 100644 dep/acelite/VERSION delete mode 100644 dep/acelite/ace-v6.1.4_hotfix1.diff delete mode 100644 dep/acelite/ace-v6.1.4_hotfix2.diff delete mode 100644 dep/acelite/ace/ACE.cpp delete mode 100644 dep/acelite/ace/ACE.h delete mode 100644 dep/acelite/ace/ACE.inl delete mode 100644 dep/acelite/ace/ACE_crc32.cpp delete mode 100644 dep/acelite/ace/ACE_crc_ccitt.cpp delete mode 100644 dep/acelite/ace/ACE_export.h delete mode 100644 dep/acelite/ace/ARGV.cpp delete mode 100644 dep/acelite/ace/ARGV.h delete mode 100644 dep/acelite/ace/ARGV.inl delete mode 100644 dep/acelite/ace/ATM_Acceptor.cpp delete mode 100644 dep/acelite/ace/ATM_Acceptor.h delete mode 100644 dep/acelite/ace/ATM_Acceptor.inl delete mode 100644 dep/acelite/ace/ATM_Addr.cpp delete mode 100644 dep/acelite/ace/ATM_Addr.h delete mode 100644 dep/acelite/ace/ATM_Addr.inl delete mode 100644 dep/acelite/ace/ATM_Connector.cpp delete mode 100644 dep/acelite/ace/ATM_Connector.h delete mode 100644 dep/acelite/ace/ATM_Connector.inl delete mode 100644 dep/acelite/ace/ATM_Params.cpp delete mode 100644 dep/acelite/ace/ATM_Params.h delete mode 100644 dep/acelite/ace/ATM_Params.inl delete mode 100644 dep/acelite/ace/ATM_QoS.cpp delete mode 100644 dep/acelite/ace/ATM_QoS.h delete mode 100644 dep/acelite/ace/ATM_QoS.inl delete mode 100644 dep/acelite/ace/ATM_Stream.cpp delete mode 100644 dep/acelite/ace/ATM_Stream.h delete mode 100644 dep/acelite/ace/ATM_Stream.inl delete mode 100644 dep/acelite/ace/Abstract_Timer_Queue.cpp delete mode 100644 dep/acelite/ace/Abstract_Timer_Queue.h delete mode 100644 dep/acelite/ace/Acceptor.cpp delete mode 100644 dep/acelite/ace/Acceptor.h delete mode 100644 dep/acelite/ace/Activation_Queue.cpp delete mode 100644 dep/acelite/ace/Activation_Queue.h delete mode 100644 dep/acelite/ace/Activation_Queue.inl delete mode 100644 dep/acelite/ace/Active_Map_Manager.cpp delete mode 100644 dep/acelite/ace/Active_Map_Manager.h delete mode 100644 dep/acelite/ace/Active_Map_Manager.inl delete mode 100644 dep/acelite/ace/Active_Map_Manager_T.cpp delete mode 100644 dep/acelite/ace/Active_Map_Manager_T.h delete mode 100644 dep/acelite/ace/Active_Map_Manager_T.inl delete mode 100644 dep/acelite/ace/Addr.cpp delete mode 100644 dep/acelite/ace/Addr.h delete mode 100644 dep/acelite/ace/Addr.inl delete mode 100644 dep/acelite/ace/Arg_Shifter.cpp delete mode 100644 dep/acelite/ace/Arg_Shifter.h delete mode 100644 dep/acelite/ace/Argv_Type_Converter.cpp delete mode 100644 dep/acelite/ace/Argv_Type_Converter.h delete mode 100644 dep/acelite/ace/Argv_Type_Converter.inl delete mode 100644 dep/acelite/ace/Array_Base.cpp delete mode 100644 dep/acelite/ace/Array_Base.h delete mode 100644 dep/acelite/ace/Array_Base.inl delete mode 100644 dep/acelite/ace/Array_Map.cpp delete mode 100644 dep/acelite/ace/Array_Map.h delete mode 100644 dep/acelite/ace/Array_Map.inl delete mode 100644 dep/acelite/ace/Assert.cpp delete mode 100644 dep/acelite/ace/Assert.h delete mode 100644 dep/acelite/ace/Asynch_Acceptor.cpp delete mode 100644 dep/acelite/ace/Asynch_Acceptor.h delete mode 100644 dep/acelite/ace/Asynch_Connector.cpp delete mode 100644 dep/acelite/ace/Asynch_Connector.h delete mode 100644 dep/acelite/ace/Asynch_IO.cpp delete mode 100644 dep/acelite/ace/Asynch_IO.h delete mode 100644 dep/acelite/ace/Asynch_IO_Impl.cpp delete mode 100644 dep/acelite/ace/Asynch_IO_Impl.h delete mode 100644 dep/acelite/ace/Asynch_IO_Impl.inl delete mode 100644 dep/acelite/ace/Asynch_Pseudo_Task.cpp delete mode 100644 dep/acelite/ace/Asynch_Pseudo_Task.h delete mode 100644 dep/acelite/ace/Atomic_Op.cpp delete mode 100644 dep/acelite/ace/Atomic_Op.h delete mode 100644 dep/acelite/ace/Atomic_Op.inl delete mode 100644 dep/acelite/ace/Atomic_Op_GCC_T.cpp delete mode 100644 dep/acelite/ace/Atomic_Op_GCC_T.h delete mode 100644 dep/acelite/ace/Atomic_Op_GCC_T.inl delete mode 100644 dep/acelite/ace/Atomic_Op_Sparc.c delete mode 100644 dep/acelite/ace/Atomic_Op_Sparc.h delete mode 100644 dep/acelite/ace/Atomic_Op_T.cpp delete mode 100644 dep/acelite/ace/Atomic_Op_T.h delete mode 100644 dep/acelite/ace/Atomic_Op_T.inl delete mode 100644 dep/acelite/ace/Auto_Event.cpp delete mode 100644 dep/acelite/ace/Auto_Event.h delete mode 100644 dep/acelite/ace/Auto_Event.inl delete mode 100644 dep/acelite/ace/Auto_Functor.cpp delete mode 100644 dep/acelite/ace/Auto_Functor.h delete mode 100644 dep/acelite/ace/Auto_Functor.inl delete mode 100644 dep/acelite/ace/Auto_IncDec_T.cpp delete mode 100644 dep/acelite/ace/Auto_IncDec_T.h delete mode 100644 dep/acelite/ace/Auto_IncDec_T.inl delete mode 100644 dep/acelite/ace/Auto_Ptr.cpp delete mode 100644 dep/acelite/ace/Auto_Ptr.h delete mode 100644 dep/acelite/ace/Auto_Ptr.inl delete mode 100644 dep/acelite/ace/Barrier.cpp delete mode 100644 dep/acelite/ace/Barrier.h delete mode 100644 dep/acelite/ace/Barrier.inl delete mode 100644 dep/acelite/ace/Base_Thread_Adapter.cpp delete mode 100644 dep/acelite/ace/Base_Thread_Adapter.h delete mode 100644 dep/acelite/ace/Base_Thread_Adapter.inl delete mode 100644 dep/acelite/ace/Based_Pointer_Repository.cpp delete mode 100644 dep/acelite/ace/Based_Pointer_Repository.h delete mode 100644 dep/acelite/ace/Based_Pointer_T.cpp delete mode 100644 dep/acelite/ace/Based_Pointer_T.h delete mode 100644 dep/acelite/ace/Based_Pointer_T.inl delete mode 100644 dep/acelite/ace/Basic_Stats.cpp delete mode 100644 dep/acelite/ace/Basic_Stats.h delete mode 100644 dep/acelite/ace/Basic_Stats.inl delete mode 100644 dep/acelite/ace/Basic_Types.cpp delete mode 100644 dep/acelite/ace/Basic_Types.h delete mode 100644 dep/acelite/ace/Bound_Ptr.h delete mode 100644 dep/acelite/ace/Bound_Ptr.inl delete mode 100644 dep/acelite/ace/CDR_Base.cpp delete mode 100644 dep/acelite/ace/CDR_Base.h delete mode 100644 dep/acelite/ace/CDR_Base.inl delete mode 100644 dep/acelite/ace/CDR_Size.cpp delete mode 100644 dep/acelite/ace/CDR_Size.h delete mode 100644 dep/acelite/ace/CDR_Size.inl delete mode 100644 dep/acelite/ace/CDR_Stream.cpp delete mode 100644 dep/acelite/ace/CDR_Stream.h delete mode 100644 dep/acelite/ace/CDR_Stream.inl delete mode 100644 dep/acelite/ace/CE_Screen_Output.cpp delete mode 100644 dep/acelite/ace/CE_Screen_Output.h delete mode 100644 dep/acelite/ace/CMakeLists.txt delete mode 100644 dep/acelite/ace/CORBA_macros.h delete mode 100644 dep/acelite/ace/Cache_Map_Manager_T.cpp delete mode 100644 dep/acelite/ace/Cache_Map_Manager_T.h delete mode 100644 dep/acelite/ace/Cache_Map_Manager_T.inl delete mode 100644 dep/acelite/ace/Cached_Connect_Strategy_T.cpp delete mode 100644 dep/acelite/ace/Cached_Connect_Strategy_T.h delete mode 100644 dep/acelite/ace/Caching_Strategies_T.cpp delete mode 100644 dep/acelite/ace/Caching_Strategies_T.h delete mode 100644 dep/acelite/ace/Caching_Strategies_T.inl delete mode 100644 dep/acelite/ace/Caching_Utility_T.cpp delete mode 100644 dep/acelite/ace/Caching_Utility_T.h delete mode 100644 dep/acelite/ace/Capabilities.cpp delete mode 100644 dep/acelite/ace/Capabilities.h delete mode 100644 dep/acelite/ace/Capabilities.inl delete mode 100644 dep/acelite/ace/Cleanup.cpp delete mode 100644 dep/acelite/ace/Cleanup.h delete mode 100644 dep/acelite/ace/Cleanup.inl delete mode 100644 dep/acelite/ace/Cleanup_Strategies_T.cpp delete mode 100644 dep/acelite/ace/Cleanup_Strategies_T.h delete mode 100644 dep/acelite/ace/Codecs.cpp delete mode 100644 dep/acelite/ace/Codecs.h delete mode 100644 dep/acelite/ace/Codeset_IBM1047.cpp delete mode 100644 dep/acelite/ace/Codeset_IBM1047.h delete mode 100644 dep/acelite/ace/Codeset_Registry.cpp delete mode 100644 dep/acelite/ace/Codeset_Registry.h delete mode 100644 dep/acelite/ace/Codeset_Registry.inl delete mode 100644 dep/acelite/ace/Codeset_Registry_db.cpp delete mode 100644 dep/acelite/ace/Codeset_Symbols.h delete mode 100644 dep/acelite/ace/Compression/ACE_Compression_export.h delete mode 100644 dep/acelite/ace/Compression/Compressor.cpp delete mode 100644 dep/acelite/ace/Compression/Compressor.h delete mode 100644 dep/acelite/ace/Compression/Compressor.inl delete mode 100644 dep/acelite/ace/Compression/rle/ACE_RLECompression_export.h delete mode 100644 dep/acelite/ace/Compression/rle/RLECompressor.cpp delete mode 100644 dep/acelite/ace/Compression/rle/RLECompressor.h delete mode 100644 dep/acelite/ace/Condition_Attributes.cpp delete mode 100644 dep/acelite/ace/Condition_Attributes.h delete mode 100644 dep/acelite/ace/Condition_Attributes.inl delete mode 100644 dep/acelite/ace/Condition_Recursive_Thread_Mutex.cpp delete mode 100644 dep/acelite/ace/Condition_Recursive_Thread_Mutex.h delete mode 100644 dep/acelite/ace/Condition_T.cpp delete mode 100644 dep/acelite/ace/Condition_T.h delete mode 100644 dep/acelite/ace/Condition_T.inl delete mode 100644 dep/acelite/ace/Condition_Thread_Mutex.cpp delete mode 100644 dep/acelite/ace/Condition_Thread_Mutex.h delete mode 100644 dep/acelite/ace/Condition_Thread_Mutex.inl delete mode 100644 dep/acelite/ace/Configuration.cpp delete mode 100644 dep/acelite/ace/Configuration.h delete mode 100644 dep/acelite/ace/Configuration.inl delete mode 100644 dep/acelite/ace/Configuration_Import_Export.cpp delete mode 100644 dep/acelite/ace/Configuration_Import_Export.h delete mode 100644 dep/acelite/ace/Connection_Recycling_Strategy.cpp delete mode 100644 dep/acelite/ace/Connection_Recycling_Strategy.h delete mode 100644 dep/acelite/ace/Connector.cpp delete mode 100644 dep/acelite/ace/Connector.h delete mode 100644 dep/acelite/ace/Containers.cpp delete mode 100644 dep/acelite/ace/Containers.h delete mode 100644 dep/acelite/ace/Containers.inl delete mode 100644 dep/acelite/ace/Containers_T.cpp delete mode 100644 dep/acelite/ace/Containers_T.h delete mode 100644 dep/acelite/ace/Containers_T.inl delete mode 100644 dep/acelite/ace/Copy_Disabled.cpp delete mode 100644 dep/acelite/ace/Copy_Disabled.h delete mode 100644 dep/acelite/ace/Countdown_Time.h delete mode 100644 dep/acelite/ace/Countdown_Time_T.cpp delete mode 100644 dep/acelite/ace/Countdown_Time_T.h delete mode 100644 dep/acelite/ace/Countdown_Time_T.inl delete mode 100644 dep/acelite/ace/DEV.cpp delete mode 100644 dep/acelite/ace/DEV.h delete mode 100644 dep/acelite/ace/DEV.inl delete mode 100644 dep/acelite/ace/DEV_Addr.cpp delete mode 100644 dep/acelite/ace/DEV_Addr.h delete mode 100644 dep/acelite/ace/DEV_Addr.inl delete mode 100644 dep/acelite/ace/DEV_Connector.cpp delete mode 100644 dep/acelite/ace/DEV_Connector.h delete mode 100644 dep/acelite/ace/DEV_Connector.inl delete mode 100644 dep/acelite/ace/DEV_IO.cpp delete mode 100644 dep/acelite/ace/DEV_IO.h delete mode 100644 dep/acelite/ace/DEV_IO.inl delete mode 100644 dep/acelite/ace/DLL.cpp delete mode 100644 dep/acelite/ace/DLL.h delete mode 100644 dep/acelite/ace/DLL_Manager.cpp delete mode 100644 dep/acelite/ace/DLL_Manager.h delete mode 100644 dep/acelite/ace/Date_Time.cpp delete mode 100644 dep/acelite/ace/Date_Time.h delete mode 100644 dep/acelite/ace/Date_Time.inl delete mode 100644 dep/acelite/ace/Default_Constants.h delete mode 100644 dep/acelite/ace/Dev_Poll_Reactor.cpp delete mode 100644 dep/acelite/ace/Dev_Poll_Reactor.h delete mode 100644 dep/acelite/ace/Dev_Poll_Reactor.inl delete mode 100644 dep/acelite/ace/Dirent.cpp delete mode 100644 dep/acelite/ace/Dirent.h delete mode 100644 dep/acelite/ace/Dirent.inl delete mode 100644 dep/acelite/ace/Dirent_Selector.cpp delete mode 100644 dep/acelite/ace/Dirent_Selector.h delete mode 100644 dep/acelite/ace/Dirent_Selector.inl delete mode 100644 dep/acelite/ace/Dump.cpp delete mode 100644 dep/acelite/ace/Dump.h delete mode 100644 dep/acelite/ace/Dump_T.cpp delete mode 100644 dep/acelite/ace/Dump_T.h delete mode 100644 dep/acelite/ace/Dynamic.cpp delete mode 100644 dep/acelite/ace/Dynamic.h delete mode 100644 dep/acelite/ace/Dynamic.inl delete mode 100644 dep/acelite/ace/Dynamic_Message_Strategy.cpp delete mode 100644 dep/acelite/ace/Dynamic_Message_Strategy.h delete mode 100644 dep/acelite/ace/Dynamic_Message_Strategy.inl delete mode 100644 dep/acelite/ace/Dynamic_Service.cpp delete mode 100644 dep/acelite/ace/Dynamic_Service.h delete mode 100644 dep/acelite/ace/Dynamic_Service.inl delete mode 100644 dep/acelite/ace/Dynamic_Service_Base.cpp delete mode 100644 dep/acelite/ace/Dynamic_Service_Base.h delete mode 100644 dep/acelite/ace/Dynamic_Service_Dependency.cpp delete mode 100644 dep/acelite/ace/Dynamic_Service_Dependency.h delete mode 100644 dep/acelite/ace/ETCL/ETCL_Constraint.cpp delete mode 100644 dep/acelite/ace/ETCL/ETCL_Constraint.h delete mode 100644 dep/acelite/ace/ETCL/ETCL_Constraint.inl delete mode 100644 dep/acelite/ace/ETCL/ETCL_Constraint_Visitor.cpp delete mode 100644 dep/acelite/ace/ETCL/ETCL_Constraint_Visitor.h delete mode 100644 dep/acelite/ace/ETCL/ETCL_Interpreter.cpp delete mode 100644 dep/acelite/ace/ETCL/ETCL_Interpreter.h delete mode 100644 dep/acelite/ace/ETCL/ETCL_l.cpp delete mode 100644 dep/acelite/ace/ETCL/ETCL_y.cpp delete mode 100644 dep/acelite/ace/ETCL/ETCL_y.h delete mode 100644 dep/acelite/ace/ETCL/ace_etcl_export.h delete mode 100644 dep/acelite/ace/ETCL/etcl_parser_export.h delete mode 100644 dep/acelite/ace/Encoding_Converter.cpp delete mode 100644 dep/acelite/ace/Encoding_Converter.h delete mode 100644 dep/acelite/ace/Encoding_Converter_Factory.cpp delete mode 100644 dep/acelite/ace/Encoding_Converter_Factory.h delete mode 100644 dep/acelite/ace/Env_Value_T.cpp delete mode 100644 dep/acelite/ace/Env_Value_T.h delete mode 100644 dep/acelite/ace/Env_Value_T.inl delete mode 100644 dep/acelite/ace/Event.cpp delete mode 100644 dep/acelite/ace/Event.h delete mode 100644 dep/acelite/ace/Event.inl delete mode 100644 dep/acelite/ace/Event_Handler.cpp delete mode 100644 dep/acelite/ace/Event_Handler.h delete mode 100644 dep/acelite/ace/Event_Handler.inl delete mode 100644 dep/acelite/ace/Event_Handler_Handle_Timeout_Upcall.cpp delete mode 100644 dep/acelite/ace/Event_Handler_Handle_Timeout_Upcall.h delete mode 100644 dep/acelite/ace/Event_Handler_Handle_Timeout_Upcall.inl delete mode 100644 dep/acelite/ace/Event_Handler_T.cpp delete mode 100644 dep/acelite/ace/Event_Handler_T.h delete mode 100644 dep/acelite/ace/Event_Handler_T.inl delete mode 100644 dep/acelite/ace/FIFO.cpp delete mode 100644 dep/acelite/ace/FIFO.h delete mode 100644 dep/acelite/ace/FIFO.inl delete mode 100644 dep/acelite/ace/FIFO_Recv.cpp delete mode 100644 dep/acelite/ace/FIFO_Recv.h delete mode 100644 dep/acelite/ace/FIFO_Recv.inl delete mode 100644 dep/acelite/ace/FIFO_Recv_Msg.cpp delete mode 100644 dep/acelite/ace/FIFO_Recv_Msg.h delete mode 100644 dep/acelite/ace/FIFO_Recv_Msg.inl delete mode 100644 dep/acelite/ace/FIFO_Send.cpp delete mode 100644 dep/acelite/ace/FIFO_Send.h delete mode 100644 dep/acelite/ace/FIFO_Send.inl delete mode 100644 dep/acelite/ace/FIFO_Send_Msg.cpp delete mode 100644 dep/acelite/ace/FIFO_Send_Msg.h delete mode 100644 dep/acelite/ace/FIFO_Send_Msg.inl delete mode 100644 dep/acelite/ace/FILE.cpp delete mode 100644 dep/acelite/ace/FILE.h delete mode 100644 dep/acelite/ace/FILE.inl delete mode 100644 dep/acelite/ace/FILE_Addr.cpp delete mode 100644 dep/acelite/ace/FILE_Addr.h delete mode 100644 dep/acelite/ace/FILE_Addr.inl delete mode 100644 dep/acelite/ace/FILE_Connector.cpp delete mode 100644 dep/acelite/ace/FILE_Connector.h delete mode 100644 dep/acelite/ace/FILE_Connector.inl delete mode 100644 dep/acelite/ace/FILE_IO.cpp delete mode 100644 dep/acelite/ace/FILE_IO.h delete mode 100644 dep/acelite/ace/FILE_IO.inl delete mode 100644 dep/acelite/ace/File_Lock.cpp delete mode 100644 dep/acelite/ace/File_Lock.h delete mode 100644 dep/acelite/ace/File_Lock.inl delete mode 100644 dep/acelite/ace/Filecache.cpp delete mode 100644 dep/acelite/ace/Filecache.h delete mode 100644 dep/acelite/ace/FlReactor/ACE_FlReactor_export.h delete mode 100644 dep/acelite/ace/FlReactor/FlReactor.cpp delete mode 100644 dep/acelite/ace/FlReactor/FlReactor.h delete mode 100644 dep/acelite/ace/Flag_Manip.cpp delete mode 100644 dep/acelite/ace/Flag_Manip.h delete mode 100644 dep/acelite/ace/Flag_Manip.inl delete mode 100644 dep/acelite/ace/FoxReactor/ACE_FoxReactor_export.h delete mode 100644 dep/acelite/ace/FoxReactor/FoxReactor.cpp delete mode 100644 dep/acelite/ace/FoxReactor/FoxReactor.h delete mode 100644 dep/acelite/ace/Framework_Component.cpp delete mode 100644 dep/acelite/ace/Framework_Component.h delete mode 100644 dep/acelite/ace/Framework_Component.inl delete mode 100644 dep/acelite/ace/Framework_Component_T.cpp delete mode 100644 dep/acelite/ace/Framework_Component_T.h delete mode 100644 dep/acelite/ace/Free_List.cpp delete mode 100644 dep/acelite/ace/Free_List.h delete mode 100644 dep/acelite/ace/Functor.cpp delete mode 100644 dep/acelite/ace/Functor.h delete mode 100644 dep/acelite/ace/Functor.inl delete mode 100644 dep/acelite/ace/Functor_String.cpp delete mode 100644 dep/acelite/ace/Functor_String.h delete mode 100644 dep/acelite/ace/Functor_String.inl delete mode 100644 dep/acelite/ace/Functor_T.cpp delete mode 100644 dep/acelite/ace/Functor_T.h delete mode 100644 dep/acelite/ace/Functor_T.inl delete mode 100644 dep/acelite/ace/Future.cpp delete mode 100644 dep/acelite/ace/Future.h delete mode 100644 dep/acelite/ace/Future_Set.cpp delete mode 100644 dep/acelite/ace/Future_Set.h delete mode 100644 dep/acelite/ace/Get_Opt.cpp delete mode 100644 dep/acelite/ace/Get_Opt.h delete mode 100644 dep/acelite/ace/Get_Opt.inl delete mode 100644 dep/acelite/ace/Global_Macros.h delete mode 100644 dep/acelite/ace/Guard_T.cpp delete mode 100644 dep/acelite/ace/Guard_T.h delete mode 100644 dep/acelite/ace/Guard_T.inl delete mode 100644 dep/acelite/ace/Handle_Gobbler.h delete mode 100644 dep/acelite/ace/Handle_Gobbler.inl delete mode 100644 dep/acelite/ace/Handle_Ops.cpp delete mode 100644 dep/acelite/ace/Handle_Ops.h delete mode 100644 dep/acelite/ace/Handle_Set.cpp delete mode 100644 dep/acelite/ace/Handle_Set.h delete mode 100644 dep/acelite/ace/Handle_Set.inl delete mode 100644 dep/acelite/ace/Hash_Cache_Map_Manager_T.cpp delete mode 100644 dep/acelite/ace/Hash_Cache_Map_Manager_T.h delete mode 100644 dep/acelite/ace/Hash_Cache_Map_Manager_T.inl delete mode 100644 dep/acelite/ace/Hash_Map_Manager.h delete mode 100644 dep/acelite/ace/Hash_Map_Manager_T.cpp delete mode 100644 dep/acelite/ace/Hash_Map_Manager_T.h delete mode 100644 dep/acelite/ace/Hash_Map_Manager_T.inl delete mode 100644 dep/acelite/ace/Hash_Map_With_Allocator_T.cpp delete mode 100644 dep/acelite/ace/Hash_Map_With_Allocator_T.h delete mode 100644 dep/acelite/ace/Hash_Map_With_Allocator_T.inl delete mode 100644 dep/acelite/ace/Hash_Multi_Map_Manager_T.cpp delete mode 100644 dep/acelite/ace/Hash_Multi_Map_Manager_T.h delete mode 100644 dep/acelite/ace/Hash_Multi_Map_Manager_T.inl delete mode 100644 dep/acelite/ace/Hashable.cpp delete mode 100644 dep/acelite/ace/Hashable.h delete mode 100644 dep/acelite/ace/Hashable.inl delete mode 100644 dep/acelite/ace/High_Res_Timer.cpp delete mode 100644 dep/acelite/ace/High_Res_Timer.h delete mode 100644 dep/acelite/ace/High_Res_Timer.inl delete mode 100644 dep/acelite/ace/ICMP_Socket.cpp delete mode 100644 dep/acelite/ace/ICMP_Socket.h delete mode 100644 dep/acelite/ace/INET_Addr.cpp delete mode 100644 dep/acelite/ace/INET_Addr.h delete mode 100644 dep/acelite/ace/INET_Addr.inl delete mode 100644 dep/acelite/ace/IOStream.cpp delete mode 100644 dep/acelite/ace/IOStream.h delete mode 100644 dep/acelite/ace/IOStream_T.cpp delete mode 100644 dep/acelite/ace/IOStream_T.h delete mode 100644 dep/acelite/ace/IOStream_T.inl delete mode 100644 dep/acelite/ace/IO_Cntl_Msg.cpp delete mode 100644 dep/acelite/ace/IO_Cntl_Msg.h delete mode 100644 dep/acelite/ace/IO_Cntl_Msg.inl delete mode 100644 dep/acelite/ace/IO_SAP.cpp delete mode 100644 dep/acelite/ace/IO_SAP.h delete mode 100644 dep/acelite/ace/IO_SAP.inl delete mode 100644 dep/acelite/ace/IPC_SAP.cpp delete mode 100644 dep/acelite/ace/IPC_SAP.h delete mode 100644 dep/acelite/ace/IPC_SAP.inl delete mode 100644 dep/acelite/ace/If_Then_Else.h delete mode 100644 dep/acelite/ace/Init_ACE.cpp delete mode 100644 dep/acelite/ace/Init_ACE.h delete mode 100644 dep/acelite/ace/Intrusive_Auto_Ptr.cpp delete mode 100644 dep/acelite/ace/Intrusive_Auto_Ptr.h delete mode 100644 dep/acelite/ace/Intrusive_Auto_Ptr.inl delete mode 100644 dep/acelite/ace/Intrusive_List.cpp delete mode 100644 dep/acelite/ace/Intrusive_List.h delete mode 100644 dep/acelite/ace/Intrusive_List.inl delete mode 100644 dep/acelite/ace/Intrusive_List_Node.cpp delete mode 100644 dep/acelite/ace/Intrusive_List_Node.h delete mode 100644 dep/acelite/ace/Intrusive_List_Node.inl delete mode 100644 dep/acelite/ace/LOCK_SOCK_Acceptor.cpp delete mode 100644 dep/acelite/ace/LOCK_SOCK_Acceptor.h delete mode 100644 dep/acelite/ace/LSOCK.cpp delete mode 100644 dep/acelite/ace/LSOCK.h delete mode 100644 dep/acelite/ace/LSOCK.inl delete mode 100644 dep/acelite/ace/LSOCK_Acceptor.cpp delete mode 100644 dep/acelite/ace/LSOCK_Acceptor.h delete mode 100644 dep/acelite/ace/LSOCK_CODgram.cpp delete mode 100644 dep/acelite/ace/LSOCK_CODgram.h delete mode 100644 dep/acelite/ace/LSOCK_CODgram.inl delete mode 100644 dep/acelite/ace/LSOCK_Connector.cpp delete mode 100644 dep/acelite/ace/LSOCK_Connector.h delete mode 100644 dep/acelite/ace/LSOCK_Connector.inl delete mode 100644 dep/acelite/ace/LSOCK_Dgram.cpp delete mode 100644 dep/acelite/ace/LSOCK_Dgram.h delete mode 100644 dep/acelite/ace/LSOCK_Dgram.inl delete mode 100644 dep/acelite/ace/LSOCK_Stream.cpp delete mode 100644 dep/acelite/ace/LSOCK_Stream.h delete mode 100644 dep/acelite/ace/LSOCK_Stream.inl delete mode 100644 dep/acelite/ace/Lib_Find.cpp delete mode 100644 dep/acelite/ace/Lib_Find.h delete mode 100644 dep/acelite/ace/Local_Memory_Pool.cpp delete mode 100644 dep/acelite/ace/Local_Memory_Pool.h delete mode 100644 dep/acelite/ace/Local_Name_Space.cpp delete mode 100644 dep/acelite/ace/Local_Name_Space.h delete mode 100644 dep/acelite/ace/Local_Name_Space_T.cpp delete mode 100644 dep/acelite/ace/Local_Name_Space_T.h delete mode 100644 dep/acelite/ace/Local_Tokens.cpp delete mode 100644 dep/acelite/ace/Local_Tokens.h delete mode 100644 dep/acelite/ace/Local_Tokens.inl delete mode 100644 dep/acelite/ace/Lock.cpp delete mode 100644 dep/acelite/ace/Lock.h delete mode 100644 dep/acelite/ace/Lock.inl delete mode 100644 dep/acelite/ace/Lock_Adapter_T.cpp delete mode 100644 dep/acelite/ace/Lock_Adapter_T.h delete mode 100644 dep/acelite/ace/Lock_Adapter_T.inl delete mode 100644 dep/acelite/ace/Log_Msg.cpp delete mode 100644 dep/acelite/ace/Log_Msg.h delete mode 100644 dep/acelite/ace/Log_Msg.inl delete mode 100644 dep/acelite/ace/Log_Msg_Backend.cpp delete mode 100644 dep/acelite/ace/Log_Msg_Backend.h delete mode 100644 dep/acelite/ace/Log_Msg_Callback.cpp delete mode 100644 dep/acelite/ace/Log_Msg_Callback.h delete mode 100644 dep/acelite/ace/Log_Msg_IPC.cpp delete mode 100644 dep/acelite/ace/Log_Msg_IPC.h delete mode 100644 dep/acelite/ace/Log_Msg_NT_Event_Log.cpp delete mode 100644 dep/acelite/ace/Log_Msg_NT_Event_Log.h delete mode 100644 dep/acelite/ace/Log_Msg_UNIX_Syslog.cpp delete mode 100644 dep/acelite/ace/Log_Msg_UNIX_Syslog.h delete mode 100644 dep/acelite/ace/Log_Priority.h delete mode 100644 dep/acelite/ace/Log_Record.cpp delete mode 100644 dep/acelite/ace/Log_Record.h delete mode 100644 dep/acelite/ace/Log_Record.inl delete mode 100644 dep/acelite/ace/Logging_Strategy.cpp delete mode 100644 dep/acelite/ace/Logging_Strategy.h delete mode 100644 dep/acelite/ace/MEM_Acceptor.cpp delete mode 100644 dep/acelite/ace/MEM_Acceptor.h delete mode 100644 dep/acelite/ace/MEM_Acceptor.inl delete mode 100644 dep/acelite/ace/MEM_Addr.cpp delete mode 100644 dep/acelite/ace/MEM_Addr.h delete mode 100644 dep/acelite/ace/MEM_Addr.inl delete mode 100644 dep/acelite/ace/MEM_Connector.cpp delete mode 100644 dep/acelite/ace/MEM_Connector.h delete mode 100644 dep/acelite/ace/MEM_Connector.inl delete mode 100644 dep/acelite/ace/MEM_IO.cpp delete mode 100644 dep/acelite/ace/MEM_IO.h delete mode 100644 dep/acelite/ace/MEM_IO.inl delete mode 100644 dep/acelite/ace/MEM_SAP.cpp delete mode 100644 dep/acelite/ace/MEM_SAP.h delete mode 100644 dep/acelite/ace/MEM_SAP.inl delete mode 100644 dep/acelite/ace/MEM_Stream.cpp delete mode 100644 dep/acelite/ace/MEM_Stream.h delete mode 100644 dep/acelite/ace/MEM_Stream.inl delete mode 100644 dep/acelite/ace/MMAP_Memory_Pool.cpp delete mode 100644 dep/acelite/ace/MMAP_Memory_Pool.h delete mode 100644 dep/acelite/ace/MMAP_Memory_Pool.inl delete mode 100644 dep/acelite/ace/Malloc.cpp delete mode 100644 dep/acelite/ace/Malloc.h delete mode 100644 dep/acelite/ace/Malloc.inl delete mode 100644 dep/acelite/ace/Malloc_Allocator.cpp delete mode 100644 dep/acelite/ace/Malloc_Allocator.h delete mode 100644 dep/acelite/ace/Malloc_Allocator.inl delete mode 100644 dep/acelite/ace/Malloc_Base.h delete mode 100644 dep/acelite/ace/Malloc_T.cpp delete mode 100644 dep/acelite/ace/Malloc_T.h delete mode 100644 dep/acelite/ace/Malloc_T.inl delete mode 100644 dep/acelite/ace/Managed_Object.cpp delete mode 100644 dep/acelite/ace/Managed_Object.h delete mode 100644 dep/acelite/ace/Managed_Object.inl delete mode 100644 dep/acelite/ace/Manual_Event.cpp delete mode 100644 dep/acelite/ace/Manual_Event.h delete mode 100644 dep/acelite/ace/Manual_Event.inl delete mode 100644 dep/acelite/ace/Map_Manager.cpp delete mode 100644 dep/acelite/ace/Map_Manager.h delete mode 100644 dep/acelite/ace/Map_Manager.inl delete mode 100644 dep/acelite/ace/Map_T.cpp delete mode 100644 dep/acelite/ace/Map_T.h delete mode 100644 dep/acelite/ace/Map_T.inl delete mode 100644 dep/acelite/ace/Mem_Map.cpp delete mode 100644 dep/acelite/ace/Mem_Map.h delete mode 100644 dep/acelite/ace/Mem_Map.inl delete mode 100644 dep/acelite/ace/Memory_Pool.h delete mode 100644 dep/acelite/ace/Message_Block.cpp delete mode 100644 dep/acelite/ace/Message_Block.h delete mode 100644 dep/acelite/ace/Message_Block.inl delete mode 100644 dep/acelite/ace/Message_Block_T.cpp delete mode 100644 dep/acelite/ace/Message_Block_T.h delete mode 100644 dep/acelite/ace/Message_Block_T.inl delete mode 100644 dep/acelite/ace/Message_Queue.cpp delete mode 100644 dep/acelite/ace/Message_Queue.h delete mode 100644 dep/acelite/ace/Message_Queue.inl delete mode 100644 dep/acelite/ace/Message_Queue_NT.cpp delete mode 100644 dep/acelite/ace/Message_Queue_NT.h delete mode 100644 dep/acelite/ace/Message_Queue_NT.inl delete mode 100644 dep/acelite/ace/Message_Queue_T.cpp delete mode 100644 dep/acelite/ace/Message_Queue_T.h delete mode 100644 dep/acelite/ace/Message_Queue_Vx.cpp delete mode 100644 dep/acelite/ace/Message_Queue_Vx.h delete mode 100644 dep/acelite/ace/Message_Queue_Vx.inl delete mode 100644 dep/acelite/ace/Method_Request.cpp delete mode 100644 dep/acelite/ace/Method_Request.h delete mode 100644 dep/acelite/ace/Metrics_Cache.h delete mode 100644 dep/acelite/ace/Metrics_Cache_T.cpp delete mode 100644 dep/acelite/ace/Metrics_Cache_T.h delete mode 100644 dep/acelite/ace/Metrics_Cache_T.inl delete mode 100644 dep/acelite/ace/Min_Max.h delete mode 100644 dep/acelite/ace/Module.cpp delete mode 100644 dep/acelite/ace/Module.h delete mode 100644 dep/acelite/ace/Module.inl delete mode 100644 dep/acelite/ace/Monitor_Admin.cpp delete mode 100644 dep/acelite/ace/Monitor_Admin.h delete mode 100644 dep/acelite/ace/Monitor_Admin_Manager.cpp delete mode 100644 dep/acelite/ace/Monitor_Admin_Manager.h delete mode 100644 dep/acelite/ace/Monitor_Base.cpp delete mode 100644 dep/acelite/ace/Monitor_Base.h delete mode 100644 dep/acelite/ace/Monitor_Base.inl delete mode 100644 dep/acelite/ace/Monitor_Control/Auto_Update_Starter.cpp delete mode 100644 dep/acelite/ace/Monitor_Control/Auto_Update_Starter.h delete mode 100644 dep/acelite/ace/Monitor_Control/BSD_Network_Interface_Monitor.cpp delete mode 100644 dep/acelite/ace/Monitor_Control/BSD_Network_Interface_Monitor.h delete mode 100644 dep/acelite/ace/Monitor_Control/Bytes_Received_Monitor.cpp delete mode 100644 dep/acelite/ace/Monitor_Control/Bytes_Received_Monitor.h delete mode 100644 dep/acelite/ace/Monitor_Control/Bytes_Sent_Monitor.cpp delete mode 100644 dep/acelite/ace/Monitor_Control/Bytes_Sent_Monitor.h delete mode 100644 dep/acelite/ace/Monitor_Control/CPU_Load_Monitor.cpp delete mode 100644 dep/acelite/ace/Monitor_Control/CPU_Load_Monitor.h delete mode 100644 dep/acelite/ace/Monitor_Control/Constraint_Interpreter.cpp delete mode 100644 dep/acelite/ace/Monitor_Control/Constraint_Interpreter.h delete mode 100644 dep/acelite/ace/Monitor_Control/Constraint_Visitor.cpp delete mode 100644 dep/acelite/ace/Monitor_Control/Constraint_Visitor.h delete mode 100644 dep/acelite/ace/Monitor_Control/FreeBSD_Network_Interface_Monitor.cpp delete mode 100644 dep/acelite/ace/Monitor_Control/FreeBSD_Network_Interface_Monitor.h delete mode 100644 dep/acelite/ace/Monitor_Control/Linux_Network_Interface_Monitor.cpp delete mode 100644 dep/acelite/ace/Monitor_Control/Linux_Network_Interface_Monitor.h delete mode 100644 dep/acelite/ace/Monitor_Control/Memory_Usage_Monitor.cpp delete mode 100644 dep/acelite/ace/Monitor_Control/Memory_Usage_Monitor.h delete mode 100644 dep/acelite/ace/Monitor_Control/Monitor_Control.h delete mode 100644 dep/acelite/ace/Monitor_Control/Monitor_Control_export.h delete mode 100644 dep/acelite/ace/Monitor_Control/Monitor_Control_utils.h delete mode 100644 dep/acelite/ace/Monitor_Control/Monitor_Group.cpp delete mode 100644 dep/acelite/ace/Monitor_Control/Monitor_Group.h delete mode 100644 dep/acelite/ace/Monitor_Control/Monitor_Query.cpp delete mode 100644 dep/acelite/ace/Monitor_Control/Monitor_Query.h delete mode 100644 dep/acelite/ace/Monitor_Control/Null_Network_Interface_Monitor.cpp delete mode 100644 dep/acelite/ace/Monitor_Control/Null_Network_Interface_Monitor.h delete mode 100644 dep/acelite/ace/Monitor_Control/Num_Threads_Monitor.cpp delete mode 100644 dep/acelite/ace/Monitor_Control/Num_Threads_Monitor.h delete mode 100644 dep/acelite/ace/Monitor_Control/Packets_Received_Monitor.cpp delete mode 100644 dep/acelite/ace/Monitor_Control/Packets_Received_Monitor.h delete mode 100644 dep/acelite/ace/Monitor_Control/Packets_Sent_Monitor.cpp delete mode 100644 dep/acelite/ace/Monitor_Control/Packets_Sent_Monitor.h delete mode 100644 dep/acelite/ace/Monitor_Control/Solaris_Network_Interface_Monitor.cpp delete mode 100644 dep/acelite/ace/Monitor_Control/Solaris_Network_Interface_Monitor.h delete mode 100644 dep/acelite/ace/Monitor_Control/Windows_Monitor.cpp delete mode 100644 dep/acelite/ace/Monitor_Control/Windows_Monitor.h delete mode 100644 dep/acelite/ace/Monitor_Control/Windows_Multi_Instance_Monitor.cpp delete mode 100644 dep/acelite/ace/Monitor_Control/Windows_Multi_Instance_Monitor.h delete mode 100644 dep/acelite/ace/Monitor_Control_Action.cpp delete mode 100644 dep/acelite/ace/Monitor_Control_Action.h delete mode 100644 dep/acelite/ace/Monitor_Control_Types.cpp delete mode 100644 dep/acelite/ace/Monitor_Control_Types.h delete mode 100644 dep/acelite/ace/Monitor_Point_Registry.cpp delete mode 100644 dep/acelite/ace/Monitor_Point_Registry.h delete mode 100644 dep/acelite/ace/Monitor_Size.cpp delete mode 100644 dep/acelite/ace/Monitor_Size.h delete mode 100644 dep/acelite/ace/Monotonic_Time_Policy.cpp delete mode 100644 dep/acelite/ace/Monotonic_Time_Policy.h delete mode 100644 dep/acelite/ace/Monotonic_Time_Policy.inl delete mode 100644 dep/acelite/ace/Msg_WFMO_Reactor.cpp delete mode 100644 dep/acelite/ace/Msg_WFMO_Reactor.h delete mode 100644 dep/acelite/ace/Msg_WFMO_Reactor.inl delete mode 100644 dep/acelite/ace/Multihomed_INET_Addr.cpp delete mode 100644 dep/acelite/ace/Multihomed_INET_Addr.h delete mode 100644 dep/acelite/ace/Multihomed_INET_Addr.inl delete mode 100644 dep/acelite/ace/Mutex.cpp delete mode 100644 dep/acelite/ace/Mutex.h delete mode 100644 dep/acelite/ace/Mutex.inl delete mode 100644 dep/acelite/ace/NT_Service.cpp delete mode 100644 dep/acelite/ace/NT_Service.h delete mode 100644 dep/acelite/ace/NT_Service.inl delete mode 100644 dep/acelite/ace/Name_Proxy.cpp delete mode 100644 dep/acelite/ace/Name_Proxy.h delete mode 100644 dep/acelite/ace/Name_Request_Reply.cpp delete mode 100644 dep/acelite/ace/Name_Request_Reply.h delete mode 100644 dep/acelite/ace/Name_Space.cpp delete mode 100644 dep/acelite/ace/Name_Space.h delete mode 100644 dep/acelite/ace/Naming_Context.cpp delete mode 100644 dep/acelite/ace/Naming_Context.h delete mode 100644 dep/acelite/ace/Naming_Context.inl delete mode 100644 dep/acelite/ace/Netlink_Addr.cpp delete mode 100644 dep/acelite/ace/Netlink_Addr.h delete mode 100644 dep/acelite/ace/Netlink_Addr.inl delete mode 100644 dep/acelite/ace/Node.cpp delete mode 100644 dep/acelite/ace/Node.h delete mode 100644 dep/acelite/ace/Notification_Queue.cpp delete mode 100644 dep/acelite/ace/Notification_Queue.h delete mode 100644 dep/acelite/ace/Notification_Queue.inl delete mode 100644 dep/acelite/ace/Notification_Strategy.cpp delete mode 100644 dep/acelite/ace/Notification_Strategy.h delete mode 100644 dep/acelite/ace/Notification_Strategy.inl delete mode 100644 dep/acelite/ace/Null_Barrier.h delete mode 100644 dep/acelite/ace/Null_Condition.h delete mode 100644 dep/acelite/ace/Null_Mutex.h delete mode 100644 dep/acelite/ace/Null_Semaphore.h delete mode 100644 dep/acelite/ace/Numeric_Limits.h delete mode 100644 dep/acelite/ace/OS.h delete mode 100644 dep/acelite/ace/OS_Errno.cpp delete mode 100644 dep/acelite/ace/OS_Errno.h delete mode 100644 dep/acelite/ace/OS_Errno.inl delete mode 100644 dep/acelite/ace/OS_Log_Msg_Attributes.cpp delete mode 100644 dep/acelite/ace/OS_Log_Msg_Attributes.h delete mode 100644 dep/acelite/ace/OS_Log_Msg_Attributes.inl delete mode 100644 dep/acelite/ace/OS_Memory.h delete mode 100644 dep/acelite/ace/OS_NS_Thread.cpp delete mode 100644 dep/acelite/ace/OS_NS_Thread.h delete mode 100644 dep/acelite/ace/OS_NS_Thread.inl delete mode 100644 dep/acelite/ace/OS_NS_arpa_inet.cpp delete mode 100644 dep/acelite/ace/OS_NS_arpa_inet.h delete mode 100644 dep/acelite/ace/OS_NS_arpa_inet.inl delete mode 100644 dep/acelite/ace/OS_NS_ctype.cpp delete mode 100644 dep/acelite/ace/OS_NS_ctype.h delete mode 100644 dep/acelite/ace/OS_NS_ctype.inl delete mode 100644 dep/acelite/ace/OS_NS_dirent.cpp delete mode 100644 dep/acelite/ace/OS_NS_dirent.h delete mode 100644 dep/acelite/ace/OS_NS_dirent.inl delete mode 100644 dep/acelite/ace/OS_NS_dlfcn.cpp delete mode 100644 dep/acelite/ace/OS_NS_dlfcn.h delete mode 100644 dep/acelite/ace/OS_NS_dlfcn.inl delete mode 100644 dep/acelite/ace/OS_NS_errno.cpp delete mode 100644 dep/acelite/ace/OS_NS_errno.h delete mode 100644 dep/acelite/ace/OS_NS_errno.inl delete mode 100644 dep/acelite/ace/OS_NS_fcntl.cpp delete mode 100644 dep/acelite/ace/OS_NS_fcntl.h delete mode 100644 dep/acelite/ace/OS_NS_fcntl.inl delete mode 100644 dep/acelite/ace/OS_NS_macros.h delete mode 100644 dep/acelite/ace/OS_NS_math.cpp delete mode 100644 dep/acelite/ace/OS_NS_math.h delete mode 100644 dep/acelite/ace/OS_NS_math.inl delete mode 100644 dep/acelite/ace/OS_NS_netdb.cpp delete mode 100644 dep/acelite/ace/OS_NS_netdb.h delete mode 100644 dep/acelite/ace/OS_NS_netdb.inl delete mode 100644 dep/acelite/ace/OS_NS_poll.cpp delete mode 100644 dep/acelite/ace/OS_NS_poll.h delete mode 100644 dep/acelite/ace/OS_NS_poll.inl delete mode 100644 dep/acelite/ace/OS_NS_pwd.cpp delete mode 100644 dep/acelite/ace/OS_NS_pwd.h delete mode 100644 dep/acelite/ace/OS_NS_pwd.inl delete mode 100644 dep/acelite/ace/OS_NS_regex.cpp delete mode 100644 dep/acelite/ace/OS_NS_regex.h delete mode 100644 dep/acelite/ace/OS_NS_regex.inl delete mode 100644 dep/acelite/ace/OS_NS_signal.cpp delete mode 100644 dep/acelite/ace/OS_NS_signal.h delete mode 100644 dep/acelite/ace/OS_NS_signal.inl delete mode 100644 dep/acelite/ace/OS_NS_stdio.cpp delete mode 100644 dep/acelite/ace/OS_NS_stdio.h delete mode 100644 dep/acelite/ace/OS_NS_stdio.inl delete mode 100644 dep/acelite/ace/OS_NS_stdlib.cpp delete mode 100644 dep/acelite/ace/OS_NS_stdlib.h delete mode 100644 dep/acelite/ace/OS_NS_stdlib.inl delete mode 100644 dep/acelite/ace/OS_NS_string.cpp delete mode 100644 dep/acelite/ace/OS_NS_string.h delete mode 100644 dep/acelite/ace/OS_NS_string.inl delete mode 100644 dep/acelite/ace/OS_NS_strings.cpp delete mode 100644 dep/acelite/ace/OS_NS_strings.h delete mode 100644 dep/acelite/ace/OS_NS_strings.inl delete mode 100644 dep/acelite/ace/OS_NS_stropts.cpp delete mode 100644 dep/acelite/ace/OS_NS_stropts.h delete mode 100644 dep/acelite/ace/OS_NS_stropts.inl delete mode 100644 dep/acelite/ace/OS_NS_sys_mman.cpp delete mode 100644 dep/acelite/ace/OS_NS_sys_mman.h delete mode 100644 dep/acelite/ace/OS_NS_sys_mman.inl delete mode 100644 dep/acelite/ace/OS_NS_sys_msg.cpp delete mode 100644 dep/acelite/ace/OS_NS_sys_msg.h delete mode 100644 dep/acelite/ace/OS_NS_sys_msg.inl delete mode 100644 dep/acelite/ace/OS_NS_sys_resource.cpp delete mode 100644 dep/acelite/ace/OS_NS_sys_resource.h delete mode 100644 dep/acelite/ace/OS_NS_sys_resource.inl delete mode 100644 dep/acelite/ace/OS_NS_sys_select.cpp delete mode 100644 dep/acelite/ace/OS_NS_sys_select.h delete mode 100644 dep/acelite/ace/OS_NS_sys_select.inl delete mode 100644 dep/acelite/ace/OS_NS_sys_sendfile.cpp delete mode 100644 dep/acelite/ace/OS_NS_sys_sendfile.h delete mode 100644 dep/acelite/ace/OS_NS_sys_sendfile.inl delete mode 100644 dep/acelite/ace/OS_NS_sys_shm.cpp delete mode 100644 dep/acelite/ace/OS_NS_sys_shm.h delete mode 100644 dep/acelite/ace/OS_NS_sys_shm.inl delete mode 100644 dep/acelite/ace/OS_NS_sys_socket.cpp delete mode 100644 dep/acelite/ace/OS_NS_sys_socket.h delete mode 100644 dep/acelite/ace/OS_NS_sys_socket.inl delete mode 100644 dep/acelite/ace/OS_NS_sys_stat.cpp delete mode 100644 dep/acelite/ace/OS_NS_sys_stat.h delete mode 100644 dep/acelite/ace/OS_NS_sys_stat.inl delete mode 100644 dep/acelite/ace/OS_NS_sys_time.cpp delete mode 100644 dep/acelite/ace/OS_NS_sys_time.h delete mode 100644 dep/acelite/ace/OS_NS_sys_time.inl delete mode 100644 dep/acelite/ace/OS_NS_sys_uio.cpp delete mode 100644 dep/acelite/ace/OS_NS_sys_uio.h delete mode 100644 dep/acelite/ace/OS_NS_sys_uio.inl delete mode 100644 dep/acelite/ace/OS_NS_sys_utsname.cpp delete mode 100644 dep/acelite/ace/OS_NS_sys_utsname.h delete mode 100644 dep/acelite/ace/OS_NS_sys_wait.cpp delete mode 100644 dep/acelite/ace/OS_NS_sys_wait.h delete mode 100644 dep/acelite/ace/OS_NS_sys_wait.inl delete mode 100644 dep/acelite/ace/OS_NS_time.cpp delete mode 100644 dep/acelite/ace/OS_NS_time.h delete mode 100644 dep/acelite/ace/OS_NS_time.inl delete mode 100644 dep/acelite/ace/OS_NS_unistd.cpp delete mode 100644 dep/acelite/ace/OS_NS_unistd.h delete mode 100644 dep/acelite/ace/OS_NS_unistd.inl delete mode 100644 dep/acelite/ace/OS_NS_wchar.cpp delete mode 100644 dep/acelite/ace/OS_NS_wchar.h delete mode 100644 dep/acelite/ace/OS_NS_wchar.inl delete mode 100644 dep/acelite/ace/OS_NS_wctype.cpp delete mode 100644 dep/acelite/ace/OS_NS_wctype.h delete mode 100644 dep/acelite/ace/OS_NS_wctype.inl delete mode 100644 dep/acelite/ace/OS_QoS.cpp delete mode 100644 dep/acelite/ace/OS_QoS.h delete mode 100644 dep/acelite/ace/OS_TLI.cpp delete mode 100644 dep/acelite/ace/OS_TLI.h delete mode 100644 dep/acelite/ace/OS_TLI.inl delete mode 100644 dep/acelite/ace/OS_Thread_Adapter.cpp delete mode 100644 dep/acelite/ace/OS_Thread_Adapter.h delete mode 100644 dep/acelite/ace/OS_main.cpp delete mode 100644 dep/acelite/ace/OS_main.h delete mode 100644 dep/acelite/ace/Obchunk.cpp delete mode 100644 dep/acelite/ace/Obchunk.h delete mode 100644 dep/acelite/ace/Obchunk.inl delete mode 100644 dep/acelite/ace/Object_Manager.cpp delete mode 100644 dep/acelite/ace/Object_Manager.h delete mode 100644 dep/acelite/ace/Object_Manager.inl delete mode 100644 dep/acelite/ace/Object_Manager_Base.cpp delete mode 100644 dep/acelite/ace/Object_Manager_Base.h delete mode 100644 dep/acelite/ace/Obstack.h delete mode 100644 dep/acelite/ace/Obstack_T.cpp delete mode 100644 dep/acelite/ace/Obstack_T.h delete mode 100644 dep/acelite/ace/Obstack_T.inl delete mode 100644 dep/acelite/ace/PI_Malloc.cpp delete mode 100644 dep/acelite/ace/PI_Malloc.h delete mode 100644 dep/acelite/ace/PI_Malloc.inl delete mode 100644 dep/acelite/ace/POSIX_Asynch_IO.cpp delete mode 100644 dep/acelite/ace/POSIX_Asynch_IO.h delete mode 100644 dep/acelite/ace/POSIX_CB_Proactor.cpp delete mode 100644 dep/acelite/ace/POSIX_CB_Proactor.h delete mode 100644 dep/acelite/ace/POSIX_Proactor.cpp delete mode 100644 dep/acelite/ace/POSIX_Proactor.h delete mode 100644 dep/acelite/ace/POSIX_Proactor.inl delete mode 100644 dep/acelite/ace/Pagefile_Memory_Pool.cpp delete mode 100644 dep/acelite/ace/Pagefile_Memory_Pool.h delete mode 100644 dep/acelite/ace/Pagefile_Memory_Pool.inl delete mode 100644 dep/acelite/ace/Pair_T.cpp delete mode 100644 dep/acelite/ace/Pair_T.h delete mode 100644 dep/acelite/ace/Pair_T.inl delete mode 100644 dep/acelite/ace/Parse_Node.cpp delete mode 100644 dep/acelite/ace/Parse_Node.h delete mode 100644 dep/acelite/ace/Ping_Socket.cpp delete mode 100644 dep/acelite/ace/Ping_Socket.h delete mode 100644 dep/acelite/ace/Ping_Socket.inl delete mode 100644 dep/acelite/ace/Pipe.cpp delete mode 100644 dep/acelite/ace/Pipe.h delete mode 100644 dep/acelite/ace/Pipe.inl delete mode 100644 dep/acelite/ace/PrecompiledHeaders/WinAcePCH.cpp delete mode 100644 dep/acelite/ace/PrecompiledHeaders/WinAcePCH.h delete mode 100644 dep/acelite/ace/Priority_Reactor.cpp delete mode 100644 dep/acelite/ace/Priority_Reactor.h delete mode 100644 dep/acelite/ace/Proactor.cpp delete mode 100644 dep/acelite/ace/Proactor.h delete mode 100644 dep/acelite/ace/Proactor.inl delete mode 100644 dep/acelite/ace/Proactor_Impl.cpp delete mode 100644 dep/acelite/ace/Proactor_Impl.h delete mode 100644 dep/acelite/ace/Process.cpp delete mode 100644 dep/acelite/ace/Process.h delete mode 100644 dep/acelite/ace/Process.inl delete mode 100644 dep/acelite/ace/Process_Manager.cpp delete mode 100644 dep/acelite/ace/Process_Manager.h delete mode 100644 dep/acelite/ace/Process_Manager.inl delete mode 100644 dep/acelite/ace/Process_Mutex.cpp delete mode 100644 dep/acelite/ace/Process_Mutex.h delete mode 100644 dep/acelite/ace/Process_Mutex.inl delete mode 100644 dep/acelite/ace/Process_Semaphore.cpp delete mode 100644 dep/acelite/ace/Process_Semaphore.h delete mode 100644 dep/acelite/ace/Process_Semaphore.inl delete mode 100644 dep/acelite/ace/Profile_Timer.cpp delete mode 100644 dep/acelite/ace/Profile_Timer.h delete mode 100644 dep/acelite/ace/Profile_Timer.inl delete mode 100644 dep/acelite/ace/QoS/ACE_QoS_Export.h delete mode 100644 dep/acelite/ace/QoS/QoS_Decorator.cpp delete mode 100644 dep/acelite/ace/QoS/QoS_Decorator.h delete mode 100644 dep/acelite/ace/QoS/QoS_Manager.cpp delete mode 100644 dep/acelite/ace/QoS/QoS_Manager.h delete mode 100644 dep/acelite/ace/QoS/QoS_Session.h delete mode 100644 dep/acelite/ace/QoS/QoS_Session_Factory.cpp delete mode 100644 dep/acelite/ace/QoS/QoS_Session_Factory.h delete mode 100644 dep/acelite/ace/QoS/QoS_Session_Impl.cpp delete mode 100644 dep/acelite/ace/QoS/QoS_Session_Impl.h delete mode 100644 dep/acelite/ace/QoS/QoS_Session_Impl.inl delete mode 100644 dep/acelite/ace/QoS/README delete mode 100644 dep/acelite/ace/QoS/SOCK_Dgram_Mcast_QoS.cpp delete mode 100644 dep/acelite/ace/QoS/SOCK_Dgram_Mcast_QoS.h delete mode 100644 dep/acelite/ace/QoS/SOCK_Dgram_Mcast_QoS.inl delete mode 100644 dep/acelite/ace/QtReactor/ACE_QtReactor_export.h delete mode 100644 dep/acelite/ace/QtReactor/QtReactor.cpp delete mode 100644 dep/acelite/ace/QtReactor/QtReactor.h delete mode 100644 dep/acelite/ace/RB_Tree.cpp delete mode 100644 dep/acelite/ace/RB_Tree.h delete mode 100644 dep/acelite/ace/RB_Tree.inl delete mode 100644 dep/acelite/ace/README delete mode 100644 dep/acelite/ace/RW_Mutex.cpp delete mode 100644 dep/acelite/ace/RW_Mutex.h delete mode 100644 dep/acelite/ace/RW_Mutex.inl delete mode 100644 dep/acelite/ace/RW_Process_Mutex.cpp delete mode 100644 dep/acelite/ace/RW_Process_Mutex.h delete mode 100644 dep/acelite/ace/RW_Process_Mutex.inl delete mode 100644 dep/acelite/ace/RW_Thread_Mutex.cpp delete mode 100644 dep/acelite/ace/RW_Thread_Mutex.h delete mode 100644 dep/acelite/ace/RW_Thread_Mutex.inl delete mode 100644 dep/acelite/ace/Reactor.cpp delete mode 100644 dep/acelite/ace/Reactor.h delete mode 100644 dep/acelite/ace/Reactor.inl delete mode 100644 dep/acelite/ace/Reactor_Impl.cpp delete mode 100644 dep/acelite/ace/Reactor_Impl.h delete mode 100644 dep/acelite/ace/Reactor_Notification_Strategy.cpp delete mode 100644 dep/acelite/ace/Reactor_Notification_Strategy.h delete mode 100644 dep/acelite/ace/Reactor_Notification_Strategy.inl delete mode 100644 dep/acelite/ace/Reactor_Timer_Interface.cpp delete mode 100644 dep/acelite/ace/Reactor_Timer_Interface.h delete mode 100644 dep/acelite/ace/Reactor_Token_T.cpp delete mode 100644 dep/acelite/ace/Reactor_Token_T.h delete mode 100644 dep/acelite/ace/Read_Buffer.cpp delete mode 100644 dep/acelite/ace/Read_Buffer.h delete mode 100644 dep/acelite/ace/Read_Buffer.inl delete mode 100644 dep/acelite/ace/Recursive_Thread_Mutex.cpp delete mode 100644 dep/acelite/ace/Recursive_Thread_Mutex.h delete mode 100644 dep/acelite/ace/Recursive_Thread_Mutex.inl delete mode 100644 dep/acelite/ace/Recyclable.cpp delete mode 100644 dep/acelite/ace/Recyclable.h delete mode 100644 dep/acelite/ace/Recyclable.inl delete mode 100644 dep/acelite/ace/Refcountable_T.cpp delete mode 100644 dep/acelite/ace/Refcountable_T.h delete mode 100644 dep/acelite/ace/Refcountable_T.inl delete mode 100644 dep/acelite/ace/Refcounted_Auto_Ptr.cpp delete mode 100644 dep/acelite/ace/Refcounted_Auto_Ptr.h delete mode 100644 dep/acelite/ace/Refcounted_Auto_Ptr.inl delete mode 100644 dep/acelite/ace/Registry.cpp delete mode 100644 dep/acelite/ace/Registry.h delete mode 100644 dep/acelite/ace/Registry_Name_Space.cpp delete mode 100644 dep/acelite/ace/Registry_Name_Space.h delete mode 100644 dep/acelite/ace/Remote_Name_Space.cpp delete mode 100644 dep/acelite/ace/Remote_Name_Space.h delete mode 100644 dep/acelite/ace/Remote_Tokens.cpp delete mode 100644 dep/acelite/ace/Remote_Tokens.h delete mode 100644 dep/acelite/ace/Remote_Tokens.inl delete mode 100644 dep/acelite/ace/Reverse_Lock_T.cpp delete mode 100644 dep/acelite/ace/Reverse_Lock_T.h delete mode 100644 dep/acelite/ace/Reverse_Lock_T.inl delete mode 100644 dep/acelite/ace/Rtems_init.c delete mode 100644 dep/acelite/ace/SOCK.cpp delete mode 100644 dep/acelite/ace/SOCK.h delete mode 100644 dep/acelite/ace/SOCK.inl delete mode 100644 dep/acelite/ace/SOCK_Acceptor.cpp delete mode 100644 dep/acelite/ace/SOCK_Acceptor.h delete mode 100644 dep/acelite/ace/SOCK_Acceptor.inl delete mode 100644 dep/acelite/ace/SOCK_CODgram.cpp delete mode 100644 dep/acelite/ace/SOCK_CODgram.h delete mode 100644 dep/acelite/ace/SOCK_CODgram.inl delete mode 100644 dep/acelite/ace/SOCK_Connector.cpp delete mode 100644 dep/acelite/ace/SOCK_Connector.h delete mode 100644 dep/acelite/ace/SOCK_Connector.inl delete mode 100644 dep/acelite/ace/SOCK_Dgram.cpp delete mode 100644 dep/acelite/ace/SOCK_Dgram.h delete mode 100644 dep/acelite/ace/SOCK_Dgram.inl delete mode 100644 dep/acelite/ace/SOCK_Dgram_Bcast.cpp delete mode 100644 dep/acelite/ace/SOCK_Dgram_Bcast.h delete mode 100644 dep/acelite/ace/SOCK_Dgram_Bcast.inl delete mode 100644 dep/acelite/ace/SOCK_Dgram_Mcast.cpp delete mode 100644 dep/acelite/ace/SOCK_Dgram_Mcast.h delete mode 100644 dep/acelite/ace/SOCK_Dgram_Mcast.inl delete mode 100644 dep/acelite/ace/SOCK_IO.cpp delete mode 100644 dep/acelite/ace/SOCK_IO.h delete mode 100644 dep/acelite/ace/SOCK_IO.inl delete mode 100644 dep/acelite/ace/SOCK_Netlink.cpp delete mode 100644 dep/acelite/ace/SOCK_Netlink.h delete mode 100644 dep/acelite/ace/SOCK_Netlink.inl delete mode 100644 dep/acelite/ace/SOCK_SEQPACK_Acceptor.cpp delete mode 100644 dep/acelite/ace/SOCK_SEQPACK_Acceptor.h delete mode 100644 dep/acelite/ace/SOCK_SEQPACK_Acceptor.inl delete mode 100644 dep/acelite/ace/SOCK_SEQPACK_Association.cpp delete mode 100644 dep/acelite/ace/SOCK_SEQPACK_Association.h delete mode 100644 dep/acelite/ace/SOCK_SEQPACK_Association.inl delete mode 100644 dep/acelite/ace/SOCK_SEQPACK_Connector.cpp delete mode 100644 dep/acelite/ace/SOCK_SEQPACK_Connector.h delete mode 100644 dep/acelite/ace/SOCK_SEQPACK_Connector.inl delete mode 100644 dep/acelite/ace/SOCK_Stream.cpp delete mode 100644 dep/acelite/ace/SOCK_Stream.h delete mode 100644 dep/acelite/ace/SOCK_Stream.inl delete mode 100644 dep/acelite/ace/SPIPE.cpp delete mode 100644 dep/acelite/ace/SPIPE.h delete mode 100644 dep/acelite/ace/SPIPE.inl delete mode 100644 dep/acelite/ace/SPIPE_Acceptor.cpp delete mode 100644 dep/acelite/ace/SPIPE_Acceptor.h delete mode 100644 dep/acelite/ace/SPIPE_Addr.cpp delete mode 100644 dep/acelite/ace/SPIPE_Addr.h delete mode 100644 dep/acelite/ace/SPIPE_Addr.inl delete mode 100644 dep/acelite/ace/SPIPE_Connector.cpp delete mode 100644 dep/acelite/ace/SPIPE_Connector.h delete mode 100644 dep/acelite/ace/SPIPE_Connector.inl delete mode 100644 dep/acelite/ace/SPIPE_Stream.cpp delete mode 100644 dep/acelite/ace/SPIPE_Stream.h delete mode 100644 dep/acelite/ace/SPIPE_Stream.inl delete mode 100644 dep/acelite/ace/SSL/SSL_Asynch_BIO.cpp delete mode 100644 dep/acelite/ace/SSL/SSL_Asynch_BIO.h delete mode 100644 dep/acelite/ace/SSL/SSL_Asynch_Stream.cpp delete mode 100644 dep/acelite/ace/SSL/SSL_Asynch_Stream.h delete mode 100644 dep/acelite/ace/SSL/SSL_Asynch_Stream.inl delete mode 100644 dep/acelite/ace/SSL/SSL_Context.cpp delete mode 100644 dep/acelite/ace/SSL/SSL_Context.h delete mode 100644 dep/acelite/ace/SSL/SSL_Context.inl delete mode 100644 dep/acelite/ace/SSL/SSL_Export.h delete mode 100644 dep/acelite/ace/SSL/SSL_Initializer.cpp delete mode 100644 dep/acelite/ace/SSL/SSL_Initializer.h delete mode 100644 dep/acelite/ace/SSL/SSL_SOCK.cpp delete mode 100644 dep/acelite/ace/SSL/SSL_SOCK.h delete mode 100644 dep/acelite/ace/SSL/SSL_SOCK.inl delete mode 100644 dep/acelite/ace/SSL/SSL_SOCK_Acceptor.cpp delete mode 100644 dep/acelite/ace/SSL/SSL_SOCK_Acceptor.h delete mode 100644 dep/acelite/ace/SSL/SSL_SOCK_Acceptor.inl delete mode 100644 dep/acelite/ace/SSL/SSL_SOCK_Connector.cpp delete mode 100644 dep/acelite/ace/SSL/SSL_SOCK_Connector.h delete mode 100644 dep/acelite/ace/SSL/SSL_SOCK_Connector.inl delete mode 100644 dep/acelite/ace/SSL/SSL_SOCK_Stream.cpp delete mode 100644 dep/acelite/ace/SSL/SSL_SOCK_Stream.h delete mode 100644 dep/acelite/ace/SSL/SSL_SOCK_Stream.inl delete mode 100644 dep/acelite/ace/SSL/sslconf.h delete mode 100644 dep/acelite/ace/SString.cpp delete mode 100644 dep/acelite/ace/SString.h delete mode 100644 dep/acelite/ace/SString.inl delete mode 100644 dep/acelite/ace/SStringfwd.h delete mode 100644 dep/acelite/ace/SUN_Proactor.cpp delete mode 100644 dep/acelite/ace/SUN_Proactor.h delete mode 100644 dep/acelite/ace/SV_Message.cpp delete mode 100644 dep/acelite/ace/SV_Message.h delete mode 100644 dep/acelite/ace/SV_Message.inl delete mode 100644 dep/acelite/ace/SV_Message_Queue.cpp delete mode 100644 dep/acelite/ace/SV_Message_Queue.h delete mode 100644 dep/acelite/ace/SV_Message_Queue.inl delete mode 100644 dep/acelite/ace/SV_Semaphore_Complex.cpp delete mode 100644 dep/acelite/ace/SV_Semaphore_Complex.h delete mode 100644 dep/acelite/ace/SV_Semaphore_Complex.inl delete mode 100644 dep/acelite/ace/SV_Semaphore_Simple.cpp delete mode 100644 dep/acelite/ace/SV_Semaphore_Simple.h delete mode 100644 dep/acelite/ace/SV_Semaphore_Simple.inl delete mode 100644 dep/acelite/ace/SV_Shared_Memory.cpp delete mode 100644 dep/acelite/ace/SV_Shared_Memory.h delete mode 100644 dep/acelite/ace/SV_Shared_Memory.inl delete mode 100644 dep/acelite/ace/Sample_History.cpp delete mode 100644 dep/acelite/ace/Sample_History.h delete mode 100644 dep/acelite/ace/Sample_History.inl delete mode 100644 dep/acelite/ace/Sbrk_Memory_Pool.cpp delete mode 100644 dep/acelite/ace/Sbrk_Memory_Pool.h delete mode 100644 dep/acelite/ace/Sched_Params.cpp delete mode 100644 dep/acelite/ace/Sched_Params.h delete mode 100644 dep/acelite/ace/Sched_Params.inl delete mode 100644 dep/acelite/ace/Select_Reactor.h delete mode 100644 dep/acelite/ace/Select_Reactor_Base.cpp delete mode 100644 dep/acelite/ace/Select_Reactor_Base.h delete mode 100644 dep/acelite/ace/Select_Reactor_Base.inl delete mode 100644 dep/acelite/ace/Select_Reactor_T.cpp delete mode 100644 dep/acelite/ace/Select_Reactor_T.h delete mode 100644 dep/acelite/ace/Select_Reactor_T.inl delete mode 100644 dep/acelite/ace/Semaphore.cpp delete mode 100644 dep/acelite/ace/Semaphore.h delete mode 100644 dep/acelite/ace/Semaphore.inl delete mode 100644 dep/acelite/ace/Service_Config.cpp delete mode 100644 dep/acelite/ace/Service_Config.h delete mode 100644 dep/acelite/ace/Service_Config.inl delete mode 100644 dep/acelite/ace/Service_Gestalt.cpp delete mode 100644 dep/acelite/ace/Service_Gestalt.h delete mode 100644 dep/acelite/ace/Service_Gestalt.inl delete mode 100644 dep/acelite/ace/Service_Manager.cpp delete mode 100644 dep/acelite/ace/Service_Manager.h delete mode 100644 dep/acelite/ace/Service_Object.cpp delete mode 100644 dep/acelite/ace/Service_Object.h delete mode 100644 dep/acelite/ace/Service_Object.inl delete mode 100644 dep/acelite/ace/Service_Repository.cpp delete mode 100644 dep/acelite/ace/Service_Repository.h delete mode 100644 dep/acelite/ace/Service_Repository.inl delete mode 100644 dep/acelite/ace/Service_Types.cpp delete mode 100644 dep/acelite/ace/Service_Types.h delete mode 100644 dep/acelite/ace/Service_Types.inl delete mode 100644 dep/acelite/ace/Shared_Memory.cpp delete mode 100644 dep/acelite/ace/Shared_Memory.h delete mode 100644 dep/acelite/ace/Shared_Memory_MM.cpp delete mode 100644 dep/acelite/ace/Shared_Memory_MM.h delete mode 100644 dep/acelite/ace/Shared_Memory_MM.inl delete mode 100644 dep/acelite/ace/Shared_Memory_Pool.cpp delete mode 100644 dep/acelite/ace/Shared_Memory_Pool.h delete mode 100644 dep/acelite/ace/Shared_Memory_SV.cpp delete mode 100644 dep/acelite/ace/Shared_Memory_SV.h delete mode 100644 dep/acelite/ace/Shared_Memory_SV.inl delete mode 100644 dep/acelite/ace/Shared_Object.cpp delete mode 100644 dep/acelite/ace/Shared_Object.h delete mode 100644 dep/acelite/ace/Shared_Object.inl delete mode 100644 dep/acelite/ace/Sig_Adapter.cpp delete mode 100644 dep/acelite/ace/Sig_Adapter.h delete mode 100644 dep/acelite/ace/Sig_Handler.cpp delete mode 100644 dep/acelite/ace/Sig_Handler.h delete mode 100644 dep/acelite/ace/Sig_Handler.inl delete mode 100644 dep/acelite/ace/Signal.cpp delete mode 100644 dep/acelite/ace/Signal.h delete mode 100644 dep/acelite/ace/Signal.inl delete mode 100644 dep/acelite/ace/Singleton.cpp delete mode 100644 dep/acelite/ace/Singleton.h delete mode 100644 dep/acelite/ace/Singleton.inl delete mode 100644 dep/acelite/ace/Sock_Connect.cpp delete mode 100644 dep/acelite/ace/Sock_Connect.h delete mode 100644 dep/acelite/ace/Stack_Trace.cpp delete mode 100644 dep/acelite/ace/Stack_Trace.h delete mode 100644 dep/acelite/ace/Static_Object_Lock.h delete mode 100644 dep/acelite/ace/Stats.cpp delete mode 100644 dep/acelite/ace/Stats.h delete mode 100644 dep/acelite/ace/Stats.inl delete mode 100644 dep/acelite/ace/Strategies_T.cpp delete mode 100644 dep/acelite/ace/Strategies_T.h delete mode 100644 dep/acelite/ace/Strategies_T.inl delete mode 100644 dep/acelite/ace/Stream.cpp delete mode 100644 dep/acelite/ace/Stream.h delete mode 100644 dep/acelite/ace/Stream.inl delete mode 100644 dep/acelite/ace/Stream_Modules.cpp delete mode 100644 dep/acelite/ace/Stream_Modules.h delete mode 100644 dep/acelite/ace/String_Base.cpp delete mode 100644 dep/acelite/ace/String_Base.h delete mode 100644 dep/acelite/ace/String_Base.inl delete mode 100644 dep/acelite/ace/String_Base_Const.cpp delete mode 100644 dep/acelite/ace/String_Base_Const.h delete mode 100644 dep/acelite/ace/Svc_Conf.h delete mode 100644 dep/acelite/ace/Svc_Conf.y delete mode 100644 dep/acelite/ace/Svc_Conf_Lexer.cpp delete mode 100644 dep/acelite/ace/Svc_Conf_Lexer.h delete mode 100644 dep/acelite/ace/Svc_Conf_Param.h delete mode 100644 dep/acelite/ace/Svc_Conf_Token_Table.h delete mode 100644 dep/acelite/ace/Svc_Conf_Tokens.h delete mode 100644 dep/acelite/ace/Svc_Conf_y.cpp delete mode 100644 dep/acelite/ace/Svc_Handler.cpp delete mode 100644 dep/acelite/ace/Svc_Handler.h delete mode 100644 dep/acelite/ace/Synch.h delete mode 100644 dep/acelite/ace/Synch_Options.cpp delete mode 100644 dep/acelite/ace/Synch_Options.h delete mode 100644 dep/acelite/ace/Synch_Traits.h delete mode 100644 dep/acelite/ace/System_Time.cpp delete mode 100644 dep/acelite/ace/System_Time.h delete mode 100644 dep/acelite/ace/TLI.cpp delete mode 100644 dep/acelite/ace/TLI.h delete mode 100644 dep/acelite/ace/TLI.inl delete mode 100644 dep/acelite/ace/TLI_Acceptor.cpp delete mode 100644 dep/acelite/ace/TLI_Acceptor.h delete mode 100644 dep/acelite/ace/TLI_Connector.cpp delete mode 100644 dep/acelite/ace/TLI_Connector.h delete mode 100644 dep/acelite/ace/TLI_Connector.inl delete mode 100644 dep/acelite/ace/TLI_Stream.cpp delete mode 100644 dep/acelite/ace/TLI_Stream.h delete mode 100644 dep/acelite/ace/TLI_Stream.inl delete mode 100644 dep/acelite/ace/TP_Reactor.cpp delete mode 100644 dep/acelite/ace/TP_Reactor.h delete mode 100644 dep/acelite/ace/TP_Reactor.inl delete mode 100644 dep/acelite/ace/TSS_Adapter.cpp delete mode 100644 dep/acelite/ace/TSS_Adapter.h delete mode 100644 dep/acelite/ace/TSS_T.cpp delete mode 100644 dep/acelite/ace/TSS_T.h delete mode 100644 dep/acelite/ace/TSS_T.inl delete mode 100644 dep/acelite/ace/TTY_IO.cpp delete mode 100644 dep/acelite/ace/TTY_IO.h delete mode 100644 dep/acelite/ace/Task.cpp delete mode 100644 dep/acelite/ace/Task.h delete mode 100644 dep/acelite/ace/Task.inl delete mode 100644 dep/acelite/ace/Task_Ex_T.cpp delete mode 100644 dep/acelite/ace/Task_Ex_T.h delete mode 100644 dep/acelite/ace/Task_Ex_T.inl delete mode 100644 dep/acelite/ace/Task_T.cpp delete mode 100644 dep/acelite/ace/Task_T.h delete mode 100644 dep/acelite/ace/Task_T.inl delete mode 100644 dep/acelite/ace/Test_and_Set.cpp delete mode 100644 dep/acelite/ace/Test_and_Set.h delete mode 100644 dep/acelite/ace/Thread.cpp delete mode 100644 dep/acelite/ace/Thread.h delete mode 100644 dep/acelite/ace/Thread.inl delete mode 100644 dep/acelite/ace/Thread_Adapter.cpp delete mode 100644 dep/acelite/ace/Thread_Adapter.h delete mode 100644 dep/acelite/ace/Thread_Adapter.inl delete mode 100644 dep/acelite/ace/Thread_Control.cpp delete mode 100644 dep/acelite/ace/Thread_Control.h delete mode 100644 dep/acelite/ace/Thread_Control.inl delete mode 100644 dep/acelite/ace/Thread_Exit.cpp delete mode 100644 dep/acelite/ace/Thread_Exit.h delete mode 100644 dep/acelite/ace/Thread_Hook.cpp delete mode 100644 dep/acelite/ace/Thread_Hook.h delete mode 100644 dep/acelite/ace/Thread_Manager.cpp delete mode 100644 dep/acelite/ace/Thread_Manager.h delete mode 100644 dep/acelite/ace/Thread_Manager.inl delete mode 100644 dep/acelite/ace/Thread_Mutex.cpp delete mode 100644 dep/acelite/ace/Thread_Mutex.h delete mode 100644 dep/acelite/ace/Thread_Mutex.inl delete mode 100644 dep/acelite/ace/Thread_Semaphore.cpp delete mode 100644 dep/acelite/ace/Thread_Semaphore.h delete mode 100644 dep/acelite/ace/Thread_Semaphore.inl delete mode 100644 dep/acelite/ace/Throughput_Stats.cpp delete mode 100644 dep/acelite/ace/Throughput_Stats.h delete mode 100644 dep/acelite/ace/Time_Policy.cpp delete mode 100644 dep/acelite/ace/Time_Policy.h delete mode 100644 dep/acelite/ace/Time_Policy.inl delete mode 100644 dep/acelite/ace/Time_Policy_T.cpp delete mode 100644 dep/acelite/ace/Time_Policy_T.h delete mode 100644 dep/acelite/ace/Time_Policy_T.inl delete mode 100644 dep/acelite/ace/Time_Value.cpp delete mode 100644 dep/acelite/ace/Time_Value.h delete mode 100644 dep/acelite/ace/Time_Value.inl delete mode 100644 dep/acelite/ace/Time_Value_T.cpp delete mode 100644 dep/acelite/ace/Time_Value_T.h delete mode 100644 dep/acelite/ace/Time_Value_T.inl delete mode 100644 dep/acelite/ace/Timeprobe.cpp delete mode 100644 dep/acelite/ace/Timeprobe.h delete mode 100644 dep/acelite/ace/Timeprobe.inl delete mode 100644 dep/acelite/ace/Timeprobe_T.cpp delete mode 100644 dep/acelite/ace/Timeprobe_T.h delete mode 100644 dep/acelite/ace/Timer_Hash.h delete mode 100644 dep/acelite/ace/Timer_Hash_T.cpp delete mode 100644 dep/acelite/ace/Timer_Hash_T.h delete mode 100644 dep/acelite/ace/Timer_Heap.h delete mode 100644 dep/acelite/ace/Timer_Heap_T.cpp delete mode 100644 dep/acelite/ace/Timer_Heap_T.h delete mode 100644 dep/acelite/ace/Timer_List.h delete mode 100644 dep/acelite/ace/Timer_List_T.cpp delete mode 100644 dep/acelite/ace/Timer_List_T.h delete mode 100644 dep/acelite/ace/Timer_Queue.h delete mode 100644 dep/acelite/ace/Timer_Queue_Adapters.cpp delete mode 100644 dep/acelite/ace/Timer_Queue_Adapters.h delete mode 100644 dep/acelite/ace/Timer_Queue_Adapters.inl delete mode 100644 dep/acelite/ace/Timer_Queue_Iterator.cpp delete mode 100644 dep/acelite/ace/Timer_Queue_Iterator.h delete mode 100644 dep/acelite/ace/Timer_Queue_Iterator.inl delete mode 100644 dep/acelite/ace/Timer_Queue_T.cpp delete mode 100644 dep/acelite/ace/Timer_Queue_T.h delete mode 100644 dep/acelite/ace/Timer_Queue_T.inl delete mode 100644 dep/acelite/ace/Timer_Queuefwd.h delete mode 100644 dep/acelite/ace/Timer_Wheel.h delete mode 100644 dep/acelite/ace/Timer_Wheel_T.cpp delete mode 100644 dep/acelite/ace/Timer_Wheel_T.h delete mode 100644 dep/acelite/ace/TkReactor/ACE_TkReactor_export.h delete mode 100644 dep/acelite/ace/TkReactor/TkReactor.cpp delete mode 100644 dep/acelite/ace/TkReactor/TkReactor.h delete mode 100644 dep/acelite/ace/Token.cpp delete mode 100644 dep/acelite/ace/Token.h delete mode 100644 dep/acelite/ace/Token.inl delete mode 100644 dep/acelite/ace/Token_Collection.cpp delete mode 100644 dep/acelite/ace/Token_Collection.h delete mode 100644 dep/acelite/ace/Token_Collection.inl delete mode 100644 dep/acelite/ace/Token_Invariants.cpp delete mode 100644 dep/acelite/ace/Token_Invariants.h delete mode 100644 dep/acelite/ace/Token_Manager.cpp delete mode 100644 dep/acelite/ace/Token_Manager.h delete mode 100644 dep/acelite/ace/Token_Manager.inl delete mode 100644 dep/acelite/ace/Token_Request_Reply.cpp delete mode 100644 dep/acelite/ace/Token_Request_Reply.h delete mode 100644 dep/acelite/ace/Token_Request_Reply.inl delete mode 100644 dep/acelite/ace/Tokenizer_T.cpp delete mode 100644 dep/acelite/ace/Tokenizer_T.h delete mode 100644 dep/acelite/ace/Trace.cpp delete mode 100644 dep/acelite/ace/Trace.h delete mode 100644 dep/acelite/ace/Truncate.h delete mode 100644 dep/acelite/ace/Typed_SV_Message.cpp delete mode 100644 dep/acelite/ace/Typed_SV_Message.h delete mode 100644 dep/acelite/ace/Typed_SV_Message.inl delete mode 100644 dep/acelite/ace/Typed_SV_Message_Queue.cpp delete mode 100644 dep/acelite/ace/Typed_SV_Message_Queue.h delete mode 100644 dep/acelite/ace/Typed_SV_Message_Queue.inl delete mode 100644 dep/acelite/ace/UNIX_Addr.cpp delete mode 100644 dep/acelite/ace/UNIX_Addr.h delete mode 100644 dep/acelite/ace/UNIX_Addr.inl delete mode 100644 dep/acelite/ace/UPIPE_Acceptor.cpp delete mode 100644 dep/acelite/ace/UPIPE_Acceptor.h delete mode 100644 dep/acelite/ace/UPIPE_Acceptor.inl delete mode 100644 dep/acelite/ace/UPIPE_Addr.h delete mode 100644 dep/acelite/ace/UPIPE_Connector.cpp delete mode 100644 dep/acelite/ace/UPIPE_Connector.h delete mode 100644 dep/acelite/ace/UPIPE_Connector.inl delete mode 100644 dep/acelite/ace/UPIPE_Stream.cpp delete mode 100644 dep/acelite/ace/UPIPE_Stream.h delete mode 100644 dep/acelite/ace/UPIPE_Stream.inl delete mode 100644 dep/acelite/ace/UTF16_Encoding_Converter.cpp delete mode 100644 dep/acelite/ace/UTF16_Encoding_Converter.h delete mode 100644 dep/acelite/ace/UTF16_Encoding_Converter.inl delete mode 100644 dep/acelite/ace/UTF32_Encoding_Converter.cpp delete mode 100644 dep/acelite/ace/UTF32_Encoding_Converter.h delete mode 100644 dep/acelite/ace/UTF8_Encoding_Converter.cpp delete mode 100644 dep/acelite/ace/UTF8_Encoding_Converter.h delete mode 100644 dep/acelite/ace/UUID.cpp delete mode 100644 dep/acelite/ace/UUID.h delete mode 100644 dep/acelite/ace/UUID.inl delete mode 100644 dep/acelite/ace/Unbounded_Queue.cpp delete mode 100644 dep/acelite/ace/Unbounded_Queue.h delete mode 100644 dep/acelite/ace/Unbounded_Queue.inl delete mode 100644 dep/acelite/ace/Unbounded_Set.cpp delete mode 100644 dep/acelite/ace/Unbounded_Set.h delete mode 100644 dep/acelite/ace/Unbounded_Set.inl delete mode 100644 dep/acelite/ace/Unbounded_Set_Ex.cpp delete mode 100644 dep/acelite/ace/Unbounded_Set_Ex.h delete mode 100644 dep/acelite/ace/Unbounded_Set_Ex.inl delete mode 100644 dep/acelite/ace/Value_Ptr.h delete mode 100644 dep/acelite/ace/Vector_T.cpp delete mode 100644 dep/acelite/ace/Vector_T.h delete mode 100644 dep/acelite/ace/Vector_T.inl delete mode 100644 dep/acelite/ace/Version.h delete mode 100644 dep/acelite/ace/Versioned_Namespace.h delete mode 100644 dep/acelite/ace/WFMO_Reactor.cpp delete mode 100644 dep/acelite/ace/WFMO_Reactor.h delete mode 100644 dep/acelite/ace/WFMO_Reactor.inl delete mode 100644 dep/acelite/ace/WIN32_Asynch_IO.cpp delete mode 100644 dep/acelite/ace/WIN32_Asynch_IO.h delete mode 100644 dep/acelite/ace/WIN32_Proactor.cpp delete mode 100644 dep/acelite/ace/WIN32_Proactor.h delete mode 100644 dep/acelite/ace/XML_Svc_Conf.cpp delete mode 100644 dep/acelite/ace/XML_Svc_Conf.h delete mode 100644 dep/acelite/ace/XML_Utils/XMLSchema/Traversal.hpp delete mode 100644 dep/acelite/ace/XML_Utils/XMLSchema/Traversal.ipp delete mode 100644 dep/acelite/ace/XML_Utils/XMLSchema/TypeInfo.hpp delete mode 100644 dep/acelite/ace/XML_Utils/XMLSchema/TypeInfo.ipp delete mode 100644 dep/acelite/ace/XML_Utils/XMLSchema/TypeInfo.tpp delete mode 100644 dep/acelite/ace/XML_Utils/XMLSchema/Types.hpp delete mode 100644 dep/acelite/ace/XML_Utils/XMLSchema/Types.ipp delete mode 100644 dep/acelite/ace/XML_Utils/XMLSchema/Writer.hpp delete mode 100644 dep/acelite/ace/XML_Utils/XMLSchema/Writer.ipp delete mode 100644 dep/acelite/ace/XML_Utils/XMLSchema/id_map.hpp delete mode 100644 dep/acelite/ace/XML_Utils/XML_Error_Handler.cpp delete mode 100644 dep/acelite/ace/XML_Utils/XML_Error_Handler.h delete mode 100644 dep/acelite/ace/XML_Utils/XML_Helper.h delete mode 100644 dep/acelite/ace/XML_Utils/XML_Schema_Resolver.cpp delete mode 100644 dep/acelite/ace/XML_Utils/XML_Schema_Resolver.h delete mode 100644 dep/acelite/ace/XML_Utils/XML_Typedefs.cpp delete mode 100644 dep/acelite/ace/XML_Utils/XML_Typedefs.h delete mode 100644 dep/acelite/ace/XML_Utils/XML_Utils_Export.h delete mode 100644 dep/acelite/ace/XML_Utils/XSCRT/Elements.hpp delete mode 100644 dep/acelite/ace/XML_Utils/XSCRT/ExtendedTypeInfo.hpp delete mode 100644 dep/acelite/ace/XML_Utils/XSCRT/ExtendedTypeInfo.ipp delete mode 100644 dep/acelite/ace/XML_Utils/XSCRT/Parser.hpp delete mode 100644 dep/acelite/ace/XML_Utils/XSCRT/Traversal.hpp delete mode 100644 dep/acelite/ace/XML_Utils/XSCRT/Traversal.tpp delete mode 100644 dep/acelite/ace/XML_Utils/XSCRT/Writer.hpp delete mode 100644 dep/acelite/ace/XML_Utils/XSCRT/XML.hpp delete mode 100644 dep/acelite/ace/XML_Utils/XSCRT/XMLSchema.hpp delete mode 100644 dep/acelite/ace/XML_Utils/XercesString.cpp delete mode 100644 dep/acelite/ace/XML_Utils/XercesString.h delete mode 100644 dep/acelite/ace/XTI_ATM_Mcast.cpp delete mode 100644 dep/acelite/ace/XTI_ATM_Mcast.h delete mode 100644 dep/acelite/ace/XTI_ATM_Mcast.inl delete mode 100644 dep/acelite/ace/XtReactor/ACE_XtReactor_export.h delete mode 100644 dep/acelite/ace/XtReactor/XtReactor.cpp delete mode 100644 dep/acelite/ace/XtReactor/XtReactor.h delete mode 100644 dep/acelite/ace/ace.rc delete mode 100644 dep/acelite/ace/ace_message_table.bin delete mode 100644 dep/acelite/ace/ace_wchar.cpp delete mode 100644 dep/acelite/ace/ace_wchar.h delete mode 100644 dep/acelite/ace/ace_wchar.inl delete mode 100644 dep/acelite/ace/checked_iterator.h delete mode 100644 dep/acelite/ace/config-WinCE.h delete mode 100644 dep/acelite/ace/config-aix-5.x.h delete mode 100644 dep/acelite/ace/config-aix-7.h delete mode 100644 dep/acelite/ace/config-all.h delete mode 100644 dep/acelite/ace/config-android.h delete mode 100644 dep/acelite/ace/config-cygwin32.h delete mode 100644 dep/acelite/ace/config-freebsd.h delete mode 100644 dep/acelite/ace/config-g++-common.h delete mode 100644 dep/acelite/ace/config-hpux-11.00.h delete mode 100644 dep/acelite/ace/config-icc-common.h delete mode 100644 dep/acelite/ace/config-integritySCA.h delete mode 100644 dep/acelite/ace/config-kfreebsd.h delete mode 100644 dep/acelite/ace/config-linux.h delete mode 100644 dep/acelite/ace/config-lite.h delete mode 100644 dep/acelite/ace/config-lynxos.h delete mode 100644 dep/acelite/ace/config-macosx-iOS-hardware.h delete mode 100644 dep/acelite/ace/config-macosx-iOS-simulator.h delete mode 100644 dep/acelite/ace/config-macosx-leopard.h delete mode 100644 dep/acelite/ace/config-macosx-lion.h delete mode 100644 dep/acelite/ace/config-macosx-panther.h delete mode 100644 dep/acelite/ace/config-macosx-snowleopard.h delete mode 100644 dep/acelite/ace/config-macosx-tiger.h delete mode 100644 dep/acelite/ace/config-macosx.h delete mode 100644 dep/acelite/ace/config-macros.h delete mode 100644 dep/acelite/ace/config-netbsd.h delete mode 100644 dep/acelite/ace/config-openbsd.h delete mode 100644 dep/acelite/ace/config-openvms.h delete mode 100644 dep/acelite/ace/config-pharlap.h delete mode 100644 dep/acelite/ace/config-posix-nonetworking.h delete mode 100644 dep/acelite/ace/config-posix.h delete mode 100644 dep/acelite/ace/config-qnx.h delete mode 100644 dep/acelite/ace/config-rtems.h delete mode 100644 dep/acelite/ace/config-suncc-common.h delete mode 100644 dep/acelite/ace/config-sunos5.10.h delete mode 100644 dep/acelite/ace/config-sunos5.11.h delete mode 100644 dep/acelite/ace/config-sunos5.4-g++.h delete mode 100644 dep/acelite/ace/config-sunos5.4-sunc++-4.x.h delete mode 100644 dep/acelite/ace/config-sunos5.5.h delete mode 100644 dep/acelite/ace/config-sunos5.6.h delete mode 100644 dep/acelite/ace/config-sunos5.7.h delete mode 100644 dep/acelite/ace/config-sunos5.8.h delete mode 100644 dep/acelite/ace/config-sunos5.9.h delete mode 100644 dep/acelite/ace/config-vxworks.h delete mode 100644 dep/acelite/ace/config-vxworks6.4.h delete mode 100644 dep/acelite/ace/config-vxworks6.5.h delete mode 100644 dep/acelite/ace/config-vxworks6.6.h delete mode 100644 dep/acelite/ace/config-vxworks6.7.h delete mode 100644 dep/acelite/ace/config-vxworks6.8.h delete mode 100644 dep/acelite/ace/config-vxworks6.9.h delete mode 100644 dep/acelite/ace/config-win32-cegcc.h delete mode 100644 dep/acelite/ace/config-win32-common.h delete mode 100644 dep/acelite/ace/config-win32-dmc.h delete mode 100644 dep/acelite/ace/config-win32-interix.h delete mode 100644 dep/acelite/ace/config-win32-mingw.h delete mode 100644 dep/acelite/ace/config-win32-msvc-10.h delete mode 100644 dep/acelite/ace/config-win32-msvc-7.h delete mode 100644 dep/acelite/ace/config-win32-msvc-8.h delete mode 100644 dep/acelite/ace/config-win32-msvc-9.h delete mode 100644 dep/acelite/ace/config-win32-msvc.h delete mode 100644 dep/acelite/ace/config-win32.h delete mode 100644 dep/acelite/ace/config-windows.h delete mode 100644 dep/acelite/ace/iosfwd.h delete mode 100644 dep/acelite/ace/os_include/arpa/os_inet.h delete mode 100644 dep/acelite/ace/os_include/net/os_if.h delete mode 100644 dep/acelite/ace/os_include/netinet/os_in.h delete mode 100644 dep/acelite/ace/os_include/netinet/os_tcp.h delete mode 100644 dep/acelite/ace/os_include/os_aio.h delete mode 100644 dep/acelite/ace/os_include/os_assert.h delete mode 100644 dep/acelite/ace/os_include/os_byteswap.h delete mode 100644 dep/acelite/ace/os_include/os_complex.h delete mode 100644 dep/acelite/ace/os_include/os_cpio.h delete mode 100644 dep/acelite/ace/os_include/os_ctype.h delete mode 100644 dep/acelite/ace/os_include/os_dirent.h delete mode 100644 dep/acelite/ace/os_include/os_dlfcn.h delete mode 100644 dep/acelite/ace/os_include/os_errno.h delete mode 100644 dep/acelite/ace/os_include/os_fcntl.h delete mode 100644 dep/acelite/ace/os_include/os_fenv.h delete mode 100644 dep/acelite/ace/os_include/os_float.h delete mode 100644 dep/acelite/ace/os_include/os_fmtmsg.h delete mode 100644 dep/acelite/ace/os_include/os_fnmatch.h delete mode 100644 dep/acelite/ace/os_include/os_ftw.h delete mode 100644 dep/acelite/ace/os_include/os_glob.h delete mode 100644 dep/acelite/ace/os_include/os_grp.h delete mode 100644 dep/acelite/ace/os_include/os_iconv.h delete mode 100644 dep/acelite/ace/os_include/os_ifaddrs.h delete mode 100644 dep/acelite/ace/os_include/os_intrin.h delete mode 100644 dep/acelite/ace/os_include/os_inttypes.h delete mode 100644 dep/acelite/ace/os_include/os_iso646.h delete mode 100644 dep/acelite/ace/os_include/os_kstat.h delete mode 100644 dep/acelite/ace/os_include/os_langinfo.h delete mode 100644 dep/acelite/ace/os_include/os_libgen.h delete mode 100644 dep/acelite/ace/os_include/os_limits.h delete mode 100644 dep/acelite/ace/os_include/os_local.h delete mode 100644 dep/acelite/ace/os_include/os_math.h delete mode 100644 dep/acelite/ace/os_include/os_monetary.h delete mode 100644 dep/acelite/ace/os_include/os_mqueue.h delete mode 100644 dep/acelite/ace/os_include/os_ndbm.h delete mode 100644 dep/acelite/ace/os_include/os_netdb.h delete mode 100644 dep/acelite/ace/os_include/os_nl_types.h delete mode 100644 dep/acelite/ace/os_include/os_pdh.h delete mode 100644 dep/acelite/ace/os_include/os_pdhmsg.h delete mode 100644 dep/acelite/ace/os_include/os_poll.h delete mode 100644 dep/acelite/ace/os_include/os_pthread.h delete mode 100644 dep/acelite/ace/os_include/os_pwd.h delete mode 100644 dep/acelite/ace/os_include/os_regex.h delete mode 100644 dep/acelite/ace/os_include/os_sched.h delete mode 100644 dep/acelite/ace/os_include/os_search.h delete mode 100644 dep/acelite/ace/os_include/os_semaphore.h delete mode 100644 dep/acelite/ace/os_include/os_setjmp.h delete mode 100644 dep/acelite/ace/os_include/os_signal.h delete mode 100644 dep/acelite/ace/os_include/os_spawn.h delete mode 100644 dep/acelite/ace/os_include/os_stdarg.h delete mode 100644 dep/acelite/ace/os_include/os_stdbool.h delete mode 100644 dep/acelite/ace/os_include/os_stddef.h delete mode 100644 dep/acelite/ace/os_include/os_stdint.h delete mode 100644 dep/acelite/ace/os_include/os_stdio.h delete mode 100644 dep/acelite/ace/os_include/os_stdlib.h delete mode 100644 dep/acelite/ace/os_include/os_string.h delete mode 100644 dep/acelite/ace/os_include/os_strings.h delete mode 100644 dep/acelite/ace/os_include/os_stropts.h delete mode 100644 dep/acelite/ace/os_include/os_syslog.h delete mode 100644 dep/acelite/ace/os_include/os_tar.h delete mode 100644 dep/acelite/ace/os_include/os_termios.h delete mode 100644 dep/acelite/ace/os_include/os_tgmath.h delete mode 100644 dep/acelite/ace/os_include/os_time.h delete mode 100644 dep/acelite/ace/os_include/os_trace.h delete mode 100644 dep/acelite/ace/os_include/os_typeinfo.h delete mode 100644 dep/acelite/ace/os_include/os_ucontext.h delete mode 100644 dep/acelite/ace/os_include/os_ulimit.h delete mode 100644 dep/acelite/ace/os_include/os_unistd.h delete mode 100644 dep/acelite/ace/os_include/os_utime.h delete mode 100644 dep/acelite/ace/os_include/os_utmpx.h delete mode 100644 dep/acelite/ace/os_include/os_wchar.h delete mode 100644 dep/acelite/ace/os_include/os_wctype.h delete mode 100644 dep/acelite/ace/os_include/os_wordexp.h delete mode 100644 dep/acelite/ace/os_include/sys/os_ipc.h delete mode 100644 dep/acelite/ace/os_include/sys/os_loadavg.h delete mode 100644 dep/acelite/ace/os_include/sys/os_mman.h delete mode 100644 dep/acelite/ace/os_include/sys/os_msg.h delete mode 100644 dep/acelite/ace/os_include/sys/os_pstat.h delete mode 100644 dep/acelite/ace/os_include/sys/os_resource.h delete mode 100644 dep/acelite/ace/os_include/sys/os_select.h delete mode 100644 dep/acelite/ace/os_include/sys/os_sem.h delete mode 100644 dep/acelite/ace/os_include/sys/os_shm.h delete mode 100644 dep/acelite/ace/os_include/sys/os_socket.h delete mode 100644 dep/acelite/ace/os_include/sys/os_stat.h delete mode 100644 dep/acelite/ace/os_include/sys/os_statvfs.h delete mode 100644 dep/acelite/ace/os_include/sys/os_sysctl.h delete mode 100644 dep/acelite/ace/os_include/sys/os_sysinfo.h delete mode 100644 dep/acelite/ace/os_include/sys/os_time.h delete mode 100644 dep/acelite/ace/os_include/sys/os_timeb.h delete mode 100644 dep/acelite/ace/os_include/sys/os_times.h delete mode 100644 dep/acelite/ace/os_include/sys/os_types.h delete mode 100644 dep/acelite/ace/os_include/sys/os_uio.h delete mode 100644 dep/acelite/ace/os_include/sys/os_un.h delete mode 100644 dep/acelite/ace/os_include/sys/os_utsname.h delete mode 100644 dep/acelite/ace/os_include/sys/os_wait.h delete mode 100644 dep/acelite/ace/post.h delete mode 100644 dep/acelite/ace/pre.h delete mode 100644 dep/acelite/ace/streams.h delete mode 100644 dep/acelite/ace/svc_export.h (limited to 'src') diff --git a/CMakeLists.txt b/CMakeLists.txt index 7923fc33eb7..7150c9664bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,10 +49,8 @@ include(CheckPlatform) # basic packagesearching and setup (further support will be needed, this is a preliminary release!) set(OPENSSL_EXPECTED_VERSION 1.0.0) -set(ACE_EXPECTED_VERSION 5.8.3) find_package(PCHSupport) -find_package(ACE REQUIRED) find_package(OpenSSL REQUIRED) find_package(Threads REQUIRED) diff --git a/README.md b/README.md index 2a1dca52942..f70463a4631 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ website at [TrinityCore.org](http://www.trinitycore.org). + Platform: Linux, Windows or Mac + Processor with SSE2 support -+ ACE ≥ 5.8.3 (included for Windows) ++ Boost ≥ 1.55 + MySQL ≥ 5.1.0 (included for Windows) + CMake ≥ 2.8.11.2 / 2.8.9 (Windows / Linux) + OpenSSL ≥ 1.0.0 diff --git a/cmake/macros/FindACE.cmake b/cmake/macros/FindACE.cmake deleted file mode 100644 index bd534fb33db..00000000000 --- a/cmake/macros/FindACE.cmake +++ /dev/null @@ -1,84 +0,0 @@ -# -# Find the ACE client includes and library -# - -# This module defines -# ACE_INCLUDE_DIR, where to find ace.h -# ACE_LIBRARIES, the libraries to link against -# ACE_FOUND, if false, you cannot build anything that requires ACE - -# also defined, but not for general use are -# ACE_LIBRARY, where to find the ACE library. - -set( ACE_FOUND 0 ) - -if ( UNIX ) - if (NOT ACE_INCLUDE_DIR) - FIND_PATH( ACE_INCLUDE_DIR - NAMES - ace/ACE.h - PATHS - /usr/include - /usr/include/ace - /usr/local/include - /usr/local/include/ace - $ENV{ACE_ROOT} - $ENV{ACE_ROOT}/ace - $ENV{ACE_ROOT}/include - ${CMAKE_SOURCE_DIR}/externals/ace - DOC - "Specify include-directories that might contain ace.h here." - ) - endif() - - if (NOT ACE_LIBRARY) - FIND_LIBRARY( ACE_LIBRARY - NAMES - ace ACE - PATHS - /usr/lib - /usr/lib/ace - /usr/local/lib - /usr/local/lib/ace - /usr/local/ace/lib - $ENV{ACE_ROOT}/lib - $ENV{ACE_ROOT} - DOC "Specify library-locations that might contain the ACE library here." - ) - - # FIND_LIBRARY( ACE_EXTRA_LIBRARIES - # NAMES - # z zlib - # PATHS - # /usr/lib - # /usr/local/lib - # DOC - # "if more libraries are necessary to link into ACE, specify them here." - # ) - endif() - - if ( ACE_LIBRARY ) - if ( ACE_INCLUDE_DIR ) - if (_ACE_VERSION) - set(ACE_VERSION "${_ACE_VERSION}") - else (_ACE_VERSION) - file(STRINGS "${ACE_INCLUDE_DIR}/ace/Version.h" ACE_VERSION_STR REGEX "^#define ACE_VERSION \".*\"") - string(REGEX REPLACE "^.*ACE_VERSION \"([0-9].[0-9].[0-9a-z]).*$" - "\\1" ACE_VERSION "${ACE_VERSION_STR}") - endif (_ACE_VERSION) - - include(EnsureVersion) - ENSURE_VERSION( "${ACE_EXPECTED_VERSION}" "${ACE_VERSION}" ACE_FOUND) - if (NOT ACE_FOUND) - message(FATAL_ERROR "TrinityCore needs ACE version ${ACE_EXPECTED_VERSION} but found version ${ACE_VERSION}") - endif() - - message( STATUS "Found ACE library: ${ACE_LIBRARY}") - message( STATUS "Found ACE headers: ${ACE_INCLUDE_DIR}") - else ( ACE_INCLUDE_DIR ) - message(FATAL_ERROR "Could not find ACE headers! Please install ACE libraries and headers") - endif ( ACE_INCLUDE_DIR ) - endif ( ACE_LIBRARY ) - - mark_as_advanced( ACE_FOUND ACE_LIBRARY ACE_EXTRA_LIBRARIES ACE_INCLUDE_DIR ) -endif (UNIX) diff --git a/cmake/platform/win/settings.cmake b/cmake/platform/win/settings.cmake index c0f724922e3..f57f84c6a45 100644 --- a/cmake/platform/win/settings.cmake +++ b/cmake/platform/win/settings.cmake @@ -2,8 +2,6 @@ option(USE_MYSQL_SOURCES "Use included MySQL-sources to build libraries" 1) # Package overloads -set(ACE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/dep/acelite) -set(ACE_LIBRARY "ace") set(BZIP2_LIBRARIES "bzip2") set(ZLIB_LIBRARIES "zlib") diff --git a/dep/CMakeLists.txt b/dep/CMakeLists.txt index 35b3ead1f2d..3b3be7e1551 100644 --- a/dep/CMakeLists.txt +++ b/dep/CMakeLists.txt @@ -21,7 +21,6 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux") endif() if(CMAKE_SYSTEM_NAME MATCHES "Windows") - add_subdirectory(acelite) if(USE_MYSQL_SOURCES) add_subdirectory(mysqllite) endif() diff --git a/dep/PackageList.txt b/dep/PackageList.txt index 3fa0143a584..3ef81027e0e 100644 --- a/dep/PackageList.txt +++ b/dep/PackageList.txt @@ -1,8 +1,8 @@ TrinityCore uses (parts of or in whole) the following opensource software : -ACE (ADAPTIVE Communication Environment) - http://www.cs.wustl.edu/~schmidt/ACE.html - Version: 6.1.4 +Boost + http://www.boost.org + Version: 1.55 bzip2 (a freely available, patent free, high-quality data compressor) http://www.bzip.org/ diff --git a/dep/acelite/AUTHORS b/dep/acelite/AUTHORS deleted file mode 100644 index 3e474e06cc0..00000000000 --- a/dep/acelite/AUTHORS +++ /dev/null @@ -1,13 +0,0 @@ -Douglas C. Schmidt -d.schmidt@vanderbilt.edu - -Professor of Computer Science -Associate Chair of Computer Science and Engineering -Department of Electrical Engineering and Computer Science -Senior Researcher at the Institute for Software Integrated Systems (ISIS) -Vanderbilt University -Nashville, TN 37203 - -www.dre.vanderbilt.edu/~schmidt -TEL: (615) 343-8197 -FAX: (615) 343-7440 diff --git a/dep/acelite/CMakeLists.txt b/dep/acelite/CMakeLists.txt deleted file mode 100644 index db2915b2952..00000000000 --- a/dep/acelite/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (C) 2008-2014 TrinityCore -# -# This file is free software; as a special exception the author gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -add_subdirectory(ace) diff --git a/dep/acelite/COPYING b/dep/acelite/COPYING deleted file mode 100644 index 226708461b9..00000000000 --- a/dep/acelite/COPYING +++ /dev/null @@ -1,111 +0,0 @@ - - _________________________________________________________________ - - Copyright and Licensing Information for ACE(TM), TAO(TM), CIAO(TM), - DAnCE(TM), and CoSMIC(TM) - - [1]ACE(TM), [2]TAO(TM), [3]CIAO(TM), DAnCE(TM), and [4]CoSMIC(TM) - (henceforth referred to as "DOC software") are copyrighted by - [5]Douglas C. Schmidt and his [6]research group at [7]Washington - University, [8]University of California, Irvine, and [9]Vanderbilt - University, Copyright (c) 1993-2012, all rights reserved. Since DOC - software is open-source, freely available software, you are free to - use, modify, copy, and distribute--perpetually and irrevocably--the - DOC software source code and object code produced from the source, as - well as copy and distribute modified versions of this software. You - must, however, include this copyright statement along with any code - built using DOC software that you release. No copyright statement - needs to be provided if you just ship binary executables of your - software products. - - You can use DOC software in commercial and/or binary software releases - and are under no obligation to redistribute any of your source code - that is built using DOC software. Note, however, that you may not - misappropriate the DOC software code, such as copyrighting it yourself - or claiming authorship of the DOC software code, in a way that will - prevent DOC software from being distributed freely using an - open-source development model. You needn't inform anyone that you're - using DOC software in your software, though we encourage you to let - [10]us know so we can promote your project in the [11]DOC software - success stories. - - The [12]ACE, [13]TAO, [14]CIAO, [15]DAnCE, and [16]CoSMIC web sites - are maintained by the [17]DOC Group at the [18]Institute for Software - Integrated Systems (ISIS) and the [19]Center for Distributed Object - Computing of Washington University, St. Louis for the development of - open-source software as part of the open-source software community. - Submissions are provided by the submitter ``as is'' with no warranties - whatsoever, including any warranty of merchantability, noninfringement - of third party intellectual property, or fitness for any particular - purpose. In no event shall the submitter be liable for any direct, - indirect, special, exemplary, punitive, or consequential damages, - including without limitation, lost profits, even if advised of the - possibility of such damages. Likewise, DOC software is provided as is - with no warranties of any kind, including the warranties of design, - merchantability, and fitness for a particular purpose, - noninfringement, or arising from a course of dealing, usage or trade - practice. Washington University, UC Irvine, Vanderbilt University, - their employees, and students shall have no liability with respect to - the infringement of copyrights, trade secrets or any patents by DOC - software or any part thereof. Moreover, in no event will Washington - University, UC Irvine, or Vanderbilt University, their employees, or - students be liable for any lost revenue or profits or other special, - indirect and consequential damages. - - DOC software is provided with no support and without any obligation on - the part of Washington University, UC Irvine, Vanderbilt University, - their employees, or students to assist in its use, correction, - modification, or enhancement. A [20]number of companies around the - world provide commercial support for DOC software, however. DOC - software is Y2K-compliant, as long as the underlying OS platform is - Y2K-compliant. Likewise, DOC software is compliant with the new US - daylight savings rule passed by Congress as "The Energy Policy Act of - 2005," which established new daylight savings times (DST) rules for - the United States that expand DST as of March 2007. Since DOC software - obtains time/date and calendaring information from operating systems - users will not be affected by the new DST rules as long as they - upgrade their operating systems accordingly. - - The names ACE(TM), TAO(TM), CIAO(TM), DAnCE(TM), CoSMIC(TM), - Washington University, UC Irvine, and Vanderbilt University, may not - be used to endorse or promote products or services derived from this - source without express written permission from Washington University, - UC Irvine, or Vanderbilt University. This license grants no permission - to call products or services derived from this source ACE(TM), - TAO(TM), CIAO(TM), DAnCE(TM), or CoSMIC(TM), nor does it grant - permission for the name Washington University, UC Irvine, or - Vanderbilt University to appear in their names. - - If you have any suggestions, additions, comments, or questions, please - let [21]me know. - - [22]Douglas C. Schmidt - _________________________________________________________________ - - Back to the [23]ACE home page. - -References - - 1. http://www.cs.wustl.edu/~schmidt/ACE.html - 2. http://www.cs.wustl.edu/~schmidt/TAO.html - 3. http://www.dre.vanderbilt.edu/CIAO/ - 4. http://www.dre.vanderbilt.edu/cosmic/ - 5. http://www.dre.vanderbilt.edu/~schmidt/ - 6. http://www.cs.wustl.edu/~schmidt/ACE-members.html - 7. http://www.wustl.edu/ - 8. http://www.uci.edu/ - 9. http://www.vanderbilt.edu/ - 10. mailto:doc_group@cs.wustl.edu - 11. http://www.cs.wustl.edu/~schmidt/ACE-users.html - 12. http://www.cs.wustl.edu/~schmidt/ACE.html - 13. http://www.cs.wustl.edu/~schmidt/TAO.html - 14. http://www.dre.vanderbilt.edu/CIAO/ - 15. http://www.dre.vanderbilt.edu/~schmidt/DOC_ROOT/DAnCE/ - 16. http://www.dre.vanderbilt.edu/cosmic/ - 17. http://www.dre.vanderbilt.edu/ - 18. http://www.isis.vanderbilt.edu/ - 19. http://www.cs.wustl.edu/~schmidt/doc-center.html - 20. http://www.cs.wustl.edu/~schmidt/commercial-support.html - 21. mailto:d.schmidt@vanderbilt.edu - 22. http://www.dre.vanderbilt.edu/~schmidt/ - 23. http://www.cs.wustl.edu/ACE.html diff --git a/dep/acelite/ChangeLog b/dep/acelite/ChangeLog deleted file mode 100644 index 7381bdcca07..00000000000 --- a/dep/acelite/ChangeLog +++ /dev/null @@ -1,2590 +0,0 @@ -Wed Aug 29 08:16:04 CEST 2012 Johnny Willemsen - - * ACE version 6.1.4 released. - -Mon Aug 27 20:38:00 UTC 2012 Steve Huston - - * include/makeinclude/platform_linux.GNU: Make CC and CXX setting - conditional again. Conditional behavior is relied upon by users. - Reverts the following: - Tue Mar 1 11:31:55 UTC 2011 Olli Savia - -Mon Aug 27 09:43:43 UTC 2012 johnny - - * apps/JAWS/clients/WebSTONE/src/config.cache: - * apps/JAWS/clients/WebSTONE/src/config.log: - * apps/JAWS/clients/WebSTONE/src/config.status: - Removed these files, generated by configure and - shouldn't be stored in the repository - -Fri Aug 24 10:27:22 UTC 2012 johnny - - * examples/APG/Streams/CommandModule.h: - * tests/Service_Config_Stream_Test.cpp: - Add ACE_System_Time_Policy as second template argument - to ACE_Module, the default template argument doesn't - work with clang which seems to be a bug in that - compiler - -Thu Aug 23 12:33:35 UTC 2012 johnny - - * ace/Condition_Attributes.inl: - * ace/config-hpux-11.00.h: - Another fix for hpux ia64 v3 - -Thu Aug 23 06:35:20 UTC 2012 Johnny Willemsen - - * ace/Condition_Attributes.inl: - Only check for ACE_LACKS_MONOTONIC_TIME - - * ace/Monotonic_Time_Policy.inl: - Layout change - - * ace/config-hpux-11.00.h: - Added ACE_LACKS_MONOTONIC_TIME - -Wed Aug 22 11:50:22 UTC 2012 Johnny Willemsen - - * ace/config-win32-common.h: - Added ACE_LACKS_CLOCK_MONOTONIC and - ACE_LACKS_CLOCK_REALTIME - -Wed Aug 22 06:13:12 UTC 2012 Johnny Willemsen - - * ace/os_include/sys/os_time.h: - Fixed incorrect check in this file - -Tue Aug 21 16:55:13 UTC 2012 Johnny Willemsen - - * ace/os_include/sys/os_time.h: - Introduced new ACE_LACKS_CLOCKID_T which is used to determine whether - we need to define clockid_t in ACE. Moved CLOCK_MONOTONIC and - CLOCK_REALTIME to file below - - * ace/os_include/sys/os_types.h: - Added CLOCK_MONOTONIC and CLOCK_REALTIME here and introduced new - ACE_LACKS_CLOCK_REALTIME and ACE_LACKS_CLOCK_MONOTONIC because on - for example HPUX CLOCK_REALTIME is not a define but part of an enum - - * ace/config-win32-common.h: - Added ACE_LACKS_CLOCKID_T - -Tue Aug 21 14:38:00 UTC 2012 Simon Massey - - * protocols/ace/INet/SSL_CallbackManager.h: - Spelling in comment. - -Tue Aug 21 12:25:45 UTC 2012 Simon Massey - - * ace/SSL/SSL_Context.h: - * ace/SSL/SSL_Context.inl: - - Solaris studio compilers amongst others were issuing warnings due to an - incorrect type of function pointer (i.e. not extern "C", but standard - C++ type) being stored/used of the form: - - Warning (Anachronism): Formal argument callback of type - extern "C" int(*)(int,x509_store_ctx_st*) - in call to - SSL_CTX_set_verify(ssl_ctx_st*, int, extern "C" int(*)(int,x509_store_ctx_st*)) - is being passed - int(*)(int,x509_store_ctx_st*) - - when the C++ code was providing callback functions to certain C system SSL - library calls. - - Unfortunatly you cannot specify extern "C" linkage anywhere inside a - class declaration or inside a function prototype for individual - parameters. I.e: - - class { extern "C" int (*callback_) (int, void *); }; - - to store an extern "C" function pointer as a data member of the - class is illegal, as is: - - void function (extern "C" int (*callback) (int, void *); - - to declare a function (or a class member) that takes a extern "C" - function pointer as a parameter. - - Since we need to specify an extern "C" function pointer as a parameter - to be stored in the class and handled by member functions, we are forced - to declare a typedef of that extern "C" function pointer outside of the - class that we can then use. Unfortunatly you also are not allowed to - simply add the extern "C" to the typedef itself, like this: - - typedef extern "C" int (*extern_C_callback_t) (int, void *); - - instead you have to place the typedef declaration inside an extern "C" - block, thus: - - extern "C" { - typedef int (*extern_C_callback_t) (int, void *); - } - - This then results in the correct call type associated with the - function pointer which may then be used inside the function and - class declarations to remove these warnings and possiable incorrect - call methods undertaken via the STL C functions. A lot of different - compilers ignore extern "C" where it is not allowed, the only way - I have found to be universally understood is as stated above. - - * protocols/ace/INet/SSL_CallbackManager.h: - * protocols/ace/INet/SSL_CallbackManager.cpp: - - Similar problems and interfacing to the changed calling type of the above - extern "C" function pointers. NOTE: just declaring a static function for - the class is NOT sufficient to obtain the correct extern "C" calling type. - We are therefore forced to declare friend functions external to the class - (as again we cannot have a extern "C" declaration inside a class even for - a static method) to do this job. Since these are extern "C" functions they - also of course cannot be overloaded, i.e. they are required to be unique - names. They also cannot be non-class static functions to make them private - to the cpp file as they need to actually be seen by the class declaration - to be made friends and therefore have to be included in the header file. - -Tue Aug 21 12:20:43 UTC 2012 Johnny Willemsen - - * ace/os_include/sys/os_types.h: - Fixed HPUX problem - -Tue Aug 21 02:45:07 UTC 2012 Phil Mesnier - - * ace/config-macosx-leopard.h: - setclock not supported on current macs. - -Mon Aug 20 18:07:25 UTC 2012 Johnny Willemsen - - * ace/Global_Macros.h: - Doxyen fixes - - * bin/valgrind.supp: - Added another needed suppression - -Mon Aug 20 10:03:23 UTC 2012 Johnny Willemsen - - * docs/ACE-monotonic-timer.html: - Fixed fuzz - -Mon Aug 20 09:03:22 UTC 2012 Johnny Willemsen - - * ace/Module.cpp: - Fixed possible memory leak and dead code, uncovered by Coverity scan - -Mon Aug 20 08:36:46 UTC 2012 Johnny Willemsen - - * docs/ACE-monotonic-timer.html: - New document describing the ACE monotonic timer support for conditions, - message queues and tasks - - * docs/index.html: - Added new page, removed link to site that doesn't work anymore - -Mon Aug 20 08:21:00 UTC 2012 Johnny Willemsen - - * ace/os_include/sys/os_types.h: - Define CLOCK_MONOTONIC to 1 when it is not defined, should fix - hpux problems - -Mon Aug 20 07:57:53 UTC 2012 Johnny Willemsen - - * ace/Condition_Attributes.h: - * ace/Condition_Attributes.inl: - Added accessor for attributes and removed friend declaration, - that hopefully fixes the Sun Studio 11 problems - - * ace/Condition_Recursive_Thread_Mutex.cpp: - * ace/Condition_T.cpp: - * ace/Condition_Thread_Mutex.cpp: - Use accessor of the attributes. - -Sat Aug 18 19:25:38 UTC 2012 Johnny Willemsen - - * ace/Null_Condition.h: - Fix for single threaded builds - -Sat Aug 18 19:23:21 UTC 2012 Johnny Willemsen - - * ace/Condition_Attributes.h: - Added forward declaration, maybe this fixes solaris 9 - -Fri Aug 17 18:05:54 UTC 2012 Johnny Willemsen - - * ace/OS_NS_Thread.inl: - Attempt to fix clang warning - -Fri Aug 17 13:38:05 UTC 2012 Martin Corino - - * ace/Condition_Recursive_Thread_Mutex.h: - * ace/Condition_Thread_Mutex.h: - * ace/Null_Condition.h: - * ace/Synch_Traits.h: - Changes to attempt to fix Solaris9 SUNStudio11 problems. - -Fri Aug 17 12:28:32 UTC 2012 Martin Corino - - * ace/config-hpux-11.00.h: - * ace/config-linux.h: - Fixes (hopefully) for non-compliant POSIX platforms. - -Fri Aug 17 11:19:01 UTC 2012 Martin Corino - - * tests/Monotonic_Message_Queue_Test.cpp: - * tests/Monotonic_Task_Test.cpp: - Added include files because of compile errors in certain - builds. - -Fri Aug 17 09:04:50 UTC 2012 Martin Corino - - * ace/Message_Queue_T.h: - * ace/Message_Queue_T.cpp: - * ace/Stream.h: - * ace/Stream.cpp: - * tests/Bug_4055_Regression_Test.cpp: - * tests/Monotonic_Task_Test.cpp: - Fixed compile errors for a bunch of crappy compilers - like the one on RHEL53 and AIX. - -Thu Aug 16 18:47:59 UTC 2012 Johnny Willemsen - - * ace/ace.mpc: - * ace/ace_for_tao.mpc: - List Time_Value_T files - -Thu Aug 16 13:43:39 UTC 2012 Martin Corino - - * ace/Message_Queue_T.cpp: - * ace/Stream.cpp: - * ace/Thread_Manager.cpp: - * tests/Bug_4055_Regression_Test.cpp: - Fixed problems with single threaded builds. - -Thu Aug 16 12:44:05 UTC 2012 Martin Corino - - * ace/Task_T.inl: - * ace/Time_Policy_T.inl: - Fuzz fixes. - -Thu Aug 16 09:43:00 UTC 2012 Simon Massey - - * test/Bug_3943_Regression_Test.cpp: - - Another cast required to remove warning. - -Thu Aug 16 09:22:31 UTC 2012 Martin Corino - - * ace/Condition_Attributes.h: - * ace/Condition_Attributes.inl: - * ace/Condition_Attributes.cpp: - * ace/Condition_Recursive_Thread_Mutex.h: - * ace/Condition_Recursive_Thread_Mutex.cpp: - * ace/Condition_T.h: - * ace/Condition_T.cpp: - * ace/Condition_Thread_Mutex.h: - * ace/Condition_Thread_Mutex.inl: - * ace/Condition_Thread_Mutex.cpp: - * ace/Message_Queue.h: - * ace/Message_Queue_T.h: - * ace/Message_Queue_T.cpp: - * ace/Module.h: - * ace/Module.inl: - * ace/Module.cpp: - * ace/Monotonic_Time_Policy.h: - * ace/Monotonic_Time_Policy.inl: - * ace/Monotonic_Time_Policy.cpp: - * ace/Null_Condition.h: - * ace/OS_NS_Thread.h: - * ace/OS_NS_Thread.inl: - * ace/OS_NS_Thread.cpp: - * ace/Stream.h: - * ace/Stream.inl: - * ace/Stream.cpp: - * ace/Stream_Modules.h: - * ace/Stream_Modules.cpp: - * ace/Synch_Traits.h: - * ace/Task_Ex_T.h: - * ace/Task_Ex_T.inl: - * ace/Task_Ex_T.cpp: - * ace/Task_T.h: - * ace/Task_T.inl: - * ace/Task_T.cpp: - * ace/Thread_Manager.h: - * ace/Thread_Manager.cpp: - * ace/Thread_Mutex.h: - * ace/Time_Policy.h: - * ace/Time_Policy.inl: - * ace/Time_Policy.cpp: - * ace/Time_Policy_T.h: - * ace/Time_Policy_T.inl: - * ace/Time_Policy_T.cpp: - * ace/Time_Value.h: - * ace/Time_Value.cpp: - * ace/Time_Value_T.h: - * ace/Time_Value_T.inl: - * ace/Time_Value_T.cpp: - * ace/ace.mpc: - * ace/ace_for_tao.mpc: - Added a Monotonic time policy and a Time_Value template - supporting time policies. Refactored OS_NS_Thread time - calculations to use new time policy aware functionality - of time values. Added support for monotonic timers with - condition variables in message queues, tasks and related - classes. See NEWS file and new regression tests for more - details. - Full backward compatibility is maintained. - - * tests/Bug_4055_Regression_Test.cpp: - Updated to fixed state. - - * tests/Monotonic_Message_Queue_Test.cpp: - * tests/Monotonic_Task_Test.cpp: - * tests/run_test.lst: - * tests/tests.mpc: - Added new monotonic timer regression tests. - - * NEWS: - Added detailed update descriptions. - -Thu Aug 16 09:24:00 UTC 2012 Simon Massey - - * bin/PerlACE/Process_Win32.pm: - * bin/PerlACE/ProcessVX_Win32.pm: - - If we wait for a process to exit, and it does, set the RUNNING status to false. - -Thu Aug 16 08:26:12 UTC 2012 Olli Savia - - * tests/tests.mpc: - Bug_4055_Regression_Test uses threads. - -Wed Aug 15 14:10:00 UTC 2012 Simon Massey - - * test/Bug_3911_Regression_Test.cpp: - * test/Bug_3943_Regression_Test.cpp: - - Some compilers warning against ordering pointers with integers. - -Wed Aug 15 11:42:28 UTC 2012 Johnny Willemsen - - * include/makeinclude/platform_linux_clang.GNU: - Support for c++0x flag - -Wed Aug 15 11:29:48 UTC 2012 Johnny Willemsen - - * include/makeinclude/platform_clang_common.GNU: - Support for c++0x flag - -Tue Aug 14 22:22:05 UTC 2012 Adam Mitz - - * ace/config-vxworks6.8.h: - - When building for VxWorks kernel mode, define ACE_LACKS_STD_WSTRING. - -Tue Aug 14 06:35:54 UTC 2012 Johnny Willemsen - - * bin/valgrind.supp: - Extended suppression list - -Thu Aug 9 07:03:10 UTC 2012 Johnny Willemsen - - * docs/bczar/bczar.html: - Added packages - - * include/makeinclude/platform_g++_common.GNU: - Use -Wno-deprecated with C++11 due to the heavy usage of auto_ptr - - * tests/randomize.h: - Doxygen fix - -Wed Aug 8 22:13:55 UTC 2012 Adam Mitz - - * ace/ACE.cpp: - * ace/ACE_crc_ccitt.cpp: - * ace/Basic_Types.h: - * ace/Configuration_Import_Export.cpp: - * ace/Handle_Set.inl: - * ace/INET_Addr.inl: - * ace/Message_Queue_Vx.inl: - * ace/Name_Request_Reply.cpp: - * ace/OS_NS_stdlib.cpp: - * ace/OS_NS_unistd.inl: - * ace/Select_Reactor_T.inl: - * ace/Service_Config.cpp: - * ace/Stack_Trace.cpp: - * ace/UUID.cpp: - * ace/config-vxworks6.9.h: - * include/makeinclude/platform_vxworks6.8.GNU: - * include/makeinclude/platform_vxworks6.9.GNU: - - Enable compiling for 64-bit VxWorks 6.9 (x86 RTP static). - -Wed Aug 8 15:30:00 UTC 2012 Simon Massey - - * ace/config-linux.h: - - According to man pages Linux uses different (compared to UNIX systems) types - for setting IP_MULTICAST_TTL and IPV6_MULTICAST_LOOP / IP_MULTICAST_LOOP - in setsockopt/getsockopt. - In the current (circa 2012) kernel source however there is an explicit check - for IPV6_MULTICAST_LOOP being sizeof(int). Anything else is rejected so it must - not be a passed a bool, irrespective of what the man pages (still) say. - i.e. #define ACE_HAS_IPV6_MULTICAST_LOOP_AS_BOOL 1 is wrong. - - * ace/SOCK_Dgram_Mcast.h: - * ace/SOCK_Dgram_Mcast.inl: - - Override read/write acessor for the constructor options - This class is typically default instantiated in a connection handler templated - framework so these cannot be specified on construction. - -Mon Aug 6 20:54:17 UTC 2012 Adam Mitz - - * bin/PerlACE/TestTarget.pm: - - Updated fix from Fri Jul 20 17:37:27 UTC 2012 to work when - one of source or destination is a relative path and other is not. - -Sat Jul 28 19:22:06 UTC 2012 Johnny Willemsen - - * bin/make_release.py: - Fixed exclude - -Fri Jul 27 10:55:51 UTC 2012 Johnny Willemsen - - * etc/ace.doxygen: - * etc/ace_inet.doxygen: - * etc/ace_qos.doxygen: - * etc/ace_rmcast.doxygen: - * etc/ace_ssl.doxygen: - * etc/acexml.doxygen: - Generate UML diagrams, assume stl is buildin - -Fri Jul 27 08:57:07 UTC 2012 Johnny Willemsen - - * etc/ace.doxygen: - * etc/ace_inet.doxygen: - * etc/ace_qos.doxygen: - * etc/ace_rmcast.doxygen: - * etc/ace_ssl.doxygen: - * etc/acexml.doxygen: - Upgraded with doxygen -u - -Thu Jul 26 16:22:35 UTC 2012 Johnny Willemsen - - * bin/make_release.py: - * docs/bczar/bczar.html: - Improved instructions - -Thu Jul 26 14:40:45 UTC 2012 Johnny Willemsen - - * docs/bczar/bczar.html: - Set all environment variables explicitly before running the doxygen - script - -Thu Jul 26 10:19:34 UTC 2012 Johnny Willemsen - - * ace/ARGV.h: - * ace/Arg_Shifter.h: - Doxygen improvements - - * rpmbuild/ace-tao.spec: - Removed ACE_XML_Utils, only compiled when xercesc is enabled - -Thu Jul 26 09:31:19 UTC 2012 Johnny Willemsen - - * NEWS: - Updated for next release - - * bin/diff-builds-and-group-fixed-tests-only.sh: - * bin/make_release.py: - * docs/Download.html: - * docs/bczar/bczar.html: - Updated for x.1.3 release - - * etc/ace.doxygen: - * etc/ace_inet.doxygen: - * etc/ace_qos.doxygen: - * etc/ace_rmcast.doxygen: - * etc/ace_ssl.doxygen: - * etc/acexml.doxygen: - * etc/index.html: - Removed deprecated tag - -Thu Jul 26 09:12:26 CEST 2012 Johnny Willemsen - - * ACE version 6.1.3 released. - -Fri Jul 20 17:37:27 UTC 2012 Adam Mitz - - * ace/config-vxworks6.8.h: - * ace/config-vxworks6.9.h: - - Changes to build for VxWorks 6.8 kernel mode. - - * bin/PerlACE/ProcessVX_Win32.pm: - * tests/run_test.lst: - - Changes for VxWorks testing. - - * bin/PerlACE/TestTarget.pm - - Fixed a Perl bug (ne vs. !=). - -Wed Jul 18 15:40:05 UTC 2012 Douglas C. Schmidt - - * Happy 50th Birthday to me! - -Tue Jun 26 21:47:18 UTC 2012 Adam Mitz - - * bin/valgrind.supp: - - Made the suppression for dlopen more generic, so that it - can work for different linux/glibc versions. - -Tue Jun 26 13:18:13 UTC 2012 Johnny Willemsen - - * tests/Bug_4055_Regression_Test.cpp: - Added commented out way to get the hr time - -Mon Jun 25 17:40:35 UTC 2012 Johnny Willemsen - - * tests/Bug_4055_Regression_Test.cpp: - * tests/run_test.lst: - * tests/tests.mpc: - Added new unit test which currently fails. The ACE condition - variables use an absolute timeout. If we for example wait for a - timeout 3 seconds in the future and the system time is changed 10 - seconds back we are really waiting 13 seconds now. The ACE timer - queues have support for using a monotonic time source using the - time policies but this support is not available for conditions at - this moment. When that is added, than in the ACE threading code - the monotonic time source can be set on the pthread condition - to control that we want to use a monotonic time source. - -Mon Jun 25 09:31:34 UTC 2012 Johnny Willemsen - - * ace/Condition_Attributes.h: - * ace/Condition_Attributes.inl: - * ace/Condition_Attributes.cpp: - * ace/Condition_Recursive_Thread_Mutex.h: - * ace/Condition_Thread_Mutex.h: - * ace/Condition_Thread_Mutex.inl: - * ace/ace.mpc: - * ace/ace_for_tao.mpc: - Moved condition attributes to its own file - -Fri Jun 22 00:30:11 UTC 2012 James H. Hill - - * tests/CDR_Test.cpp: - - Fixed compilation warnings on CentOS 3.9 and vc9 - -Thu Jun 21 17:08:55 UTC 2012 Johnny Willemsen - - * ace/DLL.h: - * ace/DLL_Manager.h: - * ace/DLL_Manager.cpp: - Changed the order that the ACE_DLL_Manager attempts to open a library - Foo so that it will try Foo. before - Foo.. This makes library loading using ACE succeed - on the first try instead of the fourth on any platform requiring a - library prefix, like Linux. For platforms that don't have a prefix - it will also succeed on the first time. Thanks to Trent Nadeau - for providing this improvement - -Wed Jun 20 12:54:29 UTC 2012 James H. Hill - - * tests/CDR_Test.cpp: - - Fixed error in test execution. - -Mon Jun 18 20:40:29 UTC 2012 James H. Hill - - * ace/CDR_Stream.h: - * ace/CDR_Stream.cpp: - * tests/CDR_Test.cpp: - - Extended ACE_OutputCDR placeholders to support all ACE_CDR - simple types. - -Mon Jun 18 13:20:32 UTC 2012 Johnny Willemsen - - * bin/auto_run_tests.pl: - Use -z for debug mode - -Mon Jun 18 06:44:11 UTC 2012 Johnny Willemsen - - * debian/*: - Updated with latest files from debian packaging - -Thu Jun 14 14:05:13 UTC 2012 Johnny Willemsen - - * ace/XML_Utils/XML_Error_Handler.cpp: - Only print errors on cerr when we have ACE::debug enabled - -Wed Jun 13 05:57:16 UTC 2012 Johnny Willemsen - - * docs/bczar/bczar.html: - Added another package - -Tue Jun 12 17:30:47 UTC 2012 Johnny Willemsen - - * bin/make_release.py: - Exclude CIAO_*_OpenDDS workspaces for the moment - -Mon Jun 11 21:45:19 UTC 2012 Adam Mitz - - * NEWS: - * ace/config-lite.h: - * include/makeinclude/platform_sunos5_sunc++.GNU: - - Added support for Oracle Solaris Studio 12 Update 3 (SunCC 5.12). - -Mon Jun 11 17:05:36 UTC 2012 Johnny Willemsen - - * bin/auto_run_tests.pl: - Added option -d to run OpenDDS tests also - - * bin/diff-builds-and-group-fixed-tests-only.sh: - Also check OpenDDS lst files - -Thu Jun 7 10:13:13 UTC 2012 Johnny Willemsen - - * ace/Condition_Thread_Mutex.h: - * ace/Dynamic_Message_Strategy.h: - * ace/Message_Queue.h: - * ace/Metrics_Cache_T.h: - Doxygen fixes - -Wed Jun 6 14:46:53 UTC 2012 Johnny Willemsen - - * ace/XML_Utils/XSCRT/Traversal.hpp: - * ace/XML_Utils/XSCRT/Traversal.tpp: - Readded tpp file, shouldn't have been deleted - -Wed Jun 6 13:09:02 UTC 2012 Johnny Willemsen - - * ace/XML_Utils/XMLSchema/Traversal.hpp: - * ace/XML_Utils/XMLSchema/Types.hpp: - * ace/XML_Utils/XMLSchema/Writer.hpp: - * ace/XML_Utils/XSCRT/Elements.hpp: - * ace/XML_Utils/XSCRT/Parser.hpp: - * ace/XML_Utils/XSCRT/Traversal.hpp: - * ace/XML_Utils/XSCRT/Writer.hpp: - * ace/XML_Utils/XSCRT/XML.hpp: - Removed includes - - * ace/XML_Utils/XMLSchema/Traversal.tpp: - * ace/XML_Utils/XMLSchema/Types.tpp: - * ace/XML_Utils/XMLSchema/Writer.tpp: - * ace/XML_Utils/XSCRT/Elements.tpp: - * ace/XML_Utils/XSCRT/Parser.tpp: - * ace/XML_Utils/XSCRT/Traversal.tpp: - * ace/XML_Utils/XSCRT/Writer.tpp: - * ace/XML_Utils/XSCRT/XML.tpp: - Removed these files. - -Wed Jun 6 10:27:33 UTC 2012 Johnny Willemsen - - * ace/XML_Utils/XML.mpc: - Install fixes - -Wed Jun 6 08:12:22 UTC 2012 Johnny Willemsen - - * ace/XML_Utils/XML.mpc: - Install fixes - -Fri Jun 1 12:43:48 UTC 2012 Johnny Willemsen - - * ace/Condition_Thread_Mutex.cpp: - * ace/Message_Queue_T.h: - * ace/Message_Queue_T.cpp: - * ace/Thread_Semaphore.h: - * ace/Time_Policy.h: - * ace/Timer_Hash_T.h: - Doxygen fixes - -Thu May 31 14:05:51 UTC 2012 Johnny Willemsen - - * rpmbuild/ace-tao.spec: - Added new library - -Thu May 31 12:31:38 UTC 2012 Johnny Willemsen - - * ace/XML_Utils/XMLSchema: - * ace/XML_Utils/XMLSchema/Traversal.hpp: - * ace/XML_Utils/XMLSchema/TypeInfo.hpp: - * ace/XML_Utils/XMLSchema/Types.hpp: - * ace/XML_Utils/XMLSchema/Writer.hpp: - * ace/XML_Utils/XMLSchema/id_map.hpp: - * ace/XML_Utils/XSCRT: - * ace/XML_Utils/XSCRT/Elements.hpp: - * ace/XML_Utils/XSCRT/ExtendedTypeInfo.hpp: - * ace/XML_Utils/XSCRT/Parser.hpp: - * ace/XML_Utils/XSCRT/Traversal.hpp: - * ace/XML_Utils/XSCRT/Writer.hpp: - * ace/XML_Utils/XSCRT/XML.hpp: - * ace/XML_Utils/XSCRT/XMLSchema.hpp: - Moved these files from DAnCE to ACE - - * ace/XML_Utils/XSCRT/Elements.ipp: - * ace/XML_Utils/XSCRT/Parser.ipp: - * ace/XML_Utils/XSCRT/Traversal.ipp: - * ace/XML_Utils/XSCRT/Writer.ipp: - * ace/XML_Utils/XSCRT/XML.ipp: - Removed these files. - -Thu May 31 09:12:07 UTC 2012 Johnny Willemsen - - * ace/XML_Utils: - * ace/XML_Utils/XML.mpc: - * ace/XML_Utils/XML_Error_Handler.h: - * ace/XML_Utils/XML_Helper.h: - * ace/XML_Utils/XML_Schema_Resolver.h: - * bin/MakeProjectCreator/config/ace_xml_utils.mpb: - New ACE_XML_Utils library. This is coming from DAnCe and had to - move to ACE because it is now used in more places and soon will - also be used by OpenDDS - -Thu May 31 07:57:59 UTC 2012 Johnny Willemsen - - * ace/High_Res_Timer.h: - * ace/Message_Block.h: - Doxygen improvements - - * ace/High_Res_Timer.inl: - Use gsf type to prevent overflow - - * docs/bczar/bczar.html: - Added some more packages - -Thu May 24 14:35:04 UTC 2012 Steve Huston - - * ace/Cache_Map_Manager_T.cpp (find): Remove extraneous () from - 'second' - leftover from ACE_Pair days. - - * tests/Cache_Map_Manager_Test.cpp: Add call to the above method. - - * THANKS: Thanks to Milind Pangarkar for the above test, and fix. - -Thu May 24 07:58:53 UTC 2012 Johnny Willemsen - - * ace/High_Res_Timer.h: - * ace/config-win32-msvc.h: - Documentation updates - - * ace/High_Res_Timer.inl: - Layout changes - - * ace/High_Res_Timer.cpp: - Use this - -Thu May 24 05:56:27 UTC 2012 Johnny Willemsen - - * bin/MakeProjectCreator/config/MPC.cfg: - Added XSC_ROOT - - * bin/valgrind.supp: - Simplified this file - -Mon May 21 18:05:32 UTC 2012 Johnny Willemsen - - * tests/INTEGRITY.ld: - Removed this file. - -Mon May 21 07:15:10 UTC 2012 Johnny Willemsen - - * NEWS: - * bin/diff-builds-and-group-fixed-tests-only.sh: - * docs/Download.html: - * docs/bczar/bczar.html: - * etc/index.html: - Updated for new release - -Sat May 19 14:28:57 CEST 2012 Johnny Willemsen - - * ACE version 6.1.2 released. - -Thu May 17 16:16:09 UTC 2012 Adam Mitz - - * ACE-INSTALL.html: - - Replaced the make flag static_libs with static_libs_only. - Using static_libs implies that both static and shared can - be built at the same time, which is not true in general. - -Thu May 17 15:42:36 UTC 2012 Steve Huston - - * ace/Reactor.h: Clarified the timeout conditions on - run_reactor_event_loop(). Thank you to Mohsin Zaidi for this - clarification. - - * THANKS: Added Mohsin Zaidi to the Hall of Fame. - -Wed May 16 17:41:21 UTC 2012 Steve Huston - - * ace/OS_NS_Thread.cpp (ACE_Thread_ID::to_string): Use string literals - for the sprintf formats rather than build them up. Things have - simplified to the point we don't need that any longer. Thanks to - Rick Ohnemus for providing the patch. Fixes Bugzilla #4021. - -Wed May 16 06:44:23 UTC 2012 Johnny Willemsen - - * tests/run_test.lst: - * tests/tests.mpc: - * tests/Bug_4008_Regression_Test.cpp: - Removed bug 4008 test, it was testing incorrect assumptions - -Wed May 16 06:42:45 UTC 2012 Johnny Willemsen - - * ace/Basic_Types.h: - * ace/Basic_Types.cpp: - * ace/Functor.inl: - * ace/High_Res_Timer.inl: - * ace/OS_NS_time.h: - * ace/OS_NS_time.inl: - * tests/Basic_Types_Test.cpp: - * tests/Bug_2434_Regression_Test.cpp: - * tests/Time_Value_Test.cpp: - More cleanup due to removal of NSK - - * ace/Basic_Types.inl: - Removed this file. - -Tue May 15 18:16:09 UTC 2012 Johnny Willemsen - - * ace/ACE.inl: - * ace/Atomic_Op_T.h: - * ace/Basic_Types.h: - * ace/Basic_Types.inl: - * ace/Basic_Types.cpp: - * ace/CDR_Base.h: - * ace/Functor.h: - * ace/Functor.inl: - * ace/Handle_Set.cpp: - * ace/High_Res_Timer.cpp: - * ace/Log_Msg.cpp: - * ace/Numeric_Limits.h: - * ace/OS_NS_Thread.inl: - * ace/OS_NS_Thread.cpp: - * ace/OS_NS_stdlib.inl: - * ace/OS_NS_sys_select.inl: - * ace/OS_NS_sys_wait.inl: - * ace/OS_NS_time.h: - * ace/OS_NS_time.inl: - * ace/OS_NS_unistd.inl: - * ace/Profile_Timer.cpp: - * ace/Sched_Params.cpp: - * ace/Stats.cpp: - * ace/Task.cpp: - * ace/Throughput_Stats.cpp: - * ace/Time_Value.h: - * ace/Time_Value.inl: - * ace/Truncate.h: - * ace/UUID.cpp: - * ace/os_include/os_pthread.h: - * performance-tests/Server_Concurrency/Latency_Stats.h: - * performance-tests/Server_Concurrency/Leader_Follower/leader_follower.cpp: - * performance-tests/Server_Concurrency/Queue_Based_Workers/workers.cpp: - * performance-tests/UDP/udp_test.cpp: - * tests/Atomic_Op_Test.cpp: - * tests/Basic_Types_Test.cpp: - * tests/CDR_Array_Test.cpp: - Removed support for Tandem NSK. That was the last platform that - needed the emulated versions of ACE_INT64 and ACE_UINT64, that - emulation has now been removed - - * ace/config-tandem-nsk-mips-v2.h: - * ace/config-tandem-nsk-mips-v3.h: - Removed these files. - -Mon May 14 18:48:14 UTC 2012 Johnny Willemsen - - * performance-tests/Server_Concurrency/Latency_Stats.h: - Fixed conversion warnings - -Sun May 13 17:13:31 UTC 2012 Johnny Willemsen - - * ace/Sample_History.h: - * ace/Sample_History.inl: - * ace/Sample_History.cpp: - Introduced scale_factor_type traits to handle the fact that the - ACE HighResTimer scale factor is now ACE_UINT64 - -Sun May 13 12:27:03 UTC 2012 Johnny Willemsen - - * ace/High_Res_Timer.h: - Fixed typo - - * ace/Basic_Stats.h: - * ace/Basic_Stats.cpp: - * ace/Throughput_Stats.h: - * ace/Throughput_Stats.cpp: - Introduced scale_factor_type traits to handle the fact that the - ACE HighResTimer scale factor is now ACE_UINT64 - - * ace/Timeprobe_T.cpp: - Use correct trait for the scale factor - - * performance-tests/RPC/client.cpp: - * performance-tests/SCTP/SOCK_SEQPACK_clt.cpp: - * performance-tests/SCTP/SOCK_STREAM_clt.cpp: - * performance-tests/Server_Concurrency/Latency_Stats.h: - * performance-tests/TCP/tcp_test.cpp: - Use ACE_High_Res_Timer::global_scale_factor_type - -Sat May 12 11:11:45 UTC 2012 Johnny Willemsen - - * ace/Time_Value.h: - * ace/Time_Value.cpp: - None of the windows compilers define ACE_LACKS_LONGLONG_T - - * ace/High_Res_Timer.h: - * ace/High_Res_Timer.inl: - * ace/High_Res_Timer.cpp: - Integrated patches from bugzilla 3703 increasing the precision - of the high resolution timers on windows - -Sat May 12 11:03:57 UTC 2012 Johnny Willemsen - - * ASNMP/asnmp/transaction.cpp: - * Kokyu/Dispatch_Deferrer.cpp: - Compare return value of schedule_timer with -1 - - * ace/OS_NS_time.h: - None of the windows compilers define ACE_LACKS_LONGLONG_T - - * bin/PerlACE/TestTarget_WinCE.pm: - Typo fix - -Sat May 12 11:01:50 UTC 2012 Johnny Willemsen - - * ace/config-win32-common.h: - None of the windows compilers define ACE_LACKS_LONGLONG_T - -Sat May 12 10:54:24 UTC 2012 Johnny Willemsen - - * ace/Numeric_Limits.h: - Fixed typo - -Fri May 11 17:42:08 UTC 2012 Steve Huston - - * ace/Dev_Poll_Reactor.cpp (mask_ops_i): Return -1 if epoll_ctl - fails and we don't recover from it. Fixes Bugzilla #4019. Thanks - to David Simmonds for this fix. - -Fri May 4 17:25:53 UTC 2012 Johnny Willemsen - - * ace/Acceptor.cpp: - Fixed incorrect check of the return value of schedule_timer, - an error is indicated with -1, not 0. Thanks to Deux deVille - for reporting this - -Thu May 3 07:15:54 UTC 2012 Johnny Willemsen - - * tests/Bug_3673_Regression_Test.cpp: - Fixed typo - -Wed May 2 18:36:25 UTC 2012 Johnny Willemsen - - * ace/OS_NS_math.h: - Fixed compile warning with WinCE - -Wed May 2 17:08:28 UTC 2012 Jeff Parsons - - * THANKS: - - Added Markus Manck - -Tue May 1 17:38:13 UTC 2012 Johnny Willemsen - - * bin/msvc_mpc_auto_compile.pl: - Added -project_root to override $ACE_ROOT as root to search for - solutions. This is needed when using this script in a flat directory - layout - -Tue May 1 12:52:45 UTC 2012 Johnny Willemsen - - * ace/OS_NS_sys_time.cpp: - * ace/config-win32-msvc-10.h: - * ace/config-win32-msvc-8.h: - * ace/config-win32-msvc-9.h: - WinCE also has non conformant timeval. When _USE_32BIT_TIME_T is not - defined we have to use our workaround in all cases - -Tue May 1 11:42:22 UTC 2012 Johnny Willemsen - - * ace/os_include/sys/os_stat.h: - Fixed compile error - -Tue May 1 10:25:37 UTC 2012 Johnny Willemsen - - * ace/os_include/sys/os_stat.h: - Compile fix for WinCE 7 - -Tue May 1 07:48:30 UTC 2012 Johnny Willemsen - - * ace/Mem_Map.cpp: - Layout changes - - * ace/config-win32-msvc-9.h: - Removed wince comment - -Sun Apr 29 19:17:29 UTC 2012 Johnny Willemsen - - * bin/msvc_mpc_auto_compile.pl: - More improvements to this script - -Sun Apr 29 19:01:08 UTC 2012 Johnny Willemsen - - * bin/msvc_mpc_auto_compile.pl: - Support flat layout - -Fri Apr 27 18:43:31 UTC 2012 Johnny Willemsen - - * bin/msvc_mpc_auto_compile.pl: - Corrected output messages - -Fri Apr 27 18:40:51 UTC 2012 Johnny Willemsen - - * ace/OS_NS_time.h: - * ace/config-win32-msvc-9.h: - First fixes for WinCE 7 - -Wed Apr 25 07:02:16 UTC 2012 Johnny Willemsen - - * ace/Get_Opt.cpp: - Reverted Wed Apr 18 08:51:31 UTC 2012 Martin Corino - -Tue Apr 24 01:18:27 UTC 2012 Douglas C. Schmidt - - * ace/String_Base.h (template): Zapped the 'explicit' keywords - introduced by the change in - - Tue Apr 17 19:09:30 UTC 2012 Douglas C. Schmidt - - since it was breaking too much code. - -Wed Apr 18 08:51:31 UTC 2012 Martin Corino - - * ace/String_Base.h: - Reverted 'explicit' declaration for single arg constructor for - const ACE_TCHAR* as implicit conversion of this arg type to - ACE string class is the expected behaviour (similar to the - STL std::string). - - * ace/Get_Opt.cpp: - Introduced explicit ACE_CString constructor call for single - arg ACE_TCHAR (not pointer) constructor. - -Wed Apr 18 06:31:56 UTC 2012 Johnny Willemsen - - * ace/Future.cpp: - Fixed commented out guard. Thanks to Andreas Dröscher - for reporting this. - -Tue Apr 17 19:09:30 UTC 2012 Douglas C. Schmidt - - * ace/String_Base.h: Made the single parameter constructors - explicit to avoid problems with implict conversions. Thanks to - Adam Rymarczuk for - reporting this. - -Thu Apr 12 11:25:25 UTC 2012 Johnny Willemsen - - * include/makeinclude/platform_linux_icc.GNU: - Added support for c++0x - -Tue Apr 10 20:09:23 UTC 2012 Douglas C. Schmidt - - * ace/Dev_Poll_Reactor.cpp (ACE_Dev_Poll_Reactor::resumable_handler): - Changed this method to return 1 instead of 0. Thanks to David - Simmonds for providing - this fix. This fixes bugid 4015. - - Added David to the ACE hall of fame. - -Tue Apr 10 20:10:06 UTC 2012 Adam Mitz - - * bin/MakeProjectCreator/templates/gnu.mpd: - - Install the Inline_Files even with inline=0. Many of these files - are still needed, especially *_T.inl. This resolves bug #4002. - -Mon Apr 9 21:57:39 UTC 2012 Steve Huston - - * ace/Timer_Queue_T.cpp (calculate_timeout): Lock the mutex before - accessing timer queue elements to calculate the timeout. Thanks to - Kannan Ramaswamy for this fix. - -Sun Apr 8 14:25:23 UTC 2012 Phil Mesnier - - * ace/ace.mpc: - - Move ace_wchar.inl to the header section so that it is always - installed even when the library is built with inline=0. This is - required because ace_wchar is always inlined. - -Fri Apr 6 11:58:40 UTC 2012 Johnny Willemsen - - * docs/Download.html: - Added another rpm - -Fri Apr 6 10:48:03 UTC 2012 Johnny Willemsen - - * NEWS: - * bin/diff-builds-and-group-fixed-tests-only.sh: - * docs/Download.html: - * docs/bczar/bczar.html: - * etc/index.html: - Updated for next release - -Fri Apr 06 09:03:19 CEST 2012 Johnny Willemsen - - * ACE version 6.1.1 released. - -Tue Apr 3 22:49:11 UTC 2012 Steve Huston - - * ace/SOCK_Dgram_Mcast.cpp (subscribe_ifs): Set the error code when - a Windows API call fails. Also, when calling GetAdaptersAddresses() - to both check size and get the info, supply GAA_FLAG_SKIP_MULTICAST - as the flag value. This avoids obtaining info for joined multicast - addresses, not multicastable interfaces. Without the flag, and if - some other process does a join between the size-check call and the - info-gathering call, the size will be wrong. - -Tue Apr 3 17:01:33 UTC 2012 Jeff Parsons - - * THANKS: - - Added Thomas Stegemann . - -Tue Apr 3 16:18:35 UTC 2012 Douglas C. Schmidt - - * ace/ACE.cpp (ACE::timestamp): Fixed an "off-by-one" error that - caused corruption of timestamps when using - ACE_LOG_TIMESTAMP="TIME" env var. Thanks to Andrea Sormanni - for reporting this and - providing a fix. - - Added Andrea to the Hall of Fame! - -Fri Mar 30 14:33:58 UTC 2012 Steve Huston - - * examples/C++NPv1/Process_Per_Connection_Logging_Server.cpp: Changed - use of ::sscanf_s() to only those platforms with the setting - ACE_HAS_TR24731_2005_CRT (VC8 and up). - -Fri Mar 30 13:39:25 UTC 2012 Adam Mitz - - * include/makeinclude/platform_win32_msvc.GNU: - - Added iphlpapi to the list of system libraries. - -Thu Mar 29 21:50:17 UTC 2012 Adam Mitz - - * bin/MakeProjectCreator/templates/gnu.mpd: - - Postbuild steps need a dependency on the executable or library - so that parallel make will run them at the right time. - -Wed Mar 28 22:03:45 UTC 2012 Steve Huston - - * examples/C++NPv1/Process_Per_Connection_Logging_Server.cpp: Changed - the +H handle value scan to know this is a hex value on Windows, but - a decimal value on everything else. Thanks to Andy Gokhale for this. - -Wed Mar 28 21:44:20 UTC 2012 Steve Huston - - * tests/Multicast_Test.cpp: Removed the forced set_nic to "lo" for - Linux. It's not needed with the changes from: - Wed Mar 21 21:57:40 UTC 2012 Steve Huston - -Mon Mar 26 11:27:11 UTC 2012 Johnny Willemsen - - * include/makeinclude/platform_mingw32.GNU: - Added iphlpapi - -Sat Mar 24 21:53:13 UTC 2012 Steve Huston - - * ace/SOCK_Dgram_Mcast.cpp (subscribe_ifs): For Windows, handle IPv6 - and IPv4 differently. The make_multicast_ifaddr() call that will end - up being made for IPv4 wants the interface's IP address, not name. - - * bin/MakeProjectCreator/config/acedefaults.mpb: - * bin/MakeProjectCreator/config/ipv6.mpb: Moved the lit_lib for iphlpapi - on Windows from the IPv6 base to acedefaults. SOCK_Dgram_Mcast.cpp - uses it for both IPv4 and IPv6 now. - -Fri Mar 23 22:06:11 UTC 2012 Steve Huston - - * ace/WIN32_Asynch_IO.cpp: Fixed possible heap corruption in - ACE_SOCK_Dgram_Read_Dgram::recv(). Thank you to - Dmytro Ovdiienko for unconvering this. - - * THANKS: Added Dmytro to the Hall of Fame. - -Thu Mar 22 16:23:14 UTC 2012 Steve Huston - - * ace/SOCK_Dgram_Mcast.h: Corrected the description of conditions - under which using OPT_NULLIFACE_ALL works and neatened things up. - - * tests/Multicast_Test.cpp: Turn on IP_MULTICAST_LOOP all the time. - This test requires it and it's not universally the default. - -Thu Mar 22 13:03:46 UTC 2012 Johnny Willemsen - - * ace/ARGV.cpp: - * ace/Acceptor.cpp: - * ace/Asynch_Acceptor.cpp: - * ace/Cached_Connect_Strategy_T.cpp: - * ace/Lib_Find.cpp: - * ace/Strategies_T.cpp: - * ace/Timer_Heap_T.cpp: - Fixed coverity errors - -Wed Mar 21 21:57:40 UTC 2012 Steve Huston - - * ace/SOCK_Dgram_Mcast.cpp (subscribe_ifs): Expanded the use of - code to scan interfaces to be always, not just for IPv6, when - subscribing with OPT_NULLIFACE_ALL and no specific interface. - Also replaced use of ACE_OS::if_nameindex with getifaddr() when - it's available (which was only on Linux anyway) so checks - for interface up and multicastable can be made before joining. - The code now works for systems with ACE_HAS_GETIFDADDR (incl. - Linux, which was my main issue driving this) and Win32. The others - end up in the old get_ip_interfaces code which will never work - anywhere as far as I can tell because it tries to subscribe to an - interface named with the IP address in string form. - - * tests/Multicast_Test.cpp: Removed hack force of interface "lo0" - on join(). No need for that with the fix above. For background, this - was added at: - Thu Jan 21 15:25:30 UTC 2010 Martin Corino - - * ace/Sock_Connect.cpp (get_ip_interfaces_getifaddr): Will no longer - return an interface marked 'down'. Partially fixes Bugzilla #1990 - but other platform-specific changes are needed to resolve it - completely. - -Sat Mar 17 12:16:15 UTC 2012 Johnny Willemsen - - * docs/Download.html: - Added link to the mailing lists with an advice for people to subscribe - -Sat Mar 17 12:11:15 UTC 2012 Johnny Willemsen - - * bin/cleanbuilds.sh: - * bin/diff-builds.pl: - Updated teststat links - -Wed Mar 14 10:04:06 UTC 2012 Johnny Willemsen - - * docs/Download.html: - Added link to ORBZone as community site for CORBA/CCM - - * tests/run_test.lst: - Mark 4008 as not fixed - -Tue Mar 13 11:24:33 UTC 2012 Johnny Willemsen - - * ace/Service_Gestalt.cpp: - Reverted change below, breaks Missing_Svc_Conf_Test test - -Tue Mar 13 09:36:18 UTC 2012 Johnny Willemsen - - * ace/Service_Gestalt.cpp: - Fixed bugzilla 4008, thanks to Derek Dominish - for - creating the fix - -Tue Mar 13 09:29:56 UTC 2012 Johnny Willemsen - - * tests/Bug_4008_Regression_Test.cpp: - * tests/run_test.lst: - * tests/tests.mpc: - New test for bugzilla 4008. Thanks to Derek Dominish - for - creating this test - -Mon Mar 12 20:22:17 UTC 2012 Adam Mitz - - * include/makeinclude/rules.local.GNU: - - Revert this part of Friday's change, with a comment added - to describe why this use of 'pwd' is different. - -Fri Mar 9 20:38:22 UTC 2012 Adam Mitz - - * include/makeinclude/rules.lib.GNU: - - When creating an archive library, use all object files instead of - just modified object files. This fixes a bug that can occur when - two different subdirectories have objects files with the same name. - The archive dosn't track directory names so "replacing" one changed - object could actually be clobbering another one. - - * include/makeinclude/rules.local.GNU: - - Use the $(PWD) make variable for current directory. - -Wed Mar 7 14:58:07 UTC 2012 Johnny Willemsen - - * docs/Download.html: - Added new download link for latest minor with versioned namespaces - -Wed Mar 7 14:37:18 UTC 2012 Johnny Willemsen - - * rpmbuild/ace-tao.spec: - Fix for ppc64 - -Wed Mar 7 13:31:58 UTC 2012 Johnny Willemsen - - * ace/Base_Thread_Adapter.h: - * ace/Base_Thread_Adapter.cpp: - * ace/ETCL/ETCL_Constraint.inl: - * ace/Module.cpp: - * ace/Stream.cpp: - * ace/Thread_Manager.h: - * ace/Timer_Hash_T.cpp: - Fixed coverity errors - -Wed Mar 7 10:55:28 UTC 2012 Johnny Willemsen - - * rpmbuild/ace-tao.spec: - Added new libraries - -Wed Mar 7 10:02:49 UTC 2012 Johnny Willemsen - - * NEWS: - * bin/diff-builds-and-group-fixed-tests-only.sh: - * docs/Download.html: - * docs/bczar/bczar.html: - * etc/index.html: - Updated for release - -Wed Mar 07 09:04:40 CET 2012 Johnny Willemsen - - * ACE version 6.1.0 released. - -Sat Mar 3 20:48:15 UTC 2012 Johnny Willemsen - - * ace/Thread_Manager.cpp: - Coverity fix - -Sat Mar 3 20:45:30 UTC 2012 Johnny Willemsen - - * ace/Event_Handler_Handle_Timeout_Upcall.cpp: - Coverity fix - -Sat Mar 3 20:22:09 UTC 2012 Johnny Willemsen - - * ace/Compression/rle/RLECompressor.h: - Fixed export macro - -Fri Mar 2 12:41:21 UTC 2012 Johnny Willemsen - - * ace/Compression/rle/RLECompressor.h: - Fixed export macro - -Wed Feb 29 16:30:00 UTC 2012 Simon Massey - - * ace/CDR_Stream.cpp: - Allow strings to be indirected (required for ValueType RepoIDs). - -Wed Feb 29 07:25:21 UTC 2012 Johnny Willemsen - - * ace/Handle_Set.cpp: - * ace/Select_Reactor_Base.cpp: - * ace/Service_Types.cpp: - Fixed coverity errors - -Tue Feb 28 14:35:36 UTC 2012 Johnny Willemsen - - * ace/Process.cpp: - Fixed coverity error - -Tue Feb 28 03:27:28 UTC 2012 Douglas C. Schmidt - - * - apps/JAWS3/jaws3/Reactive_IO.cpp (JAWS_IO_Reactive_Transmit::handle_output_source): - Check mb == 0 before using it. Thanks to Andrey Karpov for reporting this. - -Tue Feb 28 03:18:56 UTC 2012 Douglas C. Schmidt - - * ace/Throughput_Stats.cpp (ACE_Throughput_Stats::sample): Zapped - a redundant else statement. Thanks to Andrey Karpov for reporting this. - -Tue Feb 28 03:15:37 UTC 2012 Douglas C. Schmidt - - * protocols/ace/INet/URLBase.cpp (ACE): Changed - - if (pos > 0 && url_string[pos+1] == '/' && url_string[pos+1] == '/') - - to - - if (pos > 0 && url_string[pos+1] == '/' && url_string[pos+2] == '/') - - Thanks to Andrey Karpov for reporting - this. - -Mon Feb 27 08:11:06 UTC 2012 Johnny Willemsen - - * ace/Compression/rle/RLECompressor.h: - Doxygen fix - - * ace/Compression/rle/RLECompressor.cpp: - Fixed gcc warning - -Fri Feb 24 09:19:40 UTC 2012 Johnny Willemsen - - * ace/Compression/Compressor.h: - Fixed compile warning - -Fri Feb 24 09:14:22 UTC 2012 Johnny Willemsen - - * ace/Compression/Compressor.h: - * ace/Compression/Compressor.cpp: - * ace/Compression/rle/RLECompressor.h: - * ace/Compression/rle/RLECompressor.cpp: - Added virtual destructors - -Fri Feb 24 08:45:08 UTC 2012 Johnny Willemsen - - * ace/Compression/ACE_Compression.mpc: - * ace/Compression/rle/ACE_RLECompression.mpc: - Fixed id and install problems - - * bin/fuzz.pl: - Extended check for incorrect id tags - -Thu Feb 23 08:20:56 UTC 2012 Johnny Willemsen - - * ace/Compression/Compressor.h: - * ace/Compression/rle/RLECompressor.h: - * bin/MakeProjectCreator/config/ace_compressionlib.mpb: - * bin/MakeProjectCreator/config/ace_rlecompressionlib.mpb: - Fuzz fixes - -Thu Feb 23 07:52:58 UTC 2012 Johnny Willemsen - - * ace/Compression: - * ace/Compression/ACE_Compression.mpc: - * ace/Compression/ACE_Compression_export.h: - * ace/Compression/Compressor.h: - * ace/Compression/Compressor.inl: - * ace/Compression/Compressor.cpp: - * ace/Compression/rle: - * ace/Compression/rle/ACE_RLECompression.mpc: - * ace/Compression/rle/ACE_RLECompression_export.h: - * ace/Compression/rle/RLECompressor.h: - * ace/Compression/rle/RLECompressor.cpp: - * bin/MakeProjectCreator/config/ace_compressionlib.mpb: - * bin/MakeProjectCreator/config/ace_rlecompressionlib.mpb: - Added new ACE compression and rle compressor libraries. This code - was first part of TAO, but now moved to ACE because it provides - a basic run length encoding compressor that makes it possible to - compress data without depending on any external library - - * docs/bczar/bczar.html: - Added package - -Tue Feb 21 14:52:02 UTC 2012 Adam Mitz - - * ace/OS_NS_Thread.inl: - * ace/config-vxworks6.9.h: - - Fixed errors from fuzz script. - -Tue Feb 21 14:37:47 UTC 2012 Johnny Willemsen - - * PROBLEM-REPORT-FORM: - Removed build method question - -Fri Feb 17 23:10:37 UTC 2012 Adam Mitz - - * NEWS: - * ace/Message_Queue_T.cpp: - * ace/Message_Queue_Vx.cpp: - * ace/OS_NS_Thread.inl: - * ace/OS_NS_arpa_inet.cpp: - * ace/OS_NS_unistd.inl: - * ace/Stack_Trace.cpp: - * ace/config-vxworks.h: - * ace/config-vxworks6.9.h: - * ace/os_include/sys/os_types.h: - * include/makeinclude/platform_vxworks.GNU: - * include/makeinclude/platform_vxworks6.9.GNU: - * tests/Bug_3943_Regression_Test.cpp: - - Added support for VxWorks version 6.9. - -Tue Feb 14 22:57:00 UTC 2012 William R. Otte - - * ace/ACE.cpp: - * ace/Dev_Poll_Reactor.cpp: - * ace/Handle_Set.cpp: - * ace/High_Res_Timer.h: - * ace/High_Res_Timer.cpp: - * ace/INET_Addr.h: - * ace/INET_Addr.cpp: - * ace/Monitor_Control/Bytes_Received_Monitor.h: - * ace/Monitor_Control/Bytes_Received_Monitor.cpp: - * ace/Monitor_Control/Bytes_Sent_Monitor.h: - * ace/Monitor_Control/Bytes_Sent_Monitor.cpp: - * ace/Monitor_Control/CPU_Load_Monitor.h: - * ace/Monitor_Control/CPU_Load_Monitor.cpp: - * ace/Monitor_Control/Linux_Network_Interface_Monitor.h: - * ace/Monitor_Control/Linux_Network_Interface_Monitor.cpp: - * ace/Monitor_Control/Num_Threads_Monitor.h: - * ace/Monitor_Control/Num_Threads_Monitor.cpp: - * ace/Monitor_Control/Packets_Received_Monitor.h: - * ace/Monitor_Control/Packets_Received_Monitor.cpp: - * ace/Monitor_Control/Packets_Sent_Monitor.h: - * ace/Monitor_Control/Packets_Sent_Monitor.cpp: - * ace/OS_NS_netdb.cpp: - * ace/OS_NS_sys_socket.h: - * ace/OS_NS_sys_socket.inl: - * ace/OS_NS_time.inl: - * ace/OS_NS_unistd.inl: - * ace/SOCK_Dgram.cpp: - * ace/SOCK_Dgram_Mcast.cpp: - * ace/Select_Reactor_T.cpp: - * ace/config-linux.h: - * ace/os_include/os_pthread.h: - * apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/systems.h: - * examples/APG/Signals/SigInfo.cpp: - * tests/INET_Addr_Test_IPV6.cpp: - * tests/MT_Reference_Counted_Event_Handler_Test.cpp: - * tests/Malloc_Test.cpp: - * tests/Multicast_Test.cpp: - * tests/Naming_Test.cpp: - * tests/Proactor_Test.cpp: - * tests/Proactor_Test_IPV6.cpp: - * tests/Proactor_UDP_Test.cpp: - * tests/Process_Test.cpp: - * tests/SSL/Bug_2912_Regression_Test.cpp: - - Created a new macro, ACE_LINUX, which replaces all non-standard - tests for linux, __linux, and __linux__. - -Mon Feb 13 16:38:15 UTC 2012 Adam Mitz - - * include/makeinclude/platform_gnuwin32_common.GNU: - - Set DCCFLAGS and OCCFLAGS to get debug=X and optimize=X to work. - -Tue Feb 7 12:56:41 UTC 2012 Johnny Willemsen - - * ace/XtReactor/XtReactor.cpp: - Use C++ cast to silence warning - -Tue Jan 31 20:19:16 UTC 2012 Johnny Willemsen - - * examples/Web_Crawler/Iterators.cpp: - * performance-tests/Misc/context_switch_time.cpp: - Fixed gcc 4.7 warning - -Tue Jan 31 20:17:35 UTC 2012 Johnny Willemsen - - * examples/IPC_SAP/SOCK_SAP/CPP-memclient.cpp: - Fixed gcc 4.7 warning - -Mon Jan 30 09:48:00 UTC 2012 Simon Massey - - * ace/Default_Constants.h: - Redefined ACE_MAX_UDP_PACKET_SIZE to 65507 bytes. The actual field size - sets a theoretical limit of 65,535 bytes (so 65536 was completly wrong) - which is composed of 8 byte header +65,527 bytes of data for a UDP datagram. - However the practical limit for the data length which is imposed by the - underlying IPv4 protocol is only 65,507 bytes (65507 bytes of data +8 bytes - UDP header +20 bytes IP header). - -Fri Jan 27 09:39:57 UTC 2012 Johnny Willemsen - - * ace/FlReactor/FlReactor.cpp: - Const change - - * bin/valgrind.supp: - Added another suppress - -Fri Jan 27 09:01:51 UTC 2012 Johnny Willemsen - - * NEWS: - * bin/diff-builds-and-group-fixed-tests-only.sh: - * bin/make_release.py: - * docs/Download.html: - * docs/bczar/bczar.html: - * etc/index.html: - Updated for next release - -Fri Jan 27 08:58:54 CET 2012 Johnny Willemsen - - * ACE version 6.0.8 released. - -Thu Jan 26 20:38:47 UTC 2012 Phil Mesnier - - * ace/Condition_T.cpp: - - In order to allow building with inlining on MacOSX Lion, - Condition_T.cpp needs to explicitly include Time_Value.h. In many - cases, Time_Value.h was being incidentally included, such as - through Atomic_Op_GCC_T.cpp, but that is specifically excluded for - Lion builds using the clang compiler. - -Tue Jan 24 16:44:22 UTC 2012 Chip Jones - - * NEWS: - Added information about IDL dependency generation. - -Tue Jan 24 15:26:24 UTC 2012 Johnny Willemsen - - * bin/MakeProjectCreator/config/conv_lib.mpb: - Fixed cleanup bug - -Tue Jan 24 14:40:00 UTC 2012 Johnny Willemsen - - * bin/fuzz.pl: - Can't check mpc files, when they contain gnuace specific stuff they - need tabs - -Tue Jan 24 14:29:18 UTC 2012 Johnny Willemsen - - * bin/fuzz.pl: - Fixed problem - -Tue Jan 24 13:52:20 UTC 2012 Johnny Willemsen - - * bin/fuzz.pl: - Also check mpc files for tabs - -Tue Jan 24 13:48:49 UTC 2012 Johnny Willemsen - - * apps/JAWS2/HTTPU/httpu.mpc: - * apps/JAWS2/JAWS/jaws2.mpc: - * apps/JAWS3/jaws3/jaws3.mpc: - * apps/gperf/tests/gperf_test.mpb: - * bin/MakeProjectCreator/config/ace_bzip2.mpb: - * bin/MakeProjectCreator/config/ace_fl.mpb: - * bin/MakeProjectCreator/config/ace_fox.mpb: - * bin/MakeProjectCreator/config/ace_openssl.mpb: - * bin/MakeProjectCreator/config/ace_output.mpb: - * bin/MakeProjectCreator/config/ace_qt.mpb: - * bin/MakeProjectCreator/config/ace_tk.mpb: - * bin/MakeProjectCreator/config/ace_x11.mpb: - * bin/MakeProjectCreator/config/ace_xt.mpb: - * bin/MakeProjectCreator/config/ace_zlib.mpb: - * bin/MakeProjectCreator/config/ace_zzip.mpb: - * bin/MakeProjectCreator/config/acedefaults.mpb: - * bin/MakeProjectCreator/config/conv_lib.mpb: - * bin/MakeProjectCreator/config/wxwindows.mpb: - * netsvcs/servers/servers.mpc: - * performance-tests/Synch-Benchmarks/Base_Test/Synch_Benchmarks_Base_Test.mpc: - * performance-tests/Synch-Benchmarks/Perf_Test/Synch_Benchmarks_Perf_Test.mpc: - * tests/tests.mpc: - Removed left over from automake removal - -Tue Jan 24 13:31:49 UTC 2012 Johnny Willemsen - - * examples/Reactor/WFMO_Reactor/Network_Events.cpp: - Fixed gcc warning - -Mon Jan 23 20:21:50 UTC 2012 Johnny Willemsen - - * bin/MakeProjectCreator/templates/gnu.mpd: - Fixed support for idl3toxmi and idl3toidl2 flags - -Mon Jan 23 12:02:07 UTC 2012 Johnny Willemsen - - * bin/MakeProjectCreator/templates/gnu.mpd: - Added support for idl3toxmi and idl3toidl2 flags - -Sun Jan 22 19:41:27 UTC 2012 Johnny Willemsen - - * examples/Reactor/WFMO_Reactor/APC.cpp: - * examples/Reactor/WFMO_Reactor/Abandoned.cpp: - * examples/Reactor/WFMO_Reactor/Directory_Changes.cpp: - * examples/Reactor/WFMO_Reactor/Handle_Close.cpp: - * examples/Reactor/WFMO_Reactor/Network_Events.cpp: - * examples/Reactor/WFMO_Reactor/Prerun_State_Changes.cpp: - * examples/Reactor/WFMO_Reactor/Registration.cpp: - * examples/Reactor/WFMO_Reactor/Registry_Changes.cpp: - * examples/Reactor/WFMO_Reactor/Suspended_Removals.cpp: - * examples/Reactor/WFMO_Reactor/Talker.cpp: - * examples/Reactor/WFMO_Reactor/Window_Messages.cpp: - Fixed GCC 4.6.2 release warnings - -Sun Jan 22 12:35:11 UTC 2012 Johnny Willemsen - - * bin/make_release.py: - Use the new MPC -workers option to speedup the release process - -Fri Jan 20 19:30:51 UTC 2012 Johnny Willemsen - - * examples/APG/Processes/Process_Mutex.cpp: - Use ACE_TEST_ASSERT instead of ACE_ASSERT to fix warnings in gcc 4.6 - release builds - -Fri Jan 20 19:06:02 UTC 2012 Johnny Willemsen - - * examples/APG/Containers/Allocator.cpp: - * examples/Reactor/Misc/test_timer_queue.cpp: - Use ACE_TEST_ASSERT instead of ACE_ASSERT to fix warnings in gcc 4.6 - release builds - -Wed Jan 18 09:02:18 UTC 2012 Martin Corino - - * bin/fuzz.pl: - Added suppress option to selectively disable checks. - -Tue Jan 17 17:36:31 UTC 2012 Chip Jones - - * include/makeinclude/rules.local.GNU: - Fixed 'no filename for -include' warning. - -Mon Jan 16 21:58:44 UTC 2012 Chip Jones - - * bin/DependencyGenerator/GNUIDLDependencyWriter.pm: - * bin/DependencyGenerator/GNUIDLObjectGenerator.pm: - * bin/MakeProjectCreator/config/ace_idl_dependencies.mpb: - - Added these files to support generation of IDL dependencies - for gnuace projects. - - * bin/MakeProjectCreator/config/acedefaults.mpb: - * bin/MakeProjectCreator/config/global.features: - - Added IDL dependency as a feature defaulted to off. - - * bin/MakeProjectCreator/templates/gnu.mpd: - - Modified gnuace template to generate IDL dependency rules. - - * include/makeinclude/rules.common.GNU: - * include/makeinclude/rules.local.GNU: - * include/makeinclude/wrapper_macros.GNU: - - Added depend_idl.local rule. - - This is a merge of work done in the 'ace-mpc_performance' - branch. - -Mon Jan 16 10:33:37 UTC 2012 Martin Corino - - * ace/config-win32-common.h: - * ace/config-win32-mingw.h: - Moved MinGW specific block to common because the macros - it concerns are tested there already. - -Mon Jan 16 09:01:20 UTC 2012 Martin Corino - - * ace/config-win32-mingw.h: - Fixed incorrectly placed macro test. - -Sun Jan 15 19:15:48 UTC 2012 Martin Corino - - * ace/config-win32-mingw.h: - Add some customizations and corrections to support using - --std=c++0x with MinGW32. - -Fri Jan 13 23:25:59 UTC 2012 Jeff Parsons - - * THANKS: - - Added Michael Frommberger - -Wed Jan 11 20:43:47 UTC 2012 Martin Corino - - * ace/config-freebsd.h: - * ace/config-win32-common.h: - * ace/config-win32-mingw.h: - * ace/os_include/os_signal.h: - Added ACE_LACKS_SIGSET_T to be able to distinguish between the - type and the functions being provided or not. - -Wed Jan 11 18:43:50 UTC 2012 Martin Corino - - * ace/config-win32-mingw.h: - Fixed typo. - -Wed Jan 11 15:41:00 UTC 2012 Simon Massey - - * ace/config-sunos5.10.h: - Is supposed to define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII and ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII - correctly for this platform. The old logic was "If already defined - redefine, but if not - defined don't define" and wrong. The point of providing the definition of these SIZE_T format - specifiers is to provide them if they are not set. - -Wed Jan 11 14:36:43 UTC 2012 Martin Corino - - * ace/config-win32-mingw.h: - * ace/os_include/os_signal.h: - Changes to support MinGW64 compiler. - -Mon Jan 9 11:07:54 UTC 2012 Johnny Willemsen - - * ace/Netlink_Addr.h: - * ace/Notification_Queue.h: - Doxygen fixes - - * tests/run_test.lst: - Removed several old config labels - -Fri Jan 6 11:16:03 UTC 2012 Johnny Willemsen - - * html/Stats/configuration.shtml: - * html/Stats/index.shtml: - * html/Stats/simple_footprint.shtml: - Extended data to be shown and updated links - -Fri Jan 6 10:28:35 UTC 2012 Johnny Willemsen - - * ace/Stream.cpp: - Fixed coverity errors - -Wed Jan 4 13:02:12 UTC 2012 Johnny Willemsen - - * bin/generate_compile_stats.sh: - Added link for DAnCE - -Wed Jan 4 11:45:43 UTC 2012 Johnny Willemsen - - * html/Stats/index.shtml: - Fixed link - -Wed Jan 4 11:42:13 UTC 2012 Johnny Willemsen - - * bin/generate_compile_stats.sh: - Work with flat layout and added DAnCE - -Wed Jan 4 11:06:50 UTC 2012 Johnny Willemsen - - * bin/generate_compile_stats.sh: - Updated title to include DAnCE - -Wed Jan 4 08:50:18 UTC 2012 Johnny Willemsen - - * bin/cleanbuilds.sh: - * bin/mail_test_stats.sh: - Accept date and email as arguments - -Tue Jan 3 18:47:23 UTC 2012 Johnny Willemsen - - * bin/performance_stats.sh: - * bin/topinfo_iorsize_stats.sh: - * bin/topinfo_simple_stats.sh: - * bin/topinfo_stats.sh: - Assume ACE_ROOT is set before running the script, simplified the usage - -Tue Jan 3 18:34:18 UTC 2012 Johnny Willemsen - - * bin/valgrind.supp: - Added default suppress file that can be used for valgrind when using - valgrind for ACE/TAO/CIAO/DAnCE - - * docs/bczar/bczar.html: - Added package - -Tue Jan 3 13:51:18 UTC 2012 Johnny Willemsen - - * bin/performance_stats.sh: - Create source directory - -Tue Jan 3 12:52:04 UTC 2012 Johnny Willemsen - - * bin/performance_stats.sh: - * bin/topinfo_iorsize_stats.sh: - * bin/topinfo_simple_stats.sh: - * bin/topinfo_stats.sh: - * bin/footprint_stats.sh: - Converting them to support a flat layout - -Tue Jan 3 12:40:43 UTC 2012 Johnny Willemsen - - * html/Stats/detailed_footprint.shtml: - * html/Stats/detailed_performance.shtml: - * html/Stats/footer.html: - * html/Stats/index.shtml: - * html/Stats/navigation.html: - Updated links, docu, status - - * html/Stats/compilation.shtml: - Removed this file. - -Sat Dec 31 22:12:53 UTC 2011 Douglas C. Schmidt - - * ace/Timer_Wheel_T.cpp: Changed the call to "delete root" in the - destructor to "this->free_node (root)" so the ACE_Timer_Wheel_T - will work properly when provided a custom allocator. Thanks to - Koh for reporting - this bug and providing a fix. - -Fri Dec 30 10:13:59 UTC 2011 Johnny Willemsen - - * ace/config-linux.h: - Added support for ulibc, thanks to Chong Wuk Pak - for providing the patch. This fixes - bugzilla 3999 - -Thu Dec 29 17:29:06 UTC 2011 Douglas C. Schmidt - - * ace/Mem_Map.cpp (ACE_Mem_Map::map_it): Fixed a missing '('. Thanks to Johnny for reporting this. - -Thu Dec 29 15:14:45 UTC 2011 Douglas C. Schmidt - - * ace/Mem_Map.cpp (ACE_Mem_Map::map_it): Further improved the - error checking. Thanks to JaeSung Lee for suggesting this. - -Tue Dec 27 15:19:56 UTC 2011 Douglas C. Schmidt - - * ace/Mem_Map.cpp (ACE_Mem_Map::map_it): mmap through character - device doesn't care about it's size, so map with /dev/* is done - with a special case. Thanks to JaeSung Lee for reporting this and providing a fix. - -Tue Dec 27 11:39:53 UTC 2011 Johnny Willemsen - - * NEWS: - * bin/diff-builds-and-group-fixed-tests-only.sh: - * docs/Download.html: - * docs/bczar/bczar.html: - * etc/index.html: - Updated for next release - -Tue Dec 27 10:06:28 CET 2011 Johnny Willemsen - - * ACE version 6.0.7 released. - -Wed Dec 21 11:25:49 UTC 2011 Marcel Smit - - * tests/Task_Wait_Test.cpp: - Fixed compile issue on Solaris 10. - -Wed Dec 21 09:41:54 UTC 2011 Martin Corino - - * examples/Timer_Queue/Reactor_Timer_Queue_Test.cpp: - - Added timer queue reset on global reactor instance. - -Tue Dec 20 15:43:39 UTC 2011 Steve Huston - - * tests/Task_Wait_Test.cpp: - * tests/tests.mpc: - * tests/run_test.lst: - New test program that tests the ACE_Thread_Manager::wait() from a - called-back ACE_Task::close() on thread exit. - -Tue Dec 20 15:36:24 UTC 2011 Steve Huston - - * ace/Thread.inl (disablecancel): Correct size pased to memset. - * ace/Thread_Manager.cpp (ACE_Thread_Descriptor::terminate): Don't - dereference potentially invalid pointer. - - Resolves Coverity warnings. - -Mon Dec 19 19:00:07 UTC 2011 Johnny Willemsen - - * docs/bczar/bczar.html: - Added another package - -Mon Dec 19 13:28:16 UTC 2011 Martin Corino - - * ace/Abstract_Timer_Queue.h: - * ace/Timer_Hash_T.h: - * ace/Timer_Hash_T.cpp: - * ace/Timer_Heap_T.h: - * ace/Timer_Heap_T.cpp: - * ace/Timer_List_T.h: - * ace/Timer_List_T.cpp: - * ace/Timer_Queue_Adapters.inl: - * ace/Timer_Queue_Adapters.cpp: - * ace/Timer_Wheel_T.h: - * ace/Timer_Wheel_T.cpp: - - Added close() method. - - * ace/Dev_Poll_Reactor.cpp: - * ace/Proactor.cpp: - * ace/Select_Reactor_T.cpp: - * ace/WFMO_Reactor.cpp: - - Implemented support for timer queue close (). - - The rationale for these changes is that when using reactors with - user defined timer queues the reactor does not delete the timer queue - when being deleted itself. Without any other cleanup this created the - possibility (as encountered in TAO/tests/Bug_3837_Regression after - introduction of the TIME_POLICY changes) of outstanding timer handlers - in the queue being triggered and attempting to access the reactor after - the reactor has been destroyed. - Calling close () for timer queues the reactor does not delete solves - this potential problem. - -Mon Dec 19 12:12:37 UTC 2011 Johnny Willemsen - - * bin/fuzz.pl: - Simplified check - -Mon Dec 19 09:17:33 UTC 2011 Johnny Willemsen - - * ace/ace_for_tao.mpc: - Added missing files - -Sun Dec 18 11:56:00 UTC 2011 Johnny Willemsen - - * ace/Timer_Queue_T.h: - Fixed CentOS warning - -Sun Dec 18 11:41:56 UTC 2011 Johnny Willemsen - - * ace/ace_for_tao.mpc: - Removed obsolete file - -Sun Dec 18 11:35:18 UTC 2011 Johnny Willemsen - - * bin/generate_compile_stats.sh: - Fixed incorrect command - -Sun Dec 18 10:29:12 UTC 2011 Martin Corino - - * ace/Abstract_Timer_Queue.h: - - Added missing abstract method dump(). - -Fri Dec 16 08:03:07 UTC 2011 Marcel Smit - - * ace/Time_Policy_T.h: - No dllimport/export in template classes. - -Thu Dec 15 19:45:30 UTC 2011 Johnny Willemsen - - * ace/Countdown_Time_T.h: - No need for an export macro with a C++ template - -Thu Dec 15 13:22:07 UTC 2011 Marcel Smit - - * ace/Event_Handler_Handle_Timeout_Upcall.inl: - * tests/Timer_Queue_Test.cpp: - Fuzz. Removed tab character - -Thu Dec 15 13:12:39 UTC 2011 Marcel Smit - - * ace/Event_Handler_Handle_Timeout_Upcall.inl: - * ace/Event_Handler_Handle_Timeout_Upcall.cpp: - * ace/Proactor.cpp: - * ace/Timer_Hash.h: - * ace/Timer_Hash_T.h: - * ace/Timer_Hash_T.cpp: - * ace/Timer_Heap.h: - * ace/Timer_Heap_T.h: - * ace/Timer_Heap_T.cpp: - * ace/Timer_List.h: - * ace/Timer_List_T.h: - * ace/Timer_List_T.cpp: - * ace/Timer_Queue_Adapters.cpp: - * ace/Timer_Queue_T.h: - * ace/Timer_Queue_T.cpp: - * ace/Timer_Wheel.h: - * ace/Timer_Wheel_T.h: - Fuzz. Removed tab character - -Thu Dec 15 12:52:18 UTC 2011 Marcel Smit - - * ace/Abstract_Timer_Queue.h: - * ace/Abstract_Timer_Queue.cpp: - * ace/Event_Handler_Handle_Timeout_Upcall.h: - * ace/Timer_Queue_Iterator.h: - * ace/Timer_Queue_Iterator.cpp: - Fuzz. Added Id-tags. - -Thu Dec 15 11:00:00 UTC 2011 Martin Corino - - Merged timer_policy branch. - - === start changelog === - - Thu Dec 15 09:45:00 UTC 2011 Martin Corino - - * NEWS: - - Added description of new TIME_POLICY features. - - * tests/Timer_Queue_Test.cpp: - - Added explicit test of specific TIME_POLICY feature. - - Mon Dec 12 21:28:00 UTC 2011 Martin Corino - - * ace/Abstract_Timer_Queue.h: - * ace/Time_Policy.h: - * ace/Time_Policy.inl: - * ace/Time_Policy_T.h: - * ace/Time_Policy_T.inl: - * ace/Timer_Queue_T.cpp: - * ace/Timer_Queue_T.h: - * tests/Timer_Queue_Test.cpp: - - Added backwards compatibility support. - - Mon Dec 05 10:26:00 UTC 2011 Martin Corino - - * ace/Time_Policy.inl - - Prevent setting delegate to null pointer. - - Sun Dec 04 15:40:00 UTC 2011 Martin Corino - - * ace/Countdown_Time.cpp: - * ace/Countdown_Time.inl: - - Renamed to *_T.* - - * ace/Countdown_Time.h - * ace/Countdown_Time_T.cpp - * ace/Countdown_Time_T.h - * ace/Countdown_Time_T.inl - - Changed ACE_Countdown_Time to TIME_POLICY based - template class ACE_Countdown_Time_T, - Created typedef for default template instantiation - as ACE_Countdown_Time. - - * ace/Time_Policy.cpp - * ace/Time_Policy.h - * ace/Time_Policy.inl - * ace/Time_Policy_T.cpp - * ace/Time_Policy_T.h - * ace/Time_Policy_T.inl - - Added support for dynamically loadable/shared time - policies. - - * ace/ace.mpc - - Updated for file changes. - - Fri Dec 02 11:48:00 UTC 2011 Martin Corino - - * ace/Timer_Queue_T.h: - * ace/Timer_Queue_T.inl: - - Reverting set_time_policy() change. Interpretation error. - - Thu Dec 01 17:52:00 UTC 2011 Martin Corino - - * ace/Time_Policy.h: - * ace/Time_Policy.inl: - - Added ACE_HR_Time_Policy. - - * ace/Timer_Queue_T.h: - * ace/Timer_Queue_T.inl: - - Replaced set_time_policy() by get_time_policy() since setting - the policy is not possible but configuring might be. - - Thu Dec 01 14:05:00 UTC 2011 Martin Corino - - * ace/Proactor.cpp: - * ace/Timer_Queue_T.cpp: - * ace/Timer_Queue_T.h: - - Fixed compile errors. - - Thu Dec 01 13:34:00 UTC 2011 Martin Corino - - * ace/Timer_Hash_T.cpp: - * ace/Timer_Hash_T.h: - * ace/Timer_Heap_T.h: - * ace/Timer_Wheel_T.h: - - Small cleanup to prevent potential compiler warnings. - - Mon Aug 24 02:27:36 UTC 2009 Carlos O'Ryan - - * ace/Timer_Queue_T.cpp: - Need to release the internal timer queue lock before dispatching - calls in expire_single(), otherwise we get nasty deadlocks in - the TP_Reactor implementation. - - Thu Jul 2 02:55:09 UTC 2009 Carlos O'Ryan - - * ace/Abstract_Timer_Queue.h: - * ace/Timer_Queue_T.h: - * ace/Timer_Queue_T.inl: - * ace/Timer_Queue_T.cpp: - I wanted to use gettimeofday() for the pure virtual function and - some other name for the inline function used in the timer queue - internals. - This is the second and final pass to get that change in. This - time, I renamed the internal function to gettimeofday_static(), - used the compiler (and grep) to find all uses. Once that - compiled I renamed the virtual function from - gettimeofday_abstract() to the gettimeofday() function. - I know it is convoluted, but it gets the job done without me - having to think too much. - - * ace/Timer_Hash_T.h: - * ace/Timer_Hash_T.cpp: - * ace/Select_Reactor_T.cpp: - * ace/Dev_Poll_Reactor.cpp: - * ace/Proactor.cpp: - * ace/Timer_Queue_Adapters.cpp: - * tests/Timer_Queue_Reference_Counting_Test.cpp: - * tests/Timer_Queue_Test.cpp: - * examples/APG/Timers/Timers.cpp: - * examples/APG/Timers/TimerDispatcher.cpp: - * examples/C++NPv2/Logging_Event_Handler_Ex.cpp: - Fixed users and tests to use the real name for gettimeofday() in - ACE_Abstract_Timer_Queue<> - - Wed Jul 1 02:09:44 UTC 2009 Carlos O'Ryan - - * ace/ace.mpc: - * ace/Makefile.am: - * ace/Event_Handler_Handle_Timeout_Upcall.h: - * ace/Event_Handler_Handle_Timeout_Upcall.inl: - * ace/Event_Handler_Handle_Timeout_Upcall.cpp: - First I noticed that this class did not depend on the lock type - at all, this was fortunate because I wanted to use it in a - generic way. So, change the class from a template class to a - regular class. That required moving the class to its own file too. - - * ace/Timer_List_T.h: - * ace/Timer_List_T.cpp: - * ace/Timer_Wheel_T.h: - * ace/Timer_Wheel_T.cpp: - * ace/Timer_Hash_T.h: - * ace/Timer_Hash_T.cpp: - * ace/Timer_Heap_T.h: - * ace/Timer_Heap_T.cpp: - Fixed several inconsistencies across these classes, for example, - most of them had typedef as a shorthand for the base class, but - the name of this typedef was not consistent. - Likewise, not all of the classes made the TIME_POLICY parameter - a default template parameter. - - * ace/Timer_Queue_T.h: - * ace/Timer_Queue_T.inl: - * ace/Timer_Queue_T.cpp: - Introduced an intermediate class between Abstract_Timer_Queue<> - and Timer_Queue_T<>. This is ugly, but the Proactor "needs" to - set a back-pointer from the FUNCTOR to the Proacter instance - whenever a timer queue is assigned to the Proactor. - This code smells funny. Either the API is wrong (the Proactor - should always create the functor with the backpointer,) or the - need for the back pointer is suspicious (I think there is a - thread in the Proactor that signals timers, but maybe it should - be contained in the Upcall object itself?) - The more I look here, the uglier the smell. - - * ace/Select_Reactor_T.cpp: - * ace/Timer_Queue_Adapters.cpp: - * tests/Timer_Queue_Reference_Counting_Test.cpp: - * tests/Timer_Queue_Test.cpp: - As a temporary measure, I appended "_abstract" to the - gettimeofday() function name in Abstract_Timer_Queue<>. - Shortly, I will change the Timer_Queue_T<> class to use - gettimeofday_non_virtual() or _static() or something similar. - Had to make the change in two steps to find all the uses of the - original function. - There was probably an easier/cleaner way to do this. - - * tests/Timer_Queue_Test.cpp: - Take advantage of the new ACE_Abstract_Timer_Queue<> to make the - different types of queues more compatible in ths test, including - queues with different time source policies. - - * ace/Proactor.h: - As with the Reactive version, I noticed that - ACE_Proactor_Handle_Timeout_Upcall did not depend on its - template parameter, so I changed the class to a non-template - version. - - * ace/Proactor.cpp: - Instead of making the Proactor a friend of the Timer_Handler - task, expose a safe interface to do what the proactor wants to - do. - The proactor needed access to timer queue internal details to - implement schedule(), but the reactor did not... hmmm... well, - turns out the Reactor had nicely refactor that work to the - upcall functor. So I did the same in the Proactor case. - - - * ace/Timer_List.h: - * ace/Timer_Wheel.h: - * ace/Timer_Hash.h: - * ace/Timer_Heap.h: - Use Event_Handler_Handle_Timeout_Upcall without the template - parameter. - - * ace/Abstract_Timer_Queue.h: - Remove the setter for getimeofday(), this is implemented by the - TIME_POLICY template parameter in Timer_Queue_T<> - - * tests/Reactor_Timer_Test.cpp: - * tests/Network_Adapters_Test.cpp: - * tests/Proactor_Timer_Test.cpp: - Use a different idiom to set the time policy for this test. - - * examples/Timer_Queue/Thread_Timer_Queue_Test.h: - * examples/Bounded_Packet_Relay/Thread_Bounded_Packet_Relay.h: - * examples/APG/Timers/Timers.cpp: - * examples/APG/Timers/TimerDispatcher.cpp: - * examples/Reactor/Misc/test_timer_queue.cpp: - * examples/C++NPv2/Logging_Event_Handler_Ex.cpp: - Need an additional #include for ACE_Event_Handler_Handle_Timeout - Said class class is no longer a template class, so use it - correctly. - Changed name of gettimeofday() in timer queue to - gettimeofday_abstract() This is a temporary change to find all - the uses, will revert again soon. - - * Merged in changes from bug-3607 branch. - - * ace/ace.mpc: - * ace/Abstract_Timer_Queue.h: - * ace/Abstract_Timer_Queue.cpp: - * ace/Timer_Queue_Iterator.h: - * ace/Timer_Queue_Iterator.inl: - * ace/Timer_Queue_Iterator.cpp: - * ace/Timer_Queuefwd.h: - * ace/Timer_Queue.h: - * ace/Timer_Queue_T.h: - * ace/Timer_Queue_T.inl: - * ace/Timer_Queue_T.cpp: - * ace/Timer_List_T.h: - * ace/Timer_List_T.cpp: - * ace/Timer_Wheel_T.h: - * ace/Timer_Wheel_T.cpp: - * ace/Timer_Hash_T.h: - * ace/Timer_Hash_T.cpp: - * ace/Timer_Heap_T.h: - * ace/Timer_Heap_T.cpp: - Heavy refactoring in ACE_Timer_Queue_T class and friends. - First, created a template base class (ACE_Abstract_Timer_Queue) that: - 1) Only depends on the type held by the timer queue, not to lock - or upcall strategy. - 2) It is a pure abstract class, i.e., none of its member - functions have any implementation. - 3) Provides new pure virtual functions to encapsulates some - logic that was spread between tests, TP_Reactor and - Dev_Poll_Reactor. - Then I re-wrote all the standard timer queue objects in terms of - this class. In particular, the reactors use only the abstract - interface. - I also re-factored the Timer_Queue_Iterator to only depend on - the type of objects held by the timer queue. The rest of the - parameters where not used either. - Implement functionality that was spread in Dev_Poll_Reactor, - TP_Reactor and a test into expire_single. - - * ace/Proactor.h: - * ace/TP_Reactor.cpp: - * ace/Dev_Poll_Reactor.cpp: - Both classes implemented the logic to dispatch a single timer - but release a mutex before the upcall. This was confusing as - well as required exposing too much detail about the Timer_Queue - classes. - The new mechanism is a single function in (expire_single) - ACE_Abstract_Timer_Queue<> (implemented in ACE_Timer_Queue_T<>) - which receives a command object to encapsulate the mutex release. - - * ace/Functor.h: - * ace/Functor.cpp: - * ace/Functor_T.h: - * ace/Functor_T.inl: - Add helper ACE_Command_* objects. One is a no-op, for the test - below. The other is a callback that ignores the silly void* - argument in the ACE_Command_Base::execute() member function. - - * tests/Timer_Queue_Reference_Counting_Test.cpp: - Re-factored test in terms of expire_single() - - Tue Jun 30 01:10:04 UTC 2009 Carlos O'Ryan - - * This is a temporary commit into the 3707 branch. I realized too - late that the changes from 3706 will be needed to make this work. - - * ace/ace.mpc: - * ace/Time_Policy.h: - * ace/Time_Policy.inl: - * ace/Time_Policy.cpp: - New classes to encapsulate how "now" is computed in the Timer - Queues. This will be an additional template parameter, so the - default configuration has zero overhead. - - * ace/Timer_Queuefwd.h: - * ace/Timer_List.h: - * ace/Timer_List_T.h: - * ace/Timer_List_T.cpp: - * ace/Timer_Queue_T.h: - * ace/Timer_Queue_T.inl: - * ace/Timer_Queue_T.cpp: - * ace/Timer_Wheel.h: - * ace/Timer_Wheel_T.h: - * ace/Timer_Wheel_T.cpp: - * ace/Timer_Hash.h: - * ace/Timer_Hash_T.h: - * ace/Timer_Hash_T.cpp: - * ace/Timer_Heap.h: - * ace/Timer_Heap_T.h: - * ace/Timer_Heap_T.cpp: - Re-factor timer queue classes to use new TIMER_POLICY - parameter. - - * tests/Timer_Queue_Test.cpp: - Modify test to use TIMER_POLICY. But here is the rub, the test - does not compile because all timer queue types are "different" - to each other. I need to introduce the base class from the - bug-3706 branch to make things work. - - Sun Jun 28 22:15:47 UTC 2009 Carlos O'Ryan - - * ace/ace.mpc: - * ace/Abstract_Timer_Queue.h: - * ace/Abstract_Timer_Queue.cpp: - * ace/Timer_Queue_Iterator.h: - * ace/Timer_Queue_Iterator.inl: - * ace/Timer_Queue_Iterator.cpp: - * ace/Timer_Queuefwd.h: - * ace/Timer_Queue.h: - * ace/Timer_Queue_T.h: - * ace/Timer_Queue_T.inl: - * ace/Timer_Queue_T.cpp: - * ace/Timer_List_T.h: - * ace/Timer_List_T.cpp: - * ace/Timer_Wheel_T.h: - * ace/Timer_Wheel_T.cpp: - * ace/Timer_Hash_T.h: - * ace/Timer_Hash_T.cpp: - * ace/Timer_Heap_T.h: - * ace/Timer_Heap_T.cpp: - Heavy refactoring in ACE_Timer_Queue_T class and friends. - First, created a template base class (ACE_Abstract_Timer_Queue) that: - 1) Only depends on the type held by the timer queue, not to lock - or upcall strategy. - 2) It is a pure abstract class, i.e., none of its member - functions have any implementation. - 3) Provides new pure virtual functions to encapsulates some - logic that was spread between tests, TP_Reactor and - Dev_Poll_Reactor. - Then I re-wrote all the standard timer queue objects in terms of - this class. In particular, the reactors use only the abstract - interface. - I also re-factored the Timer_Queue_Iterator to only depend on - the type of objects held by the timer queue. The rest of the - parameters where not used either. - Implement functionality that was spread in Dev_Poll_Reactor, - TP_Reactor and a test into expire_single. - - * ace/Proactor.h: - * ace/TP_Reactor.cpp: - * ace/Dev_Poll_Reactor.cpp: - Both classes implemented the logic to dispatch a single timer - but release a mutex before the upcall. This was confusing as - well as required exposing too much detail about the Timer_Queue - classes. - The new mechanism is a single function in (expire_single) - ACE_Abstract_Timer_Queue<> (implemented in ACE_Timer_Queue_T<>) - which receives a command object to encapsulate the mutex release. - - * ace/Functor.h: - * ace/Functor.cpp: - * ace/Functor_T.h: - * ace/Functor_T.inl: - Add helper ACE_Command_* objects. One is a no-op, for the test - below. The other is a callback that ignores the silly void* - argument in the ACE_Command_Base::execute() member function. - - * tests/Timer_Queue_Reference_Counting_Test.cpp: - Re-factored test in terms of expire_single() - - === end changelog === - -Wed Dec 14 16:09:22 UTC 2011 Johnny Willemsen - - * bin/auto_run_tests.pl: - Fixed DANCE_ROOT - -Mon Dec 12 19:04:55 UTC 2011 Johnny Willemsen - - * bin/MakeProjectCreator/config/vc11.features: - * bin/MakeProjectCreator/config/vc11nmake.mpb: - New files for vc11 - -Mon Dec 12 07:33:25 UTC 2011 Johnny Willemsen - - === start changelog === - - Fri Dec 9 10:41:02 UTC 2011 Marcel Smit - - * docs/svn/config: - Subversion should ignore *_svnt_T.*. - - === end changelog === - -Mon Dec 5 22:23:25 UTC 2011 Steve Huston - - * ace/DLL.h: - * ace/DLL_Manager.h: Corrected and expanded the descriptions of how - DLL/library names are handled, decorated, and located. - -Mon Dec 5 20:16:51 UTC 2011 Steve Huston - - * ace/Atomic_Op.{h inl}: - * ace/Atomic_Op_T.{h inl}: - * ace/Atomic_Op_GCC_T.{h inl}: - Added new method TYPE exchange (TYPE newval) which exchanges the - ACE_Atomic_Op's value with the specified new value. Thanks to John - Lilley for contributing this addition. - - * tests/Atomic_Op_Test.cpp: Added test for exchange(). - - * NEWS: Added description of the new exchange() method. - -Mon Dec 5 12:27:54 UTC 2011 Johnny Willemsen - - * ace/TTY_IO.h: - Doxygen fix - - * ace/config-linux.h: - Layout changes - - * tests/Cached_Accept_Conn_Test.h: - * tests/Cached_Accept_Conn_Test.cpp: - * tests/MEM_Stream_Test.cpp: - * tests/QtReactor_Test.cpp: - Layout changes and removed some ACE_UNUSED_ARG usage - -Mon Dec 5 11:25:31 UTC 2011 Johnny Willemsen - - * bin/cleanbuilds.sh: - * bin/mail_test_stats.sh: - Extended our daily test stats with another email, the failing tests - for today excluding the not fixed ones - -Mon Dec 5 08:35:54 UTC 2011 Johnny Willemsen - - * docs/Download.html: - Release has vc9/vc10 - -Mon Dec 5 08:22:11 UTC 2011 Johnny Willemsen - - * bin/diff-builds-and-group-fixed-tests-only.sh: - * docs/Download.html: - * etc/index.html: - Made 6.0.6 publicly available - - * docs/bczar/bczar.html: - Updated for next release and added wget step to get subversion config - file to make sure we checkout using commit timestamps - -Local Variables: -mode: change-log -add-log-time-format: (lambda () (progn (setq tz (getenv "TZ")) (set-time-zone-rule "UTC") (setq time (format-time-string "%a %b %e %H:%M:%S %Z %Y" (current-time))) (set-time-zone-rule tz) time)) -indent-tabs-mode: nil -End: diff --git a/dep/acelite/NEWS b/dep/acelite/NEWS deleted file mode 100644 index cf60110b536..00000000000 --- a/dep/acelite/NEWS +++ /dev/null @@ -1,1853 +0,0 @@ -USER VISIBLE CHANGES BETWEEN ACE-6.1.3 and ACE-6.1.4 -==================================================== - -. Added a new ACE_Time_Value derived template class (Time_Value_T.h): - - template class ACE_Time_Value_T - - This template class overloads 4 new virtual methods from - the ACE_Time_Value base class to provide time policy aware - time values: - to_relative_time () - to_absolute_time () - now () - duplicate () - -. Updated time policy classes to return ACE_Time_Value_T<> instantiations - for the corresponding time policy instead of 'common' time values. - -. Added new ACE_Monotonic_Time_Policy (Monotonic_Time_Policy.h). - This class provides a monotonic time source for supported - platforms (Windows and POSIX platforms providing the required - clock_gettime() time source; currently verified for Windows and - Linux) - -. Updated OS_NS_Thread to use the new time policy support in ACE_Time_Value - for (relative) time calculations and added new ACE_OS::condattr_setclock () - method. - -. Added TIME_POLICY support to ACE_Condition_Attributes to allow for - monotonic timer support for ACE_Condition. - -. Added TIME_POLICY support to ACE_Message_Queue-s, ACE_Task-s and - related classes to enable support for monotonic timers in the timed - wait methods (ACE_Condition based). See docs/ACE-monotonic-timer.html - for how to use this. - -. Added two new regression tests: - Monotonic_Task_Test - Monotonic_Message_Queue_Test - and updated the Bug_4055_Regression_Test to a fixed state. - -USER VISIBLE CHANGES BETWEEN ACE-6.1.2 and ACE-6.1.3 -==================================================== - -. Added support for Oracle Solaris Studio 12 Update 3 (SunCC 5.12) - -. Added new XML_Utils library which comes from DAnCE but is now also used - by OpenDDS - -USER VISIBLE CHANGES BETWEEN ACE-6.1.1 and ACE-6.1.2 -==================================================== - -. Added compile time support for Windows CE 7, no runtime testing has - been performed - -. The High Res Timer global scale factor on Windows is now 64bit, see bugzilla - 3703 for the background of this. If you use the gsf in your code, use the - new ACE_High_Res_Timer::global_scale_factor_type type trait to not get - any conversion warnings - -. Removed Tandem NSK v2/v3 support which resulted in cleanup throughout all - code. The emulations for ACE_INT64/ACE_UINT64 have been removed because no - platform is using them anymore - -USER VISIBLE CHANGES BETWEEN ACE-6.1.0 and ACE-6.1.1 -==================================================== - -. Minor bug fixes - -USER VISIBLE CHANGES BETWEEN ACE-6.0.8 and ACE-6.1.0 -==================================================== - -. Added compilation support for VxWorks 6.9, no runtime - testing has been performed - -. Added ACE Run-length encoding compressor - -. Fixed several Coverity reported issues - -USER VISIBLE CHANGES BETWEEN ACE-6.0.7 and ACE-6.0.8 -==================================================== - -. Added support for MPC's new feature that creates dependency files for IDL - files when generating '-type gnuace' projects. Turned off by default, it - can be enabled in a features file or on the command line with - '-features ace_idl_dependencies=1'. - -USER VISIBLE CHANGES BETWEEN ACE-6.0.6 and ACE-6.0.7 -==================================================== - -. Added a new method to ACE_Atomic_Op, TYPE exchange (TYPE newval) - which does an atomic exchange of the new value with ACE_Atomic_Op's value - and returns the old value. The tests/Atomic_Op_Test.cpp test program has a - test case that exemplifies its usage; see the Exchange_Tester class. - -. Added a new feature to timer queue templates classes: TIME_POLICY. - This feature is specified through a new template argument and provides the - timer queue with a policy for a timer (time of day) value. This feature is - intended to replace (in time) the gettimeofday setter method which has been - marked @deprecated. For now backwards compatibility is guaranteed. - The TIME_POLICY feature provides flexibility with regards to providing a timer - source to the timer queues as well as the possibility for a fully optimized - calling path. - A number of standard time policies are provided in ace/Time_Policy.h. - The tests/Timer_Queue_Test.cpp has been updated to reflect and exemplify these - changes. - -. Added the TIME_POLICY feature also to countdown time class which has now - become a template (ace/Countdown_Time_T.h) - -. Initial support for Microsoft Visual Studio 11 - -. Increased overall code quality by using Coverity and Klocwork - -USER VISIBLE CHANGES BETWEEN ACE-6.0.5 and ACE-6.0.6 -==================================================== - -. Removed autoconf support, only traditional way of - compilation is shipped from now - -. Add support for RHEL 6.1 64bit - -USER VISIBLE CHANGES BETWEEN ACE-6.0.4 and ACE-6.0.5 -==================================================== - -. Improved support for Android and added the ability to run all ACE/TAO tests - automatically using the Android emulator - -USER VISIBLE CHANGES BETWEEN ACE-6.0.3 and ACE-6.0.4 -==================================================== - -. Removed support for C++ Builder - -. Added support for building with the Android NDK, at least r5c. This - is currently available for linux host platforms. - -USER VISIBLE CHANGES BETWEEN ACE-6.0.2 and ACE-6.0.3 -==================================================== - -. Added support for GCC 4.6 - -USER VISIBLE CHANGES BETWEEN ACE-6.0.1 and ACE-6.0.2 -==================================================== - -. The ACE_wrappers/ace/OS.h file has been restored in order to ensure - build-time compatibility with older ACE versions. Its use will still - cause your build to incur more processing time than using the needed - ace/OS_NS_*.h files; however, you should be able to build OS.h-including - code without needing to replace it with OS_NS_* includes. - -. Improved and simplified QNX support - -. Changed rand_r() and getpwnam_r() to conform Single UNIX Specification. - -. Fixed performance of send_v on windows when individual iovec elements - are particularly large. - -USER VISIBLE CHANGES BETWEEN ACE-6.0.0 and ACE-6.0.1 -==================================================== - -. Added support for MinGW with GCC 4.5 - -USER VISIBLE CHANGES BETWEEN ACE-5.8.3 and ACE-6.0.0 -==================================================== - -. Changed the string format produced by ACE::timestamp() from the ctime - format "Day Mon dd hh:mm:ss yyyy" to ISO-8601 yyyy-mm-dd hh:mm:ss.mmmmmm. - This makes the time easier to collate and removes any dependence on locale. - The change affects the output from ACE_Log_Msg's %D format and both VERBOSE - and VERBOSE_LIGHT timestamps in addition to application-made direct calls - to ACE::timestamp(). - -. Removed GCC < 3 support - -. A new build system hook was added for users to include site-private rules - in a build. If a file named "rules.private.GNU" in located in any build - directory it will get included from - $ACE_ROOT/include/makeinclude/rules.local.GNU. The "private_rules_file" - make variable can be set to override the name and/or location of the file. - If no such rules file exists, its absence is silently ignored. This - facility can be used, for example, to integrate a specialized code checker - into the build process. - -USER VISIBLE CHANGES BETWEEN ACE-5.8.2 and ACE-5.8.3 -==================================================== - -. Two new methods were added to ACE_Pipe: close_read() and close_write(). - These methods can be used to close individual pipe handles. - -. The ACE::handle_ready() family of methods was changed to prefer using - poll() over select() on platforms where poll() is available. This - preference was previously only used if ACE_HAS_LIMITED_SELECT was set. - The ACE_HAS_LIMITED_SELECT choice is removed, making ACE_HAS_POLL the - setting that switches this preference. The driving reason for this - is that if select() is called to detect changes on a handle whose - values falls outside that which can safely be stored in an fdset, - the handle-setting macros/functions will set/clear bits outside - of the fdset. This results in very weird memory changes, often in - the stack, which are very hard to diagnose. poll()'s operation - does not suffer from this affect. With the growing use of large - numbers of handles and use of ACE_Dev_Poll_Reactor on Linux, - the rate at which this problem was cropping up was increasing. - -. Added a simple helper ACE::is_equal() which compares equality of two - objects without using operator==. This is useful for comparing floating - point values. - -. Removed all deprecated methods, arguments, files, classes, macros and - anything else we kept for years. - -. Removed Irix/Tru64/SCO/Uniware/Cray support - -. ACE_Pair has been removed. Users should now use std::pair. - -. This is the last micro release that will work with GCC < 3, after x.8.3 - support for GCC < 3 will be removed - -USER VISIBLE CHANGES BETWEEN ACE-5.8.1 and ACE-5.8.2 -==================================================== - -. Added support for the Microsoft Visual Studio 2010 IDE (vc10) - -. Removed complete support for emulated C++ exceptions - -USER VISIBLE CHANGES BETWEEN ACE-5.8.0 and ACE-5.8.1 -==================================================== - -. Added support for Microsoft Visual Studio 2010 using nmake - -. Reduced the amount of doxygen pages generated, the original settings caused - a doxygen generated html package of 1.4GB which was way too large - -. Extended ACE INet addon library with: - * HTTP Basic Authentication - * SSL/HTTPS support. - * Proxy CONNECT tunneling. - -USER VISIBLE CHANGES BETWEEN ACE-5.7.9 and ACE-5.8.0 -==================================================== - -. There are two new ACE_Time_Value methods for getting and setting millisecond - values to/from ACE_UINT64 values: - - ACE_UINT64 ACE_Time_Value::get_msec () const - void ACE_Time_Value::set_msec (const ACE_UINT64 &ms) - - The former is a replacement for the existing msec(ACE_UINT64&) methods that - are "getter" methods whose signatures look confusingly like "setters". See - Bugzilla #3336 for the history behind this change. - - The latter is for consistency and clarity. - -. Added ACE INet addon library for Inet protocol clients (and possibly - servers at some point) like http://, ftp:// etc. - The library implements standard C++ iostream wrapper classes for - ACE Svc_Handler and Reactor based input/output handling, URL classes - and protocol handler classes. - NOTE: This is work in progress! There is no guarentee that the API - won't change in the next few releases. - Protocol handling is currently restricted to client side download - requests for HTTP and FTP. - Handling for upload requests should be added in the near future as well - as HTTP Basic Authentication. - -USER VISIBLE CHANGES BETWEEN ACE-5.7.8 and ACE-5.7.9 -==================================================== - -. ACE's default makefiles (traditional ACE/GNU, not autoconf/automake) - now support installation with "make install". - Please see the ACE-INSTALL.html file for instructions. - -. Support for the ARCH make variable has been enhanced to apply to executables - (in addition to libraries and object files), and the ARCH feature has been - integrated into the MPC-generated makefiles (to work with MPC's requires - and avoids features). - -USER VISIBLE CHANGES BETWEEN ACE-5.7.7 and ACE-5.7.8 -==================================================== - -. ACE now uses GCC builtin Atomic instructions for short, - unsigned short, long, unsigned long, int, unsigned int, - and bool. This makes our Atomic_Op around 7 times faster - -. ACE Service Configuration Framework now process first service - configuration files and then command-line directives. Thus if - application uses both service configuration files and command-line - directives then the command-line directives may override results of - directives in the configuration files. At the same time if the - application uses only the default svc.conf file and command-line - directives then the directives from svc.conf can not override - results of the user provided command-line directives. - -. ACE_Dev_Poll_Reactor now dispatches notifications in only one thread at - a time. This brings notification handling more in line with behavior in - other Reactor implementations. - -USER VISIBLE CHANGES BETWEEN ACE-5.7.6 and ACE-5.7.7 -==================================================== - -. Integrated fix for bug 3104 and regression test for - interval timers. - -. Added support for GCC builtin Atomic instructions which - are enabled with GCC >= 4.1 for PPC32/PPC64/IA64 - -. Improved autoconf support for debian - -. Added support for -mcpu and -mtune. Add TCPU=.. to your - environment/platform_macros.GNU to specify you cpu and - than add cpumodelflag=1 and/or tunemodelflag=1. Using - this with IBM Cell increased the performance significantly - -USER VISIBLE CHANGES BETWEEN ACE-5.7.5 and ACE-5.7.6 -==================================================== - -. Added support for iPhone/iPod Touch/iPad. The following - environment variables are needed: - - IPHONE_TARGET, should be set to either SIMULATOR or - HARDWARE. Set to HARDWARE if you want to deploy - on the iPhone/iPod Touch/iPad device. - - IPHONE_VERSION, should be set to 3.1.2 or 3.2. One can - set the version to any future or past versions, but - only 3.1.2 and 3.2 have been tried. - - Note that one has to compile ACE/TAO statically as - it is believed that the iPhone OS does not support - dynamic loading of external libraries. The usual - procedure of cross compiling ACE/TAO applies - (such as setting HOST_ROOT environment variable). - -. Added support for Embarcadero C++ Builder 2010 - -. Added option to print a given ACE_Time_Value in the log - message instead of system supplied timestamp as in %T - and %D. - The option is implemented as a variant of the %D/%T - options by using the '#' flag character like '%#D' or - '%#T'. When using this flag an ACE_Time_Value pointer is - expected in the argument list supplied with the log message. - This fixed Bugzilla #3221. - -. Fixed problems with ACE_INET_Addr::is_multicast() on - little endian platforms. This fixed bugzilla #3729. - -. Added compilation support for VxWorks 6.8, no runtime - testing has been performed - -USER VISIBLE CHANGES BETWEEN ACE-5.7.4 and ACE-5.7.5 -==================================================== - -. Added MacOSX Snow Leopard support - -. Added strsignal() wrapper - -. Improved LynxOS support - -. Updated Interix port - -. Fixed MinGW compilation problems - -USER VISIBLE CHANGES BETWEEN ACE-5.7.3 and ACE-5.7.4 -==================================================== - -. ACE_CDR::consolidate now returns an int, 0 is ok, -1 is failure - -. Fixed a bug in the realclean feature of the GNU makefiles - -. Improved Sun Studio for Linux support - -. Improved OpenBSD support - -USER VISIBLE CHANGES BETWEEN ACE-5.7.2 and ACE-5.7.3 -==================================================== - -. C++ Builder 2009 Update 3 is the only C++Builder that is supported, older - and newer compilers are not supported anymore - -. Made final changes for the CEGCC port - -. Added a set of tests to validate C++ compiler and the stl implementation - they ship. - -. HP-UX PARISC aCC < 3.80 are deprecated and can't be used anymore. Upgrade - to aCC 3.80 or newer - -USER VISIBLE CHANGES BETWEEN ACE-5.7.1 and ACE-5.7.2 -==================================================== - -. Borland C++ makefiles aren't shipped anymore as part of the release - but have to be generated by the user - -. Refactored gperf to have its own shared library so that we can reuse - that in TAO - -. Added support for SuSE Enterprise 10 - -. ACE_Configuration_Heap::open() now returns -1 with errno EBUSY if it is - called multiple times. Previous versions would allow multiple calls to - open() but leak resources. - -USER VISIBLE CHANGES BETWEEN ACE-5.7.0 and ACE-5.7.1 -==================================================== - -. Added support for Sun Studio 12 Update Pack 1 - -. Fixed compile problems when using Windows CE x86 release mode - -. Fixed compile problems for FreeBSD - -USER VISIBLE CHANGES BETWEEN ACE-5.6.9 and ACE-5.7.0 -==================================================== - -. Added support for the VxWorks vxAtomicLib which is available with VxWorks 6.6 - and newer. If you don't want to use this library undef ACE_HAS_VXATOMICLIB - in your config.h file - -. Added support for C++ Builder 2009 Update 3 - -. Added support for ACE/TAO using the CEGCC project - -. Added support for upcoming Fedora 11 and OpenSuSE Factory - -USER VISIBLE CHANGES BETWEEN ACE-5.6.8 and ACE-5.6.9 -==================================================== - -. Removed Borland/CodeGear C++ Builder 2007 support. If you'd like to - fund this support please let us know. - -. Removed VxWorks 5.5.x, 6.2, and 6.3 support. If you'd like to fund - this support please let us know. - -. Improved Unicode support. - -. Added support for the native Windows Vista and Windows Server 2008 - condition variables. These has to be enabled at compile time, and when - enabled the application can only run on Vista or Server 2008. Add - ACE_HAS_WTHREADS_CONDITION_VARIABLE to your config.h file to enable - these - -. Fixed a bug when trying to read a file of 1 byte when unicode is - enabled - -. Improved the Windows CE port - -. Fixed several Klocwork reported issues - -. Added support for MinGW 3.15 - -. Added support for Incredibuild, which is an MSVC++ feature that - optimizes compiles via distributing builds. - -USER VISIBLE CHANGES BETWEEN ACE-5.6.7 and ACE-5.6.8 -==================================================== - -. Added a new function ACE::isdotdir() which determines if a specified - pathname is "dot dir" (ie. "." or ".."). ACE::isdotdir() is significantly - faster than pair of strcmp() calls. - -. Last micro release that is maintained for Borland/CodeGear C++ - Builder 2007 and Intel C++ on Windows. - -. Fixed crash when ACE thread tries to inherit the logging attributes - from non ACE threads. - -. Fixed many small compile and test errors that occur on some platforms. - -. Fixed log output formatting on some platforms. - -. Bugs fixed: 2748, 3164, 3480, 3494, 3502, 3541, 3542, 3544, 3557. - -USER VISIBLE CHANGES BETWEEN ACE-5.6.6 and ACE-5.6.7 -==================================================== - -. Changed the automake build's feature test for a "usable" config - to warn on failure instead of exiting with an error. This should - make it easier to diagnose configure failures, as the script will - now generate a config.h file even when the test fails. - -. Removed borland MPC template, use the bmake template from now - -. Added Windows Mobile 6 support and improved the WinCE port - -. Removed BCB6 and BCB2006 support - -. Added BCB2009 MPC template - -. Updated stat struct on Windows CE to match the stat struct on other - platforms so that application code can be written portable - -. Added new ACE_OS wrappers: raise, atof, atol, isblank, isascii, - isctype, and iswctype - -. Added ACE_OS wrapper for narrow-char version of strtoll. - -. ACE_OS wrappers for wide-char versions of strtol, strtoul, - strtoll, and strtoll. - -. Added Visual Studio 2010 (vc10) support - -. Added a new feature for the "Traditional Make" build facility to allow - building for multiple architectures out of a single source directory. - To use this facility, set the ARCH make variable. The ARCH value will be - used to add a subdirectory layer below the source directory where the - traditional .shobj, .obj, etc. directories will be placed. - -. Added support for HP-UX 11iv3 on Integrity using aC++ - -. ACE (and TAO) can now be built using GNU make and the Microsoft Visual C++ - compiler and linker. See include/makeinclude/platform_win32_msvc.GNU for - more details. - -. Added support for FC10 - -USER VISIBLE CHANGES BETWEEN ACE-5.6.5 and ACE-5.6.6 -==================================================== - -. Added an option to the ACE_Process_Options class to use a wchar_t - environment buffer on Windows. - -. A new configure option, --enable-rcsid, was added to the autoconf build. - This is used to embed RCS IDs in object files. - -. A new method was added: void ACE_Time_Value::msec (ACE_UINT64&) - This method, like the existing msec(ACE_UINT64&)const method, obtains the - time value in milliseconds and stores it in the passed ACE_UINT64 object. - This method was added so that msec(ACE_UINT64&) can be called on both - const and non-const ACE_Time_Value objects without triggering compile errors. - Fixes Bugzilla #3336. - -. Added ACE_Stack_Trace class to allow users to obtain a stack trace - within their application on supported platforms. A new conversion - character, the question mark, was added to ACE_Log_Msg for stack - trace logging. - -. Added iterator support to ACE_Message_Queue_Ex class. The resulted in - the addition of ACE_Message_Queue_Ex_Iterator class and - ACE_Message_Queue_Ex_Reverse_Iterator class. - -. Renamed gperf to ace_gperf to prevent clashes with the regular gperf - tool that is available in linux distributions - -. Added support for FC9 - -. Added support for OpenSuSE 11.0 - -. Improved support for GCC 4.2 and 4.3 - -. Added support for CodeGear C++ Builder 2009 - -USER VISIBLE CHANGES BETWEEN ACE-5.6.4 and ACE-5.6.5 -==================================================== - -. Added new Monitoring lib that can be used to store and retrieve - counters. This is disabled by default because it is not 100% - finished yet, with the next release it will be enabled by default - -. Fixed bug in ACE_Service_Config when it was used from a thread - not spawned by ACE - -. Add VxWorks 6.x kernel mode with shared library support to ACE - -. Extended the implementation of Unbounded_Set, which has been - renamed Unbounded_Set_Ex, to accept a second parameter which is - a comparator that implements operator() which returns true if - the items are equivalent. Unbounded_Set has been reimplemented - in terms of Unbounded_Set_Ex using a comparator that uses operator==, - which captures the previous behavior. - -. Added support for Intel C++ on MacOSX - -USER VISIBLE CHANGES BETWEEN ACE-5.6.3 and ACE-5.6.4 -==================================================== - -. Reworked the relationship between ACE_Service_Config and - ACE_Service_Gestalt - -. Improved autoconf support - -. Improved AIX with gcc support - -. Improved OpenVMS support - -. Improved VxWorks support - -USER VISIBLE CHANGES BETWEEN ACE-5.6.2 and ACE-5.6.3 -==================================================== - -. Deprecated Visual Age 5 and older - -. Closed a rare race condition hole whereby ACE_Atomic_Op<> function - pointers would not be fully initialized prior to use. See bugzilla - 3185 for details. - -. Tweaks to support MacOS X Leopard (10.5 and 10.5.1) on Intel - -. Fixed compile problems with MinGW with GCC 4.2. Do note that we do see - much more test failures then when using GCC 3.4. - -. Changed to use synchronous exception handling with msvc 8/9 which is the - default. Asynchrous exception handling does catch access violations but - it leads to lower performance and other problems. See also bugzilla 3169 - -. Make ace_main extern C with VxWorks so that it doesn't get mangled - -. Fixed compile errors and warnings for VxWorks 6.6 - -. Added an MPC generator for the WindRiver Workbench 2.6 which is shipped - with VxWorks 6.4 - -. Added support for CodeGear C++ Builder 2007 with December 2007 update - installed - -. Added support for VxWorks 5.5.1 - -. Implemented the const reverse iterator for ACE_Hash_Map_Manager_Ex - -. Increased support for using ACE_Hash_Map_Manager_Ex with STL - functions based on latest standard C++ draft - -USER VISIBLE CHANGES BETWEEN ACE-5.6.1 and ACE-5.6.2 -==================================================== - -. ACE-ified the UUID class, which will change user applications slightly. - -. Added support for Sun Studio 12 - -. Added support for Intel C++ 10.1 - -. Fixed runtime problems with VxWorks 6.x in kernel mode, several improvements - have been made to ACE, but also some problems in the VxWorks kernel have - been found for which WindRiver has made patches. - -. Added support for VxWorks 6.5 kernel mode - -. Added support for MacOS 10.5 - -. Support for MacOS 10.4 is now deprecated. - -. Added support for OpenSuSE 10.3 - -. Added support for RedHat 5.1 - -. Added support for Microsoft Visual Studio 2008 - -. Added support for Fedora Core 8 - -. Added support for Ubuntu 7.10 - -. With Ubuntu 7.04 and 7.10 we can't use visibility, that results in - unresolved externals when building some tests. With lsb_release we - now detect Ubuntu 7.04 and 7.10 automatically and then we disable - visibility - -. Removed deprecated (un)subscribe methods from ACE_SOCK_Dgram_Mcast - -. Added an additional replace() method to ACE_OuptutCDR for replacing a - ACE_CDR::Short value. Also added write_long_placeholder() and - write_short_placeholder() to properly align the stream's write pointer, - write a placeholder value and return the placeholder's pointer. The pointer - can later be used in a call to replace() to replace the placeholder with a - different value. - -. Initial support for VxWorks 6.6 - -. Removed support for pthread draft 4, 6, & 7. This makes the ACE threading - code much cleaner - -. Improved autoconf support - -. Fixed TSS emulation problems - -. Changed ACE_thread_t and ACE_hthread_t to int for VxWorks kernel mode. All - thread creation methods do have an additional const char* argument to - specify the task name, this now also works with pthread support enabled - -. Use bool in much more interfaces where this is possible - -. Added support for Debian Etch - -. Fixed ACE CDR LongDouble support on VxWorks 6.x - -. Added Microsoft Visual Studio 2008 project files to the release packages - -. Fixed a few bugs in the ACE_Vector template - -USER VISIBLE CHANGES BETWEEN ACE-5.6 and ACE-5.6.1 -==================================================== - -. Added support for CodeGear RAD Studio 2007 - -. Added support for CodeGear C++ Builder 2007 Update 3 - -. Modified the definiton of ACE_DEFAULT_THREAD_KEYS on Windows so it - is based on the version of the OS as defined by Microsoft in this web - page: http://tinyurl.com/2jqcmd - This fixes bugzilla #2753 - -USER VISIBLE CHANGES BETWEEN ACE-5.5.10 and ACE-5.6 -==================================================== - -. OpenVMS 8.3 on IA64 port - -. Added autoconf support for Intel C++ 10.0 - -. Improved autoconf support on Linux, Solaris, NetBSD and HPUX - -. CodeGear C++ Builder 2007 Update 2 support - -. The netsvcs's client logging daemon has a new configuration option, - -llocal-ip[:local-port], which can be used to specify the local IP - address and port number for the client logging daemon's connection to - the server logging daemon. If the -l option is specified with an IP - address but not a port number, an unused port number is selected. - -. A new ACE+TAO port to LabVIEW RT 8.2 with Pharlap ETS. The host build - environment is Windows with Microsoft Visual Studio .NET 2003 (VC7.1). - Please see the ACE-INSTALL.html file for build instructions. - -USER VISIBLE CHANGES BETWEEN ACE-5.5.9 and ACE-5.5.10 -==================================================== - -. The ACE_utsname struct, used in the ACE_OS::uname() function when the - platform doesn't provide the standard utsname struct, was changed. It - defines a number of text fields and their types were changed from - ACE_TCHAR[] to char[] in order to be consistent with all other platforms. - This removes the need to write different code for platforms where - ACE_LACKS_UTSNAME_T is set and that have wide characters (most probably - Windows). Fixes Bugzilla #2665. - -. The ACE::daemonize() "close_all_handles" parameter was changed from - an "int" to a "bool" to better reflect how it is used. - -. VxWorks 6.5 support. Compilation of the core libraries has been validated - but no runtime testing has been performed. - -. CodeGear C++ Builder 2007 support. - -. The FaCE utility was moved from the ACE_wrappers/apps directory to - ACE_wrappers/contrib. It is used for testing ACE+TAO apps on WinCE. - See the ACE_wrappers/contrib/FaCE/README file for more information. - -. ACE_INET_Addr::set (u_short port, char *host_name, ...) now favors IPv6 - addresses when compiled with ACE_HAS_IPV6 defined and the supplied address - family is AF_UNSPEC. This means that if host_name has an IPv6 address in - DNS or /etc/hosts, that will be used over an IPv4 address. If no IPv6 - address exists for host_name, then its IPv4 address will be used. - -. Intel C++ 10.0 support - -. Support for the version of vc8 for 64-bit (AMD64) shipped with the Microsoft - Platform SDK. - -. Fixed ACE_Vector::swap() (bugzilla #2951). - -. Make use of the Atomic_Op optimizations on Intel EM64T processors. The - Atomic_Op is now several times faster on EM64T then with previous versions - of ACE - -USER VISIBLE CHANGES BETWEEN ACE-5.5.8 and ACE-5.5.9 -==================================================== - -. Use Intel C++ specific optimizations for Linux on IA64 - -. Improved support for ACE_OS::fgetc. Added support for ACE_OS::fputc, - ACE_OS::getc, ACE_OS::putc and ACE_OS::ungetc. - -. Added support for ACE_OS::log2(double) and improved support for - ACE::log2(u_long). - -. Shared library builds on AIX now produce a libxxx.so file instead of the - previous practice of producing libxxx.a(shr.o). - -. GCC 4.1.2 that comes with Fedora 7 seems to have a fix for the visibility - attribute we use for the singletons. F7 users will therefore need to - define the following in your config.h file. - ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS 1 - -. Fixed (rare) problem in TP_Reactor where incorrect event handler was - resumed. - -. Reduced footprint on some platforms, particularly those that use - g++ >= 3.3. - -USER VISIBLE CHANGES BETWEEN ACE-5.5.7 and ACE-5.5.8 -==================================================== - -. Extended ACE_Event constructor with optional LPSECURITY_ATTRIBUTES - argument - -. Added support for QT4 - -. Added support to integrate with the FOX Toolkit (www.fox-toolkit.org) - -. Added support for Microsoft Visual Studio Code Name "Orcas", which is - the msvc9 beta - -. Added ability to provide an optional priority when calling - ACE_Message_Queue_Ex::enqueue_prio(). There was previously no way - to specify a priority for queueing. - -. Removed support for Visual Age on Windows. - -. ACE will compile once again with ACE_LACKS_CDR_ALIGNMENT #defined. - -. ACE_Process_Manager::terminate() no longer removes the process from the - process descriptor table; the pid remains available in order to call - ACE_Process_Manager::wait(). - -USER VISIBLE CHANGES BETWEEN ACE-5.5.6 and ACE-5.5.7 -==================================================== - -. ACE 5.5 contained a set of pragmas which prevented Visual Studio 2005 (VC8) - from issuing warnings where C run-time functions are used but a more - secure alternative is available. For more information on the C run-time - issues and Microsoft's response, please see the following MSDN page: - http://msdn2.microsoft.com/en-us/library/8ef0s5kh(VS.80).aspx. - In this beta, the pragmas which prevented the warnings have been removed. - The ACE library has been reviewed and most of the use of "unsafe" functions - has been fixed where possible. Since not all of the warnings emanating from - ACE are situations that can or should be fixed, the ACE VC8 projects will - prevent the warnings while building the ACE kit and its contained examples, - tests, etc. The warnings are disabled by adding Microsoft-specified macros - to the compile line via MPC. If desired, the warnings can be re-enabled by - regenerating the project files with different MPC features. Note, however, - that while ACE without warnings caused by the new C run-time functions, your - application builds may trigger these warnings either by use of the "unsafe" - C run-time functions or via use of an inlined ACE_OS method which uses it. - If the warning is caused by an ACE_OS method, there is a more safe alternate - available, probably located by appending _r to the method name (e.g., - instead of using ACE_OS::ctime(), use ACE_OS::ctime_r()). - There are other cases where the compiler may have issued warnings and ACE - prevented this via a #pragma. These #pragmas have been removed as well. - This may cause your application builds to trigger more warnings from VC8 - than past ACE versions. You should review your code and either correct - the code or disable the warnings locally, as appropriate. - -. The "release" argument to a number of ACE_String_Base<> methods was changed - from int to bool to more accurately reflect its purpose. The following - methods were changed: - - ACE_String_Base (const CHAR *s, - ACE_Allocator *the_allocator = 0, - int release = 1); - to - ACE_String_Base (const CHAR *s, - ACE_Allocator *the_allocator = 0, - bool release = true); - - ACE_String_Base (const CHAR *s, - size_type len, - ACE_Allocator *the_allocator = 0, - int release = 1); - to - ACE_String_Base (const CHAR *s, - size_type len, - ACE_Allocator *the_allocator = 0, - bool release = true); - - void set (const CHAR * s, int release = 1); - to - void set (const CHAR * s, bool release = true); - - void set (const CHAR * s, size_type len, int release); - to - void set (const CHAR * s, size_type len, bool release); - - void clear (int release = 0); - to - void clear (bool release = false); - - Since ACE_String_Base forms the basis of the ACE_CString and ACE_TString - classes, this may ripple out to user application code. If you encounter - errors in this area while building your applications, replace the - int argument you are passing to the method now with either true or false. - -. Solutions for the eVC3/4 platform have been removed from this - release. Note that we package WinCE projects/workspaces for use - with VC8. - -. There were 3 new ACE_Log_Msg logging format specifiers added to make logging - easier for types that may change sizes across platforms. These all take one - argument, and the new formats are: - %b - format a ssize_t value - %B - format a size_t value - %: - format a time_t value - -. The ace/Time_Request_Reply.h and ace/Time_Request_Reply.cpp files were - moved from $ACE_ROOT/ace to $ACE_ROOT/netsvcs/lib. The time arguments in - the public API to ACE_Time_Request were changed from ACE_UINT32 to time_t - and the portions of the on-wire protocol that contains time was changed from - ACE_UINT32 to ACE_UINT64. Thus, code that uses the ACE_Time_Request class - to transfer time information will not interoperate properly with prior - ACE versions. This will affect uses of the netsvcs time clerk/server. - -. The portion of the ACE_Name_Request class that carries the on-wire seconds - portion of a timeout value was changed from ACE_UINT32 to ACE_UINT64. This - means that Name server/clients at ACE 5.5.7 and higher will not interoperate - properly with previous ACE versions' name servers/clients. - -. In the ACE_Log_Record (ACE_Log_Priority, long, long) constructor, the - second argument, long time_stamp, was changed to be of type time_t. This - aligns the type with the expected value, a time stamp such as that returned - from ACE_OS::time(). - -. Added support for VxWorks 6.x cross compilation using a Windows host - system - -. Added support for VxWorks 6.x using the diab compiler - -. The destructor of ACE_Event_Handler no longer calls - purge_pending_notifications(). Please see bugzilla #2845 for the full - rationale. - (http://deuce.doc.wustl.edu/bugzilla/show_bug.cgi?id=2845) - -USER VISIBLE CHANGES BETWEEN ACE-5.5.5 and ACE-5.5.6 -==================================================== - -. The ACE_TYPENAME macro has been added to those that are not - available when the ACE_LACKS_DEPRECATED_MACROS config option is set - (it is not set by default). You are encouraged to replace the use of - ACE_TYPENAME with the C++ typename keyword before the ACE_TYPENAME - macros is removed from ACE in the future. - -. A new script, rm_exception_macros.pl, has been added to help users - remove the use of the ACE exception macros from their own code. - -USER VISIBLE CHANGES BETWEEN ACE-5.5.4 and ACE-5.5.5 -==================================================== - -. The prebuild MPC keyword is now supported by the gnuace project type. - This fixes Bugzilla #2713. - -. Support for Windows earlier than NT 4 SP2 was removed. ACE will not build - for Windows 95, 98, Me, etc. out of the box any longer. - -. Reformat stringified IPv6 addresses to use [addr]:port when printing - addresses that contain ':' such as "::1". - -. Added method to ACE_INET_Addr to determine if address is IPv6 or - IPv4 multicast. - -. Fixed a bug in ACE_Async_Timer_Adapter_Timer_Queue_Adapter where the - gettimeofday function of the timer queue was ignored when setting the alarm. - -. Fixed a problem where, on Solaris 9 onwards, calling - ACE_OS::thr_create(THR_NEW_LWP) more than 2^15 (65535) times in a - process will fail. See changelog entry from "Wed Jan 3 22:31:05 UTC - 2007 Chris Cleeland " for more information. - -. Fixed a bug in ACE_QtReactor where the two select() calls in that function - might select on different handler sets. - -. ACE_SOCK_IO::recvv(iovec[], size_t, const ACE_Time_Value* = 0) and - ACE_SOCK_IO::sendv (const iovec[], size_t, const ACE_Time_Value* = 0) methods - were changed to specify the iovec count argument as int instead of size_t - since it gets reduced to int in the underlying OS calls (usually). - -. The following deprecated methods were removed: - - ssize_t ACE_SOCK_IO::recv (iovec iov[], - size_t n, - const ACE_Time_Value *timeout = 0) const; - - ssize_t ACE_SOCK_IO::recv (iovec *io_vec, - const ACE_Time_Value *timeout = 0) const; - - ssize_t ACE_SOCK_IO::send (const iovec iov[], - size_t n, - const ACE_Time_Value *timeout = 0) const; - - These were previously replaced with more specific recvv() and sendv() - methods. - -. The ACE_Service_Repository::find(const ACE_TCHAR name[], - const ACE_Service_Type **srp = 0, - int ignore_suspended = true) const - method's 'ignore_suspended' parameter was changed from int to bool to - reflect it's purpose as a yes/no indicator. - -. Added --enable-ace-reactor-notification-queue configure script - option to the autoconf build for enabling the Reactor's userspace - notification queue (defines ACE_HAS_REACTOR_NOTIFICATION_QUEUE in - config.h). - -. The int ACE_OutputCDR::consolidate(void) method was contributed by - Howard Finer at Sonus Networks. This method consolidates any continuation - blocks used by an ACE_OutputCDR object into a single block. It's useful for - situations which require access to a single memory area containing the - encoded stream, regardless of its length, when the length cannot be known - in advance. - -. There are a number of new methods defined on ACE_String_Base: - - size_t capacity (void) const: This method returns the number - of allocated CHAR units in the string object. - - void fast_resize (size_t): This method manage the sizing/reallocating - of the string, but doesn't do the memory setting of resize(). - - bool operator!= (const CHAR *) const - bool operator== (const CHAR *) const: These methods compare the - string with a nul-terminated CHAR* string. - - nonmember functions operator== and operator!= where also added - that compare const ACE_String_Base and const CHAR*; these make - it possible to switch ACE_String and CHAR* on either side of - the operator. - - Thank you to Kelly Hickel for these additions. - -. There are 2 new build options on the traditional make command: - dmalloc and mtrace. When specified at build time (e.g. make mtrace=1) - the PLATFORM_DMALLOC_CPPFLAGS and/or PLATFORM_MTRACE_CPPFLAGS values - are added to CPPFLAGS. For dmalloc, the PLATFORM_DMALLOC_LDFLAGS and - PLATFORM_DMALLOC_LIBS are added to LDFLAGS and LIBS, respectively. - Thank you to Howard Finer for supplying these additions. - -. Added the ability to specify additional purify and quantify command-line - options by setting PLATFORM_PURIFY_OPTIONS and PLATFORM_QUANTIFY_OPTIONS, - respectively. Thank you to Howard Finer for supplying these additions. - -. Added the ability to use trio (http://sourceforge.net/projects/ctrio/) - if platform lacks decent support for vsnprintf. trio support is - enabled by defining trio=1 in plaform_macros.GNU - -. Removed Irix 5, DGUX, and m88k support - -. Improved LynxOS 4.2 support - -. VxWorks 6.4 support - -. Added support for FC6. Because the GCC 4.1.1 version that gets shipped - has a fix for the visibility attribute we use for the singletons - you will need to define the following in your config.h file. This can't be - done automatically because SuSE 10.2 gets shipped with GCC 4.1.2 but - doesn't have the same fix - ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS 1 - -. RTEMS port - -USER VISIBLE CHANGES BETWEEN ACE-5.5.3 and ACE-5.5.4 -==================================================== - -. Added appropriate intptr_t and uintptr_t typedefs on platforms that - don't provide them (i.e. when ACE_LACKS_INTPTR_T is defined). - -. Added ability to explicitly choose support for 32 bit or 64 bit file - offsets on all platforms. Define the _FILE_OFFSET_BITS preprocessor - symbol to either 32 or 64 to choose the desired number of file - offset bits. This preprocessor symbol is supported natively by most - UNIX and UNIX-like operating systems, and supported by ACE on - Windows. Use the new ACE_OFF_T typedef to refer to file offsets - across UNIX and Windows portably. - -. 64-bit file offsets are now enabled by default in Win64 - configurations. - -. Improved support for 64 bit platforms (64 bit addresses, etc). - -. Added STL-style traits, iterators and a swap() method to the - ACE_Array_Base<> class template. - -. Added STL-style traits and iterator accessors to the - ACE_Hash_Map_Manager_Ex<> class template, as well as new find() and - unbind() methods that return (as an "out" parameter) and accept - iterators, respectively. - -. Greatly improved event handler dispatch performance in - select()-based reactors (e.g. ACE_Select_Reactor and ACE_TP_Reactor) - for large handle sets on Windows. Previous event handler search - were linear, and are now constant on average. - -. Addressed a number of Coverity errors (CHECKED_RETURN, DEADCODE, - LOCK, USE_AFTER_FREE, RESOURCE_LEAK, FORWARD_NULL). - -. Added STL-style "element_type" trait to all ACE auto_ptr class - templates. - -. Removed support for LynxOS 3.x. - -. Resolved Bugzilla #2701 to ensure fini() is called for all - Service Objects upon calling ACE_Service_Config::close() - -. VxWorks 5.5.2 has been tested, for ACE the support is exactly - the same as for VxWorks 5.5.1. No specific defines or flags have - to be used. - -USER VISIBLE CHANGES BETWEEN ACE-5.5.2 and ACE-5.5.3 -==================================================== - -. Added the base projects for executionmanager_stub and plan_generator. - -. Added the ACE_Hash_MultiMap_Manager class and its test file. - -. Changed the ACE_Synch_Options::operator[] method to return bool rather than - int. The value returned is a yes/no indication of whether or not the - specified option(s) are set in the object. - -. Changed the prototype(s) for ACE::debug () to return (and take) a - bool. This is consistent with the original intent for this - feature. If you have been using it like 'ACE::debug () > 0' or - 'ACE::debug (1)', you may have to rebuild ACE. The value of the - ACE_DEBUG environment variable can be used to specify the initial - value for ACE::debug(), at the process start up. - -. An assembler (within a C source file) based implementation for SPARC - of atomic operations suitable for use with the - ACE_Atomic_Op and - ACE_Atomic_Op specializations has - been added. Currently, it can only be enabled by setting the - atomic_ops_sparc make macro to 1 when using the GNUACE build system with - the Solaris SunCC compiler. It should be noted that this requires the - -xarch=v8plus (or higher) be added to the CFLAGS make macro or the - assembler code will not compile. - -. The ACE_Message_Queue_Ex_N class - is new, contributed by Guy Peleg . - ACE_Message_Queue_Ex_N is - similar to ACE_Message_Queue_Ex in that the object queued is a - template parameter. However, ACE_Message_Queue_Ex_N allows the - enqueueing and dequeueing of multiple chained objects at once. This - wasn't added to ACE_Message_Queue_Ex because the chained object - functionality requires the ACE_MESSAGE_TYPE class to have a - ACE_MESSAGE_TYPE *next (void) const method, analogous to - ACE_Message_Block::next(), to follow the chain and this would - probably break existing applications using ACE_Message_Queue_Ex. - The ACE_wrappers/tests/Message_Queue_Test_Ex.cpp test has an example of - how to use the new class. - -. The selector and comparator function pointer arguments to ACE_OS::scandir() - and ACE_Dirent_Selector are now marked as extern "C" to enforce their - use with a C RTL function. User code that defines functions which are - passed as the selector or comparator arguments which are not declared - extern "C" may generate compile warnings. To resolve this, add extern "C" - to the function's signature. See ACE_wrappers/tests/Dirent_Test.cpp for - an example. - -. To address a problem in the ACE string interface that prevented - substring or character searches in very large strings (e.g. greater - than the maximum value of an ssize_t type) from being correctly - reported to the caller, the find(), rfind() and strstr() methods now - return an unsigned integer (size_t) instead of a signed one - (ssize_t). Affected classes include: - - * ACE_CString - * ACE_WString - * ACE_TString - * ACE_NS_WString - - Unless you have been explicitly using -1 instead of npos when - comparing the return value of find(), rfind() and strstr(), and/or - assigning the return value to ssize_t you should not see any - difference. A new size_type typedef has been added to the ACE string - class to aid developers. This typedef is analogous to the standard - C++ string::size_type typedef. - - The ACE_String_Base<>::strstr() documentation and the default - rfind() argument erroneously referred to -1 instead of npos. Those - instances have been corrected. - - To summarize, a "no position" condition is denoted using the npos - constant, not -1. It can be referred directly by scoping it with the - appropriate string class (e.g. ACE_CString::npos, ACE_WString::npos, - etc). - -. Changing the shared library extension for hpux ia64 to ".so". On - HP-UX 11i Version 1.5 the naming scheme is lib*.sl for PA and - lib*.so on IPF. - -. The ACE_Refcounted_Auto_Ptr reset() and release() methods were changed - per Bugzilla #1925. They will both now detach from the underlying - ACE_Refcounted_Auto_Ptr_Rep object; reset() will create a new one for - the new pointer specified as its argument. This change may cause referenced - objects to be deleted in cases where previous ACE versions would not have. - -. The return type of "ACE_Refcounted_Auto_Ptr::null (void) const" changed - from int to bool. It's possible values, true and false, have not changed. - -. TTY_IO now accepts "none" as a valid parity value. Due to this change - 'parityenb' member is now deprecated and will be removed in the future. - The users of TTY_IO class should change their code to use only 'paritymode' - member for parity control and leave 'parityenb' unchanged (it is - enabled by default in class constructor). - -. Support for Intel C++ 9.1 on Windows and Linux - -. VxWorks 6.3 support - -. Fixed Bugzilla #2648 to make sure ACE_Service_Object::fini() - is called iff ACE_Service_Object::init() succeeded, as per - C++NPv2. - -. Added preliminary support for Mac OS X 10.4 on Intel CPU's. - -. Fixed Bugzilla #2602 to re-enable XML Service Configurator - file support. - -USER VISIBLE CHANGES BETWEEN ACE-5.5.1 and ACE-5.5.2 -==================================================== - -. Added support for: - - VxWorks 6.2 for the rtp model using pthread support - - OpenVMS 8.2 for Alpha - -. Removed code and configurations that provided support for: - - Visual C++ 6.0 and 7.0 - - Chorus - - pSOS - - KAI C++ on all platforms - -. Explicit template instantiation support has been removed. This effectively - removes support for Sun Forte 6 and 7 which required explicit template - instantiation to build ACE reliably. - -. Added support for multiple independent Service Repositories through - configuration contexts called "Gestalt". Full backwards compatibility - is maintained through the existing ACE_Service_Config static methods, - while direct individual repository access is enabled through instances - of the new ACE_Service_Gestalt class. ACE_Service_Config has changed to - a specialization of ACE_Service_Gestalt and is only responsible for the - process-wide configuration. - -. To support dynamically-sized ACE_Log_Record messages, the netsvcs - logging components now use ACE CDR encoding and transfer mechanisms - inspired by the examples in Chapter 4 of the C++NPv1 book. - The client and server logging daemons in ACE 5.5.2 and forward will - not interoperate with those in previous ACE versions. - -. Added a wrapper for the sendfile API (ACE_OS::sendfile()). - -. Added support for netlink sockets on Linux. - -. Added a new method, ACE_Task::last_thread(). This method returns the thread - ID (ACE_thread_t) of the last thread to exit from the ACE_Task object. - Users checking to see if a thread is the last one out (for example, to know - when to perform cleanup operations) should compare the current thread ID to - the return value from last_thread(). This is a change from the previously - recommended practice (C++NPv2, page 189) of comparing the return value of - thr_count() with 0. - -. Changed the first argument to ACE_OS::strptime() to be 'const' which - matches its usual usage in POSIX strptime(). This change allows users to - pass const strings in - a common use case. - -. Made part of the file support in ACE 64bit but we have some places where - 32bit types are used, this could lead to some conversion warnings which - will be addressed in the near future, but getting everything 64bit - compliant is a lot of work. - -USER VISIBLE CHANGES BETWEEN ACE-5.5 and ACE-5.5.1 -==================================================== - -. Added support for the --enable-symbol-visibility configure option - to the autoconf build infrastructure instead of solely relying on - feature tests to enable/disable symbol visibility support. This - avoids build problems with icc, etc. - -. Added support for the --enable-fl-reactor configure option to the - autoconf build infrastructure to build the ACE_FlReactor library. - -. Added support for the --enable-qt-reactor configure option to the - autoconf build infrastructure to build the ACE_QtReactor library. - -. Added support for the --enable-xt-reactor configure option to the - autoconf build infrastructure to build the ACE_XtReactor library. - -. Fixed a bug that would cause timer IDs from ACE_Timer_Heap to be - improperly duplicated under certain conditions (Bugzilla #2447). - -. Fixed ACE_SSL_Context::private_key(), context(), and dh_params() methods - to allow retrying a file load after a failed call. - -. Fixed ACE_SSL_Asynch_Stream so it can be instantiated; also moved the - declarations for ACE_SSL_Asynch_Read_Stream_Result, - ACE_SSL_Asynch_Write_Stream_Result, and ACE_SSL_Asynch_Result classes - to the ace/SSL/SSL_Asynch_Stream.h file so applications can see them. - -USER VISIBLE CHANGES BETWEEN ACE-5.4.10 and ACE-5.5 -==================================================== - -. Added a platform macros option "templates=manual", currently only - applies to AIX 5.3 with XL 7 compiler. It allows the user to tell the - compiler to set -qnotempinc and -qnotemplateregistry and works well - in static builds. - -. ACE and its tests compile error free with GCC 4.1 pre release. - -. ACE_Recursive_Thread_Mutex::get_nesting_level() fixed for 64-bit Windows - XP on amd64/EM64T hardware. - -. Many build-time fixes for Windows Mobile 5 and Windows PocketPC 2003 using - Visual Studio .NET 2005 (VC8). - -. Added support for the --enable-tk-reactor configure option to the - autoconf build infrastructure to build the ACE_TkReactor library. - -USER VISIBLE CHANGES BETWEEN ACE-5.4.9 and ACE-5.4.10 -==================================================== - -. Fixed a bug in ACE_Timer_Heap_T::cancel(). - -. Improved ACE_Time_Value support for boundary conditions. - -. Fixed problems with operator placement delete on certain C++ compilers. - -. Fixed a bug with the ACE_SPIPE_Acceptor on Windows. - -. Correctly set sockaddr_in.sin_len and sockaddr_in6.sin6_len on - platforms that have these fields. - -. Avoided problems with namespace pollution for max() macros. - -. Many fixes for ACE_LACKS* and ACE_HAS* macros for autoconfig. - -USER VISIBLE CHANGES BETWEEN ACE-5.4.8 and ACE-5.4.9 -==================================================== - -. Added dozens of new ACE_LACKS and ACE_HAS defines which are used to - simplify the ACE_OS layer - -. Constructors of ACE_Time_Value have been made explicit to prevent - implicit conversions. - -. Added a shutdown() method to ACE_Barrier. The new method aborts the - wait by all threads. - -. Changed the behavior of ACE_Message_Queue::enqueue_head() and - enqueue_tail(). If the enqueued message block has other blocks - chained to it via its next() pointer, the entire chain of blocks - will be enqueued at once. - -. Improved the support for high-resolution timers with - ACE_Timer_Queue_Adapter. - -. Make it possible to disable file caching in JAWS. - -. Improved ACE_Pipe implementation so that it uses localhost to avoid - firewall problems. - -. Added Unicode support to the Service Configurator. - -USER VISIBLE CHANGES BETWEEN ACE-5.4.7 and ACE-5.4.8 -==================================================== - -. Improved IPv6 support - -. Improved 64bit portability - -. TTY_IO overhaul - - Improved documentation. - - It is now possible to request infinite timeout in portable manner. - This can be achieved by setting negative value to readtimeoutmsec. - - Various bugs fixed and portability issues resolved. - -. Subset ACE for TAO and TAO Services - -. Support for Intel C++ 9.0 on Windows and Linux - -. Support for Microsoft Visual Studio 2005 (aka VC8) for Win32 as well - as the Windows CE platforms Pocket PC 2003 and Windows Mobile 5. - Solution/project files are generated with an appended "_vc8" for - Win32 and "_WinCE" for the CE platforms. See - ACE_wrappers/docs/CE-status.txt for more information. - -. Completed implementation of ACE_Dev_Poll_Reactor using the Linux epoll - facility; tested on Red Hat Enterprise Linux 4. - -. The in-memory size of an ACE_RB_Tree will be smaller due to rearranged - placement of pointers. - -. Added an optimization to CDR stream to ignores alignment when marshaling - data. Use this new ACE_LACKS_CDR_ALIGNMENT compile-time option only - when the ACE_DISABLE_SWAP_ON_READ macro is enabled. This new option - requires ACE CDR engine to do both marshaling and demarshaling, and - when this option is enabled the encoded streams are no longer - compliant with the CORBA CDR specification. - -. Developed Feature Oriented Customizer (FOCUS) tool to enable - specialization of middleware frameworks such as Reactor and Protocol - framework. FOCUS provides an XML based transformation engine, where - the transformations to specialize the components are captured in XML - file and a weaver specializes the code. - -. Added support for unrolling ACE_OS::memcpy copy loop where - applicable to improve performance. Autoconf tests empirically - determine whether loop unrolling is at least 10% better than default - version. - -. Added support for an ACE "versioned" namespace. When enabled, ACE - library sources will be placed within a namespace of the user's - choice or a namespace of the form ACE_5_4_7 by default, where - "5_4_7" is the ACE major, minor and beta versions. The default may - be overridden by defining the ACE_VERSIONED_NAMESPACE_NAME - preprocessor symbol. Enable overall versioned namespace support by - adding "versioned_namespace=1" to your MPC default.features file. - -USER VISIBLE CHANGES BETWEEN ACE-5.4.6 and ACE-5.4.7 -==================================================== - -. Support for shared libraries with VxWorks - -. Support for Solaris 10 on x86 with Sun Studio 10 (C++ 5.7). - -. Extended ACE_OS::event_xxx implementation to support platforms - having either PThread support with Process Shared condition - variables or POSIX semaphores with named (process shared) - semaphore support or using the new FIFO based semaphores. - -. ACE_OS::closesocket() no longer calls ACE_OS::shutdown() on any platform - while closing the socket. It previously called ACE_OS::shutdown() on - HP-UX. Removing this call fixes the fork-and-close programming paradigm - that's common to many networked applications. - -. RMCast - - Support for message fragmentation. This will allow - for messages larger than 64K. - - Support for flow control. - - Timed recv() in RMCast::Socket. - - Per-instance configurable protocol parameters (e.g., message - retention time, NAK timeout, etc). - -USER VISIBLE CHANGES BETWEEN ACE-5.4.5 and ACE-5.4.6 -==================================================== - -. Updated RMCast to include - - Reactor-compatible interface. - - Message unavailability reporting. - - Protocol documentation. - -. Added support for 64bit Visual Age on AIX - -. Improved g++ 4.0 support. A number of RTTI related problems have been - fixed. - -. Smaller footprint. - -. Fixed memory leaks ACE_DLL and ACE_Log_Msg classes. - -. The ACE::ICMP_Socket and ACE::Ping_Socket classes were moved out of - the ACE namespace and "flattened" to ACE_ICMP_Socket and - ACE_Ping_Socket to be consistent with the rest of ACE. - -. ACE_INET_Addr::set_address() - fixed a possible struct member - alignment issue when building an IPv4-mapped IPv6 address. - -. Added a new ACE::wild_match() function to match a string based on - wildcards. - -. Added efficient overloads for string concatenation to the - ACE_String_Base class. - -. Added support for the use of pthread_getschedparam on MacOS X. - -. Fixed an issue with static initialization of TSS related classes on - static builds for Windows. - -USER VISIBLE CHANGES BETWEEN ACE-5.4.4 and ACE-5.4.5 -==================================================== - -. Remove special handling in the Thread Specific Storage(TSS) code - that released the TSS key for ACE_TSS. ACE_TSS has - been changed to explicitly free the TSS key when necessary. - -. On Win32 systems: detect thread termination via a hook in DLLMain - for ACE.dll. This allows cleanup of TSS objects for non-ACE threads - that use ACE functions. The most common case was threads that used - ACE logging. Formerly any TSS objects created by these threads would - be leaked. - -. Added support for GNU G++ 4.0. The x.4.5 beta takes advantage of - g++ 4.0's symbol visibility. This feature is conceptually similar - to MS Windows "__declspec(dllexport)" DLL functionality. Using this - new g++ feature results in substantially improved ACE/TAO/CIAO - shared library binaries. A subset of the improvements include the - following: - - * The number of unnecessarily exported DSO/DLL symbols is - greatly reduced, resulting in faster program start times. - * Smaller footprint. - * Improved performance since run-time indirection of internal - symbols is no longer needed. - - No changes to the ACE/TAO sources were necessary to support this - feature since the required visibility attributes were hidden behind - the various "*_Export" macros (formerly only useful for MS Windows - DLLs) used throughout ACE/TAO. - -. The ACE_Reactor destructor will now call close() on the referenced reactor - implementation. This assures that all handlers are notified before the - ACE_Reactor object that's most likely referenced in these handlers is - invalid. Although this should not be a user-visible change, it did catch - some ACE tests off guard destroying reactor implementations and ACE_Reactor - interfaces in the wrong order, so it may come up in the field as well. - When using dynamically allocated reactor implementations, do not destroy - the implementation object before the ACE_Reactor interface object. Use of - the ACE_Reactor constructor's delete_implementation argument (with a value - of 1) is recommended when dynamically allocating reactor implementations. - -. Improved performance of HTBP by not requiring a lookup of peer hostname. - -. Added new ACE_SizeCDR stream which allows one to calculate size of the - representation without writing anything. - -. Number of improvements in RMCast, reliable multicast implementation. - -USER VISIBLE CHANGES BETWEEN ACE-5.4.3 and ACE-5.4.4 -==================================================== - -. The ace-config script has been replaced by pkg-config metadata files - which are installed in ${prefix}/lib/pkgconfig by the automake build. - -. Remove ACE_OS::gets() implementation. While this ACE implementation - of gets() did not contain the security holes that all standard - gets() implementations have, keeping it around only serves to foster - confusion since (1) some may incorrectly assume that this - ACE-specific gets() implementation has the same holes as standard - ones, and (2) invoking it with a default size argument so that it - looks like a standard gets() call results in behavior that is - different from the standard. Use ACE_OS::fgets() instead. - -. Removed ACE_Unbounded_Set_Ex, this gave the false idea that it had - thread safe iterators. Use ACE_Unbounded_Set instead - -. Improved VxWorks support for static libraries. Shared libraries do cause - several known problems which will be fixed in the x.4.5 release. - -. Removed the usage of the ACE_x_cast macros, we are using the C++ casts - from now on. The ACE_x_cast macros are deprecated and will be removed - after the x.5.1 release - -. Some improvements in autoconf support; better detection of available - OS and compiler features. - -. Fixed bugs in ACE TSS emulation - -USER VISIBLE CHANGES BETWEEN ACE-5.4.2 and ACE-5.4.3 -==================================================== - -. Improved Cygwin 1.5.12 support, 90% of the tests now succeed - -. Improved OpenVMS support. - -. Added ability to use fltk with Cygwin/MinGW - -. Added ACE_INT64 that defines a native 64 bit type. - -. Added 'q' as usable specifier for ACE_Log_Msg to print out int64 bit number. - -. Added better support for Intel C++ compilers. - -. Improved HPUX support. - -. Added a new directory ("ACE_wrappers/protocols/ace") for new protocols - that are not directly components of ACE, but are relate to ACE and - defined a new protocol, HTBP (Hypertext Tunneling, Bidirectional - Protocol) providing ACE_Acceptor/Connector/Stream semantics over a - connection owned by an HTTP proxy. Test cases in - ACE_wrappers/tests/HTBP provide examples of use. - -. Performace enhancement in TP_Reactor's handle_timer_events method [Bug - 1971]. - -. Various changes to permit ACE to execute on HP NonStop platform (e.g - support for its pthreads version). - -. Updated HP NonStop configuration files (config-tandem-nsk). - -. The "ACE" pseudo-namespace is now a true C++ namespace. Transitional - pseudo-namespaces that were only meant to be used internally by ACE, - such as "ACE_Sock_Connect", no longer exist. - -. ACE_CDR::Boolean type is now a true C++ "bool" on all platforms except - MSVC++ 6. We plan to deprecate MSVC++ 6 support sometime after the - x.5 release of ACE+TAO+CIAO, so we recommend you start migrating to a - later version of MSVC++. - -. More GNU g++ 3.4.x fixes. - -. Added ICMP and "ping" socket support. - -. Added mkstemp() emulation. - -. Fixed problem on Linux < 2.5.47 platforms where equality comparison of - two logically equal sockaddr_in structure instances would incorrectly - fail. - -. Support for wide characters has been improved on non-Windows - platforms. - -. A number of Windows CE problems have been fixed. - -. ACE's loading of DLLs (for example, as a result of loading synamic - services) has been changed to use the native OS's facilities for - locating the DLL instead of searching LD_LIBRARY_PATH (or its - equivalent) then loading the DLL using a full pathname. This restores - enforcement of a platform's loading and security policy. To use the - old DLL locating method, add ACE_MUST_HELP_DLOPEN_SEARCH_PATH to your - config.h file before building ACE. - -. A number of errors in the APG example programs have been corrected. - -. Select_Reactor and Priority_Reactor performance improved. [Bug 1890] - -. Wide-char functionality on POSIX (Linux, etc.) - -. TSS memory leak fixes [Bug 1542] - -. Ported to HPUX 11i v2 on Itanium - -. Added code to ACE for platform RedHat AS 3.0 on Opteron. - -. Changed ACE::crc32() family of functions to NOT fold in the length of - the string/buffer/iovec into the CRC. - - -USER VISIBLE CHANGES BETWEEN ACE-5.4.1 and ACE-5.4.2 -==================================================== - -. Support for g++ 3.4.1. - -. All ACE Makefiles, project files, etc, are now generated by OCI's - "MakeProjectCreator" (MPC) tool. Makefiles and project files for - commonly used configurations have been pre-generated and distributed - with the beta(s). Please see: - - $ACE_ROOT/ACE-INSTALL.html - - for information on how to use MPC with ACE. - -. Improved Doxygen documentation. - -. Reduced header file dependencies, which should speedup compilation - and help minimize static footprint. - -. ACE now requires support for the following standard C++ features: - - - "bool" keyword - - - "mutable" keyword - - - "explicit" keyword - - - C++ casts (e.g. static_cast<>, reinterpret_cast<>, dynamic_cast<> - and const_cast<>) - - If you're using a compiler that does NOT support these features - please contact Steve Huston for support. - -. Changed the select()-based reactor implementations to scan for - broken handles to remove based on the registered handles, not on - event handlers. This allows for bad handles to be removed from the - reactor even if the event handler doesn't implement get_handle() the - way we expect. - -. Support for Pthreads native recursive mutexes was added. This - capability is specified to ACE_OS::mutex_init() as an optional - argument, lock_type. To fix confusion from an earlier attempt to add - this functionality, the meaning of the old 'type' argument to - ACE_OS::thread_mutex_init() is changed. It previously combined the - scope and type. Now it is just the type (e.g. recursive), as the - scope is inherent in the method used. For clarification on - ACE_HAS_RECURSIVE_MUTEXES, it means that the platform is capable of - them, not that they always are, as one would expect. However, before - Pthreads had recursion added, it was never optional. Now it is. - -. Initial support for new Linux sys_epoll() interface in - Dev_Poll_Reactor. The obsolete Linux /dev/epoll interface is no - longer supported. - -. Improved Cygwin support. - - Threading works without problems. - - Problems with shared memory, process shared mutexes, multicast and - some other small things still exist. - -. New OpenVMS port. - - This is for the latest version of OpenVMS with all available ECOs - applied. Basic stuff works without problems. Advanced features - still need some work. - -. Usage of ASYS_INLINE is deprecated in ACE. Use ACE_INLINE instead. - -. All inline source files now end in ".inl". The previous ".i" - extension is generally used for preprocessed C sources. - -. Autoconf support has been improved and fixed on a number of - platforms, including the BSD variants (e.g. FreeBSD). It is still - not the preferred way to configure most platforms, but it is ready - for wider testing. Please report any problems found to - ace-bugs@cs.wustl.edu. - -. A number of fixes were made to quiet compile errors and warnings on - 64-bit Windows. - -. For builds on AIX using Visual Age C++, the make rtti option default - was changed to 1, enabling RTTI by default. - -. ACE_Service_Repository::remove() has a new, optional argument that - can receive the service record pointer for the removed service. If - the pointer is returned to the caller, it is not deleted. If the - pointer is not returned to the caller (the default) it is deleted - (this is the historic behavior). - -. The tutorials in ACE_wrappers/docs have been removed. They were not - being maintained and caused confusion in a number of cases. Now that - there are complete examples that match the printed books (C++NPv1, - C++NPv2, APG), the older tutorials are no longer useful. Please see - - $ACE_ROOT/examples/C++NPv1/ - $ACE_ROOT/examples/C++NPv2/ - $ACE_ROOT/examples/APG/ - - for the source code of the examples in those books. - -. ACE_String_Base::fast_clear() is a new method which sets the string - length to 0. Doesn't release string-allocated memory, but if the - memory was externally supplied, it is no longer referenced from the - string object. - -. A true C++ "bool" is now used as the CDR stream boolean type, if - supported by the compiler. - -. Renamed AIX 5L configuration header from config-aix5.1.h to - config-aix-5.x.h. - -. All C++ equality, relational and logical operators now return bool - instead of int, as is the norm for modern C++. - -. Added new ACE_OS::realpath() implementation. Contributed by Olli - Savia - - -USER VISIBLE CHANGES BETWEEN ACE-5.4 and ACE-5.4.1 -==================================================== - -ACE ---- - -. Fixed "make install" support in ACE+autoconf configurations. - -. Fixed autoconf support on Solaris. - -. Corrected invalid `aux' directory (on MS Windows) found in ACE - distribution. - -. ACE/TAO build now without problems with MinGW and all ACE tests run - now without problems - -. Added some more support for the new CBuilderX Preview compiler, this - is not 100% ready yet because the compiler is still a preview and - has its own problems. - -. Added Visual SlickEdit 8.1 MPC template - -. Added workaround for compile problems in Borland Release builds - -. Cygwin 1.5.9 is now supported - -. Tests for IPV6 have been added - -. Implement lstat() so that it'll use stat() on platforms that don't - support lstat(). - -. Problems related to ACE_Event_Handler usage in WFMO_Reactor was - fixed. - -. A wrapper for rmdir () has been added. - -. Threads spawned in thread-per-connection mode never inherited the - priority. This problem was fixed and this fix is consistent with the - C++ NPV* books. - -. Fixed memory leaks with ACE_String_Base::resize () - -. Enable the usage of native recursive mutexes for the implementation - of ACE recursive mutexes on Linux. - -. The ACE Proactor framework can now be enabled for AIX 5.2. Since AIO - functionality is not run-time enabled by default on AIX 5.2, the ACE - Proactor code is not built by default on AIX. To enable it, the - config.h file must contain #define ACE_HAS_AIO_CALLS before - including the config-aix-5.1.h file. - -. The ACE_POSIX_CB_Proactor implementation is now built on all - platforms except LynxOS. - - -USER VISIBLE CHANGES BETWEEN ACE-5.3.6 and ACE-5.4 -================================================== - -ACE: ---- -. Added a new makefile commandline flag, static_link, that can be - used to force static linking when static_libs_only is turned on. It - uses the new STATIC_LINK_FLAG variable and is currently only - implemented for for GNU ld, i.e., it adds the "-static" option to - LDFLAGS. It's turned off by default since using it causes the - footprint to go up by almost 1 MB on Linux, since it links all the - system and compiler .a files, but can be turned on if users - want/need to use it, by enabling both static_libs_only and static_link. - - -. Added macros ACE_USES_GPROF which enables users to use gprof in a - multithreaded environment with ACE libs. - -. Added a new functor template class, ACE_Malloc_Lock_Adapter_T, - that's used by ACE_Malloc_T as a factory for the ACE_LOCK template - parameter, and allows the use of locking strategy classes, like - ACE_Process_Semaphore and ACE_Thread_Semaphore that don't have a - satisfactory ctor taking a single required ACE_TCHAR* parameter, to - be adapted to work with ACE_Malloc_T. - -. The source code examples from "The ACE Programmer's Guide" book by - Huston, Syyid, and Johnston, are now located in - $ACE_ROOT/examples/APG. - -. Support for GNU autoconf is now in ACE. Please see ACE-INSTALL.html - for details. - -. Fixed problems that prevented ACE from being compiled on LynxOS - 4.0.0. - -. Fixed compilation error which prevented ACE from being compiled when - ACE_COMPILE_TIMEPROBES was set to 1. - -. Preliminary support for Tandem NSK has been added. - -. Lots of bug fixes with TLI and XPG5. Please see $ACE_ROOT/ChangeLog - for details. - -. Fixed ACE_OS::event_timedwait() and ACE_OS::event_wait() so that - they use a while loop around the ACE_OS::cond_[timed]wait() calls to - avoid problems with spurious wakeups, etc. - -. ACE's wrapper around getipnodebyname() and getipnodebyaddr () has - been made go through the IPv4-only case on ACE_WIN32. Since Windows - IPv6 implementation doesn't offer support (at thistime) for - getipnodebyname() the code has been changed to use the IPV4 part of - the code. - -. Install with Borland C++ of ACE library fixed - -ACEXML: -------- - -. Fixed memory leak in ACEXML parser. - -. Fixed implementations of rewind() in all the CharStreams. They were - broken previously. - -. Fixed bugs in the parser associated with incorrect handling of PE - References for keywords. diff --git a/dep/acelite/README b/dep/acelite/README deleted file mode 100644 index 35198116bf5..00000000000 --- a/dep/acelite/README +++ /dev/null @@ -1,224 +0,0 @@ -$Id: README 94611 2011-10-06 11:54:28Z msmit $ - -This document is also available at the following URL: - -http://www.cs.wustl.edu/~schmidt/ACE.html - -All software and documentation is available via both anonymous ftp and -the World Wide Web.] - -THE ADAPTIVE COMMUNICATION ENVIRONMENT (ACE) - -An Object-Oriented Network Programming Toolkit - ----------------------------------------- - -Overview of ACE - -The ADAPTIVE Communication Environment (ACE) is an object-oriented -(OO) toolkit that implements fundamental design patterns for -communication software. ACE provides a rich set of reusable C++ -wrappers and frameworks that perform common communication software -tasks across a range of OS platforms, including Win32/Win64, most -versions of UNIX (e.g., SunOS, HP-UX , AIX, Linux, NetBSD, and FreeBSD), -real-time operating systems (e.g., VxWorks, Chorus, LynxOS, and QNX), -OpenVMS, and MVS OpenEdition. A single source tree is used for all -these platforms and porting ACE to other platforms is relatively easy. - -The communication software components provided by ACE include event -demultiplexing and event handler dispatching, service initialization, -interprocess communication, shared memory management, message routing, -dynamic (re)configuration of distributed services, multi-threading, -and concurrency control. There are both C++ and Java versions of ACE -available. - -ACE is targeted for developers of high-performance and real-time -communication services and applications on UNIX, POSIX, and Win32 -platforms. ACE simplifies the development of OO network applications -and services that utilize interprocess communication, event -demultiplexing, explicit dynamic linking, and concurrency. ACE -automates system configuration and reconfiguration by dynamically -linking services into applications at run-time and executing these -services in one or more processes or threads. - -ACE is currently used in commercial projects and products by dozens of -companies including Ericsson, Bellcore, Siemens, Motorola, Kodak, -Boeing, Lucent, DEC, Lockheed Martin, and SAIC. Commercial support -for ACE is available from several companies as listed at -http://www.cs.wustl.edu/~schmidt/commercial-support.html - ----------------------------------------- - -C++ Wrappers for OS Interfaces - -The lower-level portions of ACE provide a set of portable and -type-secure C++ wrappers that encapsulate the following C language OS -interfaces: - - . IPC mechanisms - -- e.g., Internet- and UNIX-domain sockets, TLI, Named - Pipes (for UNIX and Win32) and STREAM pipes; - - . Event demultiplexing - -- e.g., select(), poll(), and Win32 - WaitForMultipleObjects and I/O completion ports; - - . Multi-threading and synchronization - -- e.g., Solaris threads, POSIX Pthreads, and Win32 - threads; - - . Explicit dynamic linking - -- e.g., dlopen/dlsym on UNIX and LoadLibrary/GetProc - on Win32; - - . Memory-mapped files and shared memory management - -- e.g., BSD mmap(), SYSV shared memory, and Win32 - shared memory; - - . System V IPC - -- e.g., shared memory, semaphores, message queues. - -The OS Adaptation Layer shields the upper levels of ACE from platform -dependencies associated with the underlying OS interfaces. - ----------------------------------------- - -Frameworks and Class Categories - -ACE also contains a higher-level network programming framework that -integrates and enhances the lower-level C++ wrappers. This framework -supports the dynamic configuration of concurrent distributed services -into applications. The framework portion of ACE contains the -following class categories: - - . The Reactor - -- Supports both Reactive and Proactive I/O; - - . The Service Configurator - -- Support dynamic (re)configuration of objects; - - . The ADAPTIVE Service Executive - -- A user-level implementation of System V STREAMS, - that supports modular integration of - hierarchically-related communicaion services; - - . Concurrency - -- Various types of higher-level concurrency - control and synchronization patterns (such as - Polymorphic Futures and Active Objects); - - . Shared Malloc - -- Components for managing dynamically allocation - of shared and local memory; - ----------------------------------------- - -Distributed Services and Components - -Finally, ACE provides a standard library of distributed services that -are packaged as components. These service components play two roles -in ACE: - - 1. They provide reusable components for common distributed - system tasks such as logging, naming, locking, and time - synchronization. - - 2. They illustrate how to utilize ACE features such as the - Reactor, Service Configurator, Service Initialization, - Concurrency, and IPC components. - ----------------------------------------- - -Middleware Applications - -ACE has been used in research and development projects at many -universities and companies. For instance, it has been used to build -avionics systems at Boeing, telecommunication systems at Bellcore, -Ericsson, Motorola, and Lucent; medical imaging systems at Siemens and -Kodak; and many academic research projects. Two example middleware -applications provided with the ACE release include: - - 1. The ACE ORB (TAO) -- TAO is a real-time implementation of - CORBA built using the framework components and patterns - provided by ACE. - - 2. JAWS -- JAWS is a high-performance, adaptive Web server - built using the components in ACE. - ----------------------------------------- - -OBTAINING ACE - -The current ACE release is provided as a tar file that is around 3 Meg -compressed using GNU gzip. ACE may be obtained electronically from -http://www.cs.wustl.edu/~schmidt/ACE-obtain.html. This release -contains the source code, test drivers, and example applications -(including JAWS) for C++ wrapper libraries and the higher-level ACE -network programming framework developed as part of the ADAPTIVE -project at the University of California, Irvine and at Washington -University, St. Louis. - -You can get The ACE ORB (TAO) in a companion release at -http://www.cs.wustl.edu/~schmidt/TAO.html. - ----------------------------------------- - -ACE DOCUMENTATION AND TUTORIALS - -Many of the C++ wrappers and higher-level components have been -described in issues of the C++ Report, as well as in proceedings of -many journals, conferences, and workshops. - -A collection of white papers and tutorial handouts are included at -ftp://wuarchive.wustl.edu/languages/c++/ACE/ACE-documentation. This -directory contains postscript versions of various papers that describe -different aspects of ACE. - -I update these papers periodically to reflect changes to the ACE -architecture. Therefore, you might want to check the date on the -files to make sure that you have read the most recent versions of -these papers. - -This material is also available available via the WWW at URL: - -http://www.cs.wustl.edu/~schmidt/ACE.html - ----------------------------------------- - -ACE MAILING LIST AND NEWSGROUP - -A mailing list, ace-users@list.isis.vanderbilt.edu, is available for discussing -bug fixes, enhancements, and porting issues regarding ACE. Please -send mail to me at the ace-users-request@list.isis.vanderbilt.edu -if you'd like to join the mailing list. There is also a USENET newsgroup -called comp.soft-sys.ace. Please see -http://www.cs.wustl.edu/~schmidt/ACE-mail.html for details on how to -subscribe to the mailing list. - ----------------------------------------- - -BUILDING AND INSTALLING ACE - -Please refer to the http://www.cs.wustl.edu/~schmidt/ACE-install.html -file for information on how to build and test the ACE wrappers. The -BIBLIOGRAPHY file contains information on where to obtain articles -that describe the ACE wrappers and the ADAPTIVE system in more detail. - -The current release has been tested extensively, but if you find any -bugs, please report them to the ACE mailing list -ace-users@cs.wustl.edu using the $ACE_ROOT/PROBLEM-REPORT-FORM. -Please use the same form to submit questions, comments, etc. -To ensure that you see responses, please do one of the following: - - 1) Subscribe to the ace-users mail list, by sending email with - contents "subscribe ace-users" to - ace-users-request@list.isis.vanderbilt.edu. - - 2) Or, monitor the comp.soft-sys.ace newsgroup for responses. - ----------------------------------------- - -ACKNOWLEDGEMENTS - -Please see the file `$ACE_ROOT/THANKS' for a list of the thousands of -people who've contributed to ACE and TAO over the years. diff --git a/dep/acelite/THANKS b/dep/acelite/THANKS deleted file mode 100644 index dd9480b47f8..00000000000 --- a/dep/acelite/THANKS +++ /dev/null @@ -1,2399 +0,0 @@ -ACKNOWLEDGEMENTS - -ACE, TAO, CIAO, and DAnCE have been deeply influenced and improved by the -following members of my research group at Washington University in St. Louis, -the University of California at Irvine, and Vanderbilt University in Nashville. - -Everett Anderson -Alexander Babu Arulanthu -Shawn Atkins -Jaiganesh Balasubramanian -Krishnakumar Balasubramanian -Matt Braun -Darrell Brunsch -Dante J. Cannarozzi -Sharath R. Cholleti -Chris Cleeland -Angelo Corsaro -Gan Deng -Mayur Deshpande -Eric Ding -George Edwards -Sergio Flores-Gaitan -Chris Gill -Andrew G. Gilpin -Aniruddha Gokhale -Priyanka Gontla -Pradeep Gore -Matthew P. Hampton -Tim Harrison -John Heitmann -James Hill -Shawn Hannan -Don Hinton -Joe Hoffert -James Hu -Huang-Ming Huang -Frank A. Hunleth -Prashant Jain -Shanshan Jiang -Vishal Kachroo -Michael Kircher -Boris Kolpackov -Arvind S. Krishna -Yamuna Krishnamurthy -Fred Kuhns -David Levine -Tao Lu -Mike Moran -Sumedh Mungee -Balachandran Natarajan -Will Otte -Kirthika Parameswaran -Krishnakumar Pathayapura -Stoyan Paunov -Carlos O'Ryan -Ossama Othman -Jeff Parsons -Irfan Pyarali -Nilabja Roy -Lucas Seibert -Diego Sevilla Ruiz -Nishanth Shankaran -Marina Spivak -Venkita Subramonian -Nagarajan Surendran -Cassia Tatibana -Sumant Tambe -Gabriele Trombetti -Emre Turkay -Nanbor Wang -Seth Widoff -Jules White -Friedhelm Wolf -Torben Worm -Ming Xiong - -I would also like to thank all the following people who have also -contributed to ACE, TAO, CIAO, and DAnCE over the years: - -Paul Stephenson -Olaf Kruger -Ed Brown -Lee Baker -Alex Ranous -Mark Patton -Steffen Winther Sorensen -Troy Warner -Stacy Mahlon -Charles Eads -Mark Frutig -Todd Hoff -George -Brad Needham -Leslee Xu -Detlef Becker -Bruce Worden -Chris Tarr -Bill Sears -Greg Lavender -Steve Warwick -Mats Sundvall -Andreas Ueltschi -Nigel Hooke -Medhi Tabatabai -Stuart Powell -Bin Mu -Andrew McGowan -Ken Konecki -John P. Hearn -Giang Hoang Nguyen -Carlos Garcia Braschi -Jam Hamidi -Eric Vaughan -Karlheinz Dorn -Gerhard Lenzer -Steve Ritter -Chandra Venkatapathy -Matt Stevens -Bob Vistica -David Trumble -George Reynolds -Hans Rohnert -Alex V. Maclinovsky -Todd Blanchard -Rob Clairmont -Christian Millour -Neil B. Cohen -Dieter Quehl -Reginald S. Perry -James Morris -Mark Seaborn -Phil Brooks -E. Jason Scheck -Daniel Proulx -Bill Tang -John Huchinson -Jack Erickson -Byron Walton -Bill Lear -Mark Zusman -Aurelio Nocerino -Walt Akers -Greg Baker -Alexandre Karev -Pramod Kumar Singh -Bryon Rigg -Brad Brown -Patty Genualdi -Eshel Liran -Mick Adams -Chris Eich -Mike Flinn -Audun Tornquist -Sandeep Joshi -Bernd Hofner -Craig Perras -Kirk Sinnard -Matthew Newhook -Gerolf Wendland -Phil Mesnier -Ross Dargahi -Richard Orr -Rich Ryan -Jan Rychter -Tom Marrs <0002104588 at mcimail dot com> -Bob Olson -Jean-Francois Ripouteau -Ajit Sagar -Ashish Singhai -David Sames -Gonzalo Diethelm -Raj -Darrin Edelman -Steve Weismuller -Eric C. Newton -Andres Kruse -Ramesh Nagabushnam -Antonio Tortorici -Nigel Lowe -Tom Leith -Michael Fortinsky -Marco Sommerau -Gary Salsbery -Eric Beser -Alfred Keller -John Lu -James Mansion -Jesper S. M|ller -Chris Lahey -Michael R"uger -Istvan Buki -Greg Wilson -Garrett Conaty -Brad Flood -Marius Kjeldahl -Steve Huston -Eugene K. Plaude -Joseph DeAngelis -Kim Gillies -Luca Priorelli -Alan Stewart -Hani Yakan -William L. Gerecke -Craig Johnston -Pierre-Yves Duval -Rochi Febo Dommarco -Jonathan Biggar -Scott Shupe -Chuck Gehr -Avi Nash -Padhu Ramalingam -Jay Denkberg -Ayman Farahat -Tilo Christ -rev -Hamutal Yanay -Vital Aza -Alex Villazon -David Artus -Todd Barkalow -Alexander Smundak -Thilo Kielmann -Matthias Kerkhoff -Fred LaBar -Hanan Herzog -Eric Parker -James Michael Dwyer -Arun Katkere -Bob Dunmire -Sandro Doro -Robert Lyng -Phil Logan -John Cosby -Wayne Vucenic -Harry Gunnarsson -James CE Johnson -Samuel_Bercovici -Per Andersson -Anthony McConnell -Mark Rabotnikov -John Bossom -Rino Simioni -Slawomir Kuzniar -Rob Jordan -Michael Maxie -John Cosby -Nigel Owen -Jorn Jensen -Paul Roman -Dave Mayerhoefer -Bert Craytor -Joey Zhu -Arthur J. Lewis -Michael R. MacFaden -Paul Han -Jeff Morgan -Arturo Montes -Elliot Lau -Mark Wright -Michael Newton -Kumar Neelakantan -Scott Halstead -Jean-Marc Strauss -Adam Porter -Hakan Kallberg -Eric Dean Russell -Daniel Montalibet -Norbert Rapp -Ganesh Pai -Berni Merkle -Tom Wright -Torbjorn Lindgren -Mike Bernat -Brian Mendel -Jeremy Buch -Kevin Boyle -Kevin Martindale -Luis Lopes -Adrian Salt -Hongbo Xu -Michael Hartman -Tom Dobridge -Rich Christy -Satoshi Ueno -Eugene R. Somdahl -Robert Head -Ivan Murphy -Jan Perman -Shankar Krishnamoorthy -Reza Roodsari -Jim Crossley -Johannes Gutleber -Yigong Liu -Erik Urdang -Mike Schweiger -Anthony Mutiso -Jeff R. Hayes -David Brackman -Dave Moore -Joseph Cross -Cherif Sleiman -Stefan Ericsson -Thanh Ma -Oleg Krivosheev -Stephen Coy -Bob Laferriere -Satheesh Kumar MG -Karen Amestoy -Jeff Richard -Samuel Melamed -Vladimir Schipunov -Felix Popp -Billy Quinn -Michael McKnight -Huiying Shen -Alex Chan -Aaron Valdivia -Edan Ayal -Jeffrey Peterson -Neil Lavelle -Steven Wohlever -Manojkumar Acharya -Evgeny Beskrovny -Kirill Rybaltchenko -Laura Paterno -Ben Eng -Mike Kamrad -Marios Zikos -Mark L Boriack -Mark Hyett -Valik Solrzano Barboza -John Connett -Tom Arbuckle -Stephen Henry -Dani Flexer -Michael Hoffman -John Lindal -Dustin Laurence -Ernie Makris -Timothy A. Brown -Pat McNerthney -Lori Anderson -Erik Margraf -Bryan Doerr -Adam Miller -Thomas Jordan -Keith Nicewarner -Frederic Andres -Achint Sandhu -Mitch Kuninsky -Alex Chan -Jeff Hellzen -Thomas Venturella -Philippe O'Reilly -Stan Leeson -Richard Keizer -Edgar Villanueva -Oliver Kellogg -Dave Meyer -Thomas Hampson -Jay Kistler -Scott Snyder -Mark Evans -Todd Pack -Mark Maris -Jason Katz -Jim Penny -Chris Ryan -J dot Russell Noseworthy -Carol Sanders -Jerry Bickle -Paul von Behren -Sudish Joseph -Loren Rittle -Alexander Ovsiankin -Ravi Nagabhyru -Tom Brusehaver -Dave Tallman -Monish Rajpal -Garry Brother -Andreas Schuelke -Ganapathi -James Garrison -Brad Walton -Paul Motuzenko -Kurt Sussman -Rob Thornton -Chanaka Liyanaarachchi -Saneyasu -Steve Kay -Greg White -Ki-hyun Yoon -Umar Syyid -Bill Fulton -Amancio Hasty -Zoran Ivanovic -Sree Oggu -James Risinger -Leo Modica -Bob Scott -Mark Kettner -Kent Watsen -Chris Healey -Philippe Klein -William S. Lear -John Geiss -Ernesto Guisado -Stuart Myles -Lothar Werzinger -Andrew Harbick -Pavel Motuzenko -Ross J. Lillie -Sam Hauer -Frank J. Hodum -David Miron -Anton van Straaten -Joe Covalesky -Bill Backstrom -Jeff Franks -John Mulhern <9107 at mn3 dot lawson dot lawson dot com> -Johan Lundin -Eric Powers -Gabriel Lima -Doug Anderson -Hongyin Quan -Maximilian Hoferer -Kevin Stanley -Jeff Greif -Jeff McDaniel -Andreas Geisler -Bob McWhirter -Daniel Winder -Zheng Han -Christa Schwanninger -Byron Harris -Barney Dalton -Peter Gorgia -Dirk Broer -Joseph E. LaPrade -Goran Lowkrantz -Susan Liebeskind -Dana Hackman -Margherita Vittone Wiersma -Priya Narasimhan -Jeff Hopper -Mats Nilsson -Dongwook Kim -Don Davis -Alberto Villarica -XuYifeng -Tom Shields -Krishna Padmasola -Andre Folkers -Paul Sexton -Marc Lehmann -Anne Blankert -Raja Ati -Clinton Carr -Peter Liqun Na -Frank Adcock -Xu Yifeng -Valery Arkhangorodsky -Alan Scheinine -Andrew G. Harvey -Dann Corbit -James -Jason Milley -Ulf Jaehrig -Peter Nordlund -Mark Weel -Tres Seaver -Erik Koerber -Eric R. Medley -David O'Farrell -Amir Bahmanyari -Ian Wright -David Janello -Rich Wellner -Fernando D. Mato Mira -Jonathan Reis -Seung-Lee Hoon -Russell L. Carter -Bill Hall -Brian Gilstrap -Balaji Srinivasan -Anders W. Tell -Larry Lachman -Terry Rosenbaum -Rainer Blome -Kirk Ellett -Sunil Kumar -T Stach -Ron Barack -Daniel Nieten -Paul K. Fisher -Jim Buck -Olivier Lau -Achim Stindt -Fredrik Lindahl -Joseph Weihs -Serge Kolgan -James Megquier -Martin Krumpolec -Michael Thomas -Vicentini Emanuele -Bob Price -Ramiro Penataro Blanco -Sigg Pascal -Ivan Leong -Virginie Amar -Tom Ziomek -Hamish Friedlander -Mark De Jong -Knut Johannessen -Leif Jakobsmeier -Jon Lindgren -Steve Vinoski -Christian Mueffling -Victor Yu -Jeff Donner -Joe Loyall -Stanislav Meduna -Christian Korn -Ron Barack -Steve Totten -Faron Dutton -Gary York -Patty Hair -Ivan Pascal -William A. Hoffman -Mark Lucovsky -Greg Holtmeyer -Jody Hagins -Patrice Bensoussan -Keith Brown -Barry Hoggard -Peter J. Mason -Jerry D. De Master -Greg Gallant -wym -Karel Zuiderveld -Mike Goldman -Peter Gross -Greg Ross -Stanford S. Guillory -Peter Weat -Magnus Karlsson -Andreas Tobler -John Aughey -Knut-Havard Aksnes -Eric Mitchell -Tommy Andreasen -Slava Galperin -Jeff Olszewski -Sudhanshu Garg -Mike Preradovic -Greg Harrison -Sangwoo Jin -Jacques Salerian -Steve Coleman -Diethard Ohrt -Jacob Jones -Phil Ruelle -Sush Bankapura -Eric Covington -Darren Whobrey -Mason Taube -Rod Joseph -Hans Horsmann -Kevin Royalty -Souhad Mcheik -Mark Little -Tim Stack -Marc Engel -Uma Markandu -Henrik Nordberg -Tad Jarosinski -Andy Marchewka -Neal Norwitz -Frederic Maria -David Hooker -Christian Destor -Andrew Hobson -Andre Folkers -Torsten Kuepper -Hao Ruan -Alexander Davidovich -Cristian Ferretti -N Becker -Yaolong Lan -Elias Sreih -Liang Chen -Mark Laffoon -Ti Z -Brian Dance -Alexey Gadzhiev -Francois Bernier -Bill Rizzi -Peter Windle -Jaepil Kim -Dmitry Goldshtain -Carl Grinstead -Henric Jungheim -Michael Preobrazhensky -Gregory D. Fee -Roland Gigler -Frank Buschmann -Eric Eide -Don Busch -Thomas Lockhart -David Hauck -Keith Rohrer -Tim Rose -Sam Rhine -Chris Schleicher -Margaret Reitz -Thomas Mehrkam -Erik Ivanenko -Sarmeesha Reddy -Steven Tine -Dave Steele -Simeon Simeonov -David H. Whittington -Ian MacDonald -Hans Ridder -Todd Mullanix -Hai Vu -Paul Francis -Kristopher Johnson -Dave Butenhof -Dominic Williams -Srikumar Kareti -Ian Pepper -Kevin Lyda -James D. Rucker -Brian Wallis -Sandeep Goyal -English Malc -Frank O'Dwyer -Long Hoang -Steven D. Chen -Alain Magloire -Jim Rogers -Nick Sawadsky -David Brownell -Richard Stallman -Casey Lucas -Brian C. Olson -Joseph A. Condlin -Serge Du -Mike Mazurek -Christian Schuderer -John R. Taylor -Bill Tovrea -Wallace Owen -Vyacheslav A. Batenin -Edwin D. Windes -Christopher Kohlhoff -Andreas Terstegge -Stefaan Kiebooms -Keith Nichol -Rebecca Sanford -Ram Vishnuvajjala -Tom Bradley -Shaun Ohagan -Dale Wood -Robert Flanders -Gul Onural -Stephen E Blake -Eric S Rosenthal -Sridevi Subramanian -Bruce Trask -Jake Hamby -Rick Weisner -Dennis C. De Mars -V dot Lakshmanan -Hata Yoshiaki -Vidya Narayanan -Sean Landis -Youzhong Liu -John Weald -Gilbert Roulot -Gildo Medeiros Junior -Brian Peterson -Fabrice Podlyski -Darren DeRidder -John Tucker -Oleg Orlov -Timothy Canham -Randy Heiland -Joyce Fu -Surender Kumar -Pradeep Avasthi -Guicheney Christophe -Madhu Konety -Isaac Stoddard -Alvarez -Peter Brandstrom -Eugene Surovegin -Thaddeus Olczyk -John Chludzinski -Pedro Alves Ferreira -Bruce Edge -Dan Butler -Ron MacKenzie -Craig Rodrigues -Phil Y. Wang -David Brock -John Morey -Dwayne Burns -Denis Ouellet -Stefan Ullrich -Brian Raven -Gheorghe Aprotosoaie -Carsten Zerbst -Paul Calabrese -Stephane Chatre -James Whitledge -Erik Johannes -Alex Hornby -Riaz Syed -Clarence M. Weaver -Roger Egbers -Ralf Kluthe -Ruud Diterwich -Bill Nesbitt -Will Skunk -David Digby -Timothy Schimke -Jim Robinson -Peter Mueller -Raghu Nambiath -Mike Gingell -David McCann -Ruediger Franke -Brian Jones -Michael Garvin -Mike Vitalo -Kirk Davies -Arno Pernozzoli -Trey Grubbs -Matthias Schumann -John Gathright -Alexander Villatora -Hoang Duong -Michael Roth -Craig Anderson -Mitsuhiko Hara -Weihai Yu -Tal Lev-Ami -Chris Zimman -Rick Wesson -Sridhara Rao Dasu -Walter Welzel -Anthony Shipman -Tobin Bergen-Hill -Toshio Hori -John Mink -Duane Binder -Randall Sharo -Dave Madden -Cliff_H_Campbell -Narendra Ravi -Krishnakumar B. -David Sunwall -Brian Wright -Yosi Sarusi -Robert Shewan -Skye Sweeney -Lars Immisch -Stefan Wendt -Herbert -Clarence Bishop -Giga Giguashvili -Philipp Slusallek -Matthew Davis -Janusz Stopa -Rusty Conover -Phillippe Merle -Mark Winrock -Boris Kaminer -Martin Botzler -Lorin Hochstein -Wenli Bai -Harry Forry -Jose Rubio -Joerg Pommnitz -Mogens Hansen -Shafiek Savahl -Pierre Grondin -John Masiyowski -Uwe Landrock -Klaus Banzer -Probal Bhattacharjya -Dmitri Katchalov -Alok Gupta -Chien Yueh -John K. Black -Kamen Penev -Gregory Yarmit -Jarek Tomaszewski -Siegurd Weber -Fabrizio Giannotti -Harald Finster -Fritz Bosch -Charles Frasch -Chris Hafey -Rick Hess -David Dunn -Jaymes Galvin -Marat -Sergey Nemanov -Vladimir Kondratiev -John Glynn -Raymond Wiker -Michael Pitman -Joseph Jefferson -Engelbert Staller -George Ball -Dennis Noll -Ronald Fischer -Marvin Allen Wolfthal -Dan Gilboa -Sean Boudreau -Shalini Yajnik -Matt Thompson -Peter C Chien -Bruce Alderson -Christoph Poggemann -Travis Shirk -Alain Sauron -David Delano -Boris Sukholitko -Brian Mason -Thomas Groth -Damien Dufour -Paulo Breda Vieira -Samuel Stickland -Bryan Van de Ven -Greg Siebers -Rob Gabbot -Paul Carreiro -Jovan Kilibarda -Derek Dominish -Devesh Kothari -Stephen Moon -Hani Mawlawi -Benedikt Eric Heinen -Jason Topaz -Alexander Dergatch -Airat A. Sadreev -Klaus Hofmann -Miroslav Koncar -Extern Chatterji -Zach Frey -Ruibiao Qiu -Marcelo Matus -R Seshardi -Stephan Kulow -Alexander Belopolsky -Ben Bourner -Lalitha Chinthamani -Thomas Huang -Sankaranarayanan K. V -Ephraim Vider -Reid Spencer -Kevin Dalley -Jan Nielsen -Jochen Linkohr -Mirko Brandner -Yuval Yosef -Chad Elliott -David X. Callaway -Soren Ilsoe -Eric Hopper -Martin Johnson -Pierre Oberson -Chris Uzdavinis -Ishay Green -Andrey Nechypurenko -Charlie Duke -Jonathan Luellen -Andrew Psaltis -Erik Jones -Ted Burghart -Mike Winter -Judy Ward -Ken Block -Jamshid Afshar -Jerry Jiang -Rob Ruff -Hugh Arnold -Hessel Idzenga -Mark C. Barnes -Suresh Kannan -Alex Scholte -Greg Jansen -Raj Narayanaswamy -Iain Melville -Daniel Lang
-Chris Leishman -Klemen Zagar -Rick Ohnemus -Adamo, Vince -Defang Zhou -Dave Zumbro -Ted Nolan -Jianfei Xu -Alvin C. Shih -J dot Scott Evans -Alex Luk -Kenneth Osenbroch -Jason Czavislak -Alex Chachanashvili -Gilbert Grosdidier -James Briggs -Herbert Wang -Anders Olsson -Sergey Gnilitsky -David Wicks -Girish Birajdar -Hajdukiewicz Markus -Gerwin Robert -Alia Atlas -David Hall -Todd Gruhn -John Hickin -Alex Brown -Rich Seibel -Jim Scheller -Bob Bouterse -Sandeep Adwankar -W Craig Trader -Bruce McIntosh -Natarajan Kalpathy -David O'Farrell -Bob Bouterse -Malcolm Spence -Dong-Yueh Liu -Craig Ball -Norbert Krain -Adrian Miranda -Cody Dean -Hans Scharkowitz -Charles Meier -Tim Sim -Shalabh Bhatnagar -Charles Scott -Espen Harlinn -mulder -Richard L. Johnson -Tam Nguyen -Jeff Graham -Ralph Loader -Ji Wuliu -Wada Hiroshi -Sal Amander -Torsten Pfuetzenreuter -John M. Mills -David McWeeny -Florian Lackerbauer -Manuel Benche -Steve Luoma -Roger Tragin -Alex Bangs -Yangfen Qiu -Johnny Chen -John Foresteire -Larry Peacock -Francisco Bravo -Antti Valtokari -John Smyder -Mathew Samuel -Conrad Hughes -John Rodgers -Charles Taurines -James Lacey -Nick Pratt -Xiaojun Wu -George Lafortune -Aoxiang Xu -Dima Skvortsov -Moore Y. Cao -Wai Keung Fung -Michael Laing -Benoit Viaud -Ken Weinert -Ferran Boladeres Salvad -Steve Vranyes -Jim Melton -Ron Klein -Anuj Singhal -Henrik Kai -Dominic Hughes -Lior Shalev -Charlie Duke -William Horn -Greg Hall -Aviad Eden -Vianney Lecroart -Russell Mora -Samir Shaikh -Eric Yee -Matt Emerson -Yiu L. Lee -Pedro Brandao -Hakon Innerdal -Sami Aario -Ingo Dahm -Vijay Aswadhati -Xiaowen Wang - -Warren Miller -Youngkwan Cho -Dorr H. Clark -Dave McNeely -Eric Malenfant -Roland Fischer -Alexander Libman -Roger Larsson -Martin Stack -Michael Ravits -Derek Viljoen -Hamed Azizadah -Keo Kelly -Joachim Achtzehnter -Tomer Amiaz -Sergey Osokin -Nick Logvinov -Viatcheslav Batenine -Shashi Bhushan -Javier Corrales -J dot Randy Pitz -Richard Reitmeyer -Xavier Montet -Letha Etzkorn -James Dabbs -Matej Sekoranja -Mattias Eriksson -Nicoletta Viale -George Reid -Kim Lester -Wilson Chan -William Rucklidge -Victor Krebss -Chander P. Thareja -John Mills -Haifeng Lee -Hans Utz -Askok Kumar Kalanithi -Chris Able -John Hiltenbrand -Steve Hespelt -Peter Fischer -Madhu Ramachandran -Caleb Epstein -Bruno Marconi -Ken Childress -Michael Kramer -Johnny Willemsen -Jonathan Astle -Javier Lopez Sanchez -Nir Drang -Albert Wijnja -Marcel Van Der Weert -Mervyn Quah -Giovanni Zito -Matthew Adams -Sameer Schabungbam -Jeff Butler -Roland R�denauer -John Buckman -Guy Rosen - -Bennett R. Stabile -Paul Caffrey -Low Aik long -Michael Rinne -Jaffar Shaikh -Roger Beck -Trueman Bill -Harold Bien -Mateu Batle -Philip Miller -Base V Paul -Evghenii Filippov -Mike Curtis -Jessie Ragsdale -Shourya Sarcar -Eric Crampton -Sandip Patel -ChenXu -Vsevolod Novikov -Brendan Corcoran -Steve Sivier -Rick Schneeman -Klaus H. Wolf -Jean-Christophe Dubois -Michael Hampel -Wei Zheng -Bernd Annamaier -Joachim Tremouroux -Momchil Velikov -Munagala Ramanath -Kevin Marshall -David Channon -Andy Guy -Oscar Rodriquez -Jonathan Cano -Alain Decamps -Paul Rubel -Jon Loeliger -Ricardo Chan -Sarabjeet Duhra -Michael Rushton -Arno Pernozzoli -Calum Mitchell -Jerry Odenwelder -Kent Stewart -Alexander Kogan -Michael Lindner -Arnaud Compan -Michael Searles -Bogdan Jeram -Sebastian Schubert -Li Zhou -Shivakumar Patil -Steve Olson -Allen Broadman -Yuriy Zaporozhets -Joe Guan -Attilio Dona -McGanahan Skjellifetti -Matthias Wittig -David Allen -Edwin McKay -Scott Bolin -Mike Anderson -David Singer -Nick Lin -Ron Hashimshony -Max Khon -Jonas Nordin -Jonathan Stockdale -Jean-Francois Daune -Wei Chiang -Rick Stille -Kirill Kuolechov -Edwin Wrench -Yung Trinh -Richard Eperjesi -Ben Strong -David Karr -Sathish Tiptur -Lu Yunhai -Christian Ewald -Samuel Qi Luo -Sergey Logvin -Orlando Ribeiro -Doug Warner -Kevin Regan -Andy Olson -Max Voronoy -Alexandr Gavrilov -Scott Gunn -Mason Deaver -Richard Huber -Glen Osterhout -YingLi -Haka -Sam Chong -Virgilijus Globis -Stefan Scherer -Pim Philipse -Michael Grove -John Mackenzie -Ricky Marek -Patrick Maassen -Christian Schuhegger -David L Smith -Rainer Doerntge -Tompa -Derek Horton -Shameek Basu -Dipti Jain -Eric Zuur -Jeffrey J. Persch -Rahul Shukla -Pierre Fayolle -Greg McCain -Matt Cheers -Benjamin Fry -Ram Ben-Yakir -Eric Desamore -John Ashmun -Przemyslaw Marciniak -Carsten Madsen -David Sperry -Ted Horst -Diana Arroyo -Benny Prijono -Roland Ziegler -Stelios Sfakianakis -Mike Letchworth -Brian Gilmer -James Dunham -Juergen Pfreundt -Joel Sherrill -Jules Colding -Stephane Pion -Raghu Narayan -Richard Goold -Nathalie D'Amours -Albert Pariante -Stephen Torri -Philippe Perrin -Gunnar Buason -David Hanvey -Jeff McNiel -Georg Lohrer -Rachel G Smith -Tom Lake -Logan Modahala -Jean Malenfant -Victor Poznyak -Juan Jose Comellas -James Dorsey -Benot Desmeules -Tom Moog -Stan Pinte -Dayisi -Peter Georgakakis -Richard Hardgrave -Mark Drijver -Guy Bolton King -Carlton Teel -Alexandre Cervieri -Darren Griffith -Sam Mok -Josh Curry -Norman Wilson -Itzhak Briskman -James Kanyok -Corey Trager -Kirat Singh -Oleg Pavliv -Frederick Niemi -Andrew Munro -Nicolas Huynh -Kevin Burge -Wayne Erchak -Yew Khong See -Greg Thompson -Mike Pyle -Kobi Cohen-Arazi -Israel Illescas Gomez -Brodie Thiesfield -Erik Toubro Nielsen -Masaoud T. Moonim -Steve Witten -Gil Rapaport -Boris Temkin -Steve Perkins -Jerry Thomas -cuma -Ron Heald -Andrew Finnell -Dan Levi -Rob Andzik -James Maynard -Francois Rioux -Ophir Bleiberg -Allen Kelly -Victor Pitchouc -Srikanth Vedire -J Shane Culpepper -Steffen Hieber -Craig L. Ching -Ben Howard -Rich Newman -Kelly F. Hickel -David Trusty -Burkhard Neppert -Crawford Lodge -Scott Gaa -Jenny Kowald -Oren Zeev-Ben-Mordehai -Holger P. Krekel -Glenn Popelka -Tibor Kiss -Robert Davidson -Peter Crowther -Mouna Seri -Vladimir Chovanec -Alexander Rieger -Glen Coakley -Scott Plant -Wilfried Reinoehl -Sangeetha Ramadurai -Victor Chernenko -Frank Wolf -Christophe Galerne -Scott Harris -Stefan Kluehspies -Egon Wuchner -Ugendreshwar Kudupudi -Ekkehard Hoffmann -Ted Krovetz -Grzegorz Sikora -Fabris -Christina Junru -Patrick Rabau -Hyman Rosen -Torbjorn Backstrom -Robert Burke -Olivier Brunet -Bret Clark -Steve Rahn -Bertrand Motuelle -Blair Zajac -Gary Duzan -Garry Shamis -Eamonn Saunders -Yev Omenzel -John E Hein -Tino Schwarze -Gergely Timar -Peter Phillips -Yury Kuznesov -Daniel Manfis -Massimo Pichini -Eyal Neuman -Dave Hale -Giulio Agostini -Werner Buchert -Kevin Cline -Mahesh Varadarajan -Olof Lindfors -Tom Wagner -Kyle Brost -Vincent Nicolas -Jonathan Wackley -Jan Kalin -Andreas Huggel -Alain Totouom -Tushar Nair -Sunny Leung -Bonifides Bautista -Brad Hoskins -Donald Acton -Hagen Ulrich -Adrian Mercieca -Lars Steubesand -Heping He -Leo Kov -Suresh N -David Arndt -Tad Hetke -Graeme Clark -Gu Song -Chris Hughes -Fikri Pribadi -Ioulia Passynkova -Steve Osselton -Doron Rajwan -Stuart Jones -Guillaume Renaud -Tommy Svensson -Jstwo -Hartmut Quast -Ulrich Voigt -Syed Wasim Ali -Bo Balder -Michael Sawczyn -Ildar Gabdulline -David Yongqiang Wang -Shahzad Aslam-Mir -Andrew Foster -C Chan -Alexey Chalimov -Andrea Bernicchia -Praphul Menon -Patrick N -Garth Watney -Jim Connelly -Eyal Lubetzky -Gaoyan Xie -Michael Brinkmann -Chatchai Khumboa -Andrey Shkinev -Michael Graf -Justin Michel -Robert Martin -Charles Meidinger -Petr Tuma -Greg Burley -Marvin Greenberg -Mike Connors -Ben Flight -Bob Jolliffe -Jesse -Robert Handl -Keith Snively -Ahmed Riza -Miljenko Norsic -David Robison -Preston Elder -Eric Peters -Edward A Thompson -Eugene Alterman -Patrick Cosmo -Ran Kohavi -Harvinder Sawhney -Sorin Iordachescu -Mahesh Vedantam -Brian Olson -Roy Sharon -Charlie Grames -Tom Howard -Michael Gillmann -Yaniv Ben Ari -Victor Terber -David Sanders -Yoram Zini -Sean McCauliff -Shmulik Regev -Andrew L. Shwaika -Gerhard Voss -Gregor Bruce -Ian Cahoon -Alexei I. Adamovich -Sohail Husain -Jerome Julius -William R Volz -Koushik Banerjee -Zoran Cetusic -Patrick Bennett -Felix Wyss -Tim Rydell -Petr Shelomovsky -Juliana Diniz -Yuval Cohen -Timothy Kilbourn -Marc Walrave -Petru Marginean -Paresh Raote -Donna Maskell -Steve Ige -Marco Kranawetter -Christian Veleba -Olli Savia -Bhaskara Rao G -M Schulze -John Michael Zorko -Ami Bar -David Smith -Peter van Merkerk -Bill Dyer -Rodney Morris -Mark Hoffmann -Markus Wild -Joe Hayes -Chip Jones -Patrick J Lardieri -Ken O'Brien -Daniel Troesser -Ivan Pazymenko -Dan Green -Cyrille Chepelov -Peter Heitman -Paxton Mason -Yan Dai -Sean I. Luzader -Renjie Tang -Max V. Zinal -Stan Sosnovsky -Ariel Peltz -Carsten Prescher -Raghuram Shetty -Val Dumiterscu -Oleg Kraynov -Stephan Gudmundson -Frank Kuhlman -Denis Otchenashko -Marc M Adkins -Jon Lambert -Rainer Lucas -Allan S Iverson -Jeffrey Shaffer -Oleg Burlachenko -Jian Chen -Jeff Paciga -Laurent Sabourin -Frank Rybak -Tim Iskander -Michele Amoretti -Ido Yellin -Eric Page -Kevin Heifner -James Haiar -Pavel Repin -Whitney Kew -Tom Phan -Andrew Guy -Bharathi Kangatharan -Jean Quinsat -Ma Ting Chong -Andrew Sutton -Ansgar Konermann -Amir Kunst -Daniel Garrido -Andy Alvarez -Soeren Gerlach -Vitaly Prapirny -Sasha Agranov -Ruwanganie Gunatilleke -Peter Kullmann

-Lyn Headley -Jeff Adams -Alexander Maack -Timothy Culp -Oleg Terletsky -Bill Tonseth -Frank Pilhofer -Eric Quere -Keith Thornton -Nathan Krasney -Marek Maleta -David Smith -Dimitrije Jankovic -Frank O. Flemisch -Cary Steinmetz -Ty Tenait -Nitin Mallya -Nick Cross -Christopher W. Midgley -Wanjia -Shanliang Cheng -Andy Ling -Stephen Howard -Carsten T. Nielsen -Adee Ran - -Davide Pasetto -Michael Hornok -Wim van den Boogaard -Carol Hunsicker -Joseph Sarbak -Ruslan Zasukhin -Colin Weaver -Kew Whitney -Sean Ogle -Tim Bradley -Kier Schmitt -George Varsamis -Alan Tanga -Bertin Colpron -Jeff Wilson -Dmitry Khrapov -Francois -Laxmikant Bopalkar -Steven Gardner -Ronald Berger -Jeremy Altavilla -Brian Appel -Lan Zhineng -Leen Van Kampen -James Beale -Mark Xu -Umberto Mascia -Marcel Loose -Christian Klutz -Ville Lehtiniemi -Chumsu Kim -Schone Mullerin -Cemal Yimaz -Newton Aird -Frederic Motte -Roger Weeks -Gautam Thaker -Christophe Juniet -Jeff W -Geir Berset -Ken Sedgwick -Vince Mounts -Vladislav Zverev -Erich Hochmuth -Nick S. Petrov -Dmitry Botcharnikov -Philippe Haussy

-K2 -Eric Frias -Antonio Saraiva -Sean M. Paus -Yuanfang Zhang -Jonathan Franklin -Cristian Ungureanu -Tommy Persson -Christian Barheine -Ole Husgaard -Victor Kirk -Sandeep Neema -Mike Curtis -Artashes Ghazaryan -Ashok Sadasivan -Andreas Koehler -Thomas Devanneaux -Paul Marquis -Ed Skees -Marc Alter -Martin Geliot -Simon McQueen -Jason Pasion -Philipp Leibfried -Erwin Rol -Dirk Moermans -Huseyin Calgin -Jaroslaw Nozderko -Sharon Caspi -Thomas Natterer -Wilbur Lang -Rick Marlborough -David-A O-Brien -Shelton Tang -Frederic Langlet -Antonio Leonforte -Pablo d'Angelo -Christophe Vedel -Uwe Jaeger -Viktor Ransmayr -Daniel Bell -Mathias Waack -Mike Nordell -Tufan Oruk -Tim Smith -Andy King -Eric Strennen -Abhay Kulkarni -Ron Muck -Ma Weida -Terry Lao -Volker Boerchers -Tim Pullen -Marc Tardif -Guan Joe -Petr Ferschmann -Greg Mulyar -Max F. Bilyk -Danile White -Andrew Marlow -Michael F"olsl -Vincent Chau -Theo Landman -Igor Pisarenko -Dima Scub -Volodymyr Orlenko -Grigory -Michael Soden -Dennis Sporcic -Emmanuel Thevenot Beaufort -Denis Parnaland -Matthias Blankenhaus -Wolfgang Schroeder -Mario Hofmann -Bruce MacDonald -Jeffrey Graham -Otis Nyandoro -Ray Limpus -Dmitri Belogaj -Will Christof -Ferran Boladeres Salvad -Juan Carlos Montes Costa -Edward Scott -Steve Spencer -Fukasawa Mitsuo -Martin Brown -Terry Mihm -Jeff Gray -Rob Eger -Leonid Kvetnyi -Rudolf Weber -Sergei Pimenov -David Kinder -Sebastien Lalonde -Jia Wan -Bertin Colpron -Weston Markham -Bryan Thrall -Subhabrata Biswas -Dave Ryan -Zsolt Zsoldos -Tongzhe Cui -Braden McDaniel -Richard Woodring -Andras Lang -Scott Gammil -Nick Lewycky -Ira Burton -Thomas Wiegert -Craig Watcham -Pit Linnartz -Peder Norgaard -David Ohlemacher -Ken Kane -Bill Church -Udo Berninger -Vincent Korkos -Martin Corino -Terry Lacy -Branko Mijic -Jeff Kelley -Daniel Hannum -Jason Cohen -Nick Kukuczka -Andrew Voumard -Anand -D.J. Dwyer -Douglas A Stuart -Victor N. -Francesco Baldi -Michael Rice -Jesse Greenwald -Raymond Hoofman -Jason Smith -Danta Cannarozzi -Valery Salamakha -Karim Fodil-Lemelin -Wenlong Tang -Manish Jain -Robin Farine -Roland Schimmack -Roy Pollock -Eric Held -Kees van Marle -Dieter Knueppel -Amol Tambe -Emiliano Berenbaum -Scott Clarke -Sunil Rottoo -Martin Habets -Todd Cooper -Serkan Unsal -Milan Cvetkovic -Didier Becu -Dan Halbert -Jerome Waibel -Stephan Frenzel -Bruce Jones -Tim Hawes -Philip Leishman -Alexander Jasper -Gerard Grant -Trevor Fields -Jeff Dugan -Jeff Mirwaisi -Alain Dupont -Stephan Bettermann -David McKen -Adam Fanello -Matthieu Vansteene -Sean Rooney -Enrico Detoma -Onopin V. Mikhail -Edward R. Mulholland -Brian Buesker -Vladimir Naylov -Ted Mules -Mike Hepburn -Dale Wilson -Thomas Girard -Malcolm McRoberts -Dror Tirosh -Chris Sontag -Moran Levi -UV Wildner -Alan l Batongbacal -Gary Maxey -Yoav Borer -Andre Kleibeuker -Andy Bellafaire -John Fletcher -Terry Ware -Pierre Pacchioni -Roger Beathard -Konstantinos Margaritis -Stephen Procter -Christoph Liebig -Andre Kostur -Markus Stenberg -Jonathan Pollack -Si Mong Park -Hakim Souami -Paul Morrison -John Poplett -Heiko Bachmann -Andrew Metcalfe -Simon Dutkowski -Mickael P. Golovin -Shannon Barber -Brad Orner -Michelangelo Nottoli -Peter Bekiesch -Martin Kaul -Lukas Gruetzmacher -Robert Schiele -Matthew Grosso -Akim Boyko -Nils Sandoy -Daniel Miranda -Hans-Peter Bock -Dmitri Hrapof -Denny Kolb -Daniel Buchs -Matt Murphy -Brian Nelson -Avi Ouziel -Matthew Gillen -Chris Reed -Andrew Reid -Praveen Sharma -Yi Zuo -Raphael Bossek -Richard G. Hash -Karl Tredwell -Norm Whitehead -Jiang Wei -Kevin Bryan -Zvika Ashani -Thomas Costa -Dom Monteiro -Jean-Marc Prud'homme -Yury Osadchy -Pavan Mandalkar -Scott Willey -David Calkins -Wu Yongwei -Karen L. Regner -Michel Drapeau -Hans Bos -Kevin Stacy -Liat -Andreas Wagner -Steven Xie -Kris Dekeyser -Matthew Harris -Abhijit Sachdev -Mikael Lundqvist -Peter Hercek -Jay Welch -Angel Roman -Jessica Pistole -Paolo Carlini -Eric Whorter -Vincent Seignole -Jingbin An -Roland Meub -Marek Brudka -Levente Torok -Panagiotis Issaris -Mehrdad Nazari -Pierre Bisaillon -Rob Boyer -Scott Gammill -Bayu Hendradjaya -Randy Hammon -Bill Cassanova -Matthew Corey -Vinod Kumar -Mirek Pabich -Christian Egeler -J.T. Conklin -Dale Hawkins -Bill Hopkins -David Fleeman -Merlin Ran -Kevin Christian -Trina Wisler -Bae-Sik Chon -Benjamin Bronk -Dave Craig -Ofira Shaer -Ciaran Moran -Thomas Rohner -Ken Descoteaux -Claas-Hinrich Dommreis -Yateen Joshi -Sergei Kuchin -Theckla Louchios -Randy Secrest -Patrice Marques -Stanislaw Trytek -Mattias Nilsson -Michael Hollins -Dave Knox -Lance Paine -Brian Waltersdorf -Johann Kandlbauer -Adam Rymarczuk -Heiko Nardmann -J. Abelardo Gutierrez -Roger Sala -Razi Ben-Yehuda -Geo Sebastian -Simon Massey -Rich Shapiro -Ramiro Morales -Andrew Athan -Sebastien Roy -Matthew Townsend -Rick Robinson -John D. Robertson -Paul Lew -Eider Oliveira -Jeff Jones -Jean-Christophe Cota -Paul -Vincent Newsum -Vasili Goutas -Iliyan Jeliazkov -Shlomi Yaakobovich -Todd Marshall -Ciju John -Yuk Ming Kwok -Honorato Saavedra -Domingos Monteiro -Bill Somerville -Bjorn Roald -Michi Henning -Xue Yong Zhi -Ertugrul Sorar -Simone Viani -Rohan Mars -Robert S. Iakobashvili -Chris Hammond -Vincent Spano -Nuno Silva -Greg Bostrum -Dipa Suri -Adam Howell -Steven Frare -Dave Dalapati -Arjun Thounaojam -Michael Altmann -Steven Patrick -Pete McCann -William Nagel -M. C. Gahan -Thia Chang Chao -Gao Xianchao -Huang Rui -Sam Abbe -Mike McGahan -David Michael -Steve D. Baker -Martina Yen -Kim ByeongSu -Doug McCorkle -YiQing Xiong -Peter Falsh -Don Sharp -Arto Jalkanen -Scott Zionic -Diana Ukleja -Shaun Cooley -Aapo M�kinen -Matt Emerson -Sean Parker -Mark Wilson -Joerg Rockel -Phil Chen -Stefan Morrow -Bruce Elliot -Mitscher Dubreus -Brian O'Connor -Ron Wilson -Peter Grotrian -Alex Ott -D. J. Stachniak -Slava Gorelik -Wolfgang Fischer -Nicholas Todd -Arno Wilhelm -Andreas Schuler -Altaf Aali -Vemund Handeland -Mario Di Giacomo -Raoul Gough -Aaron -Rohini Madhavan -Alan Balasuar -Will Chai -Paul Koch -Dave Giovannini -Dave Varnell -Howard Finer -Mark Callaghan -Hanson Lu -Gavin Yu -Srikanth Gopal -Like Ma -Alvin Msg -Angela Ziegenhorn -Sam Mesh -Felix Perez Alamillo -Steven T. Hatton -Yevgen Galchenko -Timothy Wayne Gomez -Ventimiglia Chere -Frederick Heckel -Ian Zagorskih -Olivier Gu�rin -Abdel Rigumye -James Damour -Alan Anderson -Vito Bico -Aldo Texier -J H Choi -Mike Chartier -Nikolay Metchev -Anand Rathi -Vitaly Belekhov -Dorian Hileaga -Steve Williams -Paul Friberg

-Zachi Klopman -Jin Zhi Ye -David Carlton -Feng Li -Michael van der Westhuizen -Jan Zima -Francesco Salvestrini -Sandeep Deshpande -Hubert Talbot -Oh Yoon Sik -Anton Bakanovskiy -Toha Bakanovsky -David Faure -Robert Hancock -Peter Oslej -Yongming Wang -Vadim Iosevich -Mike Knight -Nathan Anderson -Eyal Car -Jonathan Sprinkle -Vladimir Panov -Volker Lukas -Bryan Cassell -Guy Peleg -Wallace Zhang -Richard Ward -Alan Stokes -Rick Taylor -Tobias Herzke -Paul Felix -Jan Ohlenburg -Eric Tiangang -David Hawkins -Michael Klein -Sandro Santos Andrade -Richard Spence -Thomas E Lackey -luxi78 at gmail dot com -John Lilley -Abdullah Sowayan -Nathan Bamford -Zoltan Molnar -William Byrne -Karl Schmitt -Ron DeAngelis -Alex Sheh -Daniel Wagner <__daniel___ at icg do tu-graz dot ac dot at> -Nemoy Michael -Marc Brown -Andrew Keane -Martin Kolleck -Tino Riethmueller -Adam Mitz -Frank Rehberger -Aaron Scamehorn -Alan Kierstead -Sven-Uwe Sieler-Hornke -Spencer Vanroekel -Dan Pozdol -Yauheni Akhotnikau -Axter -Roopa Pundaleeka -JR Andreassen -Mockey Chen -Vincent Joseph -Igor Mammedov -Yuan -Adrian Tulloch -Dmitriy Kuznetsov -Steve Orner -Bob Ronak -Aleksandar Vukajlovic -esIgnacio Alvarez -Sergey Zubarev -Qingbo Cai -David White -Jason Zhang -Mark Paulus -Willie Chen -Martin Cornelius -Mohit Kapoor -David Gibbs -Gary Fernandez -Jason Zhao -Keith Muzzioli -John Black -David Chu -Kevin Hu -Yasser Zabuair -Phlip -Michelle Zheng -Gerolf Reinwardt -Paul Robinson -Popeye Cai -David Highley -Sonicfly Zhou -Phil Billingham -Paul Daugherty -Robert Schwebel -William Cote -Ben Creech -Michael Reed -Heesuk Shin -Hong Xing -Winston Zhang -Stefan Naewe -Graeme Bell -Eric Danielou -Wei Jiang -Dale Boan -Christoph Schmalhofer -Amnon Berger -Ephy Levy -Don Meek -Liu Qian -Nzer Zaidenberg -Birgit Platt -Andy Salnikov -Hieu Ngyuen -Andriy Gapon -Andy Wang -Zhamak Dehghani -Charles Calkins -Manuel Traut -Drew Reynaud -Artur DeEsperanto -Scott Mitchell -Thomas Vanier -N Johnson -Adam Nagel -Robert Neumann -Venkat -Juraj Ivancic -Daniel Black -Richard Ridgway -Vadym Ridosh -Viola Wang -Ray Lischner -Sergey Kosenko -Pavel Zaichenko -Paul Riley -Nelson Filipe Ferreira Gon�alves -Harry Goldschmitt -Sail Zeng -Markus Henschel -Asif Lodhi -Andrew Schnable -Grigoriy Zeleniy -Yves Alloyer -Waba -Scott Mark -Bjoern Rasmussen -Ian C White -Dennis Chernoivanov -Werner Burger -Andres Hurtis -Joe French -M. Arshad Khan -Hans van't Hag -Roland Sun -Vance Maverick -John McCabe -Andres Oportus -Olof Granered -Eric Hughes -Zhenghao Shi -Alexander Kornienko -Ben Mohlenhoff -Bill Bruns -Dmitriy Nikitinskiy -Ravi Kanth -Ian Roberts -Patrick Spiering -Duane Beck -Kanghee Yoon -Xu Liang -Leo Lei -Jules d'Entremont -Rajiv K. Shukla -Haibin Zhang -Vikram Karandikar -Kim J. Schmock -Venkat Forums -James Marsh -Shaolong Xiang -Christoph Hofmann -Vladimir Zykov -Daniel de Angelis Cordeiro -Hal Black -Peter Korf -Norbert Thoden -Premkumar P -David Beck -Hayim Shaul -Erman Balcik -Torsten Saliwada -Nathan Glasser -Gr�gor Boirie -Alex Solan -Venkat Sidhabathuni -Nathan Ernst -Kun Niu -Karl-Heinz Wind -Oliver Spang -Hu Yi -Joe Seward -Tom Callaway -Alick Nie -Douglas Atique -Nayeem Khan -Sorin Voicu-Comendant -Andi Heusser -Paul Carter -Michael Carter -Alain Kocelniak -Alvaro Vega Garcia -Fernando C. Jeronymo -Stephen Mouring -Tim -Thomas Brownridge -June Fang -Bill Kendall -Ittehad Shaikh -Michael Doubez -Namrata Gandhi <...> -Michael Guntli -Frank F�rster -Roger Leblanc -Bob Fiske -Julien Vintrou -Jonathan Brannan -antred -Nathalie D'Amours -Mele Giovanni -Philipp Thomas -Mark Hebbel -Tim Pollock -Jack Lavender -Alexandre Skrzyniarz -E Vahala -Christian Fromme -Daniel Lang -Greg Bothe -Anand Kumar -Joe Pallas -Marcel Smit -Florent Vial -Pan Kai Luna -Jesus Martinez -Martin Gaus -Steve Stallion -Ron van Hoof -Joe Lihn -Jani Hakala -Marcus Monaghan -Kashif Khan -JD Robertson -Andreas Drescher -Alon Diamant -Igor Rayak -Shai Kedem -Steve Ramsay - -Skrzyniarz Alexandre -Rob Beekmans -Steven Hartmann -Dicky -Boyan Kasarov -Brendan Murphy -Ryan Carmichael -Koh Onishi -Markus Gaugusch -Annette Wilson -Sharon Mizrahi -William Glenn -Christian Ehrlicher -Hui Zhang -Marijke Hengstmengel -Christian Freund -Chris Shaw -Matthew Carter -Denis Budko -Gaurav Kulshreshtha -Wolfgang Pickartz -Joost Kraaijeveld -Pau Garcia i Quiles -Sail Zeng -Dirk Bonekaemper -Sreejith -Guillaume Lahaye -Andrew Kaplan -Alexander Mintz -Jennifer Kahng -Trent Nadeau -Nick Meyer -Olivier Langlois -Patrick Soboljew -Tim Pinkawa -Ed Blackmond -Dave -Inma Perea -David Ward -Anatoli Sakhnik -Max Zhou -Daynesh Mangal -Robert Shectman -Rafi -Kannan Ramaswamy -Brian Johnson -Catherine L. Paquin -Susan Finster -Frank Preischl -Matthew Waller -Elez -Ranjit Hande -Van Vuong -Mark -Wendsomde Yameogo -Shi John -Helmut Böing -Andrew Hill -Henk Jan Priester -Glenn Zickert -Chris Galli -Laura Autón García -Jonathan Saxton -Remko Duppen -Paul Fitzpatrick -Chad Beaulac -Jochen Meier -Thomas Pauli -Qiao Zhiqiang -JaeSung Lee -Chong Wuk Pak -Michael Frommberger -Andrey Karpov -Dmytro Ovdiienko -Andrea Sormanni -Thomas Stegemann -David Simmonds -Andreas Dröscher -Markus Manck -Deux deVille -Mohsin Zaidi -Milind Pangarkar -Ali Akbar Zarezadeh - -I would particularly like to thank Paul Stephenson, who worked with me -at Ericsson in the early 1990's. Paul devised the recursive Makefile -scheme that underlies the ACE distribution and also spent countless -hours with me discussing object-oriented techniques for developing -distributed application frameworks. - -Finally, I'd also like to thank Todd L. Montgomery , -fellow heavy metal head, for fulfilling his quest to get ACE to -compile with GCC! - -In conclusion, our goal is to see ACE+TAO+CIAO continue to evolve and -become a more comprehensive, robust, and well-documented C++ class -library that is freely available to researchers and developers. If -you have any improvements, suggestions, and or comments, we'd like to -hear about it. Please see the instructions in - -$ACE_ROOT/PROBLEM-REPORT-FORM -$TAO_ROOT/PROBLEM-REPORT-FORM -$CIAO_ROOT/PROBLEM-REPORT-FORM -$DANCE_ROOT/PROBLEM-REPORT-FORM - -for instructions on submitting suggestions or fixes. - - Thanks, - - Douglas C. Schmidt - d.schmidt at vanderbilt.edu diff --git a/dep/acelite/VERSION b/dep/acelite/VERSION deleted file mode 100644 index 144300e4267..00000000000 --- a/dep/acelite/VERSION +++ /dev/null @@ -1,8 +0,0 @@ -This is ACE version 6.1.4, released Wed Aug 29 08:16:04 CEST 2012 - -If you have any problems with or questions about ACE, please send -e-mail to the ACE mailing list (ace-bugs@list.isis.vanderbilt.edu), -using the form found in the file PROBLEM-REPORT-FORM. In order -to post to the list you must subscribe to it. - -See http://www.cs.wustl.edu/~schmidt/ACE-mail.html diff --git a/dep/acelite/ace-v6.1.4_hotfix1.diff b/dep/acelite/ace-v6.1.4_hotfix1.diff deleted file mode 100644 index ba3aca60fc0..00000000000 --- a/dep/acelite/ace-v6.1.4_hotfix1.diff +++ /dev/null @@ -1,418 +0,0 @@ -diff --git a/dep/acelite/ace/CMakeLists.txt b/dep/acelite/ace/CMakeLists.txt -new file mode 100644 -index 0000000..acd3d5a ---- /dev/null -+++ b/dep/acelite/ace/CMakeLists.txt -@@ -0,0 +1,348 @@ -+# Copyright (C) 2008-2014 TrinityCore -+# -+# This file is free software; as a special exception the author gives -+# unlimited permission to copy and/or distribute it, with or without -+# modifications, as long as this notice is preserved. -+# -+# This program is distributed in the hope that it will be useful, but -+# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the -+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -+ -+# NOTE: Do not use glob here, it would include files we don't want -+set(ace_STAT_SRCS -+ PrecompiledHeaders/WinAcePCH.cpp -+ ACE.cpp -+ ACE_crc32.cpp -+ ACE_crc_ccitt.cpp -+ ace_wchar.cpp -+ Activation_Queue.cpp -+ Active_Map_Manager.cpp -+ Addr.cpp -+ Argv_Type_Converter.cpp -+ Assert.cpp -+ Asynch_IO.cpp -+ Asynch_IO_Impl.cpp -+ Asynch_Pseudo_Task.cpp -+ ATM_Acceptor.cpp -+ ATM_Addr.cpp -+ ATM_Connector.cpp -+ ATM_Params.cpp -+ ATM_QoS.cpp -+ ATM_Stream.cpp -+ Atomic_Op.cpp -+ Atomic_Op_Sparc.c -+ Auto_Event.cpp -+ Barrier.cpp -+ Base_Thread_Adapter.cpp -+ Based_Pointer_Repository.cpp -+ Basic_Stats.cpp -+ Basic_Types.cpp -+ Capabilities.cpp -+ CDR_Base.cpp -+ CDR_Size.cpp -+ CDR_Stream.cpp -+ Cleanup.cpp -+ Codecs.cpp -+ Codeset_IBM1047.cpp -+ Codeset_Registry.cpp -+ Codeset_Registry_db.cpp -+ Condition_Recursive_Thread_Mutex.cpp -+ Condition_Thread_Mutex.cpp -+ Configuration.cpp -+ Configuration_Import_Export.cpp -+ Connection_Recycling_Strategy.cpp -+ Containers.cpp -+ Copy_Disabled.cpp -+ Date_Time.cpp -+ DEV.cpp -+ DEV_Addr.cpp -+ DEV_Connector.cpp -+ DEV_IO.cpp -+ Dev_Poll_Reactor.cpp -+ Dirent.cpp -+ Dirent_Selector.cpp -+ DLL.cpp -+ DLL_Manager.cpp -+ Dump.cpp -+ Dynamic.cpp -+ Dynamic_Message_Strategy.cpp -+ Dynamic_Service_Base.cpp -+ Dynamic_Service_Dependency.cpp -+ Encoding_Converter.cpp -+ Encoding_Converter_Factory.cpp -+ Event.cpp -+ Event_Handler.cpp -+ Event_Handler_Handle_Timeout_Upcall.cpp -+ FIFO.cpp -+ FIFO_Recv.cpp -+ FIFO_Recv_Msg.cpp -+ FIFO_Send.cpp -+ FIFO_Send_Msg.cpp -+ FILE.cpp -+ FILE_Addr.cpp -+ FILE_Connector.cpp -+ FILE_IO.cpp -+ File_Lock.cpp -+ Filecache.cpp -+ Flag_Manip.cpp -+ Framework_Component.cpp -+ Functor.cpp -+ Functor_String.cpp -+ Get_Opt.cpp -+ Handle_Ops.cpp -+ Handle_Set.cpp -+ Hashable.cpp -+ High_Res_Timer.cpp -+ ICMP_Socket.cpp -+ INET_Addr.cpp -+ Init_ACE.cpp -+ IO_Cntl_Msg.cpp -+ IO_SAP.cpp -+ IOStream.cpp -+ IPC_SAP.cpp -+ Lib_Find.cpp -+ Local_Memory_Pool.cpp -+ Local_Name_Space.cpp -+ Local_Tokens.cpp -+ Lock.cpp -+ Log_Msg.cpp -+ Log_Msg_Backend.cpp -+ Log_Msg_Callback.cpp -+ Log_Msg_IPC.cpp -+ Log_Msg_NT_Event_Log.cpp -+ Log_Msg_UNIX_Syslog.cpp -+ Log_Record.cpp -+ Logging_Strategy.cpp -+ LSOCK.cpp -+ LSOCK_Acceptor.cpp -+ LSOCK_CODgram.cpp -+ LSOCK_Connector.cpp -+ LSOCK_Dgram.cpp -+ LSOCK_Stream.cpp -+ Malloc.cpp -+ Malloc_Allocator.cpp -+ Manual_Event.cpp -+ MEM_Acceptor.cpp -+ MEM_Addr.cpp -+ MEM_Connector.cpp -+ MEM_IO.cpp -+ Mem_Map.cpp -+ MEM_SAP.cpp -+ MEM_Stream.cpp -+ Message_Block.cpp -+ Message_Queue.cpp -+ Message_Queue_NT.cpp -+ Message_Queue_Vx.cpp -+ Method_Request.cpp -+ MMAP_Memory_Pool.cpp -+ Monitor_Admin.cpp -+ Monitor_Admin_Manager.cpp -+ Monitor_Base.cpp -+ Monitor_Control_Action.cpp -+ Monitor_Control_Types.cpp -+ Monitor_Point_Registry.cpp -+ Monitor_Size.cpp -+ Msg_WFMO_Reactor.cpp -+ Multihomed_INET_Addr.cpp -+ Mutex.cpp -+ Name_Proxy.cpp -+ Name_Request_Reply.cpp -+ Name_Space.cpp -+ Naming_Context.cpp -+ Netlink_Addr.cpp -+ Notification_Queue.cpp -+ Notification_Strategy.cpp -+ NT_Service.cpp -+ Obchunk.cpp -+ Object_Manager.cpp -+ Object_Manager_Base.cpp -+ OS_Errno.cpp -+ OS_Log_Msg_Attributes.cpp -+ OS_main.cpp -+ OS_NS_arpa_inet.cpp -+ OS_NS_ctype.cpp -+ OS_NS_dirent.cpp -+ OS_NS_dlfcn.cpp -+ OS_NS_errno.cpp -+ OS_NS_fcntl.cpp -+ OS_NS_math.cpp -+ OS_NS_netdb.cpp -+ OS_NS_poll.cpp -+ OS_NS_pwd.cpp -+ OS_NS_regex.cpp -+ OS_NS_signal.cpp -+ OS_NS_stdio.cpp -+ OS_NS_stdlib.cpp -+ OS_NS_string.cpp -+ OS_NS_strings.cpp -+ OS_NS_stropts.cpp -+ OS_NS_sys_mman.cpp -+ OS_NS_sys_msg.cpp -+ OS_NS_sys_resource.cpp -+ OS_NS_sys_select.cpp -+ OS_NS_sys_sendfile.cpp -+ OS_NS_sys_shm.cpp -+ OS_NS_sys_socket.cpp -+ OS_NS_sys_stat.cpp -+ OS_NS_sys_time.cpp -+ OS_NS_sys_uio.cpp -+ OS_NS_sys_utsname.cpp -+ OS_NS_sys_wait.cpp -+ OS_NS_Thread.cpp -+ OS_NS_time.cpp -+ OS_NS_unistd.cpp -+ OS_NS_wchar.cpp -+ OS_QoS.cpp -+ OS_Thread_Adapter.cpp -+ OS_TLI.cpp -+ Pagefile_Memory_Pool.cpp -+ Parse_Node.cpp -+ PI_Malloc.cpp -+ Ping_Socket.cpp -+ Pipe.cpp -+ POSIX_Asynch_IO.cpp -+ POSIX_CB_Proactor.cpp -+ POSIX_Proactor.cpp -+ Priority_Reactor.cpp -+ Proactor.cpp -+ Proactor_Impl.cpp -+ Process.cpp -+ Process_Manager.cpp -+ Process_Mutex.cpp -+ Process_Semaphore.cpp -+ Profile_Timer.cpp -+ Reactor.cpp -+ Reactor_Impl.cpp -+ Reactor_Notification_Strategy.cpp -+ Reactor_Timer_Interface.cpp -+ Read_Buffer.cpp -+ Recursive_Thread_Mutex.cpp -+ Recyclable.cpp -+ Registry.cpp -+ Registry_Name_Space.cpp -+ Remote_Name_Space.cpp -+ Remote_Tokens.cpp -+ Rtems_init.c -+ RW_Mutex.cpp -+ RW_Process_Mutex.cpp -+ RW_Thread_Mutex.cpp -+ Sample_History.cpp -+ Sbrk_Memory_Pool.cpp -+ Sched_Params.cpp -+ Select_Reactor_Base.cpp -+ Semaphore.cpp -+ Service_Config.cpp -+ Service_Gestalt.cpp -+ Service_Manager.cpp -+ Service_Object.cpp -+ Service_Repository.cpp -+ Service_Types.cpp -+ Shared_Memory.cpp -+ Shared_Memory_MM.cpp -+ Shared_Memory_Pool.cpp -+ Shared_Memory_SV.cpp -+ Shared_Object.cpp -+ Sig_Adapter.cpp -+ Sig_Handler.cpp -+ Signal.cpp -+ SOCK.cpp -+ SOCK_Acceptor.cpp -+ SOCK_CODgram.cpp -+ Sock_Connect.cpp -+ SOCK_Connector.cpp -+ SOCK_Dgram.cpp -+ SOCK_Dgram_Bcast.cpp -+ SOCK_Dgram_Mcast.cpp -+ SOCK_IO.cpp -+ SOCK_Netlink.cpp -+ SOCK_SEQPACK_Acceptor.cpp -+ SOCK_SEQPACK_Association.cpp -+ SOCK_SEQPACK_Connector.cpp -+ SOCK_Stream.cpp -+ SPIPE.cpp -+ SPIPE_Acceptor.cpp -+ SPIPE_Addr.cpp -+ SPIPE_Connector.cpp -+ SPIPE_Stream.cpp -+ SString.cpp -+ Stack_Trace.cpp -+ Stats.cpp -+ String_Base_Const.cpp -+ SUN_Proactor.cpp -+ SV_Message.cpp -+ SV_Message_Queue.cpp -+ SV_Semaphore_Complex.cpp -+ SV_Semaphore_Simple.cpp -+ SV_Shared_Memory.cpp -+ Svc_Conf_Lexer.cpp -+ Svc_Conf_y.cpp -+ Synch_Options.cpp -+ System_Time.cpp -+ Task.cpp -+ Thread.cpp -+ Thread_Adapter.cpp -+ Thread_Control.cpp -+ Thread_Exit.cpp -+ Thread_Hook.cpp -+ Thread_Manager.cpp -+ Thread_Mutex.cpp -+ Thread_Semaphore.cpp -+ Throughput_Stats.cpp -+ Time_Policy.cpp -+ Time_Value.cpp -+ Timeprobe.cpp -+ TLI.cpp -+ TLI_Acceptor.cpp -+ TLI_Connector.cpp -+ TLI_Stream.cpp -+ Token.cpp -+ Token_Collection.cpp -+ Token_Invariants.cpp -+ Token_Manager.cpp -+ Token_Request_Reply.cpp -+ TP_Reactor.cpp -+ Trace.cpp -+ TSS_Adapter.cpp -+ TTY_IO.cpp -+ UNIX_Addr.cpp -+ UPIPE_Acceptor.cpp -+ UPIPE_Connector.cpp -+ UPIPE_Stream.cpp -+ UTF16_Encoding_Converter.cpp -+ UTF32_Encoding_Converter.cpp -+ UTF8_Encoding_Converter.cpp -+ UUID.cpp -+ WFMO_Reactor.cpp -+ WIN32_Asynch_IO.cpp -+ WIN32_Proactor.cpp -+ XML_Svc_Conf.cpp -+ XTI_ATM_Mcast.cpp -+) -+ -+if (USE_COREPCH) -+ set(ace_PCH_HDR PrecompiledHeaders/WinAcePCH.h) -+ set(ace_PCH_SRC PrecompiledHeaders/WinAcePCH.cpp) -+endif() -+ -+include_directories( -+ ${CMAKE_SOURCE_DIR}/dep/acelite -+ ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders -+ ${CMAKE_SOURCE_DIR}/dep/zlib -+) -+ -+# Needed for PCH support -+set_source_files_properties(Atomic_Op_Sparc.c Rtems_init.c PROPERTIES LANGUAGE CXX) -+ -+add_definitions(-DACE_BUILD_DLL) -+ -+add_library(ace SHARED -+ ${ace_STAT_SRCS} -+ ${ace_PCH_SRC} -+) -+ -+# Generate precompiled header -+if( USE_COREPCH ) -+ add_cxx_pch(ace ${ace_PCH_HDR} ${ace_PCH_SRC}) -+endif() -+ -+install(TARGETS ace RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}") -diff --git a/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.cpp b/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.cpp -new file mode 100644 -index 0000000..139597f ---- /dev/null -+++ b/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.cpp -@@ -0,0 +1,2 @@ -+ -+ -diff --git a/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.h b/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.h -new file mode 100644 -index 0000000..6ff97bf ---- /dev/null -+++ b/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.h -@@ -0,0 +1,17 @@ -+ -+#ifndef WIN_ACE_PCH -+#define WIN_ACE_PCH -+ -+#include "ace/ACE.h" -+ -+#include "ace/Synch_Traits.h" -+#include "ace/Svc_Handler.h" -+#include "ace/SOCK_Stream.h" -+#include "ace/SOCK_Acceptor.h" -+#include "ace/Acceptor.h" -+#include "ace/Thread_Mutex.h" -+#include "ace/Guard_T.h" -+#include "ace/Unbounded_Queue.h" -+#include "ace/Message_Block.h" -+ -+#endif -diff --git a/dep/acelite/ace/config-macros.h b/dep/acelite/ace/config-macros.h -index f18c8e0..32e5894 100644 ---- a/dep/acelite/ace/config-macros.h -+++ b/dep/acelite/ace/config-macros.h -@@ -21,7 +21,11 @@ - #ifndef ACE_CONFIG_MACROS_H - #define ACE_CONFIG_MACROS_H - --#include "ace/config.h" -+#ifdef _WIN32 -+ #include "ace/config-win32.h" -+#else -+ #include "ace/config.h" -+#endif - - #include "ace/Version.h" - #include "ace/Versioned_Namespace.h" -diff --git a/dep/acelite/ace/config-win32-common.h b/dep/acelite/ace/config-win32-common.h -index 50645a1..098ddbd 100644 ---- a/dep/acelite/ace/config-win32-common.h -+++ b/dep/acelite/ace/config-win32-common.h -@@ -527,9 +527,9 @@ - # else - # pragma comment(lib, "ws2_32.lib") - # pragma comment(lib, "mswsock.lib") --# if defined (ACE_HAS_IPV6) -+// # if defined (ACE_HAS_IPV6) - # pragma comment(lib, "iphlpapi.lib") --# endif -+// # endif - # endif /* ACE_HAS_WINCE */ - # endif /* _MSC_VER */ - diff --git a/dep/acelite/ace-v6.1.4_hotfix2.diff b/dep/acelite/ace-v6.1.4_hotfix2.diff deleted file mode 100644 index 4eeca2d1912..00000000000 --- a/dep/acelite/ace-v6.1.4_hotfix2.diff +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/dep/acelite/ace/CMakeLists.txt b/dep/acelite/ace/CMakeLists.txt -index eb0f6dd..1f9ffa6 100644 ---- a/dep/acelite/ace/CMakeLists.txt -+++ b/dep/acelite/ace/CMakeLists.txt -@@ -341,6 +341,10 @@ add_library(ace SHARED - ${ace_PCH_SRC} - ) - -+if (MINGW) # GCC ignores "#prama comment" -+ target_link_libraries(ace ws2_32 iphlpapi netapi32 mswsock) -+endif() -+ - # Generate precompiled header - if( USE_COREPCH ) - add_cxx_pch(ace ${ace_PCH_HDR} ${ace_PCH_SRC}) diff --git a/dep/acelite/ace/ACE.cpp b/dep/acelite/ace/ACE.cpp deleted file mode 100644 index a965eff09f6..00000000000 --- a/dep/acelite/ace/ACE.cpp +++ /dev/null @@ -1,3426 +0,0 @@ -// $Id: ACE.cpp 96017 2012-08-08 22:18:09Z mitza $ - -#include "ace/ACE.h" - -#include "ace/Basic_Types.h" -#include "ace/Handle_Set.h" -#include "ace/Auto_Ptr.h" -#include "ace/SString.h" -#include "ace/Version.h" -#include "ace/Message_Block.h" -#include "ace/Log_Msg.h" -#include "ace/OS_NS_sys_select.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_strings.h" -#include "ace/OS_NS_signal.h" -#include "ace/OS_NS_stdio.h" -#include "ace/OS_NS_sys_resource.h" -#include "ace/OS_NS_sys_wait.h" -#include "ace/OS_NS_sys_time.h" -#include "ace/OS_NS_time.h" -#include "ace/OS_NS_sys_uio.h" -#include "ace/OS_NS_sys_stat.h" -#include "ace/OS_NS_ctype.h" -#include "ace/OS_NS_fcntl.h" -#include "ace/OS_TLI.h" -#include "ace/Truncate.h" - -#if !defined (__ACE_INLINE__) -#include "ace/ACE.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_HAS_POLL) -# include "ace/OS_NS_poll.h" -#endif /* ACE_HAS_POLL */ - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace ACE -{ - // private: - // Used internally so not exported. - - // Size of allocation granularity. - size_t allocation_granularity_ = 0; - - // Size of a VM page. - size_t pagesize_ = 0; - - // Are we debugging ACE? - // Keeps track of whether we're in some global debug mode. - char debug_; -} - - -int -ACE::out_of_handles (int error) -{ - // EMFILE is common to all platforms. - if (error == EMFILE || -#if defined (ACE_WIN32) - // On Win32, we need to check for ENOBUFS also. - error == ENOBUFS || -#elif defined (HPUX) - // On HPUX, we need to check for EADDRNOTAVAIL also. - error == EADDRNOTAVAIL || -#elif defined (ACE_LINUX) - // On linux, we need to check for ENOENT also. - error == ENOENT || - // For RedHat5.2, need to check for EINVAL too. - error == EINVAL || - // Without threads check for EOPNOTSUPP - error == EOPNOTSUPP || -#elif defined (sun) - // On sun, we need to check for ENOSR also. - error == ENOSR || - // Without threads check for ENOTSUP - error == ENOTSUP || -#elif defined (__FreeBSD__) - // On FreeBSD we need to check for EOPNOTSUPP (LinuxThreads) or - // ENOSYS (libc_r threads) also. - error == EOPNOTSUPP || - error == ENOSYS || -#elif defined (__OpenBSD__) - // OpenBSD appears to return EBADF. - error == EBADF || -#endif /* ACE_WIN32 */ - error == ENFILE) - return 1; - else - return 0; -} - -u_int -ACE::major_version (void) -{ - return ACE_MAJOR_VERSION; -} - -u_int -ACE::minor_version (void) -{ - return ACE_MINOR_VERSION; -} - -u_int -ACE::beta_version (void) -{ - return ACE_BETA_VERSION; -} - -const ACE_TCHAR * -ACE::compiler_name (void) -{ -#ifdef ACE_CC_NAME - return ACE_CC_NAME; -#else - return ACE_TEXT (""); -#endif -} - -u_int -ACE::compiler_major_version (void) -{ -#ifdef ACE_CC_MAJOR_VERSION - return ACE_CC_MAJOR_VERSION; -#else - return 0; -#endif -} - -u_int -ACE::compiler_minor_version (void) -{ -#ifdef ACE_CC_MINOR_VERSION - return ACE_CC_MINOR_VERSION; -#else - return 0; -#endif -} - -u_int -ACE::compiler_beta_version (void) -{ -#ifdef ACE_CC_BETA_VERSION - return ACE_CC_BETA_VERSION; -#else - return 0; -#endif -} - -ACE_TCHAR -ACE::nibble2hex (u_int n) -{ - // Yes, this works for UNICODE - return ACE_TEXT ("0123456789abcdef")[n & 0x0f]; -} - -bool -ACE::debug (void) -{ - static const char* debug = ACE_OS::getenv ("ACE_DEBUG"); - return (ACE::debug_ != 0) ? ACE::debug_ : (debug != 0 ? (*debug != '0') : false); -} - -void -ACE::debug (bool onoff) -{ - ACE::debug_ = onoff; -} - -int -ACE::select (int width, - ACE_Handle_Set *readfds, - ACE_Handle_Set *writefds, - ACE_Handle_Set *exceptfds, - const ACE_Time_Value *timeout) -{ - int result = ACE_OS::select (width, - readfds ? readfds->fdset () : 0, - writefds ? writefds->fdset () : 0, - exceptfds ? exceptfds->fdset () : 0, - timeout); - if (result > 0) - { -# if !defined (ACE_WIN32) - // This isn't needed for Windows... it's a no-op anyway. - if (readfds) - readfds->sync ((ACE_HANDLE) width); - if (writefds) - writefds->sync ((ACE_HANDLE) width); - if (exceptfds) - exceptfds->sync ((ACE_HANDLE) width); -#endif /* ACE_WIN32 */ - } - return result; -} - -int -ACE::select (int width, - ACE_Handle_Set &readfds, - const ACE_Time_Value *timeout) -{ - int result = ACE_OS::select (width, - readfds.fdset (), - 0, - 0, - timeout); - -#if !defined (ACE_WIN32) - if (result > 0) - readfds.sync ((ACE_HANDLE) width); -#endif /* ACE_WIN32 */ - return result; -} - -int -ACE::terminate_process (pid_t pid) -{ -#if defined (ACE_HAS_PHARLAP) - ACE_UNUSED_ARG (pid); - ACE_NOTSUP_RETURN (-1); -#elif defined (ACE_WIN32) - // Create a handle for the given process id. - ACE_HANDLE process_handle = - ::OpenProcess (PROCESS_TERMINATE, - FALSE, // New handle is not inheritable. - pid); - - if (process_handle == ACE_INVALID_HANDLE - || process_handle == 0) - return -1; - else - { - // Kill the process associated with process_handle. - BOOL terminate_result = - ::TerminateProcess (process_handle, 0); - // Free up the kernel resources. - ACE_OS::close (process_handle); - return terminate_result ? 0 : -1; - } -#else - return ACE_OS::kill (pid, 9); -#endif /* ACE_HAS_PHARLAP */ -} - -int -ACE::process_active (pid_t pid) -{ -#if !defined(ACE_WIN32) - if (ACE_OS::kill (pid, 0) == 0) - return 1; - else if (errno == ESRCH) - return 0; - else - return -1; -#else - // Create a handle for the given process id. - ACE_HANDLE process_handle = - ::OpenProcess (PROCESS_QUERY_INFORMATION, FALSE, pid); - if (process_handle == ACE_INVALID_HANDLE || process_handle == 0) - return 0; - else - { - DWORD status; - int result = 1; - if (::GetExitCodeProcess (process_handle, - &status) == 0 - || status != STILL_ACTIVE) - result = 0; - - ::CloseHandle (process_handle); - return result; - } -#endif /* !ACE_WIN32 */ -} - -const ACE_TCHAR * -ACE::execname (const ACE_TCHAR *old_name) -{ -#if defined (ACE_WIN32) - const ACE_TCHAR *suffix = ACE_OS::strrchr (old_name, ACE_TEXT ('.')); - if (suffix == 0 || ACE_OS::strcasecmp (suffix, ACE_TEXT (".exe")) != 0) - { - ACE_TCHAR *new_name = 0; - - size_t size = - ACE_OS::strlen (old_name) - + ACE_OS::strlen (ACE_TEXT (".exe")) - + 1; - - ACE_NEW_RETURN (new_name, - ACE_TCHAR[size], - 0); - ACE_TCHAR *end = new_name; - - end = ACE_OS::strecpy (new_name, old_name); - - // Concatenate the .exe suffix onto the end of the executable. - // end points _after_ the terminating nul. - ACE_OS::strcpy (end - 1, ACE_TEXT (".exe")); - - return new_name; - } -#endif /* ACE_WIN32 */ - return old_name; -} - -u_long -ACE::hash_pjw (const char *str, size_t len) -{ - u_long hash = 0; - - for (size_t i = 0; i < len; i++) - { - const char temp = str[i]; - hash = (hash << 4) + (temp * 13); - - u_long g = hash & 0xf0000000; - - if (g) - { - hash ^= (g >> 24); - hash ^= g; - } - } - - return hash; -} - -u_long -ACE::hash_pjw (const char *str) -{ - return ACE::hash_pjw (str, ACE_OS::strlen (str)); -} - -#if defined (ACE_HAS_WCHAR) -u_long -ACE::hash_pjw (const wchar_t *str, size_t len) -{ - u_long hash = 0; - - for (size_t i = 0; i < len; i++) - { - // @@ UNICODE: Does this function do the correct thing with wchar's? - - const wchar_t temp = str[i]; - hash = (hash << 4) + (temp * 13); - - u_long g = hash & 0xf0000000; - - if (g) - { - hash ^= (g >> 24); - hash ^= g; - } - } - - return hash; -} - -u_long -ACE::hash_pjw (const wchar_t *str) -{ - return ACE::hash_pjw (str, ACE_OS::strlen (str)); -} -#endif /* ACE_HAS_WCHAR */ - -ACE_TCHAR * -ACE::strenvdup (const ACE_TCHAR *str) -{ - ACE_TRACE ("ACE::strenvdup"); - - return ACE_OS::strenvdup (str); -} - -/* - -Examples: - -Source NT UNIX -================================================================== -netsvc netsvc.dll libnetsvc.so -(PATH will be (LD_LIBRARY_PATH -evaluated) evaluated) - -libnetsvc.dll libnetsvc.dll libnetsvc.dll + warning -netsvc.so netsvc.so + warning libnetsvc.so - -..\../libs/netsvc ..\..\libs\netsvc.dll ../../libs/netsvc.so -(absolute path used) (absolute path used) - -*/ - -const ACE_TCHAR * -ACE::basename (const ACE_TCHAR *pathname, ACE_TCHAR delim) -{ - ACE_TRACE ("ACE::basename"); - const ACE_TCHAR *temp = ACE_OS::strrchr (pathname, delim); - - if (temp == 0) - return pathname; - else - return temp + 1; -} - -const ACE_TCHAR * -ACE::dirname (const ACE_TCHAR *pathname, ACE_TCHAR delim) -{ - ACE_TRACE ("ACE::dirname"); - static ACE_TCHAR return_dirname[MAXPATHLEN + 1]; - - const ACE_TCHAR *temp = ACE_OS::strrchr (pathname, delim); - - if (temp == 0) - { - return_dirname[0] = '.'; - return_dirname[1] = '\0'; - - return return_dirname; - } - else - { - // When the len is truncated, there are problems! This should - // not happen in normal circomstances - size_t len = temp - pathname + 1; - if (len > (sizeof return_dirname / sizeof (ACE_TCHAR))) - len = sizeof return_dirname / sizeof (ACE_TCHAR); - - ACE_OS::strsncpy (return_dirname, - pathname, - len); - return return_dirname; - } -} - -ssize_t -ACE::recv (ACE_HANDLE handle, - void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE_OS::recv (handle, (char *) buf, len, flags); - else - { - int val = 0; - if (ACE::enter_recv_timedwait (handle, timeout, val) ==-1) - return -1; - else - { - ssize_t bytes_transferred = - ACE_OS::recv (handle, (char *) buf, len, flags); - ACE::restore_non_blocking_mode (handle, val); - return bytes_transferred; - } - } -} - -#if defined (ACE_HAS_TLI) - -ssize_t -ACE::t_rcv (ACE_HANDLE handle, - void *buf, - size_t len, - int *flags, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE_OS::t_rcv (handle, (char *) buf, len, flags); - else - { - int val = 0; - if (ACE::enter_recv_timedwait (handle, timeout, val) ==-1) - return -1; - else - { - ssize_t bytes_transferred = - ACE_OS::t_rcv (handle, (char *) buf, len, flags); - ACE::restore_non_blocking_mode (handle, val); - return bytes_transferred; - } - } -} - -#endif /* ACE_HAS_TLI */ - -ssize_t -ACE::recv (ACE_HANDLE handle, - void *buf, - size_t n, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE::recv_i (handle, buf, n); - else - { - int val = 0; - if (ACE::enter_recv_timedwait (handle, timeout, val) == -1) - return -1; - else - { - ssize_t bytes_transferred = ACE::recv_i (handle, buf, n); - ACE::restore_non_blocking_mode (handle, val); - return bytes_transferred; - } - } -} - -ssize_t -ACE::recvmsg (ACE_HANDLE handle, - struct msghdr *msg, - int flags, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE_OS::recvmsg (handle, msg, flags); - else - { - int val = 0; - if (ACE::enter_recv_timedwait (handle, timeout, val) == -1) - return -1; - else - { - ssize_t bytes_transferred = ACE_OS::recvmsg (handle, msg, flags); - ACE::restore_non_blocking_mode (handle, val); - return bytes_transferred; - } - } -} - -ssize_t -ACE::recvfrom (ACE_HANDLE handle, - char *buf, - int len, - int flags, - struct sockaddr *addr, - int *addrlen, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE_OS::recvfrom (handle, buf, len, flags, addr, addrlen); - else - { - int val = 0; - if (ACE::enter_recv_timedwait (handle, timeout, val) == -1) - return -1; - else - { - ssize_t bytes_transferred = - ACE_OS::recvfrom (handle, buf, len, flags, addr, addrlen); - ACE::restore_non_blocking_mode (handle, val); - return bytes_transferred; - } - } -} - -ssize_t -ACE::recv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - int flags, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - ssize_t n; - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - // Try to transfer as much of the remaining data as possible. - n = ACE_OS::recv (handle, - static_cast (buf) + bytes_transferred, - len - bytes_transferred, - flags); - // Check EOF. - if (n == 0) - return 0; - - // Check for other errors. - if (n == -1) - { - // Check for possible blocking. - if (errno == EWOULDBLOCK) - { - // Wait for the blocking to subside. - int const result = ACE::handle_read_ready (handle, 0); - - // Did select() succeed? - if (result != -1) - { - // Blocking subsided. Continue data transfer. - n = 0; - continue; - } - } - - // Other data transfer or select() failures. - return -1; - } - } - - return static_cast (bytes_transferred); -} - -ssize_t -ACE::recv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - ssize_t n; - ssize_t result = 0; - int error = 0; - - int val = 0; - ACE::record_and_set_non_blocking_mode (handle, val); - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - // Try to transfer as much of the remaining data as possible. - // Since the socket is in non-blocking mode, this call will not - // block. - n = ACE_OS::recv (handle, - static_cast (buf) + bytes_transferred, - len - bytes_transferred, - flags); - - // Check for errors. - if (n == 0 || - n == -1) - { - // Check for possible blocking. - if (n == -1 && - errno == EWOULDBLOCK) - { - // Wait upto for the blocking to subside. - int const rtn = ACE::handle_read_ready (handle, timeout); - - // Did select() succeed? - if (rtn != -1) - { - // Blocking subsided in period. Continue - // data transfer. - n = 0; - continue; - } - } - - // Wait in select() timed out or other data transfer or - // select() failures. - error = 1; - result = n; - break; - } - } - - ACE::restore_non_blocking_mode (handle, val); - - if (error) - return result; - else - return static_cast (bytes_transferred); -} - -#if defined (ACE_HAS_TLI) - -ssize_t -ACE::t_rcv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - int *flags, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - ssize_t n; - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - // Try to transfer as much of the remaining data as possible. - n = ACE_OS::t_rcv (handle, - (char *) buf + bytes_transferred, - len - bytes_transferred, - flags); - // Check EOF. - if (n == 0) - return 0; - - // Check for other errors. - if (n == -1) - { - // Check for possible blocking. - if (errno == EWOULDBLOCK) - { - // Wait for the blocking to subside. - int const result = ACE::handle_read_ready (handle, 0); - - // Did select() succeed? - if (result != -1) - { - // Blocking subsided. Continue data transfer. - n = 0; - continue; - } - } - - // Other data transfer or select() failures. - return -1; - } - } - - return bytes_transferred; -} - -ssize_t -ACE::t_rcv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - int *flags, - const ACE_Time_Value *timeout, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - ssize_t n; - ssize_t result = 0; - int error = 0; - - int val = 0; - ACE::record_and_set_non_blocking_mode (handle, val); - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - // Try to transfer as much of the remaining data as possible. - // Since the socket is in non-blocking mode, this call will not - // block. - n = ACE_OS::t_rcv (handle, - (char *) buf + bytes_transferred, - len - bytes_transferred, - flags); - - // Check for errors. - if (n == 0 || - n == -1) - { - // Check for possible blocking. - if (n == -1 && - errno == EWOULDBLOCK) - { - // Wait upto for the blocking to subside. - int const rtn = ACE::handle_read_ready (handle, timeout); - - // Did select() succeed? - if (rtn != -1) - { - // Blocking subsided in period. Continue - // data transfer. - n = 0; - continue; - } - } - - // Wait in select() timed out or other data transfer or - // select() failures. - error = 1; - result = n; - break; - } - } - - ACE::restore_non_blocking_mode (handle, val); - - if (error) - return result; - else - return bytes_transferred; -} - -#endif /* ACE_HAS_TLI */ - -ssize_t -ACE::recv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - ssize_t n; - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - // Try to transfer as much of the remaining data as possible. - n = ACE::recv_i (handle, - static_cast (buf) + bytes_transferred, - len - bytes_transferred); - // Check EOF. - if (n == 0) - { - return 0; - } - // Check for other errors. - if (n == -1) - { - // Check for possible blocking. - if (errno == EWOULDBLOCK) - { - // Wait for the blocking to subside. - int const result = ACE::handle_read_ready (handle, 0); - - // Did select() succeed? - if (result != -1) - { - // Blocking subsided. Continue data transfer. - n = 0; - continue; - } - } - - // Other data transfer or select() failures. - return -1; - } - } - - return static_cast (bytes_transferred); -} - -ssize_t -ACE::recv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - const ACE_Time_Value *timeout, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - ssize_t n; - ssize_t result = 0; - int error = 0; - - int val = 0; - ACE::record_and_set_non_blocking_mode (handle, val); - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - // Try to transfer as much of the remaining data as possible. - // Since the socket is in non-blocking mode, this call will not - // block. - n = ACE::recv_i (handle, - static_cast (buf) + bytes_transferred, - len - bytes_transferred); - - // Check for errors. - if (n == 0 || - n == -1) - { - // Check for possible blocking. - if (n == -1 && - errno == EWOULDBLOCK) - { - // Wait upto for the blocking to subside. - int const rtn = ACE::handle_read_ready (handle, timeout); - - // Did select() succeed? - if (rtn != -1) - { - // Blocking subsided in period. Continue - // data transfer. - n = 0; - continue; - } - } - - // Wait in select() timed out or other data transfer or - // select() failures. - error = 1; - result = n; - break; - } - } - - ACE::restore_non_blocking_mode (handle, val); - - if (error) - return result; - else - return static_cast (bytes_transferred); -} - -// This is basically an interface to ACE_OS::readv, that doesn't use -// the struct iovec explicitly. The ... can be passed as an arbitrary -// number of (char *ptr, int len) tuples. However, the count N is the -// *total* number of trailing arguments, *not* a couple of the number -// of tuple pairs! - -ssize_t -ACE::recv (ACE_HANDLE handle, size_t n, ...) -{ - va_list argp; - int const total_tuples = static_cast (n / 2); - iovec *iovp = 0; -#if defined (ACE_HAS_ALLOCA) - iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); -#else - ACE_NEW_RETURN (iovp, - iovec[total_tuples], - -1); -#endif /* !defined (ACE_HAS_ALLOCA) */ - - va_start (argp, n); - - for (int i = 0; i < total_tuples; i++) - { - iovp[i].iov_base = va_arg (argp, char *); - iovp[i].iov_len = va_arg (argp, int); - } - - ssize_t const result = ACE_OS::recvv (handle, iovp, total_tuples); -#if !defined (ACE_HAS_ALLOCA) - delete [] iovp; -#endif /* !defined (ACE_HAS_ALLOCA) */ - va_end (argp); - return result; -} - -ssize_t -ACE::recvv (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE_OS::recvv (handle, iov, iovcnt); - else - { - int val = 0; - if (ACE::enter_recv_timedwait (handle, timeout, val) == -1) - return -1; - else - { - ssize_t bytes_transferred = ACE_OS::recvv (handle, iov, iovcnt); - ACE::restore_non_blocking_mode (handle, val); - return bytes_transferred; - } - } -} - -ssize_t -ACE::recvv_n_i (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - bytes_transferred = 0; - - for (int s = 0; s < iovcnt; ) - { - // Try to transfer as much of the remaining data as possible. - ssize_t n = ACE_OS::recvv (handle, iov + s, iovcnt - s); - // Check EOF. - if (n == 0) - return 0; - - // Check for other errors. - if (n == -1) - { - // Check for possible blocking. - if (errno == EWOULDBLOCK) - { - // Wait for the blocking to subside. - int const result = ACE::handle_read_ready (handle, 0); - - // Did select() succeed? - if (result != -1) - { - // Blocking subsided. Continue data transfer. - n = 0; - continue; - } - } - - // Other data transfer or select() failures. - return -1; - } - - for (bytes_transferred += n; - s < iovcnt - && n >= static_cast (iov[s].iov_len); - s++) - n -= iov[s].iov_len; - - if (n != 0) - { - char *base = static_cast (iov[s].iov_base); - iov[s].iov_base = base + n; - iov[s].iov_len = iov[s].iov_len - n; - } - } - - return ACE_Utils::truncate_cast (bytes_transferred); -} - -ssize_t -ACE::recvv_n_i (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - bytes_transferred = 0; - ssize_t result = 0; - int error = 0; - - int val = 0; - ACE::record_and_set_non_blocking_mode (handle, val); - - for (int s = 0; s < iovcnt; ) - { - // Try to transfer as much of the remaining data as possible. - // Since the socket is in non-blocking mode, this call will not - // block. - ssize_t n = ACE_OS::recvv (handle, iov + s, iovcnt - s); - - // Check for errors. - if (n == 0 || n == -1) - { - // Check for possible blocking. - if (n == -1 && errno == EWOULDBLOCK) - { - // Wait upto for the blocking to subside. - int const rtn = ACE::handle_read_ready (handle, timeout); - - // Did select() succeed? - if (rtn != -1) - { - // Blocking subsided in period. Continue - // data transfer. - n = 0; - continue; - } - } - - // Wait in select() timed out or other data transfer or - // select() failures. - error = 1; - result = n; - break; - } - - for (bytes_transferred += n; - s < iovcnt - && n >= static_cast (iov[s].iov_len); - s++) - n -= iov[s].iov_len; - - if (n != 0) - { - char *base = reinterpret_cast (iov[s].iov_base); - iov[s].iov_base = base + n; - iov[s].iov_len = iov[s].iov_len - n; - } - } - - ACE::restore_non_blocking_mode (handle, val); - - if (error) - { - return result; - } - else - { - return ACE_Utils::truncate_cast (bytes_transferred); - } -} - -ssize_t -ACE::recv_n (ACE_HANDLE handle, - ACE_Message_Block *message_block, - const ACE_Time_Value *timeout, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - bytes_transferred = 0; - - iovec iov[ACE_IOV_MAX]; - int iovcnt = 0; - - while (message_block != 0) - { - // Our current message block chain. - const ACE_Message_Block *current_message_block = message_block; - - while (current_message_block != 0) - { - size_t current_message_block_length = - current_message_block->length (); - char *this_rd_ptr = current_message_block->rd_ptr (); - - // Check if this block has any space for incoming data. - while (current_message_block_length > 0) - { - u_long const this_chunk_length = - ACE_Utils::truncate_cast ( - current_message_block_length); - - // Collect the data in the iovec. - iov[iovcnt].iov_base = this_rd_ptr; - iov[iovcnt].iov_len = this_chunk_length; - current_message_block_length -= this_chunk_length; - this_rd_ptr += this_chunk_length; - - // Increment iovec counter. - ++iovcnt; - - // The buffer is full make a OS call. @@ TODO find a way to - // find ACE_IOV_MAX for platforms that do not define it rather - // than simply setting ACE_IOV_MAX to some arbitrary value such - // as 16. - if (iovcnt == ACE_IOV_MAX) - { - size_t current_transfer = 0; - - ssize_t const result = ACE::recvv_n (handle, - iov, - iovcnt, - timeout, - ¤t_transfer); - - // Add to total bytes transferred. - bytes_transferred += current_transfer; - - // Errors. - if (result == -1 || result == 0) - return result; - - // Reset iovec counter. - iovcnt = 0; - } - } - - // Select the next message block in the chain. - current_message_block = current_message_block->cont (); - } - - // Selection of the next message block chain. - message_block = message_block->next (); - } - - // Check for remaining buffers to be sent. This will happen when - // ACE_IOV_MAX is not a multiple of the number of message blocks. - if (iovcnt != 0) - { - size_t current_transfer = 0; - - ssize_t const result = ACE::recvv_n (handle, - iov, - iovcnt, - timeout, - ¤t_transfer); - - // Add to total bytes transferred. - bytes_transferred += current_transfer; - - // Errors. - if (result == -1 || result == 0) - { - return result; - } - } - - // Return total bytes transferred. - return ACE_Utils::truncate_cast (bytes_transferred); -} - -ssize_t -ACE::send (ACE_HANDLE handle, - const void *buf, - size_t n, - int flags, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE_OS::send (handle, (const char *) buf, n, flags); - else - { - int val = 0; - if (ACE::enter_send_timedwait (handle, timeout, val) == -1) - return -1; - else - { - ssize_t const bytes_transferred = - ACE_OS::send (handle, (const char *) buf, n, flags); - ACE::restore_non_blocking_mode (handle, val); - return bytes_transferred; - } - } -} - -#if defined (ACE_HAS_TLI) - -ssize_t -ACE::t_snd (ACE_HANDLE handle, - const void *buf, - size_t n, - int flags, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE_OS::t_snd (handle, (const char *) buf, n, flags); - else - { - int val = 0; - if (ACE::enter_send_timedwait (handle, timeout, val) == -1) - return -1; - else - { - ssize_t const bytes_transferred = - ACE_OS::t_snd (handle, (const char *) buf, n, flags); - ACE::restore_non_blocking_mode (handle, val); - return bytes_transferred; - } - } -} - -#endif /* ACE_HAS_TLI */ - -ssize_t -ACE::send (ACE_HANDLE handle, - const void *buf, - size_t n, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE::send_i (handle, buf, n); - else - { - int val = 0; - if (ACE::enter_send_timedwait (handle, timeout, val) == -1) - return -1; - else - { - ssize_t const bytes_transferred = ACE::send_i (handle, buf, n); - ACE::restore_non_blocking_mode (handle, val); - return bytes_transferred; - } - } -} - -ssize_t -ACE::sendmsg (ACE_HANDLE handle, - const struct msghdr *msg, - int flags, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE_OS::sendmsg (handle, msg, flags); - else - { - int val = 0; - if (ACE::enter_send_timedwait (handle, timeout, val) == -1) - return -1; - else - { - ssize_t const bytes_transferred = - ACE_OS::sendmsg (handle, msg, flags); - ACE::restore_non_blocking_mode (handle, val); - return bytes_transferred; - } - } -} - -ssize_t -ACE::sendto (ACE_HANDLE handle, - const char *buf, - int len, - int flags, - const struct sockaddr *addr, - int addrlen, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE_OS::sendto (handle, buf, len, flags, addr, addrlen); - else - { - int val = 0; - if (ACE::enter_send_timedwait (handle, timeout, val) == -1) - return -1; - else - { - ssize_t const bytes_transferred = - ACE_OS::sendto (handle, buf, len, flags, addr, addrlen); - ACE::restore_non_blocking_mode (handle, val); - return bytes_transferred; - } - } -} - -ssize_t -ACE::send_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - ssize_t n; - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - // Try to transfer as much of the remaining data as possible. - n = ACE_OS::send (handle, - (char *) buf + bytes_transferred, - len - bytes_transferred, - flags); - // Check EOF. - if (n == 0) - return 0; - - // Check for other errors. - if (n == -1) - { - // Check for possible blocking. -#if defined (ACE_WIN32) - if (errno == EWOULDBLOCK) // If enobufs no need to loop -#else - if (errno == EWOULDBLOCK || errno == ENOBUFS) -#endif /* ACE_WIN32 */ - { - // Wait for the blocking to subside. - int const result = ACE::handle_write_ready (handle, 0); - - // Did select() succeed? - if (result != -1) - { - // Blocking subsided. Continue data transfer. - n = 0; - continue; - } - } - - // Other data transfer or select() failures. - return -1; - } - } - - return ACE_Utils::truncate_cast (bytes_transferred); -} - -ssize_t -ACE::send_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - ssize_t n; - ssize_t result = 0; - int error = 0; - - int val = 0; - ACE::record_and_set_non_blocking_mode (handle, val); - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - // Try to transfer as much of the remaining data as possible. - // Since the socket is in non-blocking mode, this call will not - // block. - n = ACE_OS::send (handle, - (char *) buf + bytes_transferred, - len - bytes_transferred, - flags); - - // Check for errors. - if (n == 0 || - n == -1) - { - // Check for possible blocking. - if (n == -1 && (errno == EWOULDBLOCK || errno == ENOBUFS)) - { - // Wait upto for the blocking to subside. - int const rtn = ACE::handle_write_ready (handle, timeout); - - // Did select() succeed? - if (rtn != -1) - { - // Blocking subsided in period. Continue - // data transfer. - n = 0; - continue; - } - } - - // Wait in select() timed out or other data transfer or - // select() failures. - error = 1; - result = n; - break; - } - } - - ACE::restore_non_blocking_mode (handle, val); - - if (error) - { - return result; - } - else - { - return ACE_Utils::truncate_cast (bytes_transferred); - } -} - -#if defined (ACE_HAS_TLI) - -ssize_t -ACE::t_snd_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - ssize_t n; - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - // Try to transfer as much of the remaining data as possible. - n = ACE_OS::t_snd (handle, - (char *) buf + bytes_transferred, - len - bytes_transferred, - flags); - // Check EOF. - if (n == 0) - return 0; - - // Check for other errors. - if (n == -1) - { - // Check for possible blocking. - if (errno == EWOULDBLOCK || errno == ENOBUFS) - { - // Wait for the blocking to subside. - int const result = ACE::handle_write_ready (handle, 0); - - // Did select() succeed? - if (result != -1) - { - // Blocking subsided. Continue data transfer. - n = 0; - continue; - } - } - - // Other data transfer or select() failures. - return -1; - } - } - - return bytes_transferred; -} - -ssize_t -ACE::t_snd_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - ssize_t n; - ssize_t result = 0; - int error = 0; - - int val = 0; - ACE::record_and_set_non_blocking_mode (handle, val); - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - // Try to transfer as much of the remaining data as possible. - // Since the socket is in non-blocking mode, this call will not - // block. - n = ACE_OS::t_snd (handle, - (char *) buf + bytes_transferred, - len - bytes_transferred, - flags); - - // Check for errors. - if (n == 0 || - n == -1) - { - // Check for possible blocking. - if (n == -1 && - errno == EWOULDBLOCK || errno == ENOBUFS) - { - // Wait upto for the blocking to subside. - int const rtn = ACE::handle_write_ready (handle, timeout); - - // Did select() succeed? - if (rtn != -1) - { - // Blocking subsided in period. Continue - // data transfer. - n = 0; - continue; - } - } - - // Wait in select() timed out or other data transfer or - // select() failures. - error = 1; - result = n; - break; - } - } - - ACE::restore_non_blocking_mode (handle, val); - - if (error) - return result; - else - return bytes_transferred; -} - -#endif /* ACE_HAS_TLI */ - -ssize_t -ACE::send_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - ssize_t n; - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - // Try to transfer as much of the remaining data as possible. - n = ACE::send_i (handle, - (char *) buf + bytes_transferred, - len - bytes_transferred); - // Check EOF. - if (n == 0) - { - return 0; - } - - // Check for other errors. - if (n == -1) - { - // Check for possible blocking. - if (errno == EWOULDBLOCK || errno == ENOBUFS) - { - // Wait for the blocking to subside. - int const result = ACE::handle_write_ready (handle, 0); - - // Did select() succeed? - if (result != -1) - { - // Blocking subsided. Continue data transfer. - n = 0; - continue; - } - } - - // Other data transfer or select() failures. - return -1; - } - } - - return ACE_Utils::truncate_cast (bytes_transferred); -} - -ssize_t -ACE::send_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - const ACE_Time_Value *timeout, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - ssize_t n; - ssize_t result = 0; - int error = 0; - - int val = 0; - ACE::record_and_set_non_blocking_mode (handle, val); - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - // Try to transfer as much of the remaining data as possible. - // Since the socket is in non-blocking mode, this call will not - // block. - n = ACE::send_i (handle, - (char *) buf + bytes_transferred, - len - bytes_transferred); - - // Check for errors. - if (n == 0 || - n == -1) - { - // Check for possible blocking. - if (n == -1 && - (errno == EWOULDBLOCK || errno == ENOBUFS)) - { - // Wait upto for the blocking to subside. - int const rtn = ACE::handle_write_ready (handle, timeout); - - // Did select() succeed? - if (rtn != -1) - { - // Blocking subsided in period. Continue - // data transfer. - n = 0; - continue; - } - } - - // Wait in select() timed out or other data transfer or - // select() failures. - error = 1; - result = n; - break; - } - } - - ACE::restore_non_blocking_mode (handle, val); - - if (error) - { - return result; - } - else - { - return ACE_Utils::truncate_cast (bytes_transferred); - } -} - -// Send N char *ptrs and int lengths. Note that the char *'s precede -// the ints (basically, an varargs version of writev). The count N is -// the *total* number of trailing arguments, *not* a couple of the -// number of tuple pairs! - -ssize_t -ACE::send (ACE_HANDLE handle, size_t n, ...) -{ - va_list argp; - int total_tuples = static_cast (n / 2); - iovec *iovp; -#if defined (ACE_HAS_ALLOCA) - iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); -#else - ACE_NEW_RETURN (iovp, - iovec[total_tuples], - -1); -#endif /* !defined (ACE_HAS_ALLOCA) */ - - va_start (argp, n); - - for (int i = 0; i < total_tuples; i++) - { - iovp[i].iov_base = va_arg (argp, char *); - iovp[i].iov_len = va_arg (argp, int); - } - - ssize_t result = ACE_OS::sendv (handle, iovp, total_tuples); -#if !defined (ACE_HAS_ALLOCA) - delete [] iovp; -#endif /* !defined (ACE_HAS_ALLOCA) */ - va_end (argp); - return result; -} - -ssize_t -ACE::sendv (ACE_HANDLE handle, - const iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE_OS::sendv (handle, iov, iovcnt); - else - { - int val = 0; - if (ACE::enter_send_timedwait (handle, timeout, val) == -1) - return -1; - else - { - ssize_t bytes_transferred = ACE_OS::sendv (handle, iov, iovcnt); - ACE::restore_non_blocking_mode (handle, val); - return bytes_transferred; - } - } -} - -ssize_t -ACE::sendv_n_i (ACE_HANDLE handle, - const iovec *i, - int iovcnt, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - bytes_transferred = 0; - - iovec *iov = const_cast (i); - - for (int s = 0; - s < iovcnt; - ) - { - // Try to transfer as much of the remaining data as possible. - ssize_t n = ACE_OS::sendv (handle, iov + s, iovcnt - s); - - // Check EOF. - if (n == 0) - return 0; - - // Check for other errors. - if (n == -1) - { - // Check for possible blocking. - if (errno == EWOULDBLOCK || errno == ENOBUFS) - { - // Wait for the blocking to subside. - int const result = ACE::handle_write_ready (handle, 0); - - // Did select() succeed? - if (result != -1) - { - // Blocking subsided. Continue data transfer. - n = 0; - continue; - } - } - - // Other data transfer or select() failures. - return -1; - } - - for (bytes_transferred += n; - s < iovcnt - && n >= static_cast (iov[s].iov_len); - s++) - n -= iov[s].iov_len; - - if (n != 0) - { - char *base = reinterpret_cast (iov[s].iov_base); - iov[s].iov_base = base + n; - iov[s].iov_len = iov[s].iov_len - n; - } - } - - return ACE_Utils::truncate_cast (bytes_transferred); -} - -ssize_t -ACE::sendv_n_i (ACE_HANDLE handle, - const iovec *i, - int iovcnt, - const ACE_Time_Value *timeout, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - bytes_transferred = 0; - ssize_t result = 0; - int error = 0; - - int val = 0; - ACE::record_and_set_non_blocking_mode (handle, val); - - iovec *iov = const_cast (i); - - for (int s = 0; - s < iovcnt; - ) - { - // Try to transfer as much of the remaining data as possible. - // Since the socket is in non-blocking mode, this call will not - // block. - ssize_t n = ACE_OS::sendv (handle, iov + s, iovcnt - s); - - // Check for errors. - if (n == 0 || - n == -1) - { - // Check for possible blocking. - if (n == -1 && - (errno == EWOULDBLOCK || errno == ENOBUFS)) - { - // Wait upto for the blocking to subside. - int const rtn = ACE::handle_write_ready (handle, timeout); - - // Did select() succeed? - if (rtn != -1) - { - // Blocking subsided in period. Continue - // data transfer. - n = 0; - continue; - } - } - - // Wait in select() timed out or other data transfer or - // select() failures. - error = 1; - result = n; - break; - } - - for (bytes_transferred += n; - s < iovcnt - && n >= static_cast (iov[s].iov_len); - s++) - n -= iov[s].iov_len; - - if (n != 0) - { - char *base = reinterpret_cast (iov[s].iov_base); - iov[s].iov_base = base + n; - iov[s].iov_len = iov[s].iov_len - n; - } - } - - ACE::restore_non_blocking_mode (handle, val); - - if (error) - { - return result; - } - else - { - return ACE_Utils::truncate_cast (bytes_transferred); - } -} - -ssize_t -ACE::write_n (ACE_HANDLE handle, - const ACE_Message_Block *message_block, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - bytes_transferred = 0; - - iovec iov[ACE_IOV_MAX]; - int iovcnt = 0; - - while (message_block != 0) - { - // Our current message block chain. - const ACE_Message_Block *current_message_block = message_block; - - while (current_message_block != 0) - { - size_t current_message_block_length = - current_message_block->length (); - char *this_block_ptr = current_message_block->rd_ptr (); - - // Check if this block has any data to be sent. - while (current_message_block_length > 0) - { - u_long const this_chunk_length = - ACE_Utils::truncate_cast ( - current_message_block_length); - - // Collect the data in the iovec. - iov[iovcnt].iov_base = this_block_ptr; - iov[iovcnt].iov_len = this_chunk_length; - current_message_block_length -= this_chunk_length; - this_block_ptr += this_chunk_length; - - // Increment iovec counter. - ++iovcnt; - - // The buffer is full make a OS call. @@ TODO find a way to - // find ACE_IOV_MAX for platforms that do not define it rather - // than simply setting ACE_IOV_MAX to some arbitrary value such - // as 16. - if (iovcnt == ACE_IOV_MAX) - { - size_t current_transfer = 0; - - ssize_t const result = ACE::writev_n (handle, - iov, - iovcnt, - ¤t_transfer); - - // Add to total bytes transferred. - bytes_transferred += current_transfer; - - // Errors. - if (result == -1 || result == 0) - return result; - - // Reset iovec counter. - iovcnt = 0; - } - } - - // Select the next message block in the chain. - current_message_block = current_message_block->cont (); - } - - // Selection of the next message block chain. - message_block = message_block->next (); - } - - // Check for remaining buffers to be sent. This will happen when - // ACE_IOV_MAX is not a multiple of the number of message blocks. - if (iovcnt != 0) - { - size_t current_transfer = 0; - - ssize_t const result = ACE::writev_n (handle, - iov, - iovcnt, - ¤t_transfer); - - // Add to total bytes transferred. - bytes_transferred += current_transfer; - - // Errors. - if (result == -1 || result == 0) - return result; - } - - // Return total bytes transferred. - return ACE_Utils::truncate_cast (bytes_transferred); -} - -ssize_t -ACE::send_n (ACE_HANDLE handle, - const ACE_Message_Block *message_block, - const ACE_Time_Value *timeout, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - bytes_transferred = 0; - - iovec iov[ACE_IOV_MAX]; - int iovcnt = 0; - - while (message_block != 0) - { - // Our current message block chain. - const ACE_Message_Block *current_message_block = message_block; - - while (current_message_block != 0) - { - char *this_block_ptr = current_message_block->rd_ptr (); - size_t current_message_block_length = - current_message_block->length (); - - // Check if this block has any data to be sent. - while (current_message_block_length > 0) - { - u_long const this_chunk_length = - ACE_Utils::truncate_cast ( - current_message_block_length); - - // Collect the data in the iovec. - iov[iovcnt].iov_base = this_block_ptr; - iov[iovcnt].iov_len = this_chunk_length; - current_message_block_length -= this_chunk_length; - this_block_ptr += this_chunk_length; - - // Increment iovec counter. - ++iovcnt; - - // The buffer is full make a OS call. @@ TODO find a way to - // find ACE_IOV_MAX for platforms that do not define it rather - // than simply setting ACE_IOV_MAX to some arbitrary value such - // as 16. - if (iovcnt == ACE_IOV_MAX) - { - size_t current_transfer = 0; - - ssize_t const result = ACE::sendv_n (handle, - iov, - iovcnt, - timeout, - ¤t_transfer); - - // Add to total bytes transferred. - bytes_transferred += current_transfer; - - // Errors. - if (result == -1 || result == 0) - return result; - - // Reset iovec counter. - iovcnt = 0; - } - } - - // Select the next message block in the chain. - current_message_block = current_message_block->cont (); - } - - // Selection of the next message block chain. - message_block = message_block->next (); - } - - // Check for remaining buffers to be sent. This will happen when - // ACE_IOV_MAX is not a multiple of the number of message blocks. - if (iovcnt != 0) - { - size_t current_transfer = 0; - - ssize_t const result = ACE::sendv_n (handle, - iov, - iovcnt, - timeout, - ¤t_transfer); - - // Add to total bytes transferred. - bytes_transferred += current_transfer; - - // Errors. - if (result == -1 || result == 0) - { - return result; - } - } - - // Return total bytes transferred. - return ACE_Utils::truncate_cast (bytes_transferred); -} - -ssize_t -ACE::readv_n (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - bytes_transferred = 0; - - for (int s = 0; - s < iovcnt; - ) - { - ssize_t n = ACE_OS::readv (handle, - iov + s, - iovcnt - s); - - if (n == -1 || n == 0) - return n; - - for (bytes_transferred += n; - s < iovcnt - && n >= static_cast (iov[s].iov_len); - s++) - n -= iov[s].iov_len; - - if (n != 0) - { - char *base = reinterpret_cast (iov[s].iov_base); - iov[s].iov_base = base + n; - iov[s].iov_len = iov[s].iov_len - n; - } - } - - return ACE_Utils::truncate_cast (bytes_transferred); -} - -ssize_t -ACE::writev_n (ACE_HANDLE handle, - const iovec *i, - int iovcnt, - size_t *bt) -{ - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - bytes_transferred = 0; - - iovec *iov = const_cast (i); - - for (int s = 0; - s < iovcnt; - ) - { - ssize_t n = ACE_OS::writev (handle, - iov + s, - iovcnt - s); - - if (n == -1 || n == 0) - { - return n; - } - - for (bytes_transferred += n; - s < iovcnt - && n >= static_cast (iov[s].iov_len); - s++) - n -= iov[s].iov_len; - - if (n != 0) - { - char *base = reinterpret_cast (iov[s].iov_base); - iov[s].iov_base = base + n; - iov[s].iov_len = iov[s].iov_len - n; - } - } - - return ACE_Utils::truncate_cast (bytes_transferred); -} - -int -ACE::handle_ready (ACE_HANDLE handle, - const ACE_Time_Value *timeout, - int read_ready, - int write_ready, - int exception_ready) -{ -#if defined (ACE_HAS_POLL) - ACE_UNUSED_ARG (exception_ready); - - struct pollfd fds; - - fds.fd = handle; - fds.events = read_ready ? POLLIN : 0; - - if( write_ready ) - { - fds.events |= POLLOUT; - } - - fds.revents = 0; - - int const result = ACE_OS::poll (&fds, 1, timeout); -#else - ACE_Handle_Set handle_set; - handle_set.set_bit (handle); - - // Wait for data or for the timeout to elapse. - int select_width = 0; -#if !defined (ACE_WIN32) - select_width = int (handle) + 1; -# endif /* ACE_WIN64 */ - int result = ACE_OS::select (select_width, - read_ready ? handle_set.fdset () : 0, // read_fds. - write_ready ? handle_set.fdset () : 0, // write_fds. - exception_ready ? handle_set.fdset () : 0, // exception_fds. - timeout); - -#endif /* ACE_HAS_POLL */ - switch (result) - { - case 0: // Timer expired. - errno = ETIME; - /* FALLTHRU */ - case -1: // we got here directly - select() returned -1. - return -1; - case 1: // Handle has data. - /* FALLTHRU */ - default: // default is case result > 0; return a - // ACE_ASSERT (result == 1); - return result; - } -} - -int -ACE::enter_recv_timedwait (ACE_HANDLE handle, - const ACE_Time_Value *timeout, - int &val) -{ - int const result = ACE::handle_read_ready (handle, timeout); - - if (result == -1) - return -1; - - ACE::record_and_set_non_blocking_mode (handle, val); - - return result; -} - -int -ACE::enter_send_timedwait (ACE_HANDLE handle, - const ACE_Time_Value *timeout, - int &val) -{ - int const result = ACE::handle_write_ready (handle, timeout); - - if (result == -1) - return -1; - - ACE::record_and_set_non_blocking_mode (handle, val); - - return result; -} - -void -ACE::record_and_set_non_blocking_mode (ACE_HANDLE handle, int &val) -{ - // We need to record whether we are already *in* nonblocking mode, - // so that we can correctly reset the state when we're done. - val = ACE::get_flags (handle); - - if (ACE_BIT_DISABLED (val, ACE_NONBLOCK)) - // Set the handle into non-blocking mode if it's not already in - // it. - ACE::set_flags (handle, ACE_NONBLOCK); -} - -void -ACE::restore_non_blocking_mode (ACE_HANDLE handle, int val) -{ - if (ACE_BIT_DISABLED (val, ACE_NONBLOCK)) - { - // Save/restore errno. - ACE_Errno_Guard error (errno); - // Only disable ACE_NONBLOCK if we weren't in non-blocking mode - // originally. - ACE::clr_flags (handle, ACE_NONBLOCK); - } -} - -/// Format buffer into printable format. This is useful for debugging. -/// Portions taken from mdump by J.P. Knight (J.P.Knight@lut.ac.uk) -/// Modifications by Todd Montgomery. -size_t -ACE::format_hexdump (const char *buffer, - size_t size, - ACE_TCHAR *obuf, - size_t obuf_sz) -{ - ACE_TRACE ("ACE::format_hexdump"); - - u_char c; - ACE_TCHAR textver[16 + 1]; - - // We can fit 16 bytes output in text mode per line, 4 chars per byte. - size_t maxlen = (obuf_sz / 68) * 16; - - if (size > maxlen) - size = maxlen; - - size_t i; - - size_t const lines = size / 16; - for (i = 0; i < lines; i++) - { - size_t j; - - for (j = 0 ; j < 16; j++) - { - c = (u_char) buffer[(i << 4) + j]; // or, buffer[i*16+j] - ACE_OS::sprintf (obuf, - ACE_TEXT ("%02x "), - c); - obuf += 3; - if (j == 7) - { - ACE_OS::sprintf (obuf, - ACE_TEXT (" ")); - ++obuf; - } - textver[j] = ACE_OS::ace_isprint (c) ? c : u_char ('.'); - } - - textver[j] = 0; - - ACE_OS::sprintf (obuf, -#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - ACE_TEXT (" %ls\n"), -#else - ACE_TEXT (" %s\n"), -#endif - textver); - - while (*obuf != '\0') - ++obuf; - } - - if (size % 16) - { - for (i = 0 ; i < size % 16; i++) - { - c = (u_char) buffer[size - size % 16 + i]; - ACE_OS::sprintf (obuf, - ACE_TEXT ("%02x "), - c); - obuf += 3; - if (i == 7) - { - ACE_OS::sprintf (obuf, - ACE_TEXT (" ")); - ++obuf; - } - textver[i] = ACE_OS::ace_isprint (c) ? c : u_char ('.'); - } - - for (i = size % 16; i < 16; i++) - { - ACE_OS::sprintf (obuf, - ACE_TEXT (" ")); - obuf += 3; - if (i == 7) - { - ACE_OS::sprintf (obuf, - ACE_TEXT (" ")); - ++obuf; - } - textver[i] = ' '; - } - - textver[i] = 0; - ACE_OS::sprintf (obuf, -#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - ACE_TEXT (" %ls\n"), -#else - ACE_TEXT (" %s\n"), -#endif - textver); - } - return size; -} - -// Returns the current timestamp in the form -// "hour:minute:second:microsecond." The month, day, and year are -// also stored in the beginning of the date_and_time array -// using ISO-8601 format. - -ACE_TCHAR * -ACE::timestamp (ACE_TCHAR date_and_time[], - size_t date_and_timelen, - bool return_pointer_to_first_digit) -{ - return ACE::timestamp (ACE_Time_Value::zero, - date_and_time, - date_and_timelen, - return_pointer_to_first_digit); -} - -// Returns the given timestamp in the form -// "hour:minute:second:microsecond." The month, day, and year are -// also stored in the beginning of the date_and_time array -// using ISO-8601 format. -// 012345678901234567890123456 -// 2010-12-02 12:56:00.123456 - -ACE_TCHAR * -ACE::timestamp (const ACE_Time_Value& time_value, - ACE_TCHAR date_and_time[], - size_t date_and_timelen, - bool return_pointer_to_first_digit) -{ - //ACE_TRACE ("ACE::timestamp"); - - // This magic number is from the formatting statement - // farther down this routine. - if (date_and_timelen < 27) - { - errno = EINVAL; - return 0; - } - - ACE_Time_Value cur_time = - (time_value == ACE_Time_Value::zero) ? - ACE_Time_Value (ACE_OS::gettimeofday ()) : time_value; - time_t secs = cur_time.sec (); - struct tm tms; - ACE_OS::localtime_r (&secs, &tms); - ACE_OS::snprintf (date_and_time, - date_and_timelen, - ACE_TEXT ("%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d.%06ld"), - tms.tm_year + 1900, - tms.tm_mon + 1, - tms.tm_mday, - tms.tm_hour, - tms.tm_min, - tms.tm_sec, - static_cast (cur_time.usec())); - date_and_time[date_and_timelen - 1] = '\0'; - return &date_and_time[10 + (return_pointer_to_first_digit != 0)]; -} - -// This function rounds the request to a multiple of the page size. - -size_t -ACE::round_to_pagesize (size_t len) -{ - ACE_TRACE ("ACE::round_to_pagesize"); - - if (ACE::pagesize_ == 0) - ACE::pagesize_ = ACE_OS::getpagesize (); - - return (len + (ACE::pagesize_ - 1)) & ~(ACE::pagesize_ - 1); -} - -size_t -ACE::round_to_allocation_granularity (size_t len) -{ - ACE_TRACE ("ACE::round_to_allocation_granularity"); - - if (ACE::allocation_granularity_ == 0) - ACE::allocation_granularity_ = ACE_OS::allocation_granularity (); - - return (len + (ACE::allocation_granularity_ - 1)) & ~(ACE::allocation_granularity_ - 1); -} - -ACE_HANDLE -ACE::handle_timed_complete (ACE_HANDLE h, - const ACE_Time_Value *timeout, - int is_tli) -{ - ACE_TRACE ("ACE::handle_timed_complete"); - -#if !defined (ACE_WIN32) && defined (ACE_HAS_POLL) - - struct pollfd fds; - - fds.fd = h; - fds.events = POLLIN | POLLOUT; - fds.revents = 0; - -#else - ACE_Handle_Set rd_handles; - ACE_Handle_Set wr_handles; - rd_handles.set_bit (h); - wr_handles.set_bit (h); -#endif /* !ACE_WIN32 && ACE_HAS_POLL */ - -#if defined (ACE_WIN32) - // Winsock is different - it sets the exception bit for failed connect, - // unlike other platforms, where the write bit is set for both success - // and fail. - ACE_Handle_Set ex_handles; - ex_handles.set_bit (h); -#endif /* ACE_WIN32 */ - - bool need_to_check = false; - bool known_failure = false; - -#if defined (ACE_WIN32) - int n = ACE_OS::select (0, // Ignored on Windows: int (h) + 1, - 0, - wr_handles, - ex_handles, - timeout); -#else -# if defined (ACE_HAS_POLL) - - int n = ACE_OS::poll (&fds, 1, timeout); - -# else - int n = 0; - if (is_tli) - n = ACE_OS::select (int (h) + 1, - rd_handles, - wr_handles, - 0, - timeout); - else - n = ACE_OS::select (int (h) + 1, - 0, - wr_handles, - 0, - timeout); -# endif /* ACE_HAS_POLL */ -#endif /* ACE_WIN32 */ - - // If we failed to connect within the time period allocated by the - // caller, then we fail (e.g., the remote host might have been too - // busy to accept our call). - if (n <= 0) - { - if (n == 0 && timeout != 0) - errno = ETIME; - return ACE_INVALID_HANDLE; - } - - // On Windows, a ready-for-write handle is successfully connected, and - // ready-for-exception is a failure. On fails, we need to grab the error - // code via getsockopt. - // On BSD sockets using select(), the handle becomes writable on - // completion either success or fail, so if the select() does not time - // out, we need to check for success/fail. - // It is believed that TLI sockets use the readable=fail, writeable=success - // but that hasn't been as well tested. -#if defined (ACE_WIN32) - ACE_UNUSED_ARG (is_tli); - - // On Win32, ex_handle set indicates a failure. We'll do the check - // to try and get an errno value, but the connect failed regardless of - // what getsockopt says about the error. - if (ex_handles.is_set (h)) - { - need_to_check = true; - known_failure = true; - } -#else - if (is_tli) -# if defined (ACE_HAS_POLL) - need_to_check = (fds.revents & POLLIN) && !(fds.revents & POLLOUT); -# else - need_to_check = rd_handles.is_set (h) && !wr_handles.is_set (h); -# endif /* ACE_HAS_POLL */ - - else -# if defined (ACE_HAS_POLL) - need_to_check = (fds.revents & POLLIN); -# else - need_to_check = true; -# endif /* ACE_HAS_POLL */ -#endif /* ACE_WIN32 */ - - if (need_to_check) - { -#if defined (SOL_SOCKET) && defined (SO_ERROR) - int sock_err = 0; - int sock_err_len = sizeof (sock_err); - int sockopt_ret = ACE_OS::getsockopt (h, SOL_SOCKET, SO_ERROR, - (char *)&sock_err, &sock_err_len); - if (sockopt_ret < 0) - { - h = ACE_INVALID_HANDLE; - } - - if (sock_err != 0 || known_failure) - { - h = ACE_INVALID_HANDLE; - errno = sock_err; - } -#else - char dummy; - - // The following recv() won't block provided that the - // ACE_NONBLOCK flag has not been turned off . - n = ACE::recv (h, &dummy, 1, MSG_PEEK); - - // If no data was read/peeked at, check to see if it's because - // of a non-connected socket (and therefore an error) or there's - // just no data yet. - if (n <= 0) - { - if (n == 0) - { - errno = ECONNREFUSED; - h = ACE_INVALID_HANDLE; - } - else if (errno != EWOULDBLOCK && errno != EAGAIN) - h = ACE_INVALID_HANDLE; - } -#endif - } - - // 1. The HANDLE is ready for writing and doesn't need to be checked or - // 2. recv() returned an indication of the state of the socket - if there is - // either data present, or a recv is legit but there's no data yet, - // the connection was successfully established. - return h; -} - -// Wait up to amount of time to accept a connection. - -int -ACE::handle_timed_accept (ACE_HANDLE listener, - ACE_Time_Value *timeout, - bool restart) -{ - ACE_TRACE ("ACE::handle_timed_accept"); - // Make sure we don't bomb out on erroneous values. - if (listener == ACE_INVALID_HANDLE) - return -1; - -#if defined (ACE_HAS_POLL) - - struct pollfd fds; - - fds.fd = listener; - fds.events = POLLIN; - fds.revents = 0; - -#else - // Use the select() implementation rather than poll(). - ACE_Handle_Set rd_handle; - rd_handle.set_bit (listener); -#endif /* ACE_HAS_POLL */ - - // We need a loop here if is enabled. - - for (;;) - { -#if defined (ACE_HAS_POLL) - - int n = ACE_OS::poll (&fds, 1, timeout); - -#else - int select_width = 0; -# if !defined (ACE_WIN32) - select_width = int (listener) + 1; -# endif /* ACE_WIN32 */ - int n = ACE_OS::select (select_width, - rd_handle, 0, 0, - timeout); -#endif /* ACE_HAS_POLL */ - - switch (n) - { - case -1: - if (errno == EINTR && restart) - continue; - else - return -1; - /* NOTREACHED */ - case 0: - if (timeout != 0 && *timeout == ACE_Time_Value::zero) - errno = EWOULDBLOCK; - else - errno = ETIMEDOUT; - return -1; - /* NOTREACHED */ - case 1: - return 0; - /* NOTREACHED */ - default: - errno = EINVAL; - return -1; - /* NOTREACHED */ - } - } -} - -// Make the current process a UNIX daemon. This is based on Stevens -// code from APUE. - -int -ACE::daemonize (const ACE_TCHAR pathname[], - bool close_all_handles, - const ACE_TCHAR program_name[]) -{ - ACE_TRACE ("ACE::daemonize"); -#if !defined (ACE_LACKS_FORK) - pid_t pid = ACE_OS::fork (); - - if (pid == -1) - return -1; - else if (pid != 0) - ACE_OS::exit (0); // Parent exits. - - // 1st child continues. - ACE_OS::setsid (); // Become session leader. - - ACE_OS::signal (SIGHUP, SIG_IGN); - - pid = ACE_OS::fork (program_name); - - if (pid != 0) - ACE_OS::exit (0); // First child terminates. - - // Second child continues. - - if (pathname != 0) - // change working directory. - ACE_OS::chdir (pathname); - - ACE_OS::umask (0); // clear our file mode creation mask. - - // Close down the I/O handles. - if (close_all_handles) - { - for (int i = ACE::max_handles () - 1; i >= 0; i--) - ACE_OS::close (i); - - int fd = ACE_OS::open ("/dev/null", O_RDWR, 0); - if (fd != -1) - { - ACE_OS::dup2 (fd, ACE_STDIN); - ACE_OS::dup2 (fd, ACE_STDOUT); - ACE_OS::dup2 (fd, ACE_STDERR); - - if (fd > ACE_STDERR) - ACE_OS::close (fd); - } - } - - return 0; -#else - ACE_UNUSED_ARG (pathname); - ACE_UNUSED_ARG (close_all_handles); - ACE_UNUSED_ARG (program_name); - - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_LACKS_FORK */ -} - -pid_t -ACE::fork (const ACE_TCHAR *program_name, - int avoid_zombies) -{ - if (avoid_zombies == 0) - return ACE_OS::fork (program_name); - else - { - // This algorithm is adapted from an example in the Stevens book - // "Advanced Programming in the Unix Environment" and an item in - // Andrew Gierth's Unix Programming FAQ. It creates an orphan - // process that's inherited by the init process; init cleans up - // when the orphan process terminates. - // - // Another way to avoid zombies is to ignore or catch the - // SIGCHLD signal; we don't use that approach here. - - pid_t pid = ACE_OS::fork (); - if (pid == 0) - { - // The child process forks again to create a grandchild. - switch (ACE_OS::fork (program_name)) - { - case 0: // grandchild returns 0. - return 0; - case -1: // assumes all errnos are < 256 - ACE_OS::_exit (errno); - default: // child terminates, orphaning grandchild - ACE_OS::_exit (0); - } - } - - // Parent process waits for child to terminate. - ACE_exitcode status; - if (pid < 0 || ACE_OS::waitpid (pid, &status, 0) < 0) - return -1; - - // child terminated by calling exit()? - if (WIFEXITED ((status))) - { - // child terminated normally? - if (WEXITSTATUS ((status)) == 0) - return 1; - else - errno = WEXITSTATUS ((status)); - } - else - // child didn't call exit(); perhaps it received a signal? - errno = EINTR; - - return -1; - } -} - -int -ACE::max_handles (void) -{ - ACE_TRACE ("ACE::max_handles"); -#if defined (RLIMIT_NOFILE) && !defined (ACE_LACKS_RLIMIT) - rlimit rl; - int const r = ACE_OS::getrlimit (RLIMIT_NOFILE, &rl); -# if !defined (RLIM_INFINITY) - if (r == 0) - return rl.rlim_cur; -# else - if (r == 0 && rl.rlim_cur != RLIM_INFINITY) - return rl.rlim_cur; - // If == RLIM_INFINITY, fall through to the ACE_LACKS_RLIMIT sections -# endif /* RLIM_INFINITY */ -#endif /* RLIMIT_NOFILE && !ACE_LACKS_RLIMIT */ - -#if defined (_SC_OPEN_MAX) - return static_cast (ACE_OS::sysconf (_SC_OPEN_MAX)); -#elif defined (FD_SETSIZE) - return FD_SETSIZE; -#else - ACE_NOTSUP_RETURN (-1); -#endif /* _SC_OPEN_MAX */ -} - -// Set the number of currently open handles in the process. -// -// If NEW_LIMIT == -1 set the limit to the maximum allowable. -// Otherwise, set it to be the value of NEW_LIMIT. - -int -ACE::set_handle_limit (int new_limit, - int increase_limit_only) -{ - ACE_TRACE ("ACE::set_handle_limit"); - int cur_limit = ACE::max_handles (); - int max_limit = cur_limit; - - if (cur_limit == -1) - return -1; - -#if !defined (ACE_LACKS_RLIMIT) && defined (RLIMIT_NOFILE) - struct rlimit rl; - - ACE_OS::memset ((void *) &rl, 0, sizeof rl); - int r = ACE_OS::getrlimit (RLIMIT_NOFILE, &rl); - if (r == 0) - max_limit = rl.rlim_max; -#endif /* ACE_LACKS_RLIMIT */ - - if (new_limit == -1) - new_limit = max_limit; - - if (new_limit < 0) - { - errno = EINVAL; - return -1; - } - else if (new_limit > cur_limit) - { - // Increase the limit. -#if !defined (ACE_LACKS_RLIMIT) && defined (RLIMIT_NOFILE) - rl.rlim_cur = new_limit; - return ACE_OS::setrlimit (RLIMIT_NOFILE, &rl); -#elif !defined (RLIMIT_NOFILE) - return 0; -#else - // Must return EINVAL errno. - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_LACKS_RLIMIT */ - } - else if (increase_limit_only == 0) - { - // Decrease the limit. -#if !defined (ACE_LACKS_RLIMIT) && defined (RLIMIT_NOFILE) - rl.rlim_cur = new_limit; - return ACE_OS::setrlimit (RLIMIT_NOFILE, &rl); -#else - // We give a chance to platforms without RLIMIT to work. - // Instead of ACE_NOTSUP_RETURN (0), just return 0 because - // new_limit is <= cur_limit, so it's a no-op. - return 0; -#endif /* ACE_LACKS_RLIMIT */ - } - - return 0; -} - -// Euclid's greatest common divisor algorithm. -u_long -ACE::gcd (u_long x, u_long y) -{ - while (y != 0) - { - u_long r = x % y; - x = y; - y = r; - } - - return x; -} - - -// Calculates the minimum enclosing frame size for the given values. -u_long -ACE::minimum_frame_size (u_long period1, u_long period2) -{ - // if one of the periods is zero, treat it as though it as - // uninitialized and return the other period as the frame size - if (0 == period1) - { - return period2; - } - if (0 == period2) - { - return period1; - } - - // if neither is zero, find the greatest common divisor of the two periods - u_long greatest_common_divisor = ACE::gcd (period1, period2); - - // explicitly consider cases to reduce risk of possible overflow errors - if (greatest_common_divisor == 1) - { - // periods are relative primes: just multiply them together - return period1 * period2; - } - else if (greatest_common_divisor == period1) - { - // the first period divides the second: return the second - return period2; - } - else if (greatest_common_divisor == period2) - { - // the second period divides the first: return the first - return period1; - } - else - { - // the current frame size and the entry's effective period - // have a non-trivial greatest common divisor: return the - // product of factors divided by those in their gcd. - return (period1 * period2) / greatest_common_divisor; - } -} - - -u_long -ACE::is_prime (const u_long n, - const u_long min_factor, - const u_long max_factor) -{ - if (n > 3) - for (u_long factor = min_factor; - factor <= max_factor; - ++factor) - if (n / factor * factor == n) - return factor; - - return 0; -} - -const ACE_TCHAR * -ACE::sock_error (int error) -{ -#if defined (ACE_WIN32) - static ACE_TCHAR unknown_msg[64]; - - switch (error) - { - case WSAVERNOTSUPPORTED: - return ACE_TEXT ("version of WinSock not supported"); - /* NOTREACHED */ - case WSASYSNOTREADY: - return ACE_TEXT ("WinSock not present or not responding"); - /* NOTREACHED */ - case WSAEINVAL: - return ACE_TEXT ("app version not supported by DLL"); - /* NOTREACHED */ - case WSAHOST_NOT_FOUND: - return ACE_TEXT ("Authoritive: Host not found"); - /* NOTREACHED */ - case WSATRY_AGAIN: - return ACE_TEXT ("Non-authoritive: host not found or server failure"); - /* NOTREACHED */ - case WSANO_RECOVERY: - return ACE_TEXT ("Non-recoverable: refused or not implemented"); - /* NOTREACHED */ - case WSANO_DATA: - return ACE_TEXT ("Valid name, no data record for type"); - /* NOTREACHED */ - /* - case WSANO_ADDRESS: - return "Valid name, no MX record"; - */ - case WSANOTINITIALISED: - return ACE_TEXT ("WSA Startup not initialized"); - /* NOTREACHED */ - case WSAENETDOWN: - return ACE_TEXT ("Network subsystem failed"); - /* NOTREACHED */ - case WSAEINPROGRESS: - return ACE_TEXT ("Blocking operation in progress"); - /* NOTREACHED */ - case WSAEINTR: - return ACE_TEXT ("Blocking call cancelled"); - /* NOTREACHED */ - case WSAEAFNOSUPPORT: - return ACE_TEXT ("address family not supported"); - /* NOTREACHED */ - case WSAEMFILE: - return ACE_TEXT ("no file handles available"); - /* NOTREACHED */ - case WSAENOBUFS: - return ACE_TEXT ("no buffer space available"); - /* NOTREACHED */ - case WSAEPROTONOSUPPORT: - return ACE_TEXT ("specified protocol not supported"); - /* NOTREACHED */ - case WSAEPROTOTYPE: - return ACE_TEXT ("protocol wrong type for this socket"); - /* NOTREACHED */ - case WSAESOCKTNOSUPPORT: - return ACE_TEXT ("socket type not supported for address family"); - /* NOTREACHED */ - case WSAENOTSOCK: - return ACE_TEXT ("handle is not a socket"); - /* NOTREACHED */ - case WSAEWOULDBLOCK: - return ACE_TEXT ("resource temporarily unavailable"); - /* NOTREACHED */ - case WSAEADDRINUSE: - return ACE_TEXT ("address already in use"); - /* NOTREACHED */ - case WSAECONNABORTED: - return ACE_TEXT ("connection aborted"); - /* NOTREACHED */ - case WSAECONNRESET: - return ACE_TEXT ("connection reset"); - /* NOTREACHED */ - case WSAENOTCONN: - return ACE_TEXT ("not connected"); - /* NOTREACHED */ - case WSAETIMEDOUT: - return ACE_TEXT ("connection timed out"); - /* NOTREACHED */ - case WSAECONNREFUSED: - return ACE_TEXT ("connection refused"); - /* NOTREACHED */ - case WSAEHOSTDOWN: - return ACE_TEXT ("host down"); - /* NOTREACHED */ - case WSAEHOSTUNREACH: - return ACE_TEXT ("host unreachable"); - /* NOTREACHED */ - case WSAEADDRNOTAVAIL: - return ACE_TEXT ("address not available"); - /* NOTREACHED */ - case WSAEISCONN: - return ACE_TEXT ("socket is already connected"); - /* NOTREACHED */ - case WSAENETRESET: - return ACE_TEXT ("network dropped connection on reset"); - /* NOTREACHED */ - case WSAEMSGSIZE: - return ACE_TEXT ("message too long"); - /* NOTREACHED */ - case WSAENETUNREACH: - return ACE_TEXT ("network is unreachable"); - /* NOTREACHED */ - case WSAEFAULT: - return ACE_TEXT ("bad address"); - /* NOTREACHED */ - case WSAEDISCON: - return ACE_TEXT ("graceful shutdown in progress"); - /* NOTREACHED */ - case WSAEACCES: - return ACE_TEXT ("permission denied"); - /* NOTREACHED */ - case WSAESHUTDOWN: - return ACE_TEXT ("cannot send after socket shutdown"); - /* NOTREACHED */ - case WSAEPROCLIM: - return ACE_TEXT ("too many processes"); - /* NOTREACHED */ - case WSAEALREADY: - return ACE_TEXT ("operation already in progress"); - /* NOTREACHED */ - case WSAEPFNOSUPPORT: - return ACE_TEXT ("protocol family not supported"); - /* NOTREACHED */ - case WSAENOPROTOOPT: - return ACE_TEXT ("bad protocol option"); - /* NOTREACHED */ - case WSATYPE_NOT_FOUND: - return ACE_TEXT ("class type not found"); - /* NOTREACHED */ - case WSAEOPNOTSUPP: - return ACE_TEXT ("operation not supported"); - /* NOTREACHED */ - case WSAEDESTADDRREQ: - return ACE_TEXT ("destination address required"); - /* NOTREACHED */ - default: - ACE_OS::sprintf (unknown_msg, ACE_TEXT ("unknown error: %d"), error); - return unknown_msg; - /* NOTREACHED */ - } -#else - ACE_UNUSED_ARG (error); - ACE_NOTSUP_RETURN (0); -#endif /* ACE_WIN32 */ -} - -bool -ACE::is_sock_error (int error) -{ -#if defined (ACE_WIN32) - switch (error) - { - case WSAVERNOTSUPPORTED: - case WSASYSNOTREADY: - case WSAEINVAL: - case WSAHOST_NOT_FOUND: - case WSATRY_AGAIN: - case WSANO_RECOVERY: - case WSANO_DATA: - /* - case WSANO_ADDRESS: - */ - case WSANOTINITIALISED: - case WSAENETDOWN: - case WSAEINPROGRESS: - case WSAEINTR: - case WSAEAFNOSUPPORT: - case WSAEMFILE: - case WSAENOBUFS: - case WSAEPROTONOSUPPORT: - case WSAEPROTOTYPE: - case WSAESOCKTNOSUPPORT: - case WSAENOTSOCK: - case WSAEWOULDBLOCK: - case WSAEADDRINUSE: - case WSAECONNABORTED: - case WSAECONNRESET: - case WSAENOTCONN: - case WSAETIMEDOUT: - case WSAECONNREFUSED: - case WSAEHOSTDOWN: - case WSAEHOSTUNREACH: - case WSAEADDRNOTAVAIL: - case WSAEISCONN: - case WSAENETRESET: - case WSAEMSGSIZE: - case WSAENETUNREACH: - case WSAEFAULT: - case WSAEDISCON: - case WSAEACCES: - case WSAESHUTDOWN: - case WSAEPROCLIM: - case WSAEALREADY: - case WSAEPFNOSUPPORT: - case WSAENOPROTOOPT: - case WSATYPE_NOT_FOUND: - case WSAEOPNOTSUPP: - return true; - } -#else - ACE_UNUSED_ARG (error); -#endif /* ACE_WIN32 */ - return false; -} - -char * -ACE::strndup (const char *str, size_t n) -{ - const char *t = str; - size_t len; - - // Figure out how long this string is (remember, it might not be - // NUL-terminated). - - for (len = 0; - len < n && *t++ != '\0'; - len++) - continue; - - char *s; - ACE_ALLOCATOR_RETURN (s, - (char *) ACE_OS::malloc (len + 1), - 0); - return ACE_OS::strsncpy (s, str, len + 1); -} - -#if defined (ACE_HAS_WCHAR) -wchar_t * -ACE::strndup (const wchar_t *str, size_t n) -{ - const wchar_t *t = str; - size_t len; - - // Figure out how long this string is (remember, it might not be - // NUL-terminated). - - for (len = 0; - len < n && *t++ != '\0'; - len++) - continue; - - wchar_t *s; - ACE_ALLOCATOR_RETURN (s, - static_cast ( - ACE_OS::malloc ((len + 1) * sizeof (wchar_t))), - 0); - return ACE_OS::strsncpy (s, str, len + 1); -} -#endif /* ACE_HAS_WCHAR */ - -char * -ACE::strnnew (const char *str, size_t n) -{ - const char *t = str; - size_t len; - - // Figure out how long this string is (remember, it might not be - // NUL-terminated). - - for (len = 0; - len < n && *t++ != L'\0'; - len++) - continue; - - char *s; - ACE_NEW_RETURN (s, - char[len + 1], - 0); - return ACE_OS::strsncpy (s, str, len + 1); -} - -#if defined (ACE_HAS_WCHAR) -wchar_t * -ACE::strnnew (const wchar_t *str, size_t n) -{ - const wchar_t *t = str; - size_t len; - - // Figure out how long this string is (remember, it might not be - // NUL-terminated). - - for (len = 0; - len < n && *t++ != ACE_TEXT_WIDE ('\0'); - len++) - continue; - - wchar_t *s; - ACE_NEW_RETURN (s, - wchar_t[len + 1], - 0); - return ACE_OS::strsncpy (s, str, len + 1); -} -#endif /* ACE_HAS_WCHAR */ - -const char * -ACE::strend (const char *s) -{ - while (*s++ != '\0') - continue; - - return s; -} - -#if defined ACE_HAS_WCHAR -const wchar_t * -ACE::strend (const wchar_t *s) -{ - while (*s++ != ACE_TEXT_WIDE ('\0')) - continue; - - return s; -} -#endif - -char * -ACE::strnew (const char *s) -{ - if (s == 0) - return 0; - char *t = 0; - ACE_NEW_RETURN (t, - char [ACE_OS::strlen (s) + 1], - 0); - return ACE_OS::strcpy (t, s); -} - -#if defined (ACE_HAS_WCHAR) -wchar_t * -ACE::strnew (const wchar_t *s) -{ - if (s == 0) - return 0; - wchar_t *t = 0; - ACE_NEW_RETURN (t, - wchar_t[ACE_OS::strlen (s) + 1], - 0); - return ACE_OS::strcpy (t, s); -} -#endif /* ACE_HAS_WCHAR */ - -// helper functions for ACE::wild_match() -namespace -{ - - inline bool equal_char (char a, char b, bool case_sensitive) - { - if (case_sensitive) - return a == b; - return ACE_OS::ace_tolower (a) == ACE_OS::ace_tolower (b); - } - - // precond: *p == '[' start of char class - // postcond: *p == ']' end of the char class - inline bool equal_class (char s, const char *&p, bool case_sensitive) - { - ++p; - bool negate = false; - if (*p == '!') - { - negate = true; - ++p; - } - // ] and - are regular in 1st position - for (bool first = true; *p && (first || *p != ']'); ++p) - { - if (!first && *p == '-' && p[1] != ']') - { - if (!p[1] || p[1] <= p[-1]) // invalid range - { - continue; - } - // Since we are in the POSIX locale, only the basic ASCII - // characters are allowed as the range endpoints. These characters - // are the same values in both signed and unsigned chars so we - // don't have to account for any "pathological cases." - for (char range = static_cast (p[-1] + 1); range <= p[1]; ++range) - { - if (equal_char (s, range, case_sensitive)) - { - while (*++p != ']') {} - return !negate; - } - } - ++p; // consume the character 1 past the - - } - else if (equal_char (s, *p, case_sensitive)) - { - while (*++p != ']') {} - return !negate; - } - first = false; - } - return negate; - } -} - -bool -ACE::wild_match(const char *str, const char *pat, bool case_sensitive, - bool character_classes) -{ - if (str == pat) - return true; - if (pat == 0 || str == 0) - return false; - - bool star = false, escape = false; - const char *s = str; - const char *p = pat; - while (*s != '\0') - { - if (!escape && *p == '\\') - { - ++p; - escape = true; - } - else if (!escape && *p == '*') - { - star = true; - pat = p; - while (*++pat == '*') {} - - if (*pat == '\0') - return true; - p = pat; - } - else if (!escape && *p == '?') - { - ++s; - ++p; - } - else if (!escape && character_classes && *p == '[') - { - if (equal_class (*s, p, case_sensitive)) - { - ++p; - } - else - { - if (!star) - return false; - p = pat; - } - ++s; - } - else if (!equal_char (*s, *p, case_sensitive)) - { - if (!star) - return false; - ++s; - p = pat; - escape = false; - } - else - { - ++s; - ++p; - escape = false; - } - } - if (*p == '*') - while (*++p == '*') {} - - return *p == '\0'; -} - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/ACE.h b/dep/acelite/ace/ACE.h deleted file mode 100644 index 58eb1f68947..00000000000 --- a/dep/acelite/ace/ACE.h +++ /dev/null @@ -1,891 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file ACE.h - * - * $Id: ACE.h 93276 2011-02-04 20:03:53Z olli $ - * - * This file contains value added ACE functions that extend the - * behavior of the UNIX and Win32 OS calls. - * - * All these ACE static functions are consolidated in a single place - * in order to manage the namespace better. These functions are put - * here rather than in @c ACE_OS in order to separate concerns. - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_ACE_H -#define ACE_ACE_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/OS_NS_math.h" -#include "ace/Flag_Manip.h" -#include "ace/Handle_Ops.h" -#include "ace/Lib_Find.h" -#include "ace/Init_ACE.h" -#include "ace/Sock_Connect.h" -#include "ace/Default_Constants.h" - -#if defined (ACE_EXPORT_MACRO) -# undef ACE_EXPORT_MACRO -#endif -#define ACE_EXPORT_MACRO ACE_Export - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declarations. -class ACE_Time_Value; -class ACE_Message_Block; -class ACE_Handle_Set; - -/** - * @namespace ACE - * - * @brief The namespace containing the ACE framework itself. - * - * The ACE namespace contains all types (classes, structures, - * typedefs, etc), and global functions and variables in the ACE - * framework. - */ -namespace ACE -{ - // = ACE version information. - /// e.g., the "5" in ACE 5.1.12. - extern ACE_Export u_int major_version (void); - - /// e.g., the "1" in ACE 5.1.12. - extern ACE_Export u_int minor_version (void); - - /// e.g., the "12" in ACE 5.1.12. - /// Returns 0 for "stable" (non-beta) releases. - extern ACE_Export u_int beta_version (void); - - // = C++ compiler version information. - /// E.g., the "SunPro C++" in SunPro C++ 4.32.0 - extern ACE_Export const ACE_TCHAR * compiler_name (void); - - /// E.g., the "4" in SunPro C++ 4.32.0 - extern ACE_Export u_int compiler_major_version (void); - - /// E.g., the "32" in SunPro C++ 4.32.0 - extern ACE_Export u_int compiler_minor_version (void); - - /// E.g., the "0" in SunPro C++ 4.32.0 - extern ACE_Export u_int compiler_beta_version (void); - - /// Check if error indicates the process being out of handles (file - /// descriptors). - extern ACE_Export int out_of_handles (int error); - - /// Simple wildcard matching function supporting '*' and '?' - /// return true if string s matches pattern. - /// If @a character_classes is true, '[' is treated as a wildcard character - /// as described in the fnmatch() POSIX API. The following POSIX "bracket - /// expression" features are not implemented: collating symbols, equivalence - /// class expressions, and character class expressions. The POSIX locale is - /// assumed. - extern ACE_Export bool wild_match(const char* s, const char* pattern, - bool case_sensitive = true, bool character_classes = false); - - /** - * @name I/O operations - * - * Notes on common parameters: - * - * @a handle is the connected endpoint that will be used for I/O. - * - * @a buf is the buffer to write from or receive into. - * - * @a len is the number of bytes to transfer. - * - * The @a timeout parameter in the following methods indicates how - * long to blocking trying to transfer data. If @a timeout == 0, - * then the call behaves as a normal send/recv call, i.e., for - * blocking sockets, the call will block until action is possible; - * for non-blocking sockets, @c EWOULDBLOCK will be returned if no - * action is immediately possible. - * - * If @a timeout != 0, the call will wait until the relative time - * specified in @a *timeout elapses. - * - * The "_n()" I/O methods keep looping until all the data has been - * transferred. These methods also work for sockets in non-blocking - * mode i.e., they keep looping on @c EWOULDBLOCK. @a timeout is - * used to make sure we keep making progress, i.e., the same timeout - * value is used for every I/O operation in the loop and the timeout - * is not counted down. - * - * The return values for the "*_n()" methods match the return values - * from the non "_n()" methods and are specified as follows: - * - * - On complete transfer, the number of bytes transferred is returned. - * - On timeout, -1 is returned, @c errno == @c ETIME. - * - On error, -1 is returned, @c errno is set to appropriate error. - * - On @c EOF, 0 is returned, @c errno is irrelevant. - * - * On partial transfers, i.e., if any data is transferred before - * timeout / error / @c EOF, @a bytes_transferred> will contain the - * number of bytes transferred. - * - * Methods with @a iovec parameter are I/O vector variants of the - * I/O operations. - * - * Methods with the extra @a flags argument will always result in - * @c send getting called. Methods without the extra @a flags - * argument will result in @c send getting called on Win32 - * platforms, and @c write getting called on non-Win32 platforms. - */ - //@{ - extern ACE_Export ssize_t recv (ACE_HANDLE handle, - void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout = 0); - -#if defined (ACE_HAS_TLI) - - extern ACE_Export ssize_t t_rcv (ACE_HANDLE handle, - void *buf, - size_t len, - int *flags, - const ACE_Time_Value *timeout = 0); - -#endif /* ACE_HAS_TLI */ - - extern ACE_Export ssize_t recv (ACE_HANDLE handle, - void *buf, - size_t len, - const ACE_Time_Value *timeout = 0); - - extern ACE_Export ssize_t recvmsg (ACE_HANDLE handle, - struct msghdr *msg, - int flags, - const ACE_Time_Value *timeout = 0); - - extern ACE_Export ssize_t recvfrom (ACE_HANDLE handle, - char *buf, - int len, - int flags, - struct sockaddr *addr, - int *addrlen, - const ACE_Time_Value *timeout = 0); - - ACE_NAMESPACE_INLINE_FUNCTION - ssize_t recv_n (ACE_HANDLE handle, - void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); - -#if defined (ACE_HAS_TLI) - - ACE_NAMESPACE_INLINE_FUNCTION - ssize_t t_rcv_n (ACE_HANDLE handle, - void *buf, - size_t len, - int *flags, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); - -#endif /* ACE_HAS_TLI */ - - ACE_NAMESPACE_INLINE_FUNCTION - ssize_t recv_n (ACE_HANDLE handle, - void *buf, - size_t len, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); - - /// Receive into a variable number of pieces. - /** - * Accepts a variable, caller-specified, number of pointer/length - * pairs. Arguments following @a n are char *, size_t pairs. - * - * @param handle The I/O handle to receive on - * @param n The total number of char *, size_t pairs following @a n. - * - * @return -1 on error, else total number of bytes received. - */ - extern ACE_Export ssize_t recv (ACE_HANDLE handle, size_t n, ...); - - extern ACE_Export ssize_t recvv (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout = 0); - - ACE_NAMESPACE_INLINE_FUNCTION - ssize_t recvv_n (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); - - extern ACE_Export ssize_t recv_n (ACE_HANDLE handle, - ACE_Message_Block *message_block, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); - - extern ACE_Export ssize_t send (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout = 0); - -#if defined (ACE_HAS_TLI) - - extern ACE_Export ssize_t t_snd (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout = 0); - -#endif /* ACE_HAS_TLI */ - - extern ACE_Export ssize_t send (ACE_HANDLE handle, - const void *buf, - size_t len, - const ACE_Time_Value *timeout = 0); - - extern ACE_Export ssize_t sendmsg (ACE_HANDLE handle, - const struct msghdr *msg, - int flags, - const ACE_Time_Value *timeout = 0); - - extern ACE_Export ssize_t sendto (ACE_HANDLE handle, - const char *buf, - int len, - int flags, - const struct sockaddr *addr, - int addrlen, - const ACE_Time_Value *timeout = 0); - - ACE_NAMESPACE_INLINE_FUNCTION - ssize_t send_n (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); - -#if defined (ACE_HAS_TLI) - - ACE_NAMESPACE_INLINE_FUNCTION - ssize_t t_snd_n (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); - -#endif /* ACE_HAS_TLI */ - - ACE_NAMESPACE_INLINE_FUNCTION - ssize_t send_n (ACE_HANDLE handle, - const void *buf, - size_t len, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); - - /// Varargs variant. - extern ACE_Export ssize_t send (ACE_HANDLE handle, size_t n, ...); - - extern ACE_Export ssize_t sendv (ACE_HANDLE handle, - const iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout = 0); - - ACE_NAMESPACE_INLINE_FUNCTION - ssize_t sendv_n (ACE_HANDLE handle, - const iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); - - /// Send all the @a message_blocks chained through their @c next and - /// @c cont pointers. This call uses the underlying OS gather-write - /// operation to reduce the domain-crossing penalty. - extern ACE_Export ssize_t send_n (ACE_HANDLE handle, - const ACE_Message_Block *message_block, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); - - // = File system I/O functions (these don't support timeouts). - - ACE_NAMESPACE_INLINE_FUNCTION - ssize_t read_n (ACE_HANDLE handle, - void *buf, - size_t len, - size_t *bytes_transferred = 0); - - ACE_NAMESPACE_INLINE_FUNCTION - ssize_t write_n (ACE_HANDLE handle, - const void *buf, - size_t len, - size_t *bytes_transferred = 0); - - /// Write all the @a message_blocks chained through their @c next - /// and @c cont pointers. This call uses the underlying OS - /// gather-write operation to reduce the domain-crossing penalty. - extern ACE_Export ssize_t write_n (ACE_HANDLE handle, - const ACE_Message_Block *message_block, - size_t *bytes_transferred = 0); - - extern ACE_Export ssize_t readv_n (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - size_t *bytes_transferred = 0); - - extern ACE_Export ssize_t writev_n (ACE_HANDLE handle, - const iovec *iov, - int iovcnt, - size_t *bytes_transferred = 0); - //@} - - /** - * Wait up to @a timeout amount of time to passively establish a - * connection. This method doesn't perform the @c accept, it just - * does the timed wait. - */ - extern ACE_Export int handle_timed_accept (ACE_HANDLE listener, - ACE_Time_Value *timeout, - bool restart); - - /** - * Wait up to @a timeout amount of time to complete an actively - * established non-blocking connection. If @a is_tli is non-0 then - * we are being called by a TLI wrapper (which behaves slightly - * differently from a socket wrapper). - */ - extern ACE_Export ACE_HANDLE handle_timed_complete ( - ACE_HANDLE listener, - const ACE_Time_Value *timeout, - int is_tli = 0); - - /** - * Reset the limit on the number of open handles. If @a new_limit - * == -1 set the limit to the maximum allowable. Otherwise, set - * the limit value to @a new_limit. If @a increase_limit_only is - * non-0 then only allow increases to the limit. - */ - extern ACE_Export int set_handle_limit (int new_limit = -1, - int increase_limit_only = 0); - - /** - * Returns the maximum number of open handles currently permitted in - * this process. This maximum may be extended using - * @c ACE::set_handle_limit. - */ - extern ACE_Export int max_handles (void); - - // = String functions - /** - * Return a dynamically allocated duplicate of @a str, substituting - * the environment variable if @c str[0] @c == @c '$'. Note that - * the pointer is allocated with @c ACE_OS::malloc and must be freed - * by @c ACE_OS::free. - */ - extern ACE_Export ACE_TCHAR *strenvdup (const ACE_TCHAR *str); - - /// Returns a pointer to the "end" of the string, i.e., the character - /// past the '\0'. - extern ACE_Export const char *strend (const char *s); - - /// This method is just like @c strdup, except that it uses - /// @c operator @c new rather than @c malloc. If @a s is NULL - /// returns NULL rather than segfaulting. - extern ACE_Export char *strnew (const char *s); - - /// Delete the memory allocated by @c strnew. - ACE_NAMESPACE_INLINE_FUNCTION void strdelete (char *s); - - /// Create a fresh new copy of @a str, up to @a n chars long. Uses - /// @c ACE_OS::malloc to allocate the new string. - extern ACE_Export char *strndup (const char *str, size_t n); - - /// Create a fresh new copy of @a str, up to @a n chars long. Uses - /// @c ACE_OS::malloc to allocate the new string. - extern ACE_Export char *strnnew (const char *str, size_t n); - - /// Determine if a specified pathname is "dot dir" (ie. "." or ".."). - ACE_NAMESPACE_INLINE_FUNCTION bool isdotdir (const char *s); - -#if defined (ACE_HAS_WCHAR) - extern ACE_Export const wchar_t *strend (const wchar_t *s); - - extern ACE_Export wchar_t *strnew (const wchar_t *s); - - ACE_NAMESPACE_INLINE_FUNCTION void strdelete (wchar_t *s); - - extern ACE_Export wchar_t *strndup (const wchar_t *str, size_t n); - - extern ACE_Export wchar_t *strnnew (const wchar_t *str, size_t n); - - ACE_NAMESPACE_INLINE_FUNCTION bool isdotdir (const wchar_t *s); - -#endif /* ACE_HAS_WCHAR */ - - /** - * On Windows, determines if a specified pathname ends with ".exe" - * (not case sensitive). If on Windows and there is no ".exe" suffix, - * a new ACE_TCHAR array is allocated and a copy of @c pathname with - * the ".exe" suffix is copied into it. In this case, the caller is - * responsible for calling delete [] on the returned pointer. - * - * @param pathname The name to check for a proper suffix. - * - * @retval @c pathname if there is a proper suffix for Windows. This is - * always the return value for non-Windows platforms. - * @retval If a suffix needs to be added, returns a pointer to new[] - * allocated memory containing the original @c pathname plus - * a ".exe" suffix. The caller is responsible for freeing the - * memory using delete []. - */ - extern ACE_Export const ACE_TCHAR *execname (const ACE_TCHAR *pathname); - - /** - * Returns the "basename" of a @a pathname separated by @a delim. - * For instance, the basename of "/tmp/foo.cpp" is "foo.cpp" when - * @a delim is @a '/'. - */ - extern ACE_Export const ACE_TCHAR *basename (const ACE_TCHAR *pathname, - ACE_TCHAR delim = - ACE_DIRECTORY_SEPARATOR_CHAR); - - /** - * Returns the "dirname" of a @a pathname. For instance, the - * dirname of "/tmp/foo.cpp" is "/tmp" when @a delim is @a '/'. If - * @a pathname has no @a delim ".\0" is returned. This method does - * not modify @a pathname and is not reentrant. - */ - extern ACE_Export const ACE_TCHAR *dirname (const ACE_TCHAR *pathname, - ACE_TCHAR delim = - ACE_DIRECTORY_SEPARATOR_CHAR); - - /** - * Translate the given timestamp to ISO-8601 format. - * - * @param time_value ACE_Time_Value to format. This is assumed to be - * an absolute time value. - * @param date_and_time Array to hold the timestamp. - * @param time_len Size of @a date_and_time in ACE_TCHARs. - * Must be greater than or equal to 27. - * @param return_pointer_to_first_digit If true, returned pointer value - * is to the first time digit, else to the space - * prior to the first time digit. See Return Values. - * - * @retval 0 if unsuccessful, with errno set. If @a time_len is less than - * 27 errno will be EINVAL. - * @retval If successful, pointer to beginning of the "time" portion of - * @a date_and_time. If @a return_pointer_to_first_digit is false - * the pointer is actually to the space before the time, else - * the pointer is to the first time digit. - */ - extern ACE_Export ACE_TCHAR *timestamp (const ACE_Time_Value& time_value, - ACE_TCHAR date_and_time[], - size_t time_len, - bool return_pointer_to_first_digit = false); - - /** - * Translate the current time to ISO-8601 timestamp format. - * - * @param date_and_time Array to hold the timestamp. - * @param time_len Size of @a date_and_time in ACE_TCHARs. - * Must be greater than or equal to 27. - * @param return_pointer_to_first_digit If true, returned pointer value - * is to the first time digit, else to the space - * prior to the first time digit. See Return Values. - * - * @retval 0 if unsuccessful, with errno set. If @a time_len is less than - * 27 errno will be EINVAL. - * @retval If successful, pointer to beginning of the "time" portion of - * @a date_and_time. If @a return_pointer_to_first_digit is false - * the pointer is actually to the space before the time, else - * the pointer is to the first time digit. - */ - extern ACE_Export ACE_TCHAR *timestamp (ACE_TCHAR date_and_time[], - size_t time_len, - bool return_pointer_to_first_digit = false); - - /** - * if @a avoid_zombies == 0 call @c ACE_OS::fork directly, else - * create an orphan process that's inherited by the init process; - * init cleans up when the orphan process terminates so we don't - * create zombies. Returns -1 on failure and either the child PID - * on success if @a avoid_zombies == 0 or 1 on success if @a - * avoid_zombies != 0 (this latter behavior is a known bug that - * needs to be fixed). - */ - extern ACE_Export pid_t fork ( - const ACE_TCHAR *program_name = ACE_TEXT (""), - int avoid_zombies = 0); - - /** - * Become a daemon process using the algorithm in Richard Stevens - * "Advanced Programming in the UNIX Environment." If - * @a close_all_handles is non-zero then all open file handles are - * closed. - */ - extern ACE_Export int daemonize ( - const ACE_TCHAR pathname[] = ACE_TEXT ("/"), - bool close_all_handles = ACE_DEFAULT_CLOSE_ALL_HANDLES, - const ACE_TCHAR program_name[] = ACE_TEXT ("")); - - // = Miscellaneous functions. - /// Rounds the request to a multiple of the page size. - extern ACE_Export size_t round_to_pagesize (size_t len); - - /// Rounds the request to a multiple of the allocation granularity. - extern ACE_Export size_t round_to_allocation_granularity (size_t len); - - // @@ UNICODE what about buffer? - /// Format buffer into printable format. This is useful for - /// debugging. - extern ACE_Export size_t format_hexdump (const char *buffer, size_t size, - ACE_TCHAR *obuf, size_t obuf_sz); - - /// Computes the hash value of {str} using the "Hash PJW" routine. - extern ACE_Export u_long hash_pjw (const char *str); - - /// Computes the hash value of {str} using the "Hash PJW" routine. - extern ACE_Export u_long hash_pjw (const char *str, size_t len); - -#if defined (ACE_HAS_WCHAR) - /// Computes the hash value of {str} using the "Hash PJW" routine. - extern ACE_Export u_long hash_pjw (const wchar_t *str); - - /// Computes the hash value of {str} using the "Hash PJW" routine. - extern ACE_Export u_long hash_pjw (const wchar_t *str, size_t len); -#endif /* ACE_HAS_WCHAR */ - - /// Computes CRC-CCITT for the string. - extern ACE_Export ACE_UINT16 crc_ccitt(const char *str); - - /// Computes CRC-CCITT for the buffer. - extern ACE_Export ACE_UINT16 crc_ccitt(const void *buf, size_t len, - ACE_UINT16 crc = 0); - - /// Computes CRC-CCITT for the @ len iovec buffers. - extern ACE_Export ACE_UINT16 crc_ccitt(const iovec *iov, int len, - ACE_UINT16 crc = 0); - - /// Computes the ISO 8802-3 standard 32 bits CRC for the string. - extern ACE_Export ACE_UINT32 crc32 (const char *str); - - /// Computes the ISO 8802-3 standard 32 bits CRC for the buffer. - extern ACE_Export ACE_UINT32 crc32 (const void *buf, size_t len, - ACE_UINT32 crc = 0); - - /// Computes the ISO 8802-3 standard 32 bits CRC for the - /// @ len iovec buffers. - extern ACE_Export ACE_UINT32 crc32 (const iovec *iov, int len, - ACE_UINT32 crc = 0); - - /// Euclid's greatest common divisor algorithm. - extern ACE_Export u_long gcd (u_long x, u_long y); - - /// Calculates the minimum enclosing frame size for the given values. - extern ACE_Export u_long minimum_frame_size (u_long period1, u_long period2); - - /** - * Function that can burn up noticeable CPU time: brute-force - * determination of whether number @a n is prime. Returns 0 if - * it is prime, or the smallest factor if it is not prime. - * @a min_factor and @a max_factor can be used to partition the work - * among threads. For just one thread, typical values are 2 and - * n/2. - */ - extern ACE_Export u_long is_prime (const u_long n, - const u_long min_factor, - const u_long max_factor); - - /// Map troublesome win32 errno values to values that standard C - /// strerr function understands. Thank you Microsoft. - extern ACE_Export int map_errno (int error); - - /// Returns a string containing the error message corresponding to a - /// WinSock error. This works around an omission in the Win32 API. - /// @internal - extern ACE_Export const ACE_TCHAR * sock_error (int error); - - /// Determins whether the given error code corresponds to to a - /// WinSock error. If so returns true, false otherwise. - /// @internal - extern ACE_Export bool is_sock_error (int error); - - /** - * Checks if process with {pid} is still alive. Returns 1 if it is - * still alive, 0 if it isn't alive, and -1 if something weird - * happened. - */ - extern ACE_Export int process_active (pid_t pid); - - /** - * Terminate the process abruptly with id @a pid. On Win32 platforms - * this uses {TerminateProcess} and on POSIX platforms is uses - * {kill} with the -9 (SIGKILL) signal, which cannot be caught or - * ignored. Note that this call is potentially dangerous to use - * since the process being terminated may not have a chance to - * cleanup before it shuts down. - */ - extern ACE_Export int terminate_process (pid_t pid); - - /** - * This method uses process id and object pointer to come up with a - * machine wide unique name. The process ID will provide uniqueness - * between processes on the same machine. The "this" pointer of the - * {object} will provide uniqueness between other "live" objects in - * the same process. The uniqueness of this name is therefore only - * valid for the life of {object}. - */ - ACE_NAMESPACE_INLINE_FUNCTION void unique_name (const void *object, - ACE_TCHAR *name, - size_t length); - - /// Computes the base 2 logarithm of {num}. - ACE_NAMESPACE_INLINE_FUNCTION u_long log2 (u_long num); - - /// Helper to avoid comparing floating point values with == - /// (uses < and > operators). - template - bool is_equal (const T& a, const T& b) - { - return !((a < b) || (a > b)); - } - - /// Helper to avoid comparing floating point values with != - /// (uses < and > operators). - template - bool is_inequal (const T& a, const T& b) - { - return !is_equal (a, b); - } - - /// Hex conversion utility. - extern ACE_Export ACE_TCHAR nibble2hex (u_int n); - - /// Convert a hex character to its byte representation. - ACE_NAMESPACE_INLINE_FUNCTION u_char hex2byte (ACE_TCHAR c); - - // = Set/get the debug level. - extern ACE_Export bool debug (void); - extern ACE_Export void debug (bool onoff); - - /// Wrapper facade for @c select that uses @c ACE_Handle_Sets. - extern ACE_Export int select (int width, - ACE_Handle_Set *readfds, - ACE_Handle_Set *writefds = 0, - ACE_Handle_Set *exceptfds = 0, - const ACE_Time_Value *timeout = 0); - - /// Wrapper facade for the most common use of @c select that uses - /// @c ACE_Handle_Sets. - extern ACE_Export int select (int width, - ACE_Handle_Set &readfds, - const ACE_Time_Value *timeout = 0); - - /// Timed wait for handle to get read ready. - /// @retval -1 for error - /// @retval 0 for timeout - /// @retval 1 the handle is ready - ACE_NAMESPACE_INLINE_FUNCTION - int handle_read_ready (ACE_HANDLE handle, - const ACE_Time_Value *timeout); - - /// Timed wait for handle to get write ready. - /// @retval -1 for error - /// @retval 0 for timeout - /// @retval 1 the handle is ready - ACE_NAMESPACE_INLINE_FUNCTION - int handle_write_ready (ACE_HANDLE handle, - const ACE_Time_Value *timeout); - - /// Timed wait for handle to get exception ready. - /// @retval -1 for error - /// @retval 0 for timeout - /// @retval 1 the handle is ready - ACE_NAMESPACE_INLINE_FUNCTION - int handle_exception_ready (ACE_HANDLE handle, - const ACE_Time_Value *timeout); - - /// Timed wait for handle to get read, write, or exception ready. - /// @retval -1 for error - /// @retval 0 for timeout - /// @retval 1 the handle is ready - extern ACE_Export int handle_ready (ACE_HANDLE handle, - const ACE_Time_Value *timeout, - int read_ready, - int write_ready, - int exception_ready); - - /// Wait for @a timeout before proceeding to a @c recv operation. - /// @a val keeps track of whether we're in non-blocking mode or - /// not. - extern ACE_Export int enter_recv_timedwait (ACE_HANDLE handle, - const ACE_Time_Value *timeout, - int &val); - - /// Wait for @a timeout before proceeding to a @c send operation. - /// @a val keeps track of whether we're in non-blocking mode or - /// not. - extern ACE_Export int enter_send_timedwait (ACE_HANDLE handle, - const ACE_Time_Value* timeout, - int &val); - - /// This makes sure that @a handle is set into non-blocking mode. - /// @a val keeps track of whether were in non-blocking mode or not. - extern ACE_Export void record_and_set_non_blocking_mode (ACE_HANDLE handle, - int &val); - - /// Cleanup after a timed operation, restore the appropriate - /// non-blocking status of @a handle. - extern ACE_Export void restore_non_blocking_mode (ACE_HANDLE handle, - int val); - - // private: - // These functions aren't meant to be used internally, so they are - // not exported. - - // - // = Recv_n helpers - // - - ACE_NAMESPACE_INLINE_FUNCTION ssize_t recv_i (ACE_HANDLE handle, - void *buf, - size_t len); - - extern ACE_Export ssize_t recv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - int flags, - size_t *bytes_transferred); - - extern ACE_Export ssize_t recv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred); - -#if defined (ACE_HAS_TLI) - - extern ACE_Export ssize_t t_rcv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - int *flags, - size_t *bytes_transferred); - - extern ACE_Export ssize_t t_rcv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - int *flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred); - -#endif /* ACE_HAS_TLI */ - - extern ACE_Export ssize_t recv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - size_t *bytes_transferred); - - extern ACE_Export ssize_t recv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - const ACE_Time_Value *timeout, - size_t *bytes_transferred); - - extern ACE_Export ssize_t recvv_n_i (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - size_t *bytes_transferred); - - extern ACE_Export ssize_t recvv_n_i (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout, - size_t *bytes_transferred); - - // - // = Send_n helpers - // - - ACE_NAMESPACE_INLINE_FUNCTION ssize_t send_i (ACE_HANDLE handle, - const void *buf, - size_t len); - - extern ACE_Export ssize_t send_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - size_t *bytes_transferred); - - extern ACE_Export ssize_t send_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred); - -#if defined (ACE_HAS_TLI) - - extern ACE_Export ssize_t t_snd_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - size_t *bytes_transferred); - - extern ACE_Export ssize_t t_snd_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred); - -#endif /* ACE_HAS_TLI */ - - extern ACE_Export ssize_t send_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - size_t *bytes_transferred); - - extern ACE_Export ssize_t send_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - const ACE_Time_Value *timeout, - size_t *bytes_transferred); - - extern ACE_Export ssize_t sendv_n_i (ACE_HANDLE handle, - const iovec *iov, - int iovcnt, - size_t *bytes_transferred); - - extern ACE_Export ssize_t sendv_n_i (ACE_HANDLE handle, - const iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout, - size_t *bytes_transferred); - -} - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/ACE.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_ACE_H */ diff --git a/dep/acelite/ace/ACE.inl b/dep/acelite/ace/ACE.inl deleted file mode 100644 index 95f45ee99d3..00000000000 --- a/dep/acelite/ace/ACE.inl +++ /dev/null @@ -1,333 +0,0 @@ -// -*- C++ -*- -// -// $Id: ACE.inl 95761 2012-05-15 18:23:04Z johnnyw $ - -#include "ace/OS_NS_unistd.h" -#include "ace/OS_NS_Thread.h" -#include "ace/OS_NS_ctype.h" -#include "ace/OS_NS_sys_socket.h" - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - - -// Wrappers for methods that have been moved to ACE_OS. - -ACE_INLINE ssize_t -ACE::read_n (ACE_HANDLE handle, - void *buf, - size_t len, - size_t *bytes_transferred) -{ - return ACE_OS::read_n (handle, - buf, - len, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE::write_n (ACE_HANDLE handle, - const void *buf, - size_t len, - size_t *bytes_transferred) -{ - return ACE_OS::write_n (handle, - buf, - len, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE::recv_n (ACE_HANDLE handle, - void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) -{ - if (timeout == 0) - return ACE::recv_n_i (handle, - buf, - len, - flags, - bytes_transferred); - else - return ACE::recv_n_i (handle, - buf, - len, - flags, - timeout, - bytes_transferred); -} - -#if defined (ACE_HAS_TLI) - -ACE_INLINE ssize_t -ACE::t_rcv_n (ACE_HANDLE handle, - void *buf, - size_t len, - int *flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) -{ - if (timeout == 0) - return ACE::t_rcv_n_i (handle, - buf, - len, - flags, - bytes_transferred); - else - return ACE::t_rcv_n_i (handle, - buf, - len, - flags, - timeout, - bytes_transferred); -} - -#endif /* ACE_HAS_TLI */ - -ACE_INLINE ssize_t -ACE::recv_n (ACE_HANDLE handle, - void *buf, - size_t len, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) -{ - if (timeout == 0) - return ACE::recv_n_i (handle, - buf, - len, - bytes_transferred); - else - return ACE::recv_n_i (handle, - buf, - len, - timeout, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE::recvv_n (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) -{ - if (timeout == 0) - return ACE::recvv_n_i (handle, - iov, - iovcnt, - bytes_transferred); - else - return ACE::recvv_n_i (handle, - iov, - iovcnt, - timeout, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE::send_n (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) -{ - if (timeout == 0) - return ACE::send_n_i (handle, - buf, - len, - flags, - bytes_transferred); - else - return ACE::send_n_i (handle, - buf, - len, - flags, - timeout, - bytes_transferred); -} - -#if defined (ACE_HAS_TLI) - -ACE_INLINE ssize_t -ACE::t_snd_n (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) -{ - if (timeout == 0) - return ACE::t_snd_n_i (handle, - buf, - len, - flags, - bytes_transferred); - else - return ACE::t_snd_n_i (handle, - buf, - len, - flags, - timeout, - bytes_transferred); -} - -#endif /* ACE_HAS_TLI */ - -ACE_INLINE ssize_t -ACE::send_n (ACE_HANDLE handle, - const void *buf, - size_t len, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) -{ - if (timeout == 0) - return ACE::send_n_i (handle, - buf, - len, - bytes_transferred); - else - return ACE::send_n_i (handle, - buf, - len, - timeout, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE::sendv_n (ACE_HANDLE handle, - const iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) -{ - if (timeout == 0) - return ACE::sendv_n_i (handle, - iov, - iovcnt, - bytes_transferred); - else - return ACE::sendv_n_i (handle, - iov, - iovcnt, - timeout, - bytes_transferred); -} - -ACE_INLINE ssize_t -ACE::send_i (ACE_HANDLE handle, const void *buf, size_t len) -{ -#if defined (ACE_WIN32) || defined (HPUX) - return ACE_OS::send (handle, (const char *) buf, len); -#else - return ACE_OS::write (handle, (const char *) buf, len); -#endif /* ACE_WIN32 */ -} - -ACE_INLINE ssize_t -ACE::recv_i (ACE_HANDLE handle, void *buf, size_t len) -{ -#if defined (ACE_WIN32) || defined (ACE_OPENVMS) - return ACE_OS::recv (handle, (char *) buf, len); -#else - return ACE_OS::read (handle, (char *) buf, len); -#endif /* ACE_WIN32 */ -} - -ACE_INLINE int -ACE::handle_read_ready (ACE_HANDLE handle, const ACE_Time_Value *timeout) -{ - return ACE::handle_ready (handle, timeout, 1, 0, 0); -} - -ACE_INLINE int -ACE::handle_write_ready (ACE_HANDLE handle, const ACE_Time_Value *timeout) -{ - return ACE::handle_ready (handle, timeout, 0, 1, 0); -} - -ACE_INLINE int -ACE::handle_exception_ready (ACE_HANDLE handle, const ACE_Time_Value *timeout) -{ - return ACE::handle_ready (handle, timeout, 0, 0, 1); -} - -ACE_INLINE void -ACE::strdelete (char *s) -{ - delete [] s; -} - -#if defined (ACE_HAS_WCHAR) -ACE_INLINE void -ACE::strdelete (wchar_t *s) -{ - delete [] s; -} -#endif /* ACE_HAS_WCHAR */ - -ACE_INLINE bool -ACE::isdotdir (const char *s) -{ - return (s[0] == '.' && - ((s[1] == 0) || (s[1] == '.' && s[2] == 0))); -} - -#if defined (ACE_HAS_WCHAR) -ACE_INLINE bool -ACE::isdotdir (const wchar_t *s) -{ - return (s[0] == ACE_TEXT ('.') && - ((s[1] == 0) || (s[1] == ACE_TEXT ('.') && s[2] == 0))); -} -#endif /* ACE_HAS_WCHAR */ - -ACE_INLINE void -ACE::unique_name (const void *object, - ACE_TCHAR *name, - size_t length) -{ - ACE_OS::unique_name (object, name, length); -} - -ACE_INLINE u_long -ACE::log2 (u_long num) -{ - u_long log = 0; - - for (; num > 1; ++log) - num >>= 1; - - return log; -} - -ACE_INLINE int -ACE::map_errno (int error) -{ -#if defined (ACE_WIN32) - switch (error) - { - case WSAEWOULDBLOCK: - return EAGAIN; // Same as UNIX errno EWOULDBLOCK. - } -#endif /* ACE_WIN32 */ - - return error; -} - -ACE_INLINE u_char -ACE::hex2byte (ACE_TCHAR c) -{ - if (ACE_OS::ace_isdigit (c)) - return (u_char) (c - ACE_TEXT ('0')); - else if (ACE_OS::ace_islower (c)) - return (u_char) (10 + c - ACE_TEXT ('a')); - else - return (u_char) (10 + c - ACE_TEXT ('A')); -} - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/ACE_crc32.cpp b/dep/acelite/ace/ACE_crc32.cpp deleted file mode 100644 index f9eb064f51b..00000000000 --- a/dep/acelite/ace/ACE_crc32.cpp +++ /dev/null @@ -1,156 +0,0 @@ -// $Id: ACE_crc32.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/ACE.h" - -namespace -{ - /*****************************************************************/ - /* */ - /* CRC LOOKUP TABLE */ - /* ================ */ - /* The following CRC lookup table was generated automagically */ - /* by the Rocksoft^tm Model CRC Algorithm Table Generation */ - /* Program V1.0 using the following model parameters: */ - /* */ - /* Width : 4 bytes. */ - /* Poly : 0x04C11DB7L */ - /* Reverse : TRUE. */ - /* */ - /* For more information on the Rocksoft^tm Model CRC Algorithm, */ - /* see the document titled "A Painless Guide to CRC Error */ - /* Detection Algorithms" by Ross Williams */ - /* (ross@guest.adelaide.edu.au.). This document is likely to be */ - /* in the FTP archive "ftp.adelaide.edu.au/pub/rocksoft". */ - /* */ - /*****************************************************************/ - - const ACE_UINT32 crc_table[] = - { - 0x00000000L, 0x77073096L, 0xEE0E612CL, 0x990951BAL, - 0x076DC419L, 0x706AF48FL, 0xE963A535L, 0x9E6495A3L, - 0x0EDB8832L, 0x79DCB8A4L, 0xE0D5E91EL, 0x97D2D988L, - 0x09B64C2BL, 0x7EB17CBDL, 0xE7B82D07L, 0x90BF1D91L, - 0x1DB71064L, 0x6AB020F2L, 0xF3B97148L, 0x84BE41DEL, - 0x1ADAD47DL, 0x6DDDE4EBL, 0xF4D4B551L, 0x83D385C7L, - 0x136C9856L, 0x646BA8C0L, 0xFD62F97AL, 0x8A65C9ECL, - 0x14015C4FL, 0x63066CD9L, 0xFA0F3D63L, 0x8D080DF5L, - 0x3B6E20C8L, 0x4C69105EL, 0xD56041E4L, 0xA2677172L, - 0x3C03E4D1L, 0x4B04D447L, 0xD20D85FDL, 0xA50AB56BL, - 0x35B5A8FAL, 0x42B2986CL, 0xDBBBC9D6L, 0xACBCF940L, - 0x32D86CE3L, 0x45DF5C75L, 0xDCD60DCFL, 0xABD13D59L, - 0x26D930ACL, 0x51DE003AL, 0xC8D75180L, 0xBFD06116L, - 0x21B4F4B5L, 0x56B3C423L, 0xCFBA9599L, 0xB8BDA50FL, - 0x2802B89EL, 0x5F058808L, 0xC60CD9B2L, 0xB10BE924L, - 0x2F6F7C87L, 0x58684C11L, 0xC1611DABL, 0xB6662D3DL, - 0x76DC4190L, 0x01DB7106L, 0x98D220BCL, 0xEFD5102AL, - 0x71B18589L, 0x06B6B51FL, 0x9FBFE4A5L, 0xE8B8D433L, - 0x7807C9A2L, 0x0F00F934L, 0x9609A88EL, 0xE10E9818L, - 0x7F6A0DBBL, 0x086D3D2DL, 0x91646C97L, 0xE6635C01L, - 0x6B6B51F4L, 0x1C6C6162L, 0x856530D8L, 0xF262004EL, - 0x6C0695EDL, 0x1B01A57BL, 0x8208F4C1L, 0xF50FC457L, - 0x65B0D9C6L, 0x12B7E950L, 0x8BBEB8EAL, 0xFCB9887CL, - 0x62DD1DDFL, 0x15DA2D49L, 0x8CD37CF3L, 0xFBD44C65L, - 0x4DB26158L, 0x3AB551CEL, 0xA3BC0074L, 0xD4BB30E2L, - 0x4ADFA541L, 0x3DD895D7L, 0xA4D1C46DL, 0xD3D6F4FBL, - 0x4369E96AL, 0x346ED9FCL, 0xAD678846L, 0xDA60B8D0L, - 0x44042D73L, 0x33031DE5L, 0xAA0A4C5FL, 0xDD0D7CC9L, - 0x5005713CL, 0x270241AAL, 0xBE0B1010L, 0xC90C2086L, - 0x5768B525L, 0x206F85B3L, 0xB966D409L, 0xCE61E49FL, - 0x5EDEF90EL, 0x29D9C998L, 0xB0D09822L, 0xC7D7A8B4L, - 0x59B33D17L, 0x2EB40D81L, 0xB7BD5C3BL, 0xC0BA6CADL, - 0xEDB88320L, 0x9ABFB3B6L, 0x03B6E20CL, 0x74B1D29AL, - 0xEAD54739L, 0x9DD277AFL, 0x04DB2615L, 0x73DC1683L, - 0xE3630B12L, 0x94643B84L, 0x0D6D6A3EL, 0x7A6A5AA8L, - 0xE40ECF0BL, 0x9309FF9DL, 0x0A00AE27L, 0x7D079EB1L, - 0xF00F9344L, 0x8708A3D2L, 0x1E01F268L, 0x6906C2FEL, - 0xF762575DL, 0x806567CBL, 0x196C3671L, 0x6E6B06E7L, - 0xFED41B76L, 0x89D32BE0L, 0x10DA7A5AL, 0x67DD4ACCL, - 0xF9B9DF6FL, 0x8EBEEFF9L, 0x17B7BE43L, 0x60B08ED5L, - 0xD6D6A3E8L, 0xA1D1937EL, 0x38D8C2C4L, 0x4FDFF252L, - 0xD1BB67F1L, 0xA6BC5767L, 0x3FB506DDL, 0x48B2364BL, - 0xD80D2BDAL, 0xAF0A1B4CL, 0x36034AF6L, 0x41047A60L, - 0xDF60EFC3L, 0xA867DF55L, 0x316E8EEFL, 0x4669BE79L, - 0xCB61B38CL, 0xBC66831AL, 0x256FD2A0L, 0x5268E236L, - 0xCC0C7795L, 0xBB0B4703L, 0x220216B9L, 0x5505262FL, - 0xC5BA3BBEL, 0xB2BD0B28L, 0x2BB45A92L, 0x5CB36A04L, - 0xC2D7FFA7L, 0xB5D0CF31L, 0x2CD99E8BL, 0x5BDEAE1DL, - 0x9B64C2B0L, 0xEC63F226L, 0x756AA39CL, 0x026D930AL, - 0x9C0906A9L, 0xEB0E363FL, 0x72076785L, 0x05005713L, - 0x95BF4A82L, 0xE2B87A14L, 0x7BB12BAEL, 0x0CB61B38L, - 0x92D28E9BL, 0xE5D5BE0DL, 0x7CDCEFB7L, 0x0BDBDF21L, - 0x86D3D2D4L, 0xF1D4E242L, 0x68DDB3F8L, 0x1FDA836EL, - 0x81BE16CDL, 0xF6B9265BL, 0x6FB077E1L, 0x18B74777L, - 0x88085AE6L, 0xFF0F6A70L, 0x66063BCAL, 0x11010B5CL, - 0x8F659EFFL, 0xF862AE69L, 0x616BFFD3L, 0x166CCF45L, - 0xA00AE278L, 0xD70DD2EEL, 0x4E048354L, 0x3903B3C2L, - 0xA7672661L, 0xD06016F7L, 0x4969474DL, 0x3E6E77DBL, - 0xAED16A4AL, 0xD9D65ADCL, 0x40DF0B66L, 0x37D83BF0L, - 0xA9BCAE53L, 0xDEBB9EC5L, 0x47B2CF7FL, 0x30B5FFE9L, - 0xBDBDF21CL, 0xCABAC28AL, 0x53B39330L, 0x24B4A3A6L, - 0xBAD03605L, 0xCDD70693L, 0x54DE5729L, 0x23D967BFL, - 0xB3667A2EL, 0xC4614AB8L, 0x5D681B02L, 0x2A6F2B94L, - 0xB40BBE37L, 0xC30C8EA1L, 0x5A05DF1BL, 0x2D02EF8DL - }; - - /*****************************************************************/ - /* End of CRC Lookup Table */ - /*****************************************************************/ -} - -#define COMPUTE(var, ch) (var) = (crc_table[(var ^ ch) & 0xFF] ^ (var >> 8)) - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_UINT32 -ACE::crc32 (const char *string) -{ - ACE_UINT32 crc = 0xFFFFFFFF; - - for (const char *p = string; - *p != 0; - ++p) - { - COMPUTE (crc, *p); - } - - return ~crc; -} - -ACE_UINT32 -ACE::crc32 (const void *buffer, size_t len, ACE_UINT32 crc) -{ - crc = ~crc; - - for (const char *p = (const char *) buffer, - *e = (const char *) buffer + len; - p != e; - ++p) - { - COMPUTE (crc, *p); - } - - return ~crc; -} - -ACE_UINT32 -ACE::crc32 (const iovec *iov, int len, ACE_UINT32 crc) -{ - crc = ~crc; - - for (int i = 0; i < len; ++i) - { - for (const char *p = (const char *) iov[i].iov_base, - *e = (const char *) iov[i].iov_base + iov[i].iov_len; - p != e; - ++p) - COMPUTE (crc, *p); - } - - return ~crc; -} - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL - -#undef COMPUTE diff --git a/dep/acelite/ace/ACE_crc_ccitt.cpp b/dep/acelite/ace/ACE_crc_ccitt.cpp deleted file mode 100644 index c1455d79171..00000000000 --- a/dep/acelite/ace/ACE_crc_ccitt.cpp +++ /dev/null @@ -1,124 +0,0 @@ -// $Id: ACE_crc_ccitt.cpp 96017 2012-08-08 22:18:09Z mitza $ - -#include "ace/ACE.h" - -namespace -{ - /*****************************************************************/ - /* */ - /* CRC LOOKUP TABLE */ - /* ================ */ - /* The following CRC lookup table was generated automagically */ - /* by the Rocksoft^tm Model CRC Algorithm Table Generation */ - /* Program V1.0 using the following model parameters: */ - /* */ - /* Width : 2 bytes. */ - /* Poly : 0x1021 */ - /* Reverse : TRUE. */ - /* */ - /* For more information on the Rocksoft^tm Model CRC Algorithm, */ - /* see the document titled "A Painless Guide to CRC Error */ - /* Detection Algorithms" by Ross Williams */ - /* (ross@guest.adelaide.edu.au.). This document is likely to be */ - /* in the FTP archive "ftp.adelaide.edu.au/pub/rocksoft". */ - /* */ - /*****************************************************************/ - - const ACE_UINT16 crc_table[] = - { - 0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF, - 0x8C48, 0x9DC1, 0xAF5A, 0xBED3, 0xCA6C, 0xDBE5, 0xE97E, 0xF8F7, - 0x1081, 0x0108, 0x3393, 0x221A, 0x56A5, 0x472C, 0x75B7, 0x643E, - 0x9CC9, 0x8D40, 0xBFDB, 0xAE52, 0xDAED, 0xCB64, 0xF9FF, 0xE876, - 0x2102, 0x308B, 0x0210, 0x1399, 0x6726, 0x76AF, 0x4434, 0x55BD, - 0xAD4A, 0xBCC3, 0x8E58, 0x9FD1, 0xEB6E, 0xFAE7, 0xC87C, 0xD9F5, - 0x3183, 0x200A, 0x1291, 0x0318, 0x77A7, 0x662E, 0x54B5, 0x453C, - 0xBDCB, 0xAC42, 0x9ED9, 0x8F50, 0xFBEF, 0xEA66, 0xD8FD, 0xC974, - 0x4204, 0x538D, 0x6116, 0x709F, 0x0420, 0x15A9, 0x2732, 0x36BB, - 0xCE4C, 0xDFC5, 0xED5E, 0xFCD7, 0x8868, 0x99E1, 0xAB7A, 0xBAF3, - 0x5285, 0x430C, 0x7197, 0x601E, 0x14A1, 0x0528, 0x37B3, 0x263A, - 0xDECD, 0xCF44, 0xFDDF, 0xEC56, 0x98E9, 0x8960, 0xBBFB, 0xAA72, - 0x6306, 0x728F, 0x4014, 0x519D, 0x2522, 0x34AB, 0x0630, 0x17B9, - 0xEF4E, 0xFEC7, 0xCC5C, 0xDDD5, 0xA96A, 0xB8E3, 0x8A78, 0x9BF1, - 0x7387, 0x620E, 0x5095, 0x411C, 0x35A3, 0x242A, 0x16B1, 0x0738, - 0xFFCF, 0xEE46, 0xDCDD, 0xCD54, 0xB9EB, 0xA862, 0x9AF9, 0x8B70, - 0x8408, 0x9581, 0xA71A, 0xB693, 0xC22C, 0xD3A5, 0xE13E, 0xF0B7, - 0x0840, 0x19C9, 0x2B52, 0x3ADB, 0x4E64, 0x5FED, 0x6D76, 0x7CFF, - 0x9489, 0x8500, 0xB79B, 0xA612, 0xD2AD, 0xC324, 0xF1BF, 0xE036, - 0x18C1, 0x0948, 0x3BD3, 0x2A5A, 0x5EE5, 0x4F6C, 0x7DF7, 0x6C7E, - 0xA50A, 0xB483, 0x8618, 0x9791, 0xE32E, 0xF2A7, 0xC03C, 0xD1B5, - 0x2942, 0x38CB, 0x0A50, 0x1BD9, 0x6F66, 0x7EEF, 0x4C74, 0x5DFD, - 0xB58B, 0xA402, 0x9699, 0x8710, 0xF3AF, 0xE226, 0xD0BD, 0xC134, - 0x39C3, 0x284A, 0x1AD1, 0x0B58, 0x7FE7, 0x6E6E, 0x5CF5, 0x4D7C, - 0xC60C, 0xD785, 0xE51E, 0xF497, 0x8028, 0x91A1, 0xA33A, 0xB2B3, - 0x4A44, 0x5BCD, 0x6956, 0x78DF, 0x0C60, 0x1DE9, 0x2F72, 0x3EFB, - 0xD68D, 0xC704, 0xF59F, 0xE416, 0x90A9, 0x8120, 0xB3BB, 0xA232, - 0x5AC5, 0x4B4C, 0x79D7, 0x685E, 0x1CE1, 0x0D68, 0x3FF3, 0x2E7A, - 0xE70E, 0xF687, 0xC41C, 0xD595, 0xA12A, 0xB0A3, 0x8238, 0x93B1, - 0x6B46, 0x7ACF, 0x4854, 0x59DD, 0x2D62, 0x3CEB, 0x0E70, 0x1FF9, - 0xF78F, 0xE606, 0xD49D, 0xC514, 0xB1AB, 0xA022, 0x92B9, 0x8330, - 0x7BC7, 0x6A4E, 0x58D5, 0x495C, 0x3DE3, 0x2C6A, 0x1EF1, 0x0F78 - }; - - /*****************************************************************/ - /* End of CRC Lookup Table */ - /*****************************************************************/ -} - -#define COMPUTE(var, ch) (var) = static_cast (crc_table[(var ^ ch) & 0xFF] ^ (var >> 8)) - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_UINT16 -ACE::crc_ccitt (const char *string) -{ - ACE_UINT16 crc = 0xFFFF; - - for (const char *p = string; - *p != 0; - ++p) - { - COMPUTE (crc, *p); - } - - return static_cast (~crc); -} - -ACE_UINT16 -ACE::crc_ccitt (const void *buffer, size_t len, ACE_UINT16 crc) -{ - crc = static_cast (~crc); - - for (const char *p = (const char *) buffer, - *e = (const char *) buffer + len; - p != e; - ++p) - { - COMPUTE (crc, *p); - } - - return static_cast (~crc); -} - -ACE_UINT16 -ACE::crc_ccitt (const iovec *iov, int len, ACE_UINT16 crc) -{ - crc = static_cast (~crc); - - for (int i = 0; i < len; ++i) - { - for (const char *p = (const char *) iov[i].iov_base, - *e = (const char *) iov[i].iov_base + iov[i].iov_len; - p != e; - ++p) - COMPUTE (crc, *p); - } - - return static_cast (~crc); -} - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL - -#undef COMPUTE diff --git a/dep/acelite/ace/ACE_export.h b/dep/acelite/ace/ACE_export.h deleted file mode 100644 index 74c62ec34df..00000000000 --- a/dep/acelite/ace/ACE_export.h +++ /dev/null @@ -1,74 +0,0 @@ -// -*- C++ -*- -// $Id: ACE_export.h 91683 2010-09-09 09:07:49Z johnnyw $ -// Definition for Win32 Export directives. -// This file is generated automatically by -// generate_export_file.pl -// ------------------------------ - -#ifndef ACE_EXPORT_H -#define ACE_EXPORT_H - -#include "ace/config-lite.h" - -#if defined (ACE_AS_STATIC_LIBS) - -# if !defined (ACE_HAS_DLL) -# define ACE_HAS_DLL 0 -# endif /* ! ACE_HAS_DLL */ -#else -# if !defined (ACE_HAS_DLL) -# define ACE_HAS_DLL 1 -# endif /* ! ACE_HAS_DLL */ -#endif /* ACE_AS_STATIC_LIB */ - -#if defined (ACE_HAS_DLL) -# if (ACE_HAS_DLL == 1) -# if defined (ACE_BUILD_DLL) -# define ACE_Export ACE_Proper_Export_Flag -# define ACE_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define ACE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else -# define ACE_Export ACE_Proper_Import_Flag -# define ACE_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define ACE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* ACE_BUILD_DLL */ -# else -# define ACE_Export -# define ACE_SINGLETON_DECLARATION(T) -# define ACE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* ! ACE_HAS_DLL == 1 */ -#else -# define ACE_Export -# define ACE_SINGLETON_DECLARATION(T) -# define ACE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* ACE_HAS_DLL */ - -// Added by hand to help with ACE_OS namespace -#if defined (__TANDEM) && defined (USE_EXPLICIT_EXPORT) -#define ACE_NAMESPACE_STORAGE_CLASS ACE_EXPORT_MACRO extern -#else -#define ACE_NAMESPACE_STORAGE_CLASS extern ACE_EXPORT_MACRO -#endif - -#if defined (__ACE_INLINE__) -# if defined (_MSC_VER) || defined (__MINGW32__) || defined (CYGWIN32) || \ - (defined (__SUNPRO_CC) && __SUNPRO_CC >= 0x560) || \ - (defined (__HP_aCC) && (__HP_aCC >= 60500)) -# define ACE_NAMESPACE_INLINE_FUNCTION inline -# else -# define ACE_NAMESPACE_INLINE_FUNCTION ACE_NAMESPACE_STORAGE_CLASS inline -# endif -# define ACE_INLINE_TEMPLATE_FUNCTION inline -#else -# define ACE_NAMESPACE_INLINE_FUNCTION ACE_NAMESPACE_STORAGE_CLASS -// Microsoft Visual C++ will accept 'extern'; others refuse. -# if defined (_MSC_VER) || defined (__BORLANDC__) -# define ACE_INLINE_TEMPLATE_FUNCTION ACE_Export -# else -# define ACE_INLINE_TEMPLATE_FUNCTION -# endif -#endif - -#endif /* ACE_EXPORT_H */ - -// End of auto generated file. diff --git a/dep/acelite/ace/ARGV.cpp b/dep/acelite/ace/ARGV.cpp deleted file mode 100644 index e64c5d8696f..00000000000 --- a/dep/acelite/ace/ARGV.cpp +++ /dev/null @@ -1,381 +0,0 @@ -// $Id: ARGV.cpp 95630 2012-03-22 13:04:47Z johnnyw $ - -#ifndef ACE_ARGV_CPP -#define ACE_ARGV_CPP - -#include "ace/Log_Msg.h" -#include "ace/OS_NS_unistd.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_Memory.h" - -#if !defined (__ACE_INLINE__) -#include "ace/ARGV.inl" -#endif /* __ACE_INLINE__ */ - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE (ACE_ARGV_Queue_Entry) -ACE_ALLOC_HOOK_DEFINE (ACE_ARGV) - -template -void -ACE_ARGV_Queue_Entry_T::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_ARGV_Queue_Entry_T::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("arg_ = %s"), this->arg_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("quote_arg_ = %d"), (int)this->quote_arg_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template -void -ACE_ARGV_T::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_ARGV_T::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("argc_ = %d"), this->argc_)); - - ACE_ARGV *this_obj = const_cast (this); - - for (int i = 0; i < this->argc_; i++) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("\nargv_[%i] = %s"), - i, - this_obj->argv ()[i])); - - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nbuf = %s\n"), this->buf_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -// Creates this->argv_ out of this->buf_. New memory is allocated for -// each element of the array. This is used by the array-to-string -// style constructor and for creating this->argv_ when in iterative -// mode. - -template -int -ACE_ARGV_T::string_to_argv (void) -{ - ACE_TRACE ("ACE_ARGV_T::string_to_argv"); - - return ACE_OS::string_to_argv (this->buf_, - this->argc_, - this->argv_, - this->substitute_env_args_); -} - -template -ACE_ARGV_T::ACE_ARGV_T (const CHAR_TYPE buf[], - bool substitute_env_args) - : substitute_env_args_ (substitute_env_args), - iterative_ (false), - argc_ (0), - argv_ (0), - buf_ (0), - length_ (0), - queue_ () -{ - ACE_TRACE ("ACE_ARGV_T::ACE_ARGV_T CHAR_TYPE[] to CHAR_TYPE *[]"); - - if (buf == 0 || buf[0] == 0) - return; - - // Make an internal copy of the string. - ACE_NEW (this->buf_, - CHAR_TYPE[ACE_OS::strlen (buf) + 1]); - ACE_OS::strcpy (this->buf_, buf); - - // Create this->argv_. - if (this->string_to_argv () == -1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("string_to_argv"))); -} - -template -ACE_ARGV_T::ACE_ARGV_T (CHAR_TYPE *argv[], - bool substitute_env_args, - bool quote_arg) - : substitute_env_args_ (substitute_env_args), - iterative_ (false), - argc_ (0), - argv_ (0), - buf_ (0), - length_ (0), - queue_ () -{ - ACE_TRACE ("ACE_ARGV_T::ACE_ARGV_T CHAR_TYPE*[] to CHAR_TYPE[]"); - - if (argv == 0 || argv[0] == 0) - return; - - this->argc_ = ACE_OS::argv_to_string (argv, - this->buf_, - substitute_env_args, - quote_arg); -} - -template -ACE_ARGV_T::ACE_ARGV_T (int argc, - CHAR_TYPE *argv[], - bool substitute_env_args, - bool quote_arg) - : substitute_env_args_ (substitute_env_args), - iterative_ (false), - argc_ (0), - argv_ (0), - buf_ (0), - length_ (0), - queue_ () -{ - ACE_TRACE ("ACE_ARGV_T::ACE_ARGV_T int,CHAR_TYPE*[] to CHAR_TYPE[]"); - - this->argc_ = ACE_OS::argv_to_string (argc, - argv, - this->buf_, - substitute_env_args, - quote_arg); -} - - -template -ACE_ARGV_T::ACE_ARGV_T (CHAR_TYPE *first_argv[], - CHAR_TYPE *second_argv[], - bool substitute_env_args, - bool quote_args) - : substitute_env_args_ (substitute_env_args), - iterative_ (false), - argc_ (0), - argv_ (0), - buf_ (0), - length_ (0), - queue_ () -{ - ACE_TRACE ("ACE_ARGV_T::ACE_ARGV_T CHAR_TYPE*[] + CHAR_TYPE *[] to CHAR_TYPE[]"); - - int first_argc = 0; - int second_argc = 0; - - CHAR_TYPE *first_buf = 0; - CHAR_TYPE *second_buf = 0; - size_t buf_len = 1; - - // convert the first argv to a string - if (first_argv != 0 && first_argv[0] != 0) - { - first_argc = ACE_OS::argv_to_string (first_argv, - first_buf, - substitute_env_args, - quote_args); - buf_len += ACE_OS::strlen (first_buf); - } - - // convert the second argv to a string - if (second_argv != 0 && second_argv[0] != 0) - { - second_argc = ACE_OS::argv_to_string (second_argv, - second_buf, - substitute_env_args, - quote_args); - buf_len += ACE_OS::strlen (second_buf); - } - - // Add the number of arguments in both the argvs. - this->argc_ = first_argc + second_argc; - - // Allocate memory to the lenght of the combined argv string. - ACE_NEW (this->buf_, - CHAR_TYPE[buf_len + 1]); - - // copy the first argv string to the buffer - ACE_OS::strcpy (this->buf_, first_buf); - - // concatenate the second argv string to the buffer - ACE_OS::strcat (this->buf_, second_buf); - - // Delete the first and second buffers - delete [] first_buf; - delete [] second_buf; -} - -template -ACE_ARGV_T::ACE_ARGV_T (bool substitute_env_args) - : substitute_env_args_ (substitute_env_args), - iterative_ (true), - argc_ (0), - argv_ (0), - buf_ (0), - length_ (0), - queue_ () -{ - ACE_TRACE ("ACE_ARGV_T::ACE_ARGV_T Iterative"); - - // Nothing to do yet -- the user puts in arguments via add () -} - -template -int -ACE_ARGV_T::add (const CHAR_TYPE *next_arg, bool quote_arg) -{ - // Only allow this to work in the "iterative" verion -- the - // ACE_ARGVs created with the one argument constructor. - if (!this->iterative_) - { - errno = EINVAL; - return -1; - } - - this->length_ += ACE_OS::strlen (next_arg); - if (quote_arg && ACE_OS::strchr (next_arg, ' ') != 0) - { - this->length_ += 2; - if (ACE_OS::strchr (next_arg, '"') != 0) - for (const CHAR_TYPE * p = next_arg; *p != '\0'; ++p) - if (*p == '"') ++this->length_; - } - else - { - quote_arg = false; - } - - // Put the new argument at the end of the queue. - if (this->queue_.enqueue_tail (ACE_ARGV_Queue_Entry_T (next_arg, quote_arg)) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("Can't add more to ARGV queue")), - -1); - - ++this->argc_; - - // Wipe argv_ and buf_ away so that they will be recreated if the - // user calls argv () or buf (). - if (this->argv_ != 0) - { - for (int i = 0; this->argv_[i] != 0; i++) - ACE_OS::free ((void *) this->argv_[i]); - - delete [] this->argv_; - this->argv_ = 0; - } - - delete [] this->buf_; - this->buf_ = 0; - - return 0; -} - -template -int -ACE_ARGV_T::add (CHAR_TYPE *argv[], bool quote_args) -{ - for (int i = 0; argv[i] != 0; i++) - if (this->add (argv[i], quote_args) == -1) - return -1; - - return 0; -} - -// Free up argv_ and buf_ - -template -ACE_ARGV_T::~ACE_ARGV_T (void) -{ - ACE_TRACE ("ACE_ARGV_T::~ACE_ARGV_T"); - - if (this->argv_ != 0) - for (int i = 0; this->argv_[i] != 0; i++) - ACE_OS::free ((void *) this->argv_[i]); - - delete [] this->argv_; - delete [] this->buf_; -} - -// Create buf_ out of the queue_. This is only used in the -// "iterative" mode. - -template -int -ACE_ARGV_T::create_buf_from_queue (void) -{ - ACE_TRACE ("ACE_ARGV_T::create_buf_from_queue"); - - // If the are no arguments, don't do anything - if (this->argc_ <= 0) - return -1; - - delete [] this->buf_; - - ACE_NEW_RETURN (this->buf_, - CHAR_TYPE[this->length_ + this->argc_], - -1); - - // Get an iterator over the queue - ACE_Unbounded_Queue_Iterator > iter (this->queue_); - - ACE_ARGV_Queue_Entry_T *arg = 0; - CHAR_TYPE *ptr = this->buf_; - size_t len; - - while (!iter.done ()) - { - // Get next argument from the queue. - iter.next (arg); - iter.advance (); - - if (arg->quote_arg_) - { - *ptr++ = '"'; - if (ACE_OS::strchr (arg->arg_, '"') != 0) - { - CHAR_TYPE prev = 0; - for (const CHAR_TYPE * p = arg->arg_; *p != '\0'; ++p) - { - if (*p == '"' && prev != '\\') *ptr++ = '\\'; - prev = *ptr++ = *p; - } - } - else - { - len = ACE_OS::strlen (arg->arg_); - // Copy the argument into buf_ - ACE_OS::memcpy ((void *) ptr, - (const void *) (arg->arg_), - len * sizeof (CHAR_TYPE)); - // Move the pointer down. - ptr += len; - } - *ptr++ = '"'; - } - else - { - len = ACE_OS::strlen (arg->arg_); - // Copy the argument into buf_ - ACE_OS::memcpy ((void *) ptr, - (const void *) (arg->arg_), - len * sizeof (CHAR_TYPE)); - // Move the pointer down. - ptr += len; - } - - // Put in an argument separating space. - *ptr++ = ' '; - } - - // Put in the NUL terminator - ptr[-1] = '\0'; - - return 0; -} - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_ARGV_CPP */ diff --git a/dep/acelite/ace/ARGV.h b/dep/acelite/ace/ARGV.h deleted file mode 100644 index 1c291bd6eda..00000000000 --- a/dep/acelite/ace/ARGV.h +++ /dev/null @@ -1,333 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file ARGV.h - * - * $Id: ARGV.h 95972 2012-07-26 10:20:42Z johnnyw $ - * - * @author Doug Schmidt - * @author Everett Anderson - */ -//========================================================================== - -#ifndef ACE_ARGUMENT_VECTOR_H -#define ACE_ARGUMENT_VECTOR_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Global_Macros.h" -#include "ace/Unbounded_Queue.h" - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_ARGV_Queue_Entry_T - * - * @brief An entry in the queue which keeps user supplied arguments. - */ -template -class ACE_ARGV_Queue_Entry_T -{ -public: - // = Initialization and termination. - /// Initialize a ACE_ARGV_Queue_Entry_T. - ACE_ARGV_Queue_Entry_T (void); - - /** - * Initialize a ACE_ARGV_Queue_Entry_T. - * - * @param arg Pointer to an argument - * - * @param quote_arg The argument @a arg need to be quoted - * while adding to the vector. - */ - ACE_ARGV_Queue_Entry_T (const CHAR_TYPE *arg, - bool quote_arg); - - /** - * Initialize a ACE_ARGV_Queue_Entry_T. - * - * @param entry Pointer to a queue entry - */ - ACE_ARGV_Queue_Entry_T (const ACE_ARGV_Queue_Entry_T &entry); - - /// We need this destructor to keep some compilers from complaining. - /// It's just a no-op, however. - ~ACE_ARGV_Queue_Entry_T (void); - - /// Dump the state of this object. - void dump (void) const; - - // Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - /// Pointer to the argument. - const CHAR_TYPE * arg_; - - /// The argument need to be quoted while adding to the vector. - bool quote_arg_; -}; - -/** - * @class ACE_ARGV_T - * - * @brief Builds a counted argument vector (ala argc/argv) from either - * a string or a set of separate tokens. This class preserves whitespace - * within tokens only if the whitespace-containing token is enclosed in - * either single (') or double (") quotes. This is consistent with the - * expected behavior if an argument vector obtained using this class is - * passed to, for example, ACE_Get_Opt. - * - * This class can substitute environment variable values for tokens that - * are environment variable references (e.g., @c $VAR). This only works - * if the token is an environment variable reference and nothing else; it - * doesn't substitute environment variable references within a token. - * For example, @c $HOME/file will not substitute the value of the HOME - * environment variable. - */ -template -class ACE_ARGV_T -{ -public: - // = Initialization and termination. - /** - * Splits the specified string into an argument vector. Arguments in the - * string are delimited by whitespace. Whitespace-containing arguments - * must be enclosed in quotes, either single (') or double ("). - * - * @param buf A nul-terminated CHAR_TYPE array to split into arguments - * for the vector. - * - * @param substitute_env_args If non-zero, any token that is an - * environment variable reference (e.g., @c $VAR) will have - * its environment variable value in the resultant vector - * in place of the environment variable name. - */ - explicit ACE_ARGV_T (const CHAR_TYPE buf[], - bool substitute_env_args = true); - - /** - * Initializes the argument vector from a set of arguments. Any environment - * variable references are translated (if applicable) during execution of - * this method. In contrast with ACE_ARGV_T(CHAR_TYPE *[], bool, bool), this - * ctor does not require argv to be 0-terminated as the number of arguments - * is provided explicitely. - * - * @param argc The number of arguments in the argv array. - * - * @param argv An array of tokens to initialize the object with. All needed - * data is copied from @a argv during this call; the pointers - * in @a argv are not needed after this call, and the memory - * referred to by @a argv is not referenced by this object. - * - * @param substitute_env_args If non-zero, any element of @a argv that is - * an environment variable reference (e.g., @c $VAR) will have - * its environment variable value in the resultant vector - * in place of the environment variable name. - * - * @param quote_args If non-zero each argument @a argv[i] needs to - * be enclosed in double quotes ('"'). - */ - explicit ACE_ARGV_T (int argc, - CHAR_TYPE *argv[], - bool substitute_env_args = true, - bool quote_args = false); - - /** - * Initializes the argument vector from a set of arguments. Any environment - * variable references are translated (if applicable) during execution of - * this method. - * - * @param argv An array of tokens to initialize the object with. The - * array must be terminated with a 0 pointer. All needed - * data is copied from @a argv during this call; the pointers - * in @a argv are not needed after this call, and the memory - * referred to by @a argv is not referenced by this object. - * - * @param substitute_env_args If non-zero, any element of @a argv that is - * an environment variable reference (e.g., @c $VAR) will have - * its environment variable value in the resultant vector - * in place of the environment variable name. - * - * @param quote_args If non-zero each argument @a argv[i] needs to - * be enclosed in double quotes ('"'). - */ - explicit ACE_ARGV_T (CHAR_TYPE *argv[], - bool substitute_env_args = true, - bool quote_args = false); - - /** - * Initializes the argument vector from two combined argument vectors. - * - * @param first_argv An array of tokens to initialize the object with. - * The array must be terminated with a 0 pointer. - * @param second_argv An array of tokens that is concatenated with the - * the tokens in @a first_argv. The array must be - * terminated with a 0 pointer. - * @param substitute_env_args If non-zero, any element of @a first_argv - * or @a second_argv that is an environment variable - * reference (e.g., @c $VAR) will have its environment - * variable value in the resultant vector in place - * of the environment variable name. - * - * @param quote_args If non-zero each arguments @a first_argv[i] and - * @a second_argv[i] needs to be enclosed - * in double quotes ('"'). - */ - ACE_ARGV_T (CHAR_TYPE *first_argv[], - CHAR_TYPE *second_argv[], - bool substitute_env_args = true, - bool quote_args = false); - - /** - * Initialize this object so arguments can be added later using one - * of the add methods. This is referred to as the @i iterative method - * of adding arguments to this object. - */ - explicit ACE_ARGV_T (bool substitute_env_args = true); - - /// Destructor. - ~ACE_ARGV_T (void); - - /** @name Accessor methods - * - * These methods access the argument vector contained in this object. - */ - //@{ - /** - * Returns the specified element of the current argument vector. - * - * @param index Index to the desired element. - * - * @retval Pointer to the indexed string. - * @retval 0 if @a index is out of bounds. - */ - const CHAR_TYPE *operator[] (size_t index); - - /** - * Returns the current argument vector. The returned pointers are to data - * maintained internally to this class. Do not change or delete either the - * pointers or the memory to which they refer. - */ - CHAR_TYPE **argv (void); - - /// Returns the current number of arguments. - int argc (void) const; - - /** - * Returns a single string form of the current arguments. The returned - * pointer refers to memory maintained internally to this class. Do not - * change or delete it. - */ - const CHAR_TYPE *buf (void); - - //@} - - /// Dump the state of this object. - void dump (void) const; - - // Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - /** - * Add another argument. This only works in the iterative mode. - * - * @note This method copies the specified pointer, but not the data - * contained in the referenced memory. Thus, if the content of - * the memory referred to by @a next_arg are changed after this - * method returns, the results are undefined. - * - * @param next_arg Pointer to the next argument to add to the vector. - * - * @param quote_arg The argument @a next_arg need to be quoted while - * adding to the vector. - * - * @retval 0 on success; -1 on failure. Most likely @c errno values are: - * - EINVAL: This object is not in iterative mode. - * - ENOMEM: Not enough memory available to save @a next_arg. - */ - int add (const CHAR_TYPE *next_arg, bool quote_arg = false); - - /** - * Add an array of arguments. This only works in the iterative mode. - * - * @note This method copies the specified pointers, but not the data - * contained in the referenced memory. Thus, if the content of - * the memory referred to by any of the @a argv elements is - * changed after this method returns, the results are undefined. - * - * @param argv Pointers to the arguments to add to the vector. - * @a argv must be terminated by a 0 pointer. - * - * @param quote_args If non-zero each argument @a argv[i] needs to - * be enclosed in double quotes ('"'). - * - * @retval 0 on success; -1 on failure. Most likely @c errno values are: - * - EINVAL: This object is not in iterative mode. - * - ENOMEM: Not enough memory available to save @a next_arg. - */ - int add (CHAR_TYPE *argv[], bool quote_args = false); - -private: - /// Copy constructor not implemented. - ACE_UNIMPLEMENTED_FUNC (ACE_ARGV_T (const ACE_ARGV_T&)) - - /// Assignment operator not implemented. - ACE_UNIMPLEMENTED_FUNC (ACE_ARGV_T operator= (const ACE_ARGV_T&)) - - /// Creates buf_ from the queue of added args, deletes previous buf_. - int create_buf_from_queue (void); - - /// Converts buf_ into the CHAR_TYPE *argv[] format. - int string_to_argv (void); - - /// Replace args with environment variable values? - bool substitute_env_args_; - - bool iterative_; - - /// Number of arguments in the ARGV array. - int argc_; - - /// The array of string arguments. - CHAR_TYPE **argv_; - - /// Buffer containing the contents. - CHAR_TYPE *buf_; - - /// Total length of the arguments in the queue, not counting - /// separating spaces - size_t length_; - - /// Queue which keeps user supplied arguments. This is only - /// active in the "iterative" mode. - ACE_Unbounded_Queue > queue_; -}; - -typedef ACE_ARGV_Queue_Entry_T ACE_ARGV_Queue_Entry; -typedef ACE_ARGV_T ACE_ARGV; - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/ARGV.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/ARGV.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("ARGV.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_ARGUMENT_VECTOR_H */ diff --git a/dep/acelite/ace/ARGV.inl b/dep/acelite/ace/ARGV.inl deleted file mode 100644 index fdc5b13d7c3..00000000000 --- a/dep/acelite/ace/ARGV.inl +++ /dev/null @@ -1,104 +0,0 @@ -/* -*- C++ -*- */ -// $Id: ARGV.inl 80826 2008-03-04 14:51:23Z wotte $ - -#include "ace/Global_Macros.h" - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE -ACE_ARGV_Queue_Entry_T::ACE_ARGV_Queue_Entry_T (void) - : arg_(0), - quote_arg_(false) -{ - // No-op -} - -template ACE_INLINE -ACE_ARGV_Queue_Entry_T::ACE_ARGV_Queue_Entry_T (const CHAR_TYPE *arg, - bool quote_arg) - : arg_(arg), - quote_arg_(quote_arg) -{ - // No-op -} - -template ACE_INLINE -ACE_ARGV_Queue_Entry_T::ACE_ARGV_Queue_Entry_T (const ACE_ARGV_Queue_Entry_T &entry) - : arg_(entry.arg_), - quote_arg_(entry.quote_arg_) -{ - // No-op -} - -template ACE_INLINE -ACE_ARGV_Queue_Entry_T::~ACE_ARGV_Queue_Entry_T (void) -{ - // No-op just to keep some compilers happy... -} - -// Return the number of args -template -ACE_INLINE int -ACE_ARGV_T::argc (void) const -{ - ACE_TRACE ("ACE_ARGV_T::argc"); - // Try to create the argv_ if it isn't there - ACE_ARGV_T *nonconst_this = - const_cast *> (this); - (void) nonconst_this->argv (); - return this->argc_; -} - -// Return the arguments in a space-separated string -template -ACE_INLINE const CHAR_TYPE * -ACE_ARGV_T::buf (void) -{ - ACE_TRACE ("ACE_ARGV_T::buf"); - - if (this->buf_ == 0 && this->iterative_) - this->create_buf_from_queue (); - - return (const CHAR_TYPE *) this->buf_; -} - -// Return the arguments in an entry-per-argument array - -template -ACE_INLINE CHAR_TYPE ** -ACE_ARGV_T::argv (void) -{ - ACE_TRACE ("ACE_ARGV_T::argv"); - - // Try to create the argv_ if it isn't there - if (this->argv_ == 0) - { - if (this->iterative_ && this->buf_ == 0) - this->create_buf_from_queue (); - - // Convert buf_ to argv_ - if (this->string_to_argv () == -1) - return (CHAR_TYPE **) 0; - } - - return (CHAR_TYPE **) this->argv_; -} - -// Subscript operator. - -template -ACE_INLINE const CHAR_TYPE * -ACE_ARGV_T::operator[] (size_t i) -{ - ACE_TRACE ("ACE_ARGV_T::operator[]"); - - // Don't go out of bounds. - if (i >= static_cast (this->argc_)) - return 0; - - return (const CHAR_TYPE *) this->argv ()[i]; -} - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/ATM_Acceptor.cpp b/dep/acelite/ace/ATM_Acceptor.cpp deleted file mode 100644 index a225cbf176d..00000000000 --- a/dep/acelite/ace/ATM_Acceptor.cpp +++ /dev/null @@ -1,309 +0,0 @@ -// $Id: ATM_Acceptor.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/ATM_Acceptor.h" - - - -#if defined (ACE_HAS_ATM) - -#if defined (ACE_HAS_LINUX_ATM) -#include /**/ "linux/atmdev.h" -#endif /* ACE_HAS_LINUX_ATM */ - -#if !defined (__ACE_INLINE__) -#include "ace/ATM_Acceptor.inl" -#endif /* __ACE_INLINE__ */ - - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Put the actual definitions of the ACE_ATM_Request and -// ACE_ATM_Request_Queue classes here to hide them from clients... - -ACE_ALLOC_HOOK_DEFINE(ACE_ATM_Acceptor) - -ACE_ATM_Acceptor::ACE_ATM_Acceptor (void) -{ - ACE_TRACE ("ACE_ATM_Acceptor::ACE_ATM_Acceptor"); -} - -ACE_ATM_Acceptor::~ACE_ATM_Acceptor (void) -{ - ACE_TRACE ("ACE_ATM_Acceptor::~ACE_ATM_Acceptor"); -} - -int -ACE_ATM_Acceptor::get_local_addr (ACE_ATM_Addr &local_addr) -{ - ACE_TRACE ("ACE_ATM_Acceptor::get_local_addr"); - -#if defined (ACE_HAS_FORE_ATM_WS2) - unsigned long ret = 0; - DWORD deviceID = 0; - ATM_ADDRESS addr; - struct sockaddr_atm *laddr; - - if (::WSAIoctl ((int) ((ACE_SOCK_Acceptor *)this) -> get_handle (), - SIO_GET_ATM_ADDRESS, - (LPVOID) &deviceID, - sizeof (DWORD), - (LPVOID)&addr, - sizeof (ATM_ADDRESS), - &ret, - 0, - 0) == SOCKET_ERROR) { - ACE_OS::printf ("ATM_Acceptor (get_local_addr): WSIoctl: %d\n", - ::WSAGetLastError ()); - return -1; - } - - laddr = (struct sockaddr_atm *)local_addr.get_addr (); - ACE_OS::memcpy ((void *)& (laddr -> satm_number), - (void *)&addr, - ATM_ADDR_SIZE - 1); - - return 0; -#elif defined (ACE_HAS_FORE_ATM_XTI) - ACE_UNUSED_ARG (local_addr); - - return 0; -#elif defined (ACE_HAS_LINUX_ATM) - ATM_Addr *myaddr = (ATM_Addr *)local_addr.get_addr (); - int addrlen = sizeof (myaddr->sockaddratmsvc); - - if (ACE_OS::getsockname (acceptor_.get_handle (), - (struct sockaddr *) & (myaddr->sockaddratmsvc), - &addrlen) < 0) { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("ATM_Acceptor (get_local_addr): ioctl: %d\n"), - errno)); - return -1; - } - - return 0; -#else - ACE_UNUSED_ARG (local_addr); - - return 0; -#endif /* ACE_HAS_FORE_ATM_WS2 && ACE_HAS_FORE_ATM_XTI */ -} - -ACE_HANDLE -ACE_ATM_Acceptor::open (const ACE_Addr &remote_sap, - int backlog, - ACE_ATM_Params params) -{ - ACE_TRACE ("ACE_ATM_Acceptor::open"); -#if defined (ACE_HAS_FORE_ATM_XTI) - ACE_HANDLE handle = acceptor_.open (remote_sap, - params.get_reuse_addr (), - params.get_oflag (), - params.get_info (), - backlog, - params.get_device ()); - return (handle == ACE_INVALID_HANDLE ? -1 : 0); -#elif defined (ACE_HAS_FORE_ATM_WS2) - struct sockaddr_atm local_atm_addr; - ACE_HANDLE ret; - DWORD flags = 0; - - /* Create a local endpoint of communication */ - - // Only leaves can listen. - flags = ACE_FLAG_MULTIPOINT_C_LEAF | ACE_FLAG_MULTIPOINT_D_LEAF; - - if ((ret = ACE_OS::socket (AF_ATM, - SOCK_RAW, - ATMPROTO_AAL5, - 0, - 0, - flags)) - == ACE_INVALID_HANDLE) { - ACE_OS::printf ("Acceptor (open): socket %d\n", - ::WSAGetLastError ()); - return (ret); - } - - ((ACE_SOCK_Acceptor *)this) -> set_handle (ret); - - /* Set up the address information to become a server */ - ACE_OS::memset ((void *) &local_atm_addr, 0, sizeof local_atm_addr); - local_atm_addr.satm_family = AF_ATM; - local_atm_addr.satm_number.AddressType = SAP_FIELD_ANY_AESA_REST; - local_atm_addr.satm_number.Addr[ ATM_ADDR_SIZE - 1 ] - = ((ACE_ATM_Addr *)&remote_sap) -> get_selector (); - local_atm_addr.satm_blli.Layer2Protocol = SAP_FIELD_ANY; - local_atm_addr.satm_blli.Layer3Protocol = SAP_FIELD_ABSENT; - local_atm_addr.satm_bhli.HighLayerInfoType = SAP_FIELD_ABSENT; - - /* Associate address with endpoint */ - if (ACE_OS::bind (((ACE_SOCK_Acceptor *)this) -> get_handle (), - reinterpret_cast (&local_atm_addr), - sizeof local_atm_addr) == -1) { - ACE_OS::printf ("Acceptor (open): bind %d\n", ::WSAGetLastError ()); - return (ACE_INVALID_HANDLE); - } - - /* Make endpoint listen for service requests */ - if (ACE_OS::listen (( (ACE_SOCK_Acceptor *)this) -> get_handle (), - backlog) - == -1) { - ACE_OS::printf ("Acceptor (open): listen %d\n", ::WSAGetLastError ()); - return (ACE_INVALID_HANDLE); - } - - return 0; -#elif defined (ACE_HAS_LINUX_ATM) - //we need to set the qos before binding to the socket - //use remote_sap as local_sap - - ACE_ATM_Addr local_sap; - ATM_Addr *local_sap_addr = (ATM_Addr*)local_sap.get_addr (); - ACE_ATM_QoS def_qos; - ATM_QoS qos = def_qos.get_qos (); - - ACE_HANDLE handle; - if ((handle = ACE_OS::socket (params.get_protocol_family (), - params.get_type (), - params.get_protocol (), - params.get_protocol_info (), - params.get_sock_group (), - params.get_flags () - )) - == ACE_INVALID_HANDLE) { - ACE_DEBUG (LM_DEBUG, - ACE_TEXT ("Acceptor (socket): socket %d\n"), - errno); - return (ACE_INVALID_HANDLE); - } - - ((ACE_SOCK_Acceptor *)this) -> set_handle (handle); - if (ACE_OS::setsockopt (handle, - SOL_ATM, - SO_ATMQOS, - reinterpret_cast (&qos), - sizeof (qos)) < 0) { - ACE_OS::printf ("Acceptor (setsockopt): setsockopt:%d\n", - errno); - } - - struct atmif_sioc req; - struct sockaddr_atmsvc aux_addr[1024]; - - req.number = 0; - req.arg = aux_addr; - req.length = sizeof (aux_addr); - if (ACE_OS::ioctl (handle, - ATM_GETADDR, - &req) < 0) { - ACE_OS::perror ("Acceptor (setsockopt): ioctl:"); - } - else { - local_sap_addr->sockaddratmsvc = aux_addr[0]; - } - local_sap.set_selector (( (ACE_ATM_Addr*)&remote_sap)->get_selector ()); - - if (ACE_OS::bind (handle, - reinterpret_cast ( - &(local_sap_addr->sockaddratmsvc)), - sizeof (local_sap_addr->sockaddratmsvc) - ) == -1) { - ACE_DEBUG (LM_DEBUG, - ACE_TEXT ("Acceptor (open): bind %d\n"), - errno); - return -1; - } - // Make endpoint listen for service requests - if (ACE_OS::listen (handle, - backlog) - == -1) { - ACE_DEBUG (LM_DEBUG, - ACE_TEXT ("Acceptor (listen): listen %d\n"), - errno); - return -1; - } - - return 0; -#else - ACE_UNUSED_ARG (remote_sap); - ACE_UNUSED_ARG (backlog); - ACE_UNUSED_ARG (params); -#endif /* ACE_HAS_FORE_ATM_XTI/ACE_HAS_FORE_ATM_WS2/ACE_HAS_LINUX_ATM */ -} - -int -ACE_ATM_Acceptor::accept (ACE_ATM_Stream &new_sap, - ACE_Addr *remote_addr, - ACE_Time_Value *timeout, - bool restart, - bool reset_new_handle, - ACE_ATM_Params params, - ACE_ATM_QoS qos) -{ - ACE_TRACE ("ACE_ATM_Acceptor::accept"); -#if defined (ACE_HAS_FORE_ATM_XTI) - ATM_QoS optbuf = qos.get_qos (); - - return (acceptor_.accept (new_sap.get_stream (), - remote_addr, - timeout, - restart, - reset_new_handle, - params.get_rw_flag (), - params.get_user_data (), - &optbuf)); -#elif defined (ACE_HAS_FORE_ATM_WS2) - ACE_HANDLE n_handle; - ACE_HANDLE s_handle = ((ACE_SOCK_Acceptor *) this) -> get_handle (); - struct sockaddr_atm *cli_addr - = (struct sockaddr_atm *)remote_addr -> get_addr (); - int caddr_len = sizeof (struct sockaddr_atm); - - do { - n_handle = ACE_OS::accept (s_handle, - reinterpret_cast (cli_addr), - &caddr_len); - } while (n_handle == ACE_INVALID_HANDLE && errno == EINTR); - - ((ACE_ATM_Addr *)remote_addr) -> set (cli_addr, - ((ACE_ATM_Addr *)remote_addr) -> get_selector ()); - ((ACE_IPC_SAP *)&new_sap) -> set_handle (n_handle); - - return 0; -#elif defined (ACE_HAS_LINUX_ATM) - ACE_UNUSED_ARG (params); - - ACE_HANDLE s_handle = ((ACE_SOCK_Acceptor *) this) -> get_handle (); - struct atm_qos accept_qos = qos.get_qos (); - - if (ACE_OS::setsockopt (s_handle, - SOL_ATM, - SO_ATMQOS, - reinterpret_cast (&accept_qos), - sizeof (accept_qos)) < 0) { - ACE_OS::printf ("Acceptor (accept): error setting Qos"); - } - - return (acceptor_.accept (new_sap.get_stream (), - remote_addr, - timeout, - restart, - reset_new_handle)); -#else - ACE_UNUSED_ARG (new_sap); - ACE_UNUSED_ARG (remote_addr); - ACE_UNUSED_ARG (timeout); - ACE_UNUSED_ARG (restart); - ACE_UNUSED_ARG (reset_new_handle); - ACE_UNUSED_ARG (params); - ACE_UNUSED_ARG (qos); - return 0; -#endif /* ACE_HAS_FORE_ATM_XTI */ -} - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL - - -#endif /* ACE_HAS_ATM */ diff --git a/dep/acelite/ace/ATM_Acceptor.h b/dep/acelite/ace/ATM_Acceptor.h deleted file mode 100644 index 1241a228caa..00000000000 --- a/dep/acelite/ace/ATM_Acceptor.h +++ /dev/null @@ -1,123 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file ATM_Acceptor.h - * - * $Id: ATM_Acceptor.h 82723 2008-09-16 09:35:44Z johnnyw $ - * - * @author Joe Hoffert - */ -//============================================================================= - - -#ifndef ACE_ATM_ACCEPTOR_H -#define ACE_ATM_ACCEPTOR_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_ATM) - -#include "ace/ATM_Stream.h" -#include "ace/ATM_Params.h" -#include "ace/ATM_QoS.h" - -#if defined (ACE_HAS_LINUX_ATM) -#include /**/ "atm.h" -#endif /* ACE_HAS_LINUX_ATM */ - -#if defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM) -#include "ace/SOCK_Acceptor.h" -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef ACE_SOCK_Acceptor ATM_Acceptor; -ACE_END_VERSIONED_NAMESPACE_DECL -#elif defined (ACE_HAS_FORE_ATM_XTI) -#include "ace/TLI_Acceptor.h" -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef ACE_TLI_Acceptor ATM_Acceptor; -ACE_END_VERSIONED_NAMESPACE_DECL -#endif // ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declarations. -class ACE_Time_Value; - -/** - * @class ACE_ATM_Acceptor - * - * @brief Defines the member functions for ACE_ATM_Acceptor abstraction. - * - * This class wraps up the ACE_SOCK_Acceptor and ACE_TLI_Acceptor - * to make the mechanism for the ATM protocol transparent. - */ -class ACE_Export ACE_ATM_Acceptor -{ - -public: - // = Initialization and termination methods. - /// Default constructor. - ACE_ATM_Acceptor (void); - - ~ACE_ATM_Acceptor (); - - /// Initiate a passive mode connection. - ACE_ATM_Acceptor (const ACE_Addr &remote_sap, - int backlog = ACE_DEFAULT_BACKLOG, - ACE_ATM_Params params = ACE_ATM_Params()); - - /// Initiate a passive mode socket. - ACE_HANDLE open (const ACE_Addr &remote_sap, - int backlog = ACE_DEFAULT_BACKLOG, - ACE_ATM_Params params = ACE_ATM_Params()); - - /// Close down the acceptor and release resources. - int close (void); - - // = Passive connection acceptance method. - - /// Accept a new data transfer connection. A @a timeout of 0 means - /// block forever, a @a timeout of {0, 0} means poll. @a restart == 1 - /// means "restart if interrupted." - int accept (ACE_ATM_Stream &new_sap, - ACE_Addr *remote_addr = 0, - ACE_Time_Value *timeout = 0, - bool restart = true, - bool reset_new_handle = false, - ACE_ATM_Params params = ACE_ATM_Params(), - ACE_ATM_QoS qos = ACE_ATM_QoS()); - - /// Get the local address currently listening on - int get_local_addr( ACE_ATM_Addr &local_addr ); - - // = Meta-type info - typedef ACE_ATM_Addr PEER_ADDR; - typedef ACE_ATM_Stream PEER_STREAM; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - ATM_Acceptor acceptor_; -}; - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL - - -#if defined (__ACE_INLINE__) -#include "ace/ATM_Acceptor.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_ATM */ -#include /**/ "ace/post.h" -#endif /* ACE_ATM_ACCEPTOR_H */ diff --git a/dep/acelite/ace/ATM_Acceptor.inl b/dep/acelite/ace/ATM_Acceptor.inl deleted file mode 100644 index fa60c4ad89a..00000000000 --- a/dep/acelite/ace/ATM_Acceptor.inl +++ /dev/null @@ -1,43 +0,0 @@ -// -*- C++ -*- -// -// $Id: ATM_Acceptor.inl 80826 2008-03-04 14:51:23Z wotte $ - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE void -ACE_ATM_Acceptor::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_ATM_Acceptor::dump"); -#endif /* ACE_HAS_DUMP */ -} - -ACE_INLINE -ACE_ATM_Acceptor::ACE_ATM_Acceptor (const ACE_Addr &remote_sap, - int backlog, - ACE_ATM_Params params) -{ - ACE_TRACE ("ACE_ATM_Acceptor::ACE_ATM_Acceptor"); - - //FUZZ: disable check_for_lack_ACE_OS - if (open (remote_sap, backlog, params) < 0) - //FUZZ: enable check_for_lack_ACE_OS - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_ATM_Acceptor::ACE_ATM_Acceptor"))); -} - -ACE_INLINE -int -ACE_ATM_Acceptor::close (void) -{ -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM) - return (acceptor_.close()); -#else - return 0; -#endif // ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM -} - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/ATM_Addr.cpp b/dep/acelite/ace/ATM_Addr.cpp deleted file mode 100644 index 47e47e8354a..00000000000 --- a/dep/acelite/ace/ATM_Addr.cpp +++ /dev/null @@ -1,522 +0,0 @@ -// $Id: ATM_Addr.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -// Defines the Internet domain address family address format. - -#include "ace/ATM_Addr.h" -#if defined (ACE_HAS_ATM) - -#include "ace/Log_Msg.h" - -#if defined (ACE_HAS_FORE_ATM_WS2) -#include /**/ "forews2.h" -#endif /* ACE_HAS_FORE_ATM_WS2 */ - -#if !defined (__ACE_INLINE__) -#include "ace/ATM_Addr.inl" -#endif /* __ACE_INLINE__ */ - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_ATM_Addr) - -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) -#define BHLI_MAGIC "FORE_ATM" -// This is line rate in cells/s for an OC-3 MM interface. -const long ACE_ATM_Addr::LINE_RATE = 353207; -const int ACE_ATM_Addr::OPT_FLAGS_CPID = 0x1; -const int ACE_ATM_Addr::OPT_FLAGS_PMP = 0x2; -const int ACE_ATM_Addr::DEFAULT_SELECTOR = 0x99; -#elif defined (ACE_HAS_LINUX_ATM) -//pbrandao:for Linux: -//pbrandao:for now stick with current definitions -//pbrandao:see if later need to change -const long ACE_ATM_Addr::LINE_RATE = 353207; -const int ACE_ATM_Addr::OPT_FLAGS_CPID = 0; -const int ACE_ATM_Addr::OPT_FLAGS_PMP = 0; -const int ACE_ATM_Addr::DEFAULT_SELECTOR = 0x99; -#else -const long ACE_ATM_Addr::LINE_RATE = 0L; -const int ACE_ATM_Addr::OPT_FLAGS_CPID = 0; -const int ACE_ATM_Addr::OPT_FLAGS_PMP = 0; -const int ACE_ATM_Addr::DEFAULT_SELECTOR = 0x0; -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ - -// Default constructor - -ACE_ATM_Addr::ACE_ATM_Addr (u_char selector) -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) - : ACE_Addr (AF_ATM, -#elif defined (ACE_HAS_LINUX_ATM) - : ACE_Addr (PF_ATMSVC, -#else - : ACE_Addr (AF_UNSPEC, -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ - sizeof this->atm_addr_) -{ - // ACE_TRACE ("ACE_ATM_Addr::ACE_ATM_Addr"); - (void) ACE_OS::memset ((void *) &this->atm_addr_, - 0, - sizeof this->atm_addr_); - this->init (selector); -} - -// Copy constructor. - -ACE_ATM_Addr::ACE_ATM_Addr (const ACE_ATM_Addr &sap, - u_char selector) -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) - : ACE_Addr (AF_ATM, -#elif defined (ACE_HAS_LINUX_ATM) - : ACE_Addr (PF_ATMSVC, -#else - : ACE_Addr (AF_UNSPEC, -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ - sizeof this->atm_addr_) -{ - ACE_TRACE ("ACE_ATM_Addr::ACE_ATM_Addr"); - this->set (sap, selector); -#if defined (ACE_HAS_LINUX_ATM) - this->atm_addr_.sockaddratmsvc.sas_family = PF_ATMSVC; - this->atm_addr_.atmsap.blli[0].l3_proto = ATM_L3_NONE; - this->atm_addr_.atmsap.blli[0].l2_proto = ATM_L2_NONE; - this->atm_addr_.atmsap.bhli.hl_type = ATM_HL_NONE; -#endif /* ACE_HAS_LINUX_ATM */ -} - -ACE_ATM_Addr::ACE_ATM_Addr (const ATM_Addr *sap, - u_char selector) -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) - : ACE_Addr (AF_ATM, -#elif defined (ACE_HAS_LINUX_ATM) - : ACE_Addr (PF_ATMSVC, -#else - : ACE_Addr (AF_UNSPEC, -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ - sizeof this->atm_addr_) -{ - ACE_TRACE ("ACE_ATM_Addr::ACE_ATM_Addr"); - this->set (sap, selector); -} - - -ACE_ATM_Addr::ACE_ATM_Addr (const ACE_TCHAR sap[], - u_char selector) -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) - : ACE_Addr (AF_ATM, -#elif defined (ACE_HAS_LINUX_ATM) - : ACE_Addr (PF_ATMSVC, -#else - : ACE_Addr (AF_UNSPEC, -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ - sizeof this->atm_addr_) -{ - ACE_TRACE ("ACE_ATM_Addr::ACE_ATM_Addr"); - this->set (sap, selector); -} - -ACE_ATM_Addr::~ACE_ATM_Addr (void) -{ -} - -// Return the address. - -void * -ACE_ATM_Addr::get_addr (void) const -{ - ACE_TRACE ("ACE_ATM_Addr::get_addr"); - return (void *) &this->atm_addr_; -} - -void -ACE_ATM_Addr::init (u_char selector) -{ -#if defined (ACE_HAS_FORE_ATM_XTI) - // Note: this approach may be FORE implementation-specific. When we - // bind with tag_addr ABSENT and tag_selector PRESENT, only the - // selector (i.e. address[19]) is used by the TP. The rest of the - // local address is filled in by the TP and can be obtained via the - // 'ret' parameter or with t_getname ()/t_getprotaddr (). - - atm_addr_.addressType = (u_int16_t) AF_ATM; - - atm_addr_.sap.t_atm_sap_addr.SVE_tag_addr = (int8_t) T_ATM_ABSENT; - atm_addr_.sap.t_atm_sap_addr.SVE_tag_selector = (int8_t) T_ATM_PRESENT; - - atm_addr_.sap.t_atm_sap_addr.address_format = (u_int8_t) T_ATM_ENDSYS_ADDR; - atm_addr_.sap.t_atm_sap_addr.address_length = ATMNSAP_ADDR_LEN; - atm_addr_.sap.t_atm_sap_addr.address[ATMNSAP_ADDR_LEN - 1] = selector; - - atm_addr_.sap.t_atm_sap_layer2.SVE_tag = (int8_t) T_ATM_ABSENT; - atm_addr_.sap.t_atm_sap_layer3.SVE_tag = (int8_t) T_ATM_ABSENT; - - atm_addr_.sap.t_atm_sap_appl.SVE_tag = (int8_t) T_ATM_PRESENT; - atm_addr_.sap.t_atm_sap_appl.ID_type = (u_int8_t) T_ATM_USER_APP_ID; - - ACE_OS::memcpy (atm_addr_.sap.t_atm_sap_appl.ID.user_defined_ID, - BHLI_MAGIC, - sizeof atm_addr_.sap.t_atm_sap_appl.ID); -#elif defined (ACE_HAS_FORE_ATM_WS2) - ACE_OS::memset ((void *)&atm_addr_, 0, sizeof atm_addr_); - atm_addr_.satm_number.Addr[ ATM_ADDR_SIZE - 1 ] = (char)selector; - atm_addr_.satm_family = AF_ATM; - atm_addr_.satm_number.AddressType = ATM_NSAP; - atm_addr_.satm_number.NumofDigits = ATM_ADDR_SIZE; - atm_addr_.satm_blli.Layer2Protocol = SAP_FIELD_ABSENT; - atm_addr_.satm_blli.Layer3Protocol = SAP_FIELD_ABSENT; - atm_addr_.satm_bhli.HighLayerInfoType = SAP_FIELD_ABSENT; - - // Need to know the correspondence. - //atm_addr_.sap.t_atm_sap_appl.SVE_tag = (int8_t) T_ATM_PRESENT; - //atm_addr_.sap.t_atm_sap_appl.ID_type = (u_int8_t) T_ATM_USER_APP_ID; - //ACE_OS::memcpy (atm_addr_.sap.t_atm_sap_appl.ID.user_defined_ID, - // BHLI_MAGIC, - // sizeof atm_addr_.sap.t_atm_sap_appl.ID); -#elif defined (ACE_HAS_LINUX_ATM) - atm_addr_.sockaddratmsvc.sas_family = AF_ATMSVC; - atm_addr_.sockaddratmsvc.sas_addr.prv[ATM_ESA_LEN - 1] = (char)selector; - atm_addr_.atmsap.blli[0].l3_proto = ATM_L3_NONE; - atm_addr_.atmsap.blli[0].l2_proto = ATM_L2_NONE; - atm_addr_.atmsap.bhli.hl_type = ATM_HL_NONE; -#else - ACE_UNUSED_ARG (selector); -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ -} - -int -ACE_ATM_Addr::set (const ACE_ATM_Addr &sap, - u_char selector) -{ - ACE_TRACE ("ACE_ATM_Addr::set"); - - this->init (selector); - - this->ACE_Addr::base_set (sap.get_type (), - sap.get_size ()); - -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) - ACE_ASSERT (sap.get_type () == AF_ATM); -#elif defined (ACE_HAS_LINUX_ATM) - ACE_ASSERT (sap.get_type () == PF_ATMSVC); -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */ - - (void) ACE_OS::memcpy ((void *) &this->atm_addr_, - (void *) &sap.atm_addr_, - sizeof this->atm_addr_); - return 0; -} - -int -ACE_ATM_Addr::set (const ATM_Addr *sap, - u_char selector) -{ - ACE_TRACE ("ACE_ATM_Addr::set"); - - this->init (selector); - -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) - this->ACE_Addr::base_set (AF_ATM, -#elif defined (ACE_HAS_LINUX_ATM) - this->ACE_Addr::base_set (PF_ATMSVC, -#else - this->ACE_Addr::base_set (AF_UNSPEC, -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */ - sizeof (*sap)); - - (void) ACE_OS::memcpy ((void *) &this->atm_addr_, - (void *) sap, - sizeof this->atm_addr_); - return 0; -} - -int -ACE_ATM_Addr::set (const ACE_TCHAR address[], - u_char selector) -{ - ACE_TRACE ("ACE_ATM_Addr::set"); - int ret; - - this->init (selector); - -#if defined (ACE_HAS_FORE_ATM_XTI) - atm_addr_.sap.t_atm_sap_addr.SVE_tag_addr = - (int8_t) T_ATM_PRESENT; -#endif /* ACE_HAS_FORE_ATM_XTI */ - - ret = this -> string_to_addr (address); - this -> set_selector (selector); - return ret; -} - -// Transform the string into the current addressing format. - -int -ACE_ATM_Addr::string_to_addr (const ACE_TCHAR sap[]) -{ - ACE_TRACE ("ACE_ATM_Addr::string_to_addr"); - -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) - this->ACE_Addr::base_set (AF_ATM, -#elif defined (ACE_HAS_LINUX_ATM) - this->ACE_Addr::base_set (PF_ATMSVC, -#else - this->ACE_Addr::base_set (AF_UNSPEC, -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ - sizeof this->atm_addr_); -#if defined (ACE_HAS_FORE_ATM_XTI) - struct hostent *entry; - struct atmnsap_addr *nsap; - - // Yow, someone gave us a NULL ATM address! - if (sap == 0) - { - errno = EINVAL; - return -1; - } - else if ((entry = gethostbyname_atmnsap ((ACE_TCHAR *)sap)) != 0) - { - ACE_OS::memcpy (atm_addr_.sap.t_atm_sap_addr.address, - entry->h_addr_list[0], - ATMNSAP_ADDR_LEN - 1); - } - else if ((nsap = atmnsap_addr (sap)) != 0) - { - ACE_OS::memcpy (atm_addr_.sap.t_atm_sap_addr.address, - nsap->atmnsap, - ATMNSAP_ADDR_LEN); - } - else { - errno = EINVAL; - return -1; - } -#elif defined (ACE_HAS_FORE_ATM_WS2) - DWORD dwValue; - HANDLE hLookup; - WSAQUERYSETW qsRestrictions; - CSADDR_INFO csaBuffer; - WCHAR tmpWStr[100]; - - MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, sap, -1, tmpWStr, 100); - - csaBuffer.LocalAddr.iSockaddrLength = sizeof (struct sockaddr_atm); - csaBuffer.LocalAddr.lpSockaddr = (struct sockaddr *)&atm_addr_; - csaBuffer.RemoteAddr.iSockaddrLength = sizeof (struct sockaddr_atm); - csaBuffer.RemoteAddr.lpSockaddr = (struct sockaddr *)&atm_addr_; - - qsRestrictions.dwSize = sizeof (WSAQUERYSETW); - qsRestrictions.lpszServiceInstanceName = 0; - qsRestrictions.lpServiceClassId = &FORE_NAME_CLASS; - qsRestrictions.lpVersion = 0; - qsRestrictions.lpszComment = 0; - qsRestrictions.dwNameSpace = FORE_NAME_SPACE; - qsRestrictions.lpNSProviderId = 0; - qsRestrictions.lpszContext = L""; - qsRestrictions.dwNumberOfProtocols = 0; - qsRestrictions.lpafpProtocols = 0; - qsRestrictions.lpszQueryString = tmpWStr; - qsRestrictions.dwNumberOfCsAddrs = 1; - qsRestrictions.lpcsaBuffer = &csaBuffer; - qsRestrictions.lpBlob = 0; //&blob; - - if (::WSALookupServiceBeginW (&qsRestrictions, LUP_RETURN_ALL, &hLookup) - == SOCKET_ERROR) { - ACE_OS::printf ("Error: WSALookupServiceBeginW failed! %d\n", - ::WSAGetLastError ()); - return -1; - } - - dwValue = sizeof (WSAQUERYSETW); - - if (::WSALookupServiceNextW (hLookup, 0, &dwValue, &qsRestrictions) - == SOCKET_ERROR) { - if (WSAGetLastError () != WSA_E_NO_MORE) { - ACE_OS::printf ("Error: WSALookupServiceNextW failed! %d\n", - ::WSAGetLastError ()); - return -1; - } - } - - if (WSALookupServiceEnd (hLookup) == SOCKET_ERROR) { - ACE_OS::printf ("Error : WSALookupServiceEnd failed! %d\n", - ::WSAGetLastError ()); - errno = EINVAL; - return -1; - } -#elif defined (ACE_HAS_LINUX_ATM) - if (sap == 0 || !ACE_OS::strcmp (sap,"")) { - errno = EINVAL; - return -1; - } - - if (text2atm ((ACE_TCHAR *)sap, - (struct sockaddr *)& (atm_addr_.sockaddratmsvc), - sizeof (atm_addr_.sockaddratmsvc), - T2A_SVC | T2A_NAME) < 0) { - ACE_DEBUG (LM_DEBUG, - "Error : text2atm failed!\n"); - errno = EINVAL; - return -1; - } -#else - ACE_UNUSED_ARG (sap); - - return 0; -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ - -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM) - return 0; -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */ -} - -// Transform the current address into string format. - -int -ACE_ATM_Addr::addr_to_string (ACE_TCHAR addr[], - size_t addrlen) const -{ - ACE_TRACE ("ACE_ATM_Addr::addr_to_string"); - -#if defined (ACE_HAS_FORE_ATM_XTI) - ACE_TCHAR buffer[MAXNAMELEN + 1]; - struct atmnsap_addr nsap; - ACE_OS::memcpy (nsap.atmnsap, - atm_addr_.sap.t_atm_sap_addr.address, - ATMNSAP_ADDR_LEN); - ACE_OS::sprintf (buffer, - ACE_TEXT ("%s"), - atmnsap_ntoa (nsap)); - - size_t total_len = ACE_OS::strlen (buffer) + sizeof ('\0'); - - if (addrlen < total_len) - return -1; - else - ACE_OS::strcpy (addr, buffer); - - return 0; -#elif defined (ACE_HAS_FORE_ATM_WS2) - ACE_TCHAR buffer[MAXNAMELEN + 1]; - int i; - - if (addrlen < ATM_ADDR_SIZE + 1) - return -1; - - for (i = 0; i < ATM_ADDR_SIZE; i++) { - buffer[ i * 3 ] = '\0'; - ACE_OS::sprintf (buffer, ACE_TEXT ("%s%02x."), - buffer, - atm_addr_.satm_number.Addr[ i ]); - } - - buffer[ ATM_ADDR_SIZE * 3 - 1 ] = '\0'; - ACE_OS::strcpy (addr, buffer); - - return 0; -#elif defined (ACE_HAS_LINUX_ATM) - ACE_TCHAR buffer[MAX_ATM_ADDR_LEN + 1]; - int total_len; - if ((total_len = atm2text (buffer, - sizeof buffer, - (struct sockaddr *)& (atm_addr_.sockaddratmsvc), - A2T_PRETTY)) < 0) { - ACE_DEBUG ((LM_DEBUG,"ACE_ATM_Addr (addr_to_string): atm2text failed\n")); - return -1; - } - if (addrlen < (size_t)total_len) - return -1; - else - ACE_OS::strcpy (addr, - buffer); - - return 0; -#else - ACE_UNUSED_ARG (addr); - ACE_UNUSED_ARG (addrlen); - return -1; -#endif /* ACE_HAS_FORE_ATM_XTI && ACE_HAS_FORE_ATM_WS2 */ -} - -const ACE_TCHAR * -ACE_ATM_Addr::addr_to_string (void) const -{ - ACE_TRACE ("ACE_ATM_Addr::addr_to_string"); - - static ACE_TCHAR addr[MAXHOSTNAMELEN + 1]; - if (this->addr_to_string (addr, - MAXHOSTNAMELEN + 1) < 0) - return 0; - - return addr; -} - -// Set a pointer to the address. -void -ACE_ATM_Addr::set_addr (void *addr, int len) -{ - ACE_TRACE ("ACE_ATM_Addr::set_addr"); - -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) - this->ACE_Addr::base_set (AF_ATM, -#elif defined (ACE_HAS_LINUX_ATM) - this->ACE_Addr::base_set (PF_ATMSVC, -#else - this->ACE_Addr::base_set (AF_UNSPEC, -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_WS2 */ - len); - ACE_OS::memcpy ((void *) &this->atm_addr_, - (void *) addr, len); -} - -// Compare two addresses for inequality. - -bool -ACE_ATM_Addr::operator != (const ACE_ATM_Addr &sap) const -{ - ACE_TRACE ("ACE_ATM_Addr::operator !="); - return ! ((*this) == sap); -} - -// Compare two addresses for equality. - -bool -ACE_ATM_Addr::operator == (const ACE_ATM_Addr &sap) const -{ - ACE_TRACE ("ACE_ATM_Addr::operator =="); - -#if defined (ACE_HAS_LINUX_ATM) - return (atm_equal ((const struct sockaddr *)& (this->atm_addr_.sockaddratmsvc), - (const struct sockaddr *)& (sap.atm_addr_.sockaddratmsvc), - 0, - 0) - && - sap_equal (& (this->atm_addr_.atmsap), - & (sap.atm_addr_.atmsap), - 0)); -#else - return ACE_OS::memcmp (&atm_addr_, - &sap.atm_addr_, - sizeof (ATM_Addr)) == 0; -#endif /* ACE_HAS_LINUX_ATM */ -} - -void -ACE_ATM_Addr::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_ATM_Addr::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - - ACE_TCHAR s[ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 16]; - ACE_OS::sprintf (s, - ACE_TEXT ("%s"), - this->addr_to_string ()); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s"), s)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_ATM */ diff --git a/dep/acelite/ace/ATM_Addr.h b/dep/acelite/ace/ATM_Addr.h deleted file mode 100644 index 7fa93f1492c..00000000000 --- a/dep/acelite/ace/ATM_Addr.h +++ /dev/null @@ -1,197 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file ATM_Addr.h - * - * $Id: ATM_Addr.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Joe Hoffert - */ -//========================================================================== - -#ifndef ACE_ATM_ADDR_H -#define ACE_ATM_ADDR_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_ATM) - -#include /**/ "ace/ACE_export.h" -#include "ace/Addr.h" - -#if defined (ACE_HAS_FORE_ATM_XTI) -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef ATMSAPAddress ATM_Addr; -ACE_END_VERSIONED_NAMESPACE_DECL -#elif defined (ACE_HAS_FORE_ATM_WS2) -#define FORE_NAME_SPACE NS_ALL -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef struct sockaddr_atm ATM_Addr; -ACE_END_VERSIONED_NAMESPACE_DECL -#elif defined (ACE_HAS_LINUX_ATM) - -#include /**/ "atm.h" - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -//pbrandao:as Linux has this 2 structs separeted we "link it" here -typedef struct _linux_atm_addr -{ - struct sockaddr_atmsvc sockaddratmsvc; - struct atm_sap atmsap; -} ATM_Addr; -#else -typedef int ATM_Addr; -#endif /* ACE_HAS_FORE_ATM_XTI/ACE_HAS_FORE_ATM_WS2/ACE_HAS_LINUX_ATM */ - -/** - * @class ACE_ATM_Addr - * - * @brief Defines the ATM domain address family address format. - */ -class ACE_Export ACE_ATM_Addr : public ACE_Addr -{ -public: - // Constants used for ATM options - static const long LINE_RATE; - static const int OPT_FLAGS_CPID; - static const int OPT_FLAGS_PMP; - static const int DEFAULT_SELECTOR; - - // = Initialization methods. - /// Default constructor. - ACE_ATM_Addr (u_char selector = DEFAULT_SELECTOR); - - /// Copy constructor. - ACE_ATM_Addr (const ACE_ATM_Addr &, - u_char selector = DEFAULT_SELECTOR); - - /** - * Creates an ACE_ATM_Addr from an ATMSAPAddress structure. This - * is vendor specific (FORE systems). May need to change when other - * vendors are supported. - */ - ACE_ATM_Addr (const ATM_Addr *, - u_char selector = DEFAULT_SELECTOR); - - /** - * Initializes an ACE_ATM_Addr from the which can be - * "atm-address" (e.g., - * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00") or "hostname" - * (e.g., "frisbee.cs.wustl.edu"). - */ - ACE_ATM_Addr (const ACE_TCHAR sap[], - u_char selector = DEFAULT_SELECTOR); - - /// Default dtor. - ~ACE_ATM_Addr (void); - - // = Initialization methods (useful after object construction). - /// Default initialization for non-address values (e.g., - /// t_atm_sap_addr.SVE_tag_addr, t_atm_sap_addr.SVE_tag_selector) - void init (u_char selector = DEFAULT_SELECTOR); - - /// Initializes from another ACE_ATM_Addr. - int set (const ACE_ATM_Addr &, - u_char selector = DEFAULT_SELECTOR); - - /** - * Initializes an ACE_ATM_Addr from an ATMSAPAddress/sockaddr_atm - * structure. This is vendor specific (FORE systems). May need to - * change when other vendors are supported. - */ - int set (const ATM_Addr *, - u_char selector = DEFAULT_SELECTOR); - - /** - * Initializes an ACE_ATM_Addr from the which can be - * "atm-address" (e.g., - * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00") or "hostname" - * (e.g., "frisbee.cs.wustl.edu"). - */ - int set (const ACE_TCHAR sap[], - u_char selector = DEFAULT_SELECTOR); - - /** - * Initializes an ACE_ATM_Addr from the which can be - * "atm-address" (e.g., - * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00") or "hostname" - * (e.g., "frisbee.cs.wustl.edu"). - */ - virtual int string_to_addr (const ACE_TCHAR sap[]); - - /** - * Return the character representation of the ATM address (e.g., - * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00") storing it in - * the @a addr (which is assumed to be bytes long). This - * version is reentrant. Returns -1 if the of the @a addr - * is too small, else 0. - */ - virtual int addr_to_string (ACE_TCHAR addr[], - size_t addrlen) const; - - /** - * Return the character representation of the ATM address (e.g., - * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00"). Returns -1 - * if the of the is too small, else 0.(This version - * is non-reentrant since it returns a pointer to a static data - * area.) - */ - const ACE_TCHAR *addr_to_string (void) const; - - /// Return a pointer to the underlying network address. - virtual void *get_addr (void) const; - - /// Set a pointer to the address. - virtual void set_addr (void *, int); - - /// Return the selector for network address. - u_char get_selector (void) const; - - /// Set the selector for the network address. - void set_selector (u_char selector); - - /** - * Compare two addresses for equality. The addresses are considered - * equal if they contain the same ATM address. Q: Is there any - * other check for equality needed for ATM? - */ - bool operator == (const ACE_ATM_Addr &SAP) const; - - /// Compare two addresses for inequality. - bool operator != (const ACE_ATM_Addr &SAP) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -// char *construct_options (ACE_HANDLE fd, -// int qos_kb, -// int flags, -// long *optsize); -// // Construct options for ATM connections - -private: - ATM_Addr atm_addr_; -}; - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL - - -#if defined (__ACE_INLINE__) -#include "ace/ATM_Addr.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_ATM */ -#include /**/ "ace/post.h" -#endif /* ACE_ATM_ADDR_H */ diff --git a/dep/acelite/ace/ATM_Addr.inl b/dep/acelite/ace/ATM_Addr.inl deleted file mode 100644 index 55f43d6613a..00000000000 --- a/dep/acelite/ace/ATM_Addr.inl +++ /dev/null @@ -1,37 +0,0 @@ -// -*- C++ -*- -// -// $Id: ATM_Addr.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE u_char -ACE_ATM_Addr::get_selector (void) const -{ - ACE_TRACE ("ACE_ATM_Addr::get_selector"); -#if defined (ACE_HAS_FORE_ATM_XTI) - return atm_addr_.sap.t_atm_sap_addr.address[ATMNSAP_ADDR_LEN - 1]; -#elif defined (ACE_HAS_FORE_ATM_WS2) - return atm_addr_.satm_number.Addr[ ATM_ADDR_SIZE - 1 ]; -#elif defined (ACE_HAS_LINUX_ATM) - return atm_addr_.sockaddratmsvc.sas_addr.prv[ATM_ESA_LEN - 1]; -#else - return 0; -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ -} - -ACE_INLINE void -ACE_ATM_Addr::set_selector (u_char selector) -{ - ACE_TRACE ("ACE_ATM_Addr::set_selector"); -#if defined (ACE_HAS_FORE_ATM_XTI) - atm_addr_.sap.t_atm_sap_addr.address[ATMNSAP_ADDR_LEN - 1] = selector; -#elif defined (ACE_HAS_FORE_ATM_WS2) - atm_addr_.satm_number.Addr[ ATM_ADDR_SIZE - 1 ] = selector; -#elif defined (ACE_HAS_LINUX_ATM) - atm_addr_.sockaddratmsvc.sas_addr.prv[ATM_ESA_LEN - 1] = selector; -#else - ACE_UNUSED_ARG (selector); -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/ATM_Connector.cpp b/dep/acelite/ace/ATM_Connector.cpp deleted file mode 100644 index 5328436f8f8..00000000000 --- a/dep/acelite/ace/ATM_Connector.cpp +++ /dev/null @@ -1,138 +0,0 @@ -// ATM_Connector.cpp -// $Id: ATM_Connector.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/ATM_Connector.h" -#if defined (ACE_HAS_ATM) - -#include "ace/Handle_Set.h" - - - -#if !defined (__ACE_INLINE__) -#include "ace/ATM_Connector.inl" -#endif /* __ACE_INLINE__ */ - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_ATM_Connector) - -ACE_ATM_Connector::ACE_ATM_Connector (void) -{ - ACE_TRACE ("ACE_ATM_Connector::ACE_ATM_Connector"); -} - -// Actively connect and produce a new ACE_ATM_Stream if things go well... -// Connect the to the , waiting up to -// amount of time if necessary. - -int -ACE_ATM_Connector::connect (ACE_ATM_Stream &new_stream, - const ACE_ATM_Addr &remote_sap, - ACE_ATM_Params params, - ACE_ATM_QoS options, - ACE_Time_Value *timeout, - const ACE_ATM_Addr &local_sap, - int reuse_addr, - int flags, - int perms) -{ - ACE_TRACE ("ACE_ATM_Connector::connect"); -#if defined (ACE_HAS_FORE_ATM_XTI) - return connector_.connect(new_stream.get_stream(), - remote_sap, - timeout, - local_sap, - reuse_addr, - flags, - perms, - params.get_device(), - params.get_info(), - params.get_rw_flag(), - params.get_user_data(), - &options.get_qos()); -#elif defined (ACE_HAS_FORE_ATM_WS2) - ACE_DEBUG(LM_DEBUG, - ACE_TEXT ("ATM_Connector(connect): set QoS parameters\n" )); - - ACE_HANDLE s = new_stream.get_handle(); - struct sockaddr_atm *saddr = ( struct sockaddr_atm *)remote_sap.get_addr(); - ACE_QoS cqos = options.get_qos(); - - ACE_QoS_Params qos_params = ACE_QoS_Params(0, - 0, - &cqos, - 0, - 0); - - ACE_DEBUG(LM_DEBUG, - ACE_TEXT ("ATM_Connector(connect): connecting...\n")); - - int result = ACE_OS::connect( s, - ( struct sockaddr *)saddr, - sizeof( struct sockaddr_atm ), - qos_params ); - - if ( result != 0 ) - ACE_OS::printf( "ATM_Connector(connect): connection failed, %d\n", - ::WSAGetLastError()); - - return result; -#elif defined (ACE_HAS_LINUX_ATM) - ACE_UNUSED_ARG (params); - ACE_UNUSED_ARG (timeout); - ACE_UNUSED_ARG (reuse_addr); - ACE_UNUSED_ARG (perms); - ACE_UNUSED_ARG (flags); - - ACE_HANDLE handle = new_stream.get_handle(); - ATM_QoS qos =options.get_qos(); - ATM_Addr *local_addr=(ATM_Addr*)local_sap.get_addr(), - *remote_addr=(ATM_Addr*)remote_sap.get_addr(); - - if (ACE_OS::setsockopt(handle, - SOL_ATM, - SO_ATMSAP, - reinterpret_cast (&(local_addr->atmsap)), - sizeof(local_addr->atmsap)) < 0) { - ACE_OS::printf( "ATM_Connector(connect): unable to set atmsap %d\nContinuing...", - errno); - } - if (ACE_OS::setsockopt(handle, - SOL_ATM, - SO_ATMQOS, - reinterpret_cast (&qos), - sizeof(qos)) < 0) { - ACE_DEBUG((LM_DEBUG,ACE_TEXT ("ATM_Connector(connect): unable to set qos %d\n"), - errno)); - return -1; - } - - int result = ACE_OS::connect(handle, - (struct sockaddr *)&(remote_addr->sockaddratmsvc), - sizeof( remote_addr->sockaddratmsvc)); - - if ( result != 0 ) - ACE_DEBUG(LM_DEBUG, - ACE_TEXT ("ATM_Connector(connect): connection failed, %d\n"), - errno); - - return result; -#else - ACE_UNUSED_ARG (new_stream); - ACE_UNUSED_ARG (remote_sap); - ACE_UNUSED_ARG (params); - ACE_UNUSED_ARG (options); - ACE_UNUSED_ARG (timeout); - ACE_UNUSED_ARG (local_sap); - ACE_UNUSED_ARG (reuse_addr); - ACE_UNUSED_ARG (flags); - ACE_UNUSED_ARG (perms); - return 0; -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ -} - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_ATM */ diff --git a/dep/acelite/ace/ATM_Connector.h b/dep/acelite/ace/ATM_Connector.h deleted file mode 100644 index 940fc5a307f..00000000000 --- a/dep/acelite/ace/ATM_Connector.h +++ /dev/null @@ -1,164 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file ATM_Connector.h - * - * $Id: ATM_Connector.h 82723 2008-09-16 09:35:44Z johnnyw $ - * - * @author Joe Hoffert - */ -//============================================================================= - -#ifndef ACE_ATM_CONNECTOR_H -#define ACE_ATM_CONNECTOR_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_ATM) - -#include "ace/ATM_Stream.h" -#include "ace/ATM_Params.h" -#include "ace/ATM_QoS.h" - -#if defined (ACE_WIN32) || defined (ACE_HAS_LINUX_ATM) -#include "ace/SOCK_Connector.h" -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef ACE_SOCK_Connector ATM_Connector; -ACE_END_VERSIONED_NAMESPACE_DECL -#else -#include "ace/XTI_ATM_Mcast.h" -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef ACE_XTI_ATM_Mcast ATM_Connector; -// Open versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL -#endif - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_ATM_Connector - * - * @brief Defines an active connection factory for the ACE_ATM C++ - * wrappers. - */ -class ACE_Export ACE_ATM_Connector -{ -public: - // = Initialization methods. - /// Default constructor. - ACE_ATM_Connector (void); - - /** - * Actively connect and produce a @a new_stream if things go well. - * The @a remote_sap is the address that we are trying to connect - * with. The are the parameters needed for either socket - * or XTI/ATM connections. The @a timeout is the amount of time to - * wait to connect. If it's 0 then we block indefinitely. If - * *timeout == {0, 0} then the connection is done using non-blocking - * mode. In this case, if the connection can't be made immediately - * the value of -1 is returned with @c errno == EWOULDBLOCK. If - * *timeout > {0, 0} then this is the maximum amount of time to wait before - * timing out. If the time expires before the connection is made - * @c errno == ETIME. The @a local_sap is the value of local address - * to bind to. If it's the default value of then - * the user is letting the OS do the binding. If @a reuse_addr == 1 - * then the is reused, even if it hasn't been cleanedup yet. - */ - ACE_ATM_Connector (ACE_ATM_Stream &new_stream, - const ACE_ATM_Addr &remote_sap, - ACE_ATM_Params params = ACE_ATM_Params(), - ACE_ATM_QoS options = ACE_ATM_QoS(), - ACE_Time_Value *timeout = 0, - const ACE_ATM_Addr &local_sap = ACE_ATM_Addr( "", 0 ), - int reuse_addr = 0, -#if defined (ACE_WIN32) - int flags = 0, -#else - int flags = O_RDWR, -#endif /* ACE_WIN32 */ - int perms = 0); - - /** - * Actively connect and produce a @a new_stream if things go well. - * The @a remote_sap is the address that we are trying to connect - * with. The are the parameters needed for either socket - * or XTI/ATM connections. The @a timeout is the amount of time to - * wait to connect. If it's 0 then we block indefinitely. If - * *timeout == {0, 0} then the connection is done using non-blocking - * mode. In this case, if the connection can't be made immediately - * the value of -1 is returned with @c errno == EWOULDBLOCK. If - * *timeout > {0, 0} then this is the maximum amount of time to wait before - * timing out. If the time expires before the connection is made - * @c errno == ETIME. The @a local_sap is the value of local address - * to bind to. If it's the default value of then - * the user is letting the OS do the binding. If @a reuse_addr == 1 - * then the is reused, even if it hasn't been cleanedup yet. - */ - int connect (ACE_ATM_Stream &new_stream, - const ACE_ATM_Addr &remote_sap, - ACE_ATM_Params params = ACE_ATM_Params(), - ACE_ATM_QoS options = ACE_ATM_QoS(), - ACE_Time_Value *timeout = 0, - const ACE_ATM_Addr &local_sap = ACE_ATM_Addr( "", - 0 ), - int reuse_addr = 0, -#if defined (ACE_WIN32) - int flags = 0, -#else - int flags = O_RDWR, -#endif /* ACE_WIN32 */ - int perms = 0); - - /** - * Try to complete a non-blocking connection. - * If connection completion is successful then @a new_stream contains - * the connected ACE_SOCK_Stream. If @a remote_sap is non-NULL then it - * will contain the address of the connected peer. - */ - int complete (ACE_ATM_Stream &new_stream, - ACE_ATM_Addr *remote_sap, - ACE_Time_Value *tv); - - /** - * Actively add a leaf to the root (i.e., point-to-multipoint). The - * @a remote_sap is the address of the leaf that we - * are trying to add. - */ - int add_leaf (ACE_ATM_Stream ¤t_stream, - const ACE_Addr &remote_sap, - ACE_ATM_QoS &qos); - - /// Resets any event associations on this handle - bool reset_new_handle (ACE_HANDLE handle); - - // = Meta-type info - typedef ACE_ATM_Addr PEER_ADDR; - typedef ACE_ATM_Stream PEER_STREAM; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - ATM_Connector connector_; -}; - -// Open versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/ATM_Connector.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_ATM */ -#include /**/ "ace/post.h" -#endif /* ACE_ATM_CONNECTOR_H */ diff --git a/dep/acelite/ace/ATM_Connector.inl b/dep/acelite/ace/ATM_Connector.inl deleted file mode 100644 index 10d1623f6c3..00000000000 --- a/dep/acelite/ace/ATM_Connector.inl +++ /dev/null @@ -1,132 +0,0 @@ -// -*- C++ -*- -// -// $Id: ATM_Connector.inl 84565 2009-02-23 08:20:39Z johnnyw $ - -// Open versioned namespace, if enabled by the user. -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE void -ACE_ATM_Connector::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_ATM_Connector::dump"); -#endif /* ACE_HAS_DUMP */ -} - -ACE_INLINE -ACE_ATM_Connector::ACE_ATM_Connector (ACE_ATM_Stream &new_stream, - const ACE_ATM_Addr &remote_sap, - ACE_ATM_Params params, - ACE_ATM_QoS options, - ACE_Time_Value *timeout, - const ACE_ATM_Addr &local_sap, - int reuse_addr, - int flags, - int perms) -{ - ACE_TRACE ("ACE_ATM_Connector::ACE_ATM_Connector"); - if ((ACE_HANDLE)this->connect (new_stream, - remote_sap, - params, - options, - timeout, - local_sap, - reuse_addr, - flags, - perms) == ACE_INVALID_HANDLE - && timeout != 0 && !(errno == EWOULDBLOCK || errno == ETIME)) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_ATM_Stream::ACE_ATM_Stream"))); -} - -// Try to complete a non-blocking connection. - -ACE_INLINE -int -ACE_ATM_Connector::complete (ACE_ATM_Stream &new_stream, - ACE_ATM_Addr *remote_sap, - ACE_Time_Value *tv) -{ - ACE_TRACE ("ACE_ATM_Connector::complete"); -#if defined (ACE_HAS_ATM) - return connector_.complete(new_stream.get_stream(), - remote_sap, - tv); -#else - ACE_UNUSED_ARG(new_stream); - ACE_UNUSED_ARG(remote_sap); - ACE_UNUSED_ARG(tv); - return 0; -#endif -} - -ACE_INLINE -int -ACE_ATM_Connector::add_leaf (ACE_ATM_Stream ¤t_stream, - const ACE_Addr &remote_sap, - ACE_ATM_QoS &qos) -{ - ACE_TRACE ("ACE_ATM_Connector::add_leaf"); -#if defined (ACE_HAS_FORE_ATM_XTI) - return connector_.add_leaf(current_stream.get_stream(), - remote_sap, - leaf_id, - timeout); -#elif defined (ACE_HAS_FORE_ATM_WS2) - struct sockaddr_atm *saddr = (struct sockaddr_atm *)remote_sap.get_addr(); - ACE_QoS cqos = qos.get_qos(); - int addr_len = sizeof( struct sockaddr_atm ); - - ACE_QoS_Params qos_params(0, - 0, - &cqos, - 0, - (JL_SENDER_ONLY)); - - ACE_OS::printf( "ATM_Connector::add_leaf: connecting...\n" ); - - ACE_HANDLE result = ACE_OS::join_leaf(current_stream.get_handle(), - (struct sockaddr *)saddr, - addr_len, - qos_params); - - if ( result == ACE_INVALID_HANDLE ) - ACE_OS::printf( "ATM_Connector(add_leaf): connection failed, %d\n", - ::WSAGetLastError()); - - return (result != ACE_INVALID_HANDLE); -#elif defined (ACE_HAS_LINUX_ATM) - ACE_OS::printf("ATM_Connector(add_leaf): not yet implemented in Linux\n"); - - ACE_UNUSED_ARG(current_stream); - ACE_UNUSED_ARG(remote_sap); - ACE_UNUSED_ARG(leaf_id); - ACE_UNUSED_ARG(timeout); - - return 0; -#else - ACE_UNUSED_ARG(current_stream); - ACE_UNUSED_ARG(remote_sap); - ACE_UNUSED_ARG(leaf_id); - ACE_UNUSED_ARG(timeout); - return 0; -#endif -} - -ACE_INLINE -bool -ACE_ATM_Connector::reset_new_handle (ACE_HANDLE handle) -{ -#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) - // Reset the event association - return ::WSAEventSelect ((SOCKET) handle, - 0, - 0); -#else /* !defined ACE_HAS_WINSOCK2 */ - ACE_UNUSED_ARG (handle); - return false; -#endif /* ACE_WIN32 */ -} - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/ATM_Params.cpp b/dep/acelite/ace/ATM_Params.cpp deleted file mode 100644 index b8d7600f11b..00000000000 --- a/dep/acelite/ace/ATM_Params.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// $Id: ATM_Params.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/ATM_Params.h" - -#if defined (ACE_HAS_ATM) - - - -#if !defined (__ACE_INLINE__) -#include "ace/ATM_Params.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_ATM_Params) - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_ATM */ - diff --git a/dep/acelite/ace/ATM_Params.h b/dep/acelite/ace/ATM_Params.h deleted file mode 100644 index d1e8c923118..00000000000 --- a/dep/acelite/ace/ATM_Params.h +++ /dev/null @@ -1,214 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file ATM_Params.h - * - * $Id: ATM_Params.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Joe Hoffert - */ -//========================================================================== - - -#ifndef ACE_ATM_PARAMS_H -#define ACE_ATM_PARAMS_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_ATM) - -#include /**/ "ace/ACE_export.h" - -#if defined (ACE_HAS_FORE_ATM_XTI) -#include "ace/TLI.h" -#define ATM_PROTOCOL_DEFAULT 0 -typedef struct t_info Param_Info; -typedef struct netbuf Param_Udata; -#elif defined (ACE_HAS_FORE_ATM_WS2) -#include "ace/SOCK.h" -#define ATM_PROTOCOL_DEFAULT ATMPROTO_AAL5 -#define ACE_XTI_ATM_DEVICE "" -typedef int Param_Info; -typedef int Param_Udata; -#elif defined (ACE_HAS_LINUX_ATM) -#include /**/ "atm.h" -#define AF_ATM PF_ATMSVC -#define ACE_XTI_ATM_DEVICE "" -#define ATM_PROTOCOL_DEFAULT ATM_AAL5 -typedef int Param_Info; -typedef int Param_Udata; -#else -#define ACE_XTI_ATM_DEVICE "" -typedef int Param_Info; -typedef int Param_Udata; -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_ATM_Params - * - * @brief Wrapper class that simplifies the information passed to the ATM - * enabled ACE_ATM_Connector class. - */ -class ACE_Export ACE_ATM_Params -{ -public: - /** - * Initialize the data members. This class combines options from - * ACE_SOCK_Connector (@a protocol_family, @a protocol, , - * @a protocol_info, , and @a flags) and - * ACE_TLI_Connector (, , , , and ) - * so that either mechanism can be used transparently for ATM. - */ - ACE_ATM_Params (int rw_flag = 1, - const char device[] = ACE_XTI_ATM_DEVICE, - Param_Info *info = 0, - Param_Udata *udata = 0, - int oflag = O_RDWR, - int protocol_family = AF_ATM, - int protocol = ATM_PROTOCOL_DEFAULT, - int type = -#if defined (ACE_HAS_LINUX_ATM) - SOCK_DGRAM, -#else - SOCK_RAW, -#endif /* ACE_HAS_LINUX_ATM */ - ACE_Protocol_Info *protocol_info = 0, - ACE_SOCK_GROUP g = 0, - u_long flags - = ACE_FLAG_MULTIPOINT_C_ROOT - | ACE_FLAG_MULTIPOINT_D_ROOT, // connector by default - int reuse_addr = 0); - - /// Destructor. - ~ACE_ATM_Params (); - - /// Get protocol family. - int get_protocol_family (void) const; - - /// Set protocol family. - void set_protocol_family (int); - - /// Get protocol. - int get_protocol (void) const; - - /// Set protocol. - void set_protocol (int); - - /// Get type. - int get_type (void) const; - - /// Set type. - void set_type (int); - - /// Get protocol info. - ACE_Protocol_Info *get_protocol_info( void ); - - /// Set protocol info. - void set_protocol_info( ACE_Protocol_Info *); - - /// Get socket group. - ACE_SOCK_GROUP get_sock_group( void ); - - /// Set socket group. - void set_sock_group( ACE_SOCK_GROUP ); - - /// Get socket flags. - u_long get_flags( void ); - - /// Set socket flags. - void set_flags( u_long ); - - /// Get reuse_addr flag. - int get_reuse_addr (void) const; - - /// Set reuse_addr flag. - void set_reuse_addr (int); - - /// Get device. - const char* get_device (void) const; - - /// Get info. - Param_Info* get_info (void) const; - - /// Set info. - void set_info (Param_Info *); - - /// Get r/w flag. - int get_rw_flag (void) const; - - /// Set r/w flag. - void set_rw_flag (int); - - /// Get user data. - Param_Udata* get_user_data (void) const; - - /// Set user data. - void set_user_data (Param_Udata*); - - /// Get open flag. - int get_oflag (void) const; - - /// Set open flag. - void set_oflag (int); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Protocol family for sockets connections. - int protocol_family_; - - /// Protocol for sockets connections. - int protocol_; - - /// Type for opening sockets. - int type_; - - /// Information about the protocol. - ACE_Protocol_Info *protocol_info_; - - /// Socket group used (for sockets only). - ACE_SOCK_GROUP group_; - - /// Flags for sockets (for sockets only). - u_long flags_; - - /// Flag for reusing address for opening sockets. - int reuse_addr_; - - /// Device name for XTI/ATM connections. - const char *device_; - - /// Info for XTI/ATM connections. - Param_Info *info_; - - /// R/W flag for XTI/ATM connections. - int rw_flag_; - - /// User data for XTI/ATM connections. - Param_Udata *udata_; - - /// Open flag for XTI/ATM connections. - int oflag_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/ATM_Params.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_ATM */ -#include /**/ "ace/post.h" -#endif /* ACE_ATM_PARAMS_H */ diff --git a/dep/acelite/ace/ATM_Params.inl b/dep/acelite/ace/ATM_Params.inl deleted file mode 100644 index de2a4d45127..00000000000 --- a/dep/acelite/ace/ATM_Params.inl +++ /dev/null @@ -1,235 +0,0 @@ -// -*- C++ -*- -// -// $Id: ATM_Params.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE void -ACE_ATM_Params::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_ATM_Params::dump"); -#endif /* ACE_HAS_DUMP */ -} - -ACE_INLINE -ACE_ATM_Params::ACE_ATM_Params (int rw_flag, - const char device[], - Param_Info *info, - Param_Udata *udata, - int oflag, - int protocol_family, - int protocol, - int type, - ACE_Protocol_Info *protocol_info, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr) - : protocol_family_(protocol_family), - protocol_(protocol), - type_(type), - protocol_info_(protocol_info), - group_(g), - flags_(flags), - reuse_addr_(reuse_addr), - device_(device), - info_(info), - rw_flag_(rw_flag), - udata_(udata), - oflag_(oflag) -{ - ACE_TRACE ("ACE_ATM_Params::ACE_ATM_Params"); -} - -// Default dtor. -ACE_INLINE -ACE_ATM_Params::~ACE_ATM_Params (void) -{ - ACE_TRACE ("ACE_ATM_Params::~ACE_ATM_Params"); -} - -ACE_INLINE -int -ACE_ATM_Params::get_protocol_family (void) const -{ - ACE_TRACE ("ACE_ATM_Params::get_protocol_family"); - return protocol_family_; -} - -ACE_INLINE -void -ACE_ATM_Params::set_protocol_family (int family) -{ - ACE_TRACE ("ACE_ATM_Params::set_protocol_family"); - protocol_family_ = family; -} - -ACE_INLINE -int -ACE_ATM_Params::get_protocol (void) const -{ - ACE_TRACE ("ACE_ATM_Params::get_protocol"); - return protocol_; -} - -ACE_INLINE -void -ACE_ATM_Params::set_protocol (int protocol) -{ - ACE_TRACE ("ACE_ATM_Params::set_protocol"); - protocol_ = protocol; -} - -ACE_INLINE -int -ACE_ATM_Params::get_type (void) const -{ - ACE_TRACE ("ACE_ATM_Params::get_type"); - return type_; -} - -ACE_INLINE -void -ACE_ATM_Params::set_type (int type) -{ - ACE_TRACE ("ACE_ATM_Params::set_type"); - type_ = type; -} - -ACE_INLINE -ACE_Protocol_Info* -ACE_ATM_Params::get_protocol_info( void ) -{ - ACE_TRACE ("ACE_ATM_Params::get_protocol_info"); - return protocol_info_; -} - -ACE_INLINE -void -ACE_ATM_Params::set_protocol_info( ACE_Protocol_Info *protocol_info ) -{ - ACE_TRACE ("ACE_ATM_Params::set_protocol_info"); - protocol_info_ = protocol_info; -} - -ACE_INLINE -ACE_SOCK_GROUP -ACE_ATM_Params::get_sock_group( void ) -{ - ACE_TRACE ("ACE_ATM_Params::get_sock_group"); - return group_; -} - -ACE_INLINE -void -ACE_ATM_Params::set_sock_group( ACE_SOCK_GROUP g ) -{ - ACE_TRACE ("ACE_ATM_Params::set_sock_group"); - group_ = g; -} - -ACE_INLINE -u_long -ACE_ATM_Params::get_flags( void ) -{ - ACE_TRACE ("ACE_ATM_Params::get_flags"); - return flags_; -} - -ACE_INLINE -void -ACE_ATM_Params::set_flags( u_long flags) -{ - ACE_TRACE ("ACE_ATM_Params::set_flags"); - flags_ = flags; -} - -ACE_INLINE -int -ACE_ATM_Params::get_reuse_addr (void) const -{ - ACE_TRACE ("ACE_ATM_Params::get_reuse_addr"); - return reuse_addr_; -} - -ACE_INLINE -void -ACE_ATM_Params::set_reuse_addr (int reuse_addr) -{ - ACE_TRACE ("ACE_ATM_Params::set_reuse_addr"); - reuse_addr_ = reuse_addr; -} - -ACE_INLINE -const char* -ACE_ATM_Params::get_device (void) const -{ - ACE_TRACE ("ACE_ATM_Params::get_device"); - return device_; -} - -ACE_INLINE -Param_Info* -ACE_ATM_Params::get_info (void) const -{ - ACE_TRACE ("ACE_ATM_Params::get_info"); - return info_; -} - -ACE_INLINE -void -ACE_ATM_Params::set_info (Param_Info* info) -{ - ACE_TRACE ("ACE_ATM_Params::set_info"); - info_ = info; -} - -ACE_INLINE -int -ACE_ATM_Params::get_rw_flag (void) const -{ - ACE_TRACE ("ACE_ATM_Params::get_rw_flag"); - return rw_flag_; -} - -ACE_INLINE -void -ACE_ATM_Params::set_rw_flag (int rw_flag) -{ - ACE_TRACE ("ACE_ATM_Params::set_rw_flag"); - rw_flag_ = rw_flag; -} - -ACE_INLINE -Param_Udata* -ACE_ATM_Params::get_user_data (void) const -{ - ACE_TRACE ("ACE_ATM_Params::get_user_data"); - return udata_; -} - -ACE_INLINE -void -ACE_ATM_Params::set_user_data (Param_Udata *udata) -{ - ACE_TRACE ("ACE_ATM_Params::set_user_data"); - udata_ = udata; -} - -ACE_INLINE -int -ACE_ATM_Params::get_oflag (void) const -{ - ACE_TRACE ("ACE_ATM_Params::get_oflag"); - return oflag_; -} - -ACE_INLINE -void -ACE_ATM_Params::set_oflag (int oflag) -{ - ACE_TRACE ("ACE_ATM_Params::set_oflag"); - oflag_ = oflag; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/ATM_QoS.cpp b/dep/acelite/ace/ATM_QoS.cpp deleted file mode 100644 index 841d57f2192..00000000000 --- a/dep/acelite/ace/ATM_QoS.cpp +++ /dev/null @@ -1,631 +0,0 @@ -// $Id: ATM_QoS.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/ATM_QoS.h" - - - -#if defined (ACE_HAS_ATM) - -#if !defined (__ACE_INLINE__) -#include "ace/ATM_QoS.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) -#define BHLI_MAGIC "FORE_ATM" -// This is line rate in cells/s for an OC-3 MM interface. -const long ACE_ATM_QoS::LINE_RATE = 353207; -const int ACE_ATM_QoS::OPT_FLAGS_CPID = 0x1; -const int ACE_ATM_QoS::OPT_FLAGS_PMP = 0x2; -const int ACE_ATM_QoS::DEFAULT_SELECTOR = 0x99; -const int ACE_ATM_QoS::DEFAULT_PKT_SIZE = 8192; -#elif defined (ACE_HAS_LINUX_ATM) -//pbrandao:for Linux: -//pbrandao:for now stick with current definitions -//pbrandao:see if later need to change -const long ACE_ATM_QoS::LINE_RATE = 353207; -const int ACE_ATM_QoS::OPT_FLAGS_CPID = 0x1; -const int ACE_ATM_QoS::OPT_FLAGS_PMP = 0x2; -const int ACE_ATM_QoS::DEFAULT_SELECTOR = 0x99; -const int ACE_ATM_QoS::DEFAULT_PKT_SIZE = 8192; -#else -const long ACE_ATM_QoS::LINE_RATE = 0L; -const int ACE_ATM_QoS::OPT_FLAGS_CPID = 0; -const int ACE_ATM_QoS::OPT_FLAGS_PMP = 0; -const int ACE_ATM_QoS::DEFAULT_SELECTOR = 0x0; -const int ACE_ATM_QoS::DEFAULT_PKT_SIZE = 0; -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ - -ACE_ALLOC_HOOK_DEFINE(ACE_ATM_QoS) - -ACE_ATM_QoS::ACE_ATM_QoS (int pktSize) -{ - ACE_TRACE ("ACE_ATM_QoS::ACE_ATM_QoS"); -#if defined (ACE_HAS_LINUX_ATM) - ACE_OS::memset(&qos_, 0, sizeof(qos_)); - qos_.aal = ATM_PROTOCOL_DEFAULT; - qos_.rxtp.traffic_class = ATM_ANYCLASS; - qos_.rxtp.max_sdu = pktSize; - qos_.txtp.traffic_class = ATM_ANYCLASS; - qos_.txtp.max_sdu = pktSize; -#else - ACE_UNUSED_ARG (pktSize); -#endif /* ACE_HAS_LINUX_ATM */ -} - -ACE_ATM_QoS::ACE_ATM_QoS(int rate, - int pktSize) -{ - ACE_TRACE( "ACE_ATM_QoS::ACE_ATM_QoS" ); -#if defined (ACE_HAS_FORE_ATM_WS2) - AAL_PARAMETERS_IE ie_aalparams; - ATM_TRAFFIC_DESCRIPTOR_IE ie_td; - ATM_BROADBAND_BEARER_CAPABILITY_IE ie_bbc; - ATM_QOS_CLASS_IE ie_qos; - Q2931_IE *ie_ptr; - int size; - - // Setting up cbr parameters ... - ie_aalparams.AALType = AALTYPE_5; - ie_aalparams.AALSpecificParameters.AAL5Parameters.ForwardMaxCPCSSDUSize - = pktSize; // was 1516; - ie_aalparams.AALSpecificParameters.AAL5Parameters.BackwardMaxCPCSSDUSize - = pktSize; // was 1516; - ie_aalparams.AALSpecificParameters.AAL5Parameters.Mode = AAL5_MODE_MESSAGE; - ie_aalparams.AALSpecificParameters.AAL5Parameters.SSCSType = AAL5_SSCS_NULL; - - size = sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(AAL_PARAMETERS_IE); - - ie_td.Forward.PeakCellRate_CLP0 = SAP_FIELD_ABSENT; - ie_td.Forward.PeakCellRate_CLP01 = rate; - ie_td.Forward.SustainableCellRate_CLP0 = SAP_FIELD_ABSENT; - ie_td.Forward.SustainableCellRate_CLP01 = SAP_FIELD_ABSENT; - ie_td.Forward.MaxBurstSize_CLP0 = SAP_FIELD_ABSENT; - ie_td.Forward.MaxBurstSize_CLP01 = SAP_FIELD_ABSENT; - ie_td.Forward.Tagging = SAP_FIELD_ABSENT; - - ie_td.Backward.PeakCellRate_CLP0 = SAP_FIELD_ABSENT; - ie_td.Backward.PeakCellRate_CLP01 = rate; - ie_td.Backward.SustainableCellRate_CLP0 = SAP_FIELD_ABSENT; - ie_td.Backward.SustainableCellRate_CLP01 = SAP_FIELD_ABSENT; - ie_td.Backward.MaxBurstSize_CLP0 = SAP_FIELD_ABSENT; - ie_td.Backward.MaxBurstSize_CLP01 = SAP_FIELD_ABSENT; - ie_td.Backward.Tagging = SAP_FIELD_ABSENT; - - ie_td.BestEffort = 0; // Note: this must be set to zero for CBR. - - size += sizeof( Q2931_IE_TYPE ) - + sizeof( ULONG ) - + sizeof( ATM_TRAFFIC_DESCRIPTOR_IE ); - - ie_bbc.BearerClass = BCOB_X; - ie_bbc.TrafficType = TT_CBR; - ie_bbc.TimingRequirements = TR_END_TO_END; - ie_bbc.ClippingSusceptability = CLIP_NOT; - ie_bbc.UserPlaneConnectionConfig = UP_P2P; - - size += sizeof( Q2931_IE_TYPE ) - + sizeof( ULONG ) - + sizeof( ATM_BROADBAND_BEARER_CAPABILITY_IE ); - - ie_qos.QOSClassForward = QOS_CLASS1; - ie_qos.QOSClassBackward = QOS_CLASS1; // This may not be really used - // since we do only simplex data xfer. - - size += sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(ATM_QOS_CLASS_IE); - - qos_.ProviderSpecific.buf = (char *) ACE_OS::malloc(size); - if (qos_.ProviderSpecific.buf == 0) { - ACE_ERROR((LM_ERROR, - ACE_TEXT ("ACE_ATM_QoS::ACE_ATM_QoS: Unable to allocate %d bytes for qos_.ProviderSpecific.buf\n"), - size)); - return; - } - qos_.ProviderSpecific.len = size; - ACE_OS::memset(qos_.ProviderSpecific.buf, 0, size); - - ie_ptr = (Q2931_IE *) qos_.ProviderSpecific.buf; - ie_ptr->IEType = IE_AALParameters; - ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) - + sizeof( ULONG ) - + sizeof( AAL_PARAMETERS_IE ); - ACE_OS::memcpy(ie_ptr->IE, &ie_aalparams, sizeof(AAL_PARAMETERS_IE)); - - ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength); - ie_ptr->IEType = IE_TrafficDescriptor; - ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) - + sizeof( ULONG ) - + sizeof( ATM_TRAFFIC_DESCRIPTOR_IE ); - ACE_OS::memcpy(ie_ptr->IE, &ie_td, sizeof(ATM_TRAFFIC_DESCRIPTOR_IE)); - - ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength); - ie_ptr->IEType = IE_BroadbandBearerCapability; - ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) - + sizeof( ULONG ) - + sizeof( ATM_BROADBAND_BEARER_CAPABILITY_IE ); - ACE_OS::memcpy(ie_ptr->IE, - &ie_bbc, - sizeof(ATM_BROADBAND_BEARER_CAPABILITY_IE)); - - ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength); - ie_ptr->IEType = IE_QOSClass; - ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) - + sizeof( ULONG ) - + sizeof( ATM_QOS_CLASS_IE ); - ACE_OS::memcpy(ie_ptr->IE, &ie_qos, sizeof(ATM_QOS_CLASS_IE)); - - // qos_.SendingFlowspec.TokenRate = 0xffffffff; - // qos_.SendingFlowspec.TokenBucketSize = 0xffffffff; - // qos_.SendingFlowspec.PeakBandwidth = 0xffffffff; - // qos_.SendingFlowspec.Latency = 0xffffffff; - // qos_.SendingFlowspec.DelayVariation = 0xffffffff; - // qos_.SendingFlowspec.ServiceType = SERVICETYPE_BESTEFFORT; - // This will most probably be ignored by the service provider. - // qos_.SendingFlowspec.MaxSduSize = 0xffffffff; - // qos_.SendingFlowspec.MinimumPolicedSize = 0xffffffff; - - // qos_.ReceivingFlowspec.TokenRate = 0xffffffff; - // qos_.ReceivingFlowspec.TokenBucketSize = 0xffffffff; - // qos_.ReceivingFlowspec.PeakBandwidth = 0xffffffff; - // qos_.ReceivingFlowspec.Latency = 0xffffffff; - // qos_.ReceivingFlowspec.DelayVariation = 0xffffffff; - // qos_.ReceivingFlowspec.ServiceType = SERVICETYPE_BESTEFFORT; - // This will most probably be ignored by the service provider. - // qos_.ReceivingFlowspec.MaxSduSize = 0xffffffff; - // qos_.ReceivingFlowspec.MinimumPolicedSize = 0; - - ACE_Flow_Spec send_fspec( 0xffffffff, - 0xffffffff, - 0xffffffff, - 0xffffffff, - 0xffffffff, - SERVICETYPE_BESTEFFORT, - // This will most probably ignored by SP. - 0xffffffff, - 0xffffffff, - 15, - ACE_DEFAULT_THREAD_PRIORITY ), - recv_fspec( 0xffffffff, - 0xffffffff, - 0xffffffff, - 0xffffffff, - 0xffffffff, - SERVICETYPE_BESTEFFORT, - // This will most probably ignored by SP. - 0xffffffff, - 0, - 15, - ACE_DEFAULT_THREAD_PRIORITY ); - - qos_.sending_flowspec (send_fspec); - qos_.receiving_flowspec (recv_fspec); -#elif defined (ACE_HAS_FORE_ATM_XTI) - ACE_UNUSED_ARG (rate); - ACE_UNUSED_ARG (pktSize); -#elif defined (ACE_HAS_LINUX_ATM) - ACE_OS::memset(&qos_, - 0, - sizeof(qos_)); - qos_.aal = ATM_PROTOCOL_DEFAULT; - qos_.rxtp.max_sdu = pktSize; - - if (rate > 0) { - qos_.rxtp.pcr = rate; - qos_.rxtp.traffic_class = ATM_CBR; - qos_.txtp.traffic_class = ATM_CBR; - qos_.txtp.pcr = rate; - } - else { - qos_.rxtp.traffic_class = ATM_UBR; - qos_.txtp.traffic_class = ATM_UBR; - } - - qos_.txtp.max_sdu = pktSize; -#else - ACE_UNUSED_ARG (rate); -#endif /* ACE_HAS_FORE_ATM_WS2 || ACE_HAS_FORE_ATM_XTI || ACE_HAS_LINUX_ATM */ -} - -void -ACE_ATM_QoS::set_cbr_rate (int rate, - int pktSize) -{ - ACE_TRACE ("ACE_ATM_QoS::set_cbr_rate"); -#if defined (ACE_HAS_FORE_ATM_WS2) - /* - AAL_PARAMETERS_IE ie_aalparams; - ATM_TRAFFIC_DESCRIPTOR_IE ie_td; - ATM_BROADBAND_BEARER_CAPABILITY_IE ie_bbc; - ATM_QOS_CLASS_IE ie_qos; - Q2931_IE *ie_ptr; - int size; - */ - - ACE_OS::printf( "ATM_QoS(set_cbr_rate): set rate to %d c/s\n", rate ); - - // Setting up cbr parameters ... - /* - FORE has changed this - we no longer specify QoS this way - ie_aalparams.AALType = AALTYPE_5; - ie_aalparams.AALSpecificParameters.AAL5Parameters.ForwardMaxCPCSSDUSize - = pktSize; // was 1516; - ie_aalparams.AALSpecificParameters.AAL5Parameters.BackwardMaxCPCSSDUSize - = pktSize; // was 1516; - ie_aalparams.AALSpecificParameters.AAL5Parameters.Mode = AAL5_MODE_MESSAGE; - ie_aalparams.AALSpecificParameters.AAL5Parameters.SSCSType = AAL5_SSCS_NULL; - - size = sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(AAL_PARAMETERS_IE); - - ie_td.Forward.PeakCellRate_CLP0 = SAP_FIELD_ABSENT; - ie_td.Forward.PeakCellRate_CLP01 = rate; - ie_td.Forward.SustainableCellRate_CLP0 = SAP_FIELD_ABSENT; - ie_td.Forward.SustainableCellRate_CLP01 = SAP_FIELD_ABSENT; - ie_td.Forward.MaxBurstSize_CLP0 = SAP_FIELD_ABSENT; - ie_td.Forward.MaxBurstSize_CLP01 = SAP_FIELD_ABSENT; - ie_td.Forward.Tagging = SAP_FIELD_ABSENT; - - ie_td.Backward.PeakCellRate_CLP0 = SAP_FIELD_ABSENT; - ie_td.Backward.PeakCellRate_CLP01 = rate; - ie_td.Backward.SustainableCellRate_CLP0 = SAP_FIELD_ABSENT; - ie_td.Backward.SustainableCellRate_CLP01 = SAP_FIELD_ABSENT; - ie_td.Backward.MaxBurstSize_CLP0 = SAP_FIELD_ABSENT; - ie_td.Backward.MaxBurstSize_CLP01 = SAP_FIELD_ABSENT; - ie_td.Backward.Tagging = SAP_FIELD_ABSENT; - - ie_td.BestEffort = 0; // Note: this must be set to zero for CBR. - - size += sizeof( Q2931_IE_TYPE ) + - sizeof( ULONG ) + - sizeof( ATM_TRAFFIC_DESCRIPTOR_IE ); - - ie_bbc.BearerClass = BCOB_X; - ie_bbc.TrafficType = TT_CBR; - ie_bbc.TimingRequirements = TR_END_TO_END; - ie_bbc.ClippingSusceptability = CLIP_NOT; - ie_bbc.UserPlaneConnectionConfig = UP_P2P; - - size += sizeof(Q2931_IE_TYPE) + - sizeof(ULONG) + - sizeof(ATM_BROADBAND_BEARER_CAPABILITY_IE); - - ie_qos.QOSClassForward = QOS_CLASS1; - ie_qos.QOSClassBackward = QOS_CLASS1; // This may not be really used - // since we only simplex data xfer. - - size += sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(ATM_QOS_CLASS_IE); - - qos_.ProviderSpecific.buf = (char *) ACE_OS::malloc(size); - if (qos_.ProviderSpecific.buf == 0) { - ACE_ERROR((LM_ERROR, - ACE_TEXT ("ACE_ATM_QoS::ACE_ATM_QoS: Unable to allocate %d bytes for qos_.ProviderSpecific.buf\n"), - size)); - return; - } - qos_.ProviderSpecific.len = size; - ACE_OS::memset(qos_.ProviderSpecific.buf, 0, size); - - ie_ptr = (Q2931_IE *) qos_.ProviderSpecific.buf; - ie_ptr->IEType = IE_AALParameters; - ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) + - sizeof( ULONG ) + - sizeof( AAL_PARAMETERS_IE ); - ACE_OS::memcpy(ie_ptr->IE, &ie_aalparams, sizeof(AAL_PARAMETERS_IE)); - - ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength); - ie_ptr->IEType = IE_TrafficDescriptor; - ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) + - sizeof( ULONG ) + - sizeof( ATM_TRAFFIC_DESCRIPTOR_IE ); - ACE_OS::memcpy(ie_ptr->IE, &ie_td, sizeof(ATM_TRAFFIC_DESCRIPTOR_IE)); - - ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength); - ie_ptr->IEType = IE_BroadbandBearerCapability; - ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) + - sizeof( ULONG ) + - sizeof( ATM_BROADBAND_BEARER_CAPABILITY_IE ); - ACE_OS::memcpy( ie_ptr->IE, - &ie_bbc, - sizeof( ATM_BROADBAND_BEARER_CAPABILITY_IE )); - - ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength); - ie_ptr->IEType = IE_QOSClass; - ie_ptr->IELength = sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + - sizeof(ATM_QOS_CLASS_IE); - ACE_OS::memcpy(ie_ptr->IE, &ie_qos, sizeof(ATM_QOS_CLASS_IE)); - */ - - const int BYTES_PER_ATM_CELL = 53; - ACE_OS::memset(&qos_, 0, sizeof(ATM_QoS)); - // Setting the token rate sets the minimum rate. 3 Mbits/sec seems too high. - // Certainly for Vaudeville audio, we only need about 1000 c/s which is - // 424000 bits/sec which is 53000 bytes/sec. - //qos_.SendingFlowspec.TokenRate = 3*(1024*128); // 3Mbits/sec - qos_.SendingFlowspec.TokenRate = 53000; // 1000 cells/sec - qos_.SendingFlowspec.TokenBucketSize = 32*1024; // our block size - //ourQos.SendingFlowspec.PeakBandwidth = ourQos.SendingFlowspec.TokenRate; - qos_.SendingFlowspec.ServiceType = SERVICETYPE_GUARANTEED; - // Peak bandwidth is in bytes/sec. The rate is specified in cells/sec so - // we need to convert from cells/sec to bytes/sec (i.e., multiply by 53). - qos_.SendingFlowspec.PeakBandwidth = rate * BYTES_PER_ATM_CELL; - qos_.SendingFlowspec.Latency = -1; // we don't care too much - qos_.SendingFlowspec.DelayVariation = -1; // we don't care too much - // no provider-specific data allowed on ATM - qos_.ProviderSpecific.buf=0; - qos_.ProviderSpecific.len=0; - // unidirectional P2MP; we don't need to setup the Receiving flowspec - - //qos_.SendingFlowspec.TokenRate = 0xffffffff; - //qos_.SendingFlowspec.TokenBucketSize = 0xffffffff; - //qos_.SendingFlowspec.PeakBandwidth = 0xffffffff; - //qos_.SendingFlowspec.Latency = 0xffffffff; - //qos_.SendingFlowspec.DelayVariation = 0xffffffff; - //qos_.SendingFlowspec.ServiceType = SERVICETYPE_BESTEFFORT; - // This will most probably be ignored by the service provider. - //qos_.SendingFlowspec.MaxSduSize = 0xffffffff; - //qos_.SendingFlowspec.MinimumPolicedSize = 0xffffffff; - - //qos_.ReceivingFlowspec.TokenRate = 0xffffffff; - //qos_.ReceivingFlowspec.TokenBucketSize = 0xffffffff; - //qos_.ReceivingFlowspec.PeakBandwidth = 0xffffffff; - //qos_.ReceivingFlowspec.Latency = 0xffffffff; - //qos_.ReceivingFlowspec.DelayVariation = 0xffffffff; - //qos_.ReceivingFlowspec.ServiceType = SERVICETYPE_BESTEFFORT; - // This will most probably be ignored by the service provider. - //qos_.ReceivingFlowspec.MaxSduSize = 0xffffffff; - //qos_.ReceivingFlowspec.MinimumPolicedSize = 0; - - /* - ACE_Flow_Spec send_fspec( 0xffffffff, - 0xffffffff, - 0xffffffff, - 0xffffffff, - 0xffffffff, - SERVICETYPE_BESTEFFORT, - // This will most probably ignored by SP. - 0xffffffff, - 0xffffffff, - 15, - ACE_DEFAULT_THREAD_PRIORITY ), - recv_fspec( 0xffffffff, - 0xffffffff, - 0xffffffff, - 0xffffffff, - 0xffffffff, - SERVICETYPE_BESTEFFORT, - // This will most probably ignored by SP. - 0xffffffff, - 0, - 15, - ACE_DEFAULT_THREAD_PRIORITY ); - - qos_.sending_flowspec( send_fspec ); - qos_.receiving_flowspec( recv_fspec ); - */ -#elif defined (ACE_HAS_FORE_ATM_XTI) - ACE_UNUSED_ARG (rate); - ACE_UNUSED_ARG (pktSize); -#elif defined (ACE_HAS_LINUX_ATM) - ACE_UNUSED_ARG (pktSize); - - qos_.rxtp.traffic_class = ATM_CBR; - qos_.rxtp.pcr = rate; - qos_.txtp.traffic_class = ATM_CBR; - qos_.txtp.pcr = rate; -#else - ACE_UNUSED_ARG (rate); -#endif /* ACE_HAS_FORE_ATM_WS2 || ACE_HAS_FORE_ATM_XTI || ACE_HAS_LINUX_ATM */ -} - -void -ACE_ATM_QoS::set_rate (ACE_HANDLE fd, - int rate, - int flags) -{ - ACE_TRACE ("ACE_ATM_QoS::set_rate"); -#if defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM) - set_cbr_rate( rate ); - - ACE_UNUSED_ARG( fd ); - ACE_UNUSED_ARG( flags ); -#elif defined (ACE_HAS_FORE_ATM_XTI) - long optlen = 0; - qos_.buf = construct_options(fd, - rate, - flags, - &optlen); - qos_.len = optlen; -#else - ACE_UNUSED_ARG (rate); -#endif /* ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM || ACE_HAS_FORE_ATM_XTI */ -} - -char* -ACE_ATM_QoS::construct_options (ACE_HANDLE fd, - int rate, - int flags, - long *len) -{ -#if defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM) - ACE_UNUSED_ARG (fd); - ACE_UNUSED_ARG (rate); - ACE_UNUSED_ARG (flags); - ACE_UNUSED_ARG (len); - return 0; -#elif defined (ACE_HAS_FORE_ATM_XTI) - struct t_opthdr *popt; - char *buf; - int qos_cells; - struct t_info info; - - if (ACE_OS::t_getinfo (fd, &info) == -1) - { - ACE_OS::t_error ("t_getinfo"); - return 0; - } - - buf = (char *) ACE_OS::malloc (info.options); - - if (buf == 0) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("Unable to allocate %d bytes for options\n"), - info.options), - 0); - - popt = (struct t_opthdr *) buf; - - if (flags & OPT_FLAGS_CPID) - { - // This constructs the T_ATM_ORIG_ADDR option, which is used to - // signal the UNI 3.1 Calling Party ID Information Element. - t_atm_addr *source_addr; - - popt->len = sizeof (struct t_opthdr) + sizeof (t_atm_addr); - popt->level = T_ATM_SIGNALING; - popt->name = T_ATM_ORIG_ADDR; - popt->status = 0; - - source_addr = - (t_atm_addr *)((char *) popt + sizeof (struct t_opthdr)); - - source_addr->address_format = T_ATM_ENDSYS_ADDR; - source_addr->address_length = ATMNSAP_ADDR_LEN; - - ATMSAPAddress local_addr; - struct t_bind boundaddr; - - boundaddr.addr.maxlen = sizeof(local_addr); - boundaddr.addr.buf = (char *) &local_addr; - - //if (ACE_OS::t_getprotaddr(fd, &boundaddr, 0) < 0) { - if (ACE_OS::t_getname(fd, - &boundaddr.addr, - LOCALNAME) < 0) - { - ACE_OS::t_error("t_getname (local_address)"); - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Can't get local address!\n"))); - ACE_OS::free (buf); - return 0; - } - - ACE_OS::memcpy(source_addr->address, - local_addr.sap.t_atm_sap_addr.address, - ATMNSAP_ADDR_LEN); - - popt = T_OPT_NEXTHDR (buf, info.options , popt); - } - - // This constructs all options necessary (bearer cap., QoS, and - // Traffic Descriptor) to signal for a CBR connection with the - // specified QoS in kbit/sec., and/or specify a PMP connection. - - // For FORE 200e cards, the adapter shapes traffic to CBR with rate - // equal to PCR CLP=0+1 (traffic.forward.PCR_all_traffic) - - qos_cells = (rate * 1000) / (48*8); - - if ((qos_cells > 0 && qos_cells < LINE_RATE) - || (ACE_BIT_ENABLED (flags, OPT_FLAGS_PMP))) - { - struct t_atm_bearer *bearer; - struct t_atm_traffic *traffic; - - // T_ATM_BEARER_CAP: Broadband bearer capability - popt->len = sizeof (struct t_opthdr) + sizeof (struct t_atm_bearer); - popt->level = T_ATM_SIGNALING; - popt->name = T_ATM_BEARER_CAP; - popt->status = 0; - - bearer = (struct t_atm_bearer *)((char *) popt + - sizeof (struct t_opthdr)); - bearer->bearer_class = T_ATM_CLASS_X; - - if (qos_cells) - { - bearer->traffic_type = T_ATM_CBR; - bearer->timing_requirements = T_ATM_END_TO_END; - } - else - { - bearer->traffic_type = 0; // UBR - bearer->timing_requirements = 0; - } - bearer->clipping_susceptibility = T_ATM_NULL; - - if (ACE_BIT_ENABLED (flags, OPT_FLAGS_PMP)) - bearer->connection_configuration = T_ATM_1_TO_MANY; - else - bearer->connection_configuration = T_ATM_1_TO_1; - - popt = T_OPT_NEXTHDR (buf, info.options, popt); - - // T_ATM_TRAFFIC: traffic descriptor - popt->len = sizeof (struct t_opthdr) + sizeof (struct t_atm_traffic); - popt->level = T_ATM_SIGNALING; - popt->name = T_ATM_TRAFFIC; - popt->status = 0; - - traffic = (struct t_atm_traffic *)((char *) popt + - sizeof (struct t_opthdr)); - - traffic->forward.PCR_high_priority = T_ATM_ABSENT; - traffic->forward.PCR_all_traffic = qos_cells ? qos_cells : LINE_RATE; - traffic->forward.SCR_high_priority = T_ATM_ABSENT; - traffic->forward.SCR_all_traffic = T_ATM_ABSENT; - traffic->forward.MBS_high_priority = T_ATM_ABSENT; - traffic->forward.MBS_all_traffic = T_ATM_ABSENT; - traffic->forward.tagging = T_NO; - - traffic->backward.PCR_high_priority = T_ATM_ABSENT; - traffic->backward.PCR_all_traffic = - (ACE_BIT_ENABLED (flags, OPT_FLAGS_PMP)) - ? 0 : qos_cells ? qos_cells : LINE_RATE; - traffic->backward.SCR_high_priority = T_ATM_ABSENT; - traffic->backward.SCR_all_traffic = T_ATM_ABSENT; - traffic->backward.MBS_high_priority = T_ATM_ABSENT; - traffic->backward.MBS_all_traffic = T_ATM_ABSENT; - traffic->backward.tagging = T_NO; - - traffic->best_effort = qos_cells ? T_NO : T_YES; - - popt = T_OPT_NEXTHDR (buf, - info.options, - popt); - } - - if (qos_cells > 0 && qos_cells < LINE_RATE) - { - struct t_atm_qos *qos; - - // T_ATM_QOS: Quality of Service - popt->len = sizeof (struct t_opthdr) + sizeof (struct t_atm_qos); - popt->level = T_ATM_SIGNALING; - popt->name = T_ATM_QOS; - popt->status = 0; - - qos = (struct t_atm_qos *)((char *) popt + sizeof (struct t_opthdr)); - qos->coding_standard = T_ATM_ITU_CODING; - qos->forward.qos_class = T_ATM_QOS_CLASS_1; - qos->backward.qos_class = T_ATM_QOS_CLASS_1; - - popt = T_OPT_NEXTHDR (buf, info.options, popt); - } - - // Return actual size of options and option buffer to user. - *len = (char *) popt - buf; - - return buf; -#else - ACE_UNUSED_ARG (fd); - ACE_UNUSED_ARG (rate); - ACE_UNUSED_ARG (flag); - ACE_UNUSED_ARG (len); - return 0; -#endif /* ACE_HAS_FORE_ATM_WS2 */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_ATM */ - diff --git a/dep/acelite/ace/ATM_QoS.h b/dep/acelite/ace/ATM_QoS.h deleted file mode 100644 index 4e35f3fddb4..00000000000 --- a/dep/acelite/ace/ATM_QoS.h +++ /dev/null @@ -1,115 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file ATM_QoS.h - * - * $Id: ATM_QoS.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Joe Hoffert - */ -//========================================================================== - - -#ifndef ACE_ATM_QoS_H -#define ACE_ATM_QoS_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined(ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_ATM) - -#if defined (ACE_HAS_FORE_ATM_WS2) -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -// just map to WS2 GQOS struct -typedef ACE_QoS ATM_QoS; -ACE_END_VERSIONED_NAMESPACE_DECL -#elif defined (ACE_HAS_FORE_ATM_XTI) -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef struct netbuf ATM_QoS; -ACE_END_VERSIONED_NAMESPACE_DECL -#elif defined (ACE_HAS_LINUX_ATM) -#include /**/ "atm.h" -#include "ace/ATM_Params.h" -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef struct atm_qos ATM_QoS; -ACE_END_VERSIONED_NAMESPACE_DECL -#else -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef int ATM_QoS; -ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_HAS_FORE_ATM_WS2 || ACE_HAS_FORE_ATM_XTI || ACE_HAS_LINUX_ATM */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_ATM_QoS - * - * @brief Define the QoS parameters for ATM - * - * This class wraps up QoS parameters for both ATM/XTI and - * ATM/WinSock2 to make the mechanism for the ATM protocol - * transparent. - */ -class ACE_Export ACE_ATM_QoS -{ -public: - // Constants used for ATM options - static const long LINE_RATE; - static const int OPT_FLAGS_CPID; - static const int OPT_FLAGS_PMP; - static const int DEFAULT_SELECTOR; - static const int DEFAULT_PKT_SIZE; - - // = Initializattion and termination methods. - /// Default constructor. - ACE_ATM_QoS(int = DEFAULT_PKT_SIZE); - - /// Constructor with a CBR rate. - ACE_ATM_QoS(int, - int = DEFAULT_PKT_SIZE); - - ~ACE_ATM_QoS (); - - /// Set the rate. - void set_rate (ACE_HANDLE, - int, - int); - - /// Set CBR rate in cells per second. - void set_cbr_rate (int, - int = DEFAULT_PKT_SIZE); - - /// Get ATM_QoS struct. - ATM_QoS get_qos (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Construct QoS options. - char* construct_options(ACE_HANDLE, - int, - int, - long*); - -private: - ATM_QoS qos_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/ATM_QoS.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_ATM */ -#include /**/ "ace/post.h" -#endif /* ACE_ATM_QoS_H */ diff --git a/dep/acelite/ace/ATM_QoS.inl b/dep/acelite/ace/ATM_QoS.inl deleted file mode 100644 index 52b5211190d..00000000000 --- a/dep/acelite/ace/ATM_QoS.inl +++ /dev/null @@ -1,29 +0,0 @@ -// -*- C++ -*- -// -// $Id: ATM_QoS.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE void -ACE_ATM_QoS::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_ATM_QoS::dump"); -#endif /* ACE_HAS_DUMP */ -} - -ACE_INLINE -ACE_ATM_QoS::~ACE_ATM_QoS () -{ - ACE_TRACE ("ACE_ATM_QoS::~ACE_ATM_QoS"); -} - -ACE_INLINE -ATM_QoS -ACE_ATM_QoS::get_qos (void) -{ - ACE_TRACE ("ACE_ATM_QoS::get_qos"); - return qos_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/ATM_Stream.cpp b/dep/acelite/ace/ATM_Stream.cpp deleted file mode 100644 index 270afab0505..00000000000 --- a/dep/acelite/ace/ATM_Stream.cpp +++ /dev/null @@ -1,288 +0,0 @@ -// $Id: ATM_Stream.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/ATM_Stream.h" - -#if defined (ACE_HAS_ATM) - -#if !defined (__ACE_INLINE__) -#include "ace/ATM_Stream.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE (ACE_ATM_Stream) - -char* -ACE_ATM_Stream::get_peer_name (void) const -{ - ACE_TRACE ("ACE_ATM_Stream::get_peer_name"); -#if defined (ACE_HAS_FORE_ATM_XTI) - // // Use t_getprotaddr for XTI/ATM - // struct t_bind *localaddr - // = (struct t_bind *) ACE_OS::t_alloc (get_handle (), - // T_BIND, - // T_ADDR); - // struct t_bind *peeraddr - // = (struct t_bind *) ACE_OS::t_alloc (get_handle (), - // T_BIND, - // T_ADDR); - // ::t_getprotaddr (get_handle (), - // localaddr, - // peeraddr); - - // char* connected_name = (char*) ACE_OS::malloc (peeraddr->addr.len + 1); - // ACE_OS::strcpy (connected_name, - // peeraddr->addr.buf); - // ACE_OS::t_free ((char *) localaddr, - // T_BIND); - // ACE_OS::t_free ((char *) peeraddr, - // T_BIND); - // return (connected_name); - -#error "This doesn't seem to work. May need to jimmy-rig something with the" -#error "/etc/xti_hosts file - Ugh!" - - ACE_ATM_Addr sa; - struct netbuf name; - name.maxlen = sa.get_size (); - name.buf = (char *) sa.get_addr (); - ACE_OS::t_getname (this->get_handle (), &name, REMOTENAME); - // ACE_OS::ioctl (this->get_handle (), - // TI_GETPEERNAME, - // &name); - return (name.buf); - -#elif defined (ACE_HAS_FORE_ATM_WS2) - // Use getpeername for WinSock2. - struct sockaddr_atm name; - ACE_OS::memset (&name, 0, sizeof (name)); - int nameSize = sizeof (name); - - if (ACE_OS::getpeername (this->get_handle (), - (struct sockaddr *) &name, - &nameSize) != 0) { - return 0; - } - - char buffer[256]; - for (unsigned int index = 0; index < ATM_ADDR_SIZE - 1; index++) { - buffer[ index * 3 ] = '\0'; - ACE_OS::sprintf (buffer, "%s%02x.", buffer, name.satm_number.Addr[ index ]); - } - buffer[ (ATM_ADDR_SIZE - 1) * 3 ] = '\0'; - ACE_OS::sprintf (buffer, "%s%02x.", buffer, 0); - buffer[ ATM_ADDR_SIZE * 3 - 1 ] = '\0'; - for (index = 0; index < ACE_OS::strlen (buffer); ++index) - buffer[index] = ACE_OS::ace_tolower (buffer[index]); - - ifstream atm_hosts ("C:/WINNT/atmhosts"); - assert (atm_hosts.is_open ()); - - // Find the host address in the ATM hosts file and return the - // host name - char line[256]; - char *host_ptr, *host_name = 0; - ACE_NEW_RETURN (host_name, char[256], 0); - while (!atm_hosts.eof ()) { - atm_hosts.getline (line, 256); - // Convert the line to lower case to ease comparison - for (index = 0; index < ACE_OS::strlen (line); ++index) - line[index] = ACE_OS::ace_tolower (line[index]); - if (ACE_OS::strstr (line, buffer) != 0) - { - char *strtok_p; - // Grab the second token which is the host name - ACE_OS::strtok_r (line, " \t", &strtok_p); - host_ptr = ACE_OS::strtok (0, " \t", &strtok_p); - ACE_OS::strcpy (host_name, host_ptr); - break; - } - } - - return host_name; -#elif defined (ACE_HAS_LINUX_ATM) - ATM_Addr name; - int nameSize = sizeof (name.sockaddratmsvc); - - if (ACE_OS::getpeername (this->get_handle (), - (struct sockaddr *) & (name.sockaddratmsvc), - &nameSize) < 0) { - ACE_OS::perror ("ACE_ATM_Stream (get_peer_name) : "); - return 0; - } - - static ACE_TCHAR buffer[MAX_ATM_ADDR_LEN + 1]; - int total_len; - if ((total_len = atm2text (buffer,sizeof buffer, - (struct sockaddr *) & (name.sockaddratmsvc), - A2T_PRETTY|A2T_NAME)) < 0) { - ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("ACE_ATM_Stream (get_peer_name) :%d"),errno)); - return 0; - } - - return (char*) buffer; -#else - return 0; -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ -} - -ACE_HANDLE -ACE_ATM_Stream::get_handle (void) const -{ - ACE_TRACE ("ACE_ATM_Stream::get_handle"); -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM) - return stream_.get_handle (); -#else - return 0; -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ -} - -int -ACE_ATM_Stream::get_vpi_vci (ACE_UINT16 &vpi, - ACE_UINT16 &vci) const -{ - ACE_TRACE ("ACE_ATM_Stream::get_vpi_vci"); -#if defined (ACE_HAS_FORE_ATM_XTI) - struct t_atm_conn_prop conn_prop; - char* connect_opts = (char *) &conn_prop; - int opt_size = sizeof (t_atm_conn_prop); - struct t_info info; - struct t_optmgmt opt_req, opt_ret; - - if (ACE_OS::t_getinfo (stream_.get_handle (), - &info) < 0) - { - ACE_OS::t_error ("t_getinfo"); - return -1; - } - - char *buf_req = (char *) ACE_OS::malloc (info.options); - if (buf_req == 0) - { - ACE_OS::fprintf (stderr, - "Unable to allocate %ld bytes for options\n", - info.options); - return -1; - } - - char *buf_ret = (char *) ACE_OS::malloc (info.options); - if (buf_ret == 0) - { - ACE_OS::fprintf (stderr, - "Unable to allocate %ld bytes for options\n", - info.options); - return -1; - } - - ACE_OS::memset (&opt_req, 0, sizeof (opt_req)); - ACE_OS::memset (&opt_ret, 0, sizeof (opt_ret)); - - struct t_opthdr *popt = (struct t_opthdr *) buf_req; - struct t_opthdr *popt_ret = (struct t_opthdr *) buf_ret; - - popt->len= sizeof (struct t_opthdr) + opt_size; - - // We are only concerned with SVCs so no other check or values are needed - // here. - popt->level = T_ATM_SIGNALING; - popt->name = T_ATM_CONN_PROP; - popt->status = 0; - - opt_req.opt.len = popt->len; - opt_req.opt.buf = (char *) popt; - opt_req.flags = T_CURRENT; - - popt = T_OPT_NEXTHDR (buf_req, - info.options, - popt); - opt_ret.opt.maxlen = info.options; - opt_ret.opt.buf = (char *) popt_ret; - - if (ACE_OS::t_optmgmt (stream_.get_handle (), - &opt_req, - &opt_ret) < 0) { - ACE_OS::t_error ("t_optmgmt"); - return -1; - } - - ACE_OS::memcpy (connect_opts, - (char *) popt_ret + sizeof (struct t_opthdr), - opt_size); - - ACE_OS::free (buf_ret); - ACE_OS::free (buf_req); - - vpi = conn_prop.vpi; - vci = conn_prop.vci; - return 0; -#elif defined (ACE_HAS_FORE_ATM_WS2) - ATM_CONNECTION_ID connID; - DWORD bytes = 0; - - if (::WSAIoctl ((int) this -> get_handle (), - SIO_GET_ATM_CONNECTION_ID, - 0, - 0, - (LPVOID) &connID, - sizeof (ATM_CONNECTION_ID), - &bytes, - 0, - 0) - == SOCKET_ERROR) { - ACE_OS::printf ("Error: WSAIoctl %d\n", WSAGetLastError ()); - } - - vpi = (ACE_UINT16) connID.VPI; - vci = (ACE_UINT16) connID.VCI; - - return 0; -#elif defined (ACE_HAS_LINUX_ATM) -#if defined (SO_ATMPVC) /* atm version>=0.62 */ - struct sockaddr_atmpvc mypvcaddr; - int addrpvclen = sizeof (mypvcaddr); - if (ACE_OS::getsockopt (stream_.get_handle (), - SOL_ATM, - SO_ATMPVC, - reinterpret_cast (&mypvcaddr), - &addrpvclen) < 0) { - ACE_DEBUG (LM_DEBUG, - ACE_TEXT ("ACE_ATM_Stream::get_vpi_vci: getsockopt %d\n"), - errno); - return -1; - } - vpi = (ACE_UINT16) mypvcaddr.sap_addr.vpi; - vci = (ACE_UINT16) mypvcaddr.sap_addr.vci; - - return 0; -#elif defined (SO_VCID) /* patch for atm version 0.59 */ - struct atm_vcid mypvcid; - int pvcidlen = sizeof (mypvcid); - if (ACE_OS::getsockopt (stream_.get_handle (), - SOL_ATM,SO_VCID, - reinterpret_cast (&mypvcid), - &pvcidlen) < 0) { - ACE_DEBUG (LM_DEBUG, - ACE_TEXT ("ACE_ATM_Stream::get_vpi_vci: getsockopt %d\n"), - errno); - return -1; - } - vpi = (ACE_UINT16) mypvcid.vpi; - vci = (ACE_UINT16) mypvcid.vci; - - return 0; -#else - ACE_DEBUG (LM_DEBUG, - ACE_TEXT ("ACE_ATM_Stream::get_vpi_vci: Not implemented in this ATM version. Update to >= 0.62\n Or patch 0.59")); - ACE_UNUSED_ARG (vci); - ACE_UNUSED_ARG (vpi); - - return -1; -#endif /* SO_ATMPVC || SO_VCID */ -#else - return -1; -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_ATM */ diff --git a/dep/acelite/ace/ATM_Stream.h b/dep/acelite/ace/ATM_Stream.h deleted file mode 100644 index 41ffb0da32e..00000000000 --- a/dep/acelite/ace/ATM_Stream.h +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file ATM_Stream.h - * - * $Id: ATM_Stream.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Joe Hoffert - */ -//============================================================================= - - -#ifndef ACE_ATM_STREAM_H -#define ACE_ATM_STREAM_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_ATM) - -#include "ace/ATM_Addr.h" -#include "ace/ATM_Params.h" - -#if defined (ACE_WIN32) -#include "ace/SOCK_Stream.h" -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef ACE_SOCK_Stream ATM_Stream; -ACE_END_VERSIONED_NAMESPACE_DECL -#else -#include "ace/TLI_Stream.h" -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef ACE_TLI_Stream ATM_Stream; -ACE_END_VERSIONED_NAMESPACE_DECL -#endif - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_ATM_Stream - * - * @brief Defines the member functions for ACE_ATM_Stream abstraction. - */ -class ACE_Export ACE_ATM_Stream -{ -public: - // = Initialization and termination methods. - /// Default constructor. - ACE_ATM_Stream (void); - - // = ATM-specific open and shutdown operations. - /// open the stream. - int open (ACE_ATM_Params params = ACE_ATM_Params()); - - /// Close down and release resources. - int close (void); - - /// Get the underlying handle. - ACE_HANDLE get_handle (void) const; - - /// Get the underlying stream. - ATM_Stream& get_stream (void); - - /// Get the name of the connected host. - char* get_peer_name (void) const; - - /// Get the VPI and VCI of the stream. - int get_vpi_vci (ACE_UINT16 &vpi, - ACE_UINT16 &vci) const; - - /// Recv an n byte buffer from the connected transport mechanism. - ssize_t recv (void *buf, - size_t n, - int *flags = 0) const; - - /// Send exactly n bytes to the connected transport mechanism. - ssize_t send_n (const void *buf, - size_t n, - int flags) const; - - // = Meta-type info - typedef ACE_ATM_Addr PEER_ADDR; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Typedef'd to the appropriate stream mechanism above. - ATM_Stream stream_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/ATM_Stream.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_ATM */ -#include /**/ "ace/post.h" -#endif /* ACE_ATM_STREAM_H */ diff --git a/dep/acelite/ace/ATM_Stream.inl b/dep/acelite/ace/ATM_Stream.inl deleted file mode 100644 index 94de09004d4..00000000000 --- a/dep/acelite/ace/ATM_Stream.inl +++ /dev/null @@ -1,132 +0,0 @@ -// -*- C++ -*- -// $Id: ATM_Stream.inl 92474 2010-11-02 13:29:39Z johnnyw $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE void -ACE_ATM_Stream::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_ATM_Stream::dump"); -#endif /* ACE_HAS_DUMP */ -} - -ACE_INLINE -ACE_ATM_Stream::ACE_ATM_Stream (void) -{ - ACE_TRACE ("ACE_ATM_Stream::ACE_ATM_Stream"); -} - -ACE_INLINE -int -ACE_ATM_Stream::open (ACE_ATM_Params params) -{ - ACE_TRACE ("ACE_ATM_Stream::open"); -#if defined (ACE_HAS_FORE_ATM_XTI) - ACE_HANDLE handle = stream_.open (params.get_device(), - params.get_oflag(), - params.get_info()); - return (handle == ACE_INVALID_HANDLE ? -1 : 0); -#elif defined (ACE_HAS_FORE_ATM_WS2) - params.set_flags( ACE_FLAG_MULTIPOINT_C_ROOT | ACE_FLAG_MULTIPOINT_D_ROOT ); - - int retval = stream_.open (params.get_type(), - params.get_protocol_family(), - params.get_protocol(), - params.get_protocol_info(), - params.get_sock_group(), - params.get_flags(), - params.get_reuse_addr()); - if (retval == -1) - return -1; - - struct sockaddr_atm sock_addr; - - ACE_OS::memset(&sock_addr, 0, sizeof(struct sockaddr_atm)); - sock_addr.satm_family = AF_ATM; - sock_addr.satm_number.AddressType=ADDR_ANY; - sock_addr.satm_number.NumofDigits = ATM_ADDR_SIZE; - sock_addr.satm_blli.Layer2Protocol = SAP_FIELD_ABSENT; - sock_addr.satm_blli.Layer3Protocol = SAP_FIELD_ABSENT; - sock_addr.satm_bhli.HighLayerInfoType = SAP_FIELD_ABSENT; - if (ACE_OS::bind(get_handle(), - (struct sockaddr FAR *)&sock_addr, - sizeof(struct sockaddr_atm)) < 0) - { - ACE_OS::printf("Error binding local address: %d",WSAGetLastError()); - return -1; - } - - return 0; -#else - ACE_UNUSED_ARG(params); - return 0; -#endif /* ACE_HAS_FORE_ATM_XTI */ -} - -ACE_INLINE -int -ACE_ATM_Stream::close (void) -{ - ACE_TRACE ("ACE_ATM_Stream::close"); -#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) - return stream_.close (); -#else - return 0; -#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */ -} - -ACE_INLINE -ATM_Stream& -ACE_ATM_Stream::get_stream (void) -{ - ACE_TRACE ("ACE_ATM_Stream::get_stream"); - return stream_; -} - -ACE_INLINE -ssize_t -ACE_ATM_Stream::recv (void *buf, - size_t n, - int *flags) const -{ - ACE_TRACE ("ACE_ATM_Stream::recv"); -#if defined (ACE_HAS_FORE_ATM_XTI) - return stream_.recv (buf, - n, - flags); -#elif defined (ACE_HAS_FORE_ATM_WS2) - return stream_.recv (buf, - n); -#else - ACE_UNUSED_ARG(buf); - ACE_UNUSED_ARG(n); - ACE_UNUSED_ARG(flags); - return 0; -#endif /* ACE_HAS_FORE_ATM_XTI */ -} - -ACE_INLINE -ssize_t -ACE_ATM_Stream::send_n (const void *buf, - size_t n, - int flags) const -{ - ACE_TRACE ("ACE_ATM_Stream::send_n"); -#if defined (ACE_HAS_FORE_ATM_XTI) - return stream_.send_n (buf, - n, - flags); -#elif defined (ACE_HAS_FORE_ATM_WS2) - return stream_.send_n (buf, - n, - flags); -#else - ACE_UNUSED_ARG(buf); - ACE_UNUSED_ARG(n); - ACE_UNUSED_ARG(flags); - return 0; -#endif /* ACE_HAS_FORE_ATM_XTI */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Abstract_Timer_Queue.cpp b/dep/acelite/ace/Abstract_Timer_Queue.cpp deleted file mode 100644 index 3207733b24e..00000000000 --- a/dep/acelite/ace/Abstract_Timer_Queue.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//$Id: Abstract_Timer_Queue.cpp 95334 2011-12-15 12:52:50Z msmit $ - -#ifndef ACE_ABSTRACT_TIMER_QUEUE_CPP -#define ACE_ABSTRACT_TIMER_QUEUE_CPP -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Abstract_Timer_Queue.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Even though the destructor is pure virtual you must provide an -// implementation. Most people know this, but sometimes we all -// forget, and we might be tempted to remove this code. -template -ACE_Abstract_Timer_Queue:: -~ACE_Abstract_Timer_Queue () -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_ABSTRACT_TIMER_QUEUE_CPP */ diff --git a/dep/acelite/ace/Abstract_Timer_Queue.h b/dep/acelite/ace/Abstract_Timer_Queue.h deleted file mode 100644 index ddb8abf7f15..00000000000 --- a/dep/acelite/ace/Abstract_Timer_Queue.h +++ /dev/null @@ -1,230 +0,0 @@ -//$Id: Abstract_Timer_Queue.h 95368 2011-12-19 13:38:49Z mcorino $ - -#ifndef ACE_ABSTRACT_TIMER_QUEUE_H -#define ACE_ABSTRACT_TIMER_QUEUE_H - -#include /**/ "ace/pre.h" -/** - * @file Abstract_Timer_Queue.h - * - * @author Carlos O'Ryan - * - * Based on classes and files developed by Doug Schmidt, Darrell - * Brunsch, Irfan Pyarali and a cast of thousands. - */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declares -class ACE_Time_Value; -class ACE_Command_Base; -template class ACE_Timer_Queue_Iterator_T; -template class ACE_Timer_Node_T; - -/** - * @class ACE_Abstract_Timer_Queue - * - * @brief Base class for all timer queues of a single type. - * - * This is a base class for all the timer queues, regardless of - * locking strategy, upcall mechanism, internal implementation, etc. - * The class was motivated by bug 3706: - * http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=3706 - * In short, the Reactor (and potentially other classes) want to refer - * to timer queues regardless of the implementation internals. - */ -template -class ACE_Abstract_Timer_Queue -{ -public: - /// Destructor - virtual ~ACE_Abstract_Timer_Queue (void) = 0; - - /// True if queue is empty, else false. - virtual bool is_empty (void) const = 0; - - /// Returns the time of the earlier node in the Timer_Queue. Must - /// be called on a non-empty queue. - virtual const ACE_Time_Value &earliest_time (void) const = 0; - - /** - * Schedule @a type that will expire at @a future_time, which is - * specified in absolute time. If it expires then @a act is passed - * in as the value to the . If @a interval is != to - * ACE_Time_Value::zero then it is used to reschedule the @a type - * automatically, using relative time to the current . - * This method returns a that uniquely identifies the the - * @a type entry in an internal list. This can be used to - * cancel the timer before it expires. The cancellation ensures - * that are unique up to values of greater than 2 - * billion timers. As long as timers don't stay around longer than - * this there should be no problems with accidentally deleting the - * wrong timer. Returns -1 on failure (which is guaranteed never to - * be a valid ). - */ - virtual long schedule (const TYPE &type, - const void *act, - const ACE_Time_Value &future_time, - const ACE_Time_Value &interval = ACE_Time_Value::zero) = 0; - - /** - * Run the for all timers whose values are <= @a current_time. - * This does not account for . Returns the number of - * timers canceled. - */ - virtual int expire (const ACE_Time_Value ¤t_time) = 0; - - /** - * Run the for all timers whose values are <= - * . Also accounts for . - * - * Depending on the resolution of the underlying OS the system calls - * like select()/poll() might return at time different than that is - * specified in the timeout. Suppose the OS guarantees a resolution of t ms. - * The timeline will look like - * - * A B - * | | - * V V - * |-------------|-------------|-------------|-------------| - * t t t t t - * - * - * If you specify a timeout value of A, then the timeout will not occur - * at A but at the next interval of the timer, which is later than - * that is expected. Similarly, if your timeout value is equal to B, - * then the timeout will occur at interval after B. Now depending upon the - * resolution of your timeouts and the accuracy of the timeouts - * needed for your application, you should set the value of - * . In the above case, if you want the timeout A to fire - * no later than A, then you should specify your to be - * A % t. - * - * The timeout value should be specified via the macro ACE_TIMER_SKEW - * in your config.h file. The default value is zero. - * - * Things get interesting if the t before the timeout value B is zero - * i.e your timeout is less than the interval. In that case, you are - * almost sure of not getting the desired timeout behaviour. Maybe you - * should look for a better OS :-) - * - * Returns the number of timers canceled. - */ - virtual int expire (void) = 0; - - /** - * A couple of classes using Timer_Queues need to dispatch a single - * event at a time. But before they dispatch the event they need to - * release a lock, signal other threads, etc. - * - * This member function should be used in that case. The additional - * operations to be called just before dispatching the event, and - * only if an event will be dispatched, are encapsulated in the - * ACE_Command_Base object. - */ - virtual int expire_single(ACE_Command_Base & pre_dispatch_command) = 0; - - /** - * Resets the interval of the timer represented by @a timer_id to - * @a interval, which is specified in relative time to the current - * . If @a interval is equal to - * ACE_Time_Value::zero, the timer will become a non-rescheduling - * timer. Returns 0 if successful, -1 if not. - */ - virtual int reset_interval (long timer_id, - const ACE_Time_Value &interval) = 0; - - /** - * Cancel all timer associated with @a type. If - * @a dont_call_handle_close is 0 then the will be invoked, - * which typically invokes the hook. Returns number - * of timers cancelled. - */ - virtual int cancel (const TYPE &type, - int dont_call_handle_close = 1) = 0; - - /** - * Cancel the single timer that matches the @a timer_id value (which - * was returned from the method). If act is non-NULL - * then it will be set to point to the ``magic cookie'' argument - * passed in when the timer was registered. This makes it possible - * to free up the memory and avoid memory leaks. If - * @a dont_call_handle_close is 0 then the will be invoked, - * which typically calls the hook. Returns 1 if - * cancellation succeeded and 0 if the @a timer_id wasn't found. - */ - virtual int cancel (long timer_id, - const void **act = 0, - int dont_call_handle_close = 1) = 0; - - /** - * Close timer queue. Cancels all timers. - */ - virtual int close (void) = 0; - - /** - * Returns the current time of day. This method allows different - * implementations of the timer queue to use special high resolution - * timers. - */ - virtual ACE_Time_Value gettimeofday (void) = 0; - - /** - * Allows applications to control how the timer queue gets the time - * of day. - * @deprecated Use TIME_POLICY support instead. See Timer_Queue_T.h - */ - virtual void gettimeofday (ACE_Time_Value (*gettimeofday)(void)) = 0; - - /// Determine the next event to timeout. Returns @a max if there are - /// no pending timers or if all pending timers are longer than max. - /// This method acquires a lock internally since it modifies internal state. - virtual ACE_Time_Value *calculate_timeout (ACE_Time_Value *max) = 0; - - /** - * Determine the next event to timeout. Returns @a max if there are - * no pending timers or if all pending timers are longer than max. - * should be a pointer to storage for the timeout value, - * and this value is also returned. This method does not acquire a - * lock internally since it doesn't modify internal state. If you - * need to call this method when the queue is being modified - * concurrently, however, you should make sure to acquire the - * externally before making the call. - */ - virtual ACE_Time_Value *calculate_timeout (ACE_Time_Value *max, - ACE_Time_Value *the_timeout) = 0; - - /** - * Return the current time, using the right time policy and any - * timer skew defined in derived classes. - */ - virtual ACE_Time_Value current_time() = 0; - - /// Type of Iterator. - typedef ACE_Timer_Queue_Iterator_T ITERATOR; - - /// Returns a pointer to this ACE_Timer_Queue's iterator. - virtual ITERATOR & iter (void) = 0; - - /// Removes the earliest node from the queue and returns it - virtual ACE_Timer_Node_T *remove_first (void) = 0; - - /// Reads the earliest node from the queue and returns it. - virtual ACE_Timer_Node_T *get_first (void) = 0; - - /// Dump the state of a object. - virtual void dump (void) const = 0; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Abstract_Timer_Queue.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Abstract_Timer_Queue.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_ABSTRACT_TIMER_QUEUE_H */ diff --git a/dep/acelite/ace/Acceptor.cpp b/dep/acelite/ace/Acceptor.cpp deleted file mode 100644 index 72bebfd78c4..00000000000 --- a/dep/acelite/ace/Acceptor.cpp +++ /dev/null @@ -1,1249 +0,0 @@ -// $Id: Acceptor.cpp 95730 2012-05-04 17:28:19Z johnnyw $ - -#ifndef ACE_ACCEPTOR_CPP -#define ACE_ACCEPTOR_CPP - -#include "ace/ACE.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Acceptor.h" -#include "ace/Svc_Handler.h" -#include "ace/WFMO_Reactor.h" -#include "ace/OS_NS_stdio.h" -#include "ace/OS_NS_string.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Acceptor) - -template void -ACE_Acceptor::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Acceptor::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - this->peer_acceptor_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Acceptor::operator ACE_PEER_ACCEPTOR & () const -{ - ACE_TRACE ("ACE_Acceptor::operator ACE_PEER_ACCEPTOR &"); - return (ACE_PEER_ACCEPTOR &) this->peer_acceptor_; -} - -template ACE_PEER_ACCEPTOR & -ACE_Acceptor::acceptor (void) const -{ - ACE_TRACE ("ACE_Acceptor::acceptor"); - return const_cast (this->peer_acceptor_); -} - -// Returns ACE_HANDLE of the underlying Acceptor_Strategy. - -template ACE_HANDLE -ACE_Acceptor::get_handle (void) const -{ - ACE_TRACE ("ACE_Acceptor::get_handle"); - return this->peer_acceptor_.get_handle (); -} - -// Initialize the appropriate strategies for creation, passive -// connection acceptance, and concurrency, and then register -// with the Reactor and listen for connection requests at the -// designated . - -template int -ACE_Acceptor::open - (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - ACE_Reactor *reactor, - int flags, - int use_select, - int reuse_addr) -{ - ACE_TRACE ("ACE_Acceptor::open"); - this->flags_ = flags; - this->use_select_ = use_select; - this->reuse_addr_ = reuse_addr; - this->peer_acceptor_addr_ = local_addr; - - // Must supply a valid Reactor to Acceptor::open()... - - if (reactor == 0) - { - errno = EINVAL; - return -1; - } - - if (this->peer_acceptor_.open (local_addr, reuse_addr) == -1) - return -1; - - // Set the peer acceptor's handle into non-blocking mode. This is a - // safe-guard against the race condition that can otherwise occur - // between the time when indicates that a passive-mode - // socket handle is "ready" and when we call . During this - // interval, the client can shutdown the connection, in which case, - // the call can hang! - if (this->accept_strategy_->acceptor ().enable (ACE_NONBLOCK) != 0) - return -1; - - // Initialize the concurrency strategy. - - if (con_s == 0) - { - ACE_NEW_RETURN (con_s, - CONCURRENCY_STRATEGY, - -1); - this->delete_concurrency_strategy_ = true; - } - this->concurrency_strategy_ = con_s; - - // Initialize the scheduling strategy. - - if (sch_s == 0) - { - ACE_NEW_RETURN (sch_s, - SCHEDULING_STRATEGY, - -1); - this->delete_scheduling_strategy_ = true; - } - this->scheduling_strategy_ = sch_s; - - this->use_select_ = use_select; - - return this->reactor ()->register_handler - (this, - ACE_Event_Handler::ACCEPT_MASK); -} - -// Simple constructor. - -template -ACE_Strategy_Acceptor::ACE_Strategy_Acceptor - (const ACE_TCHAR service_name[], - const ACE_TCHAR service_description[], - int use_select, - int reuse_addr) - : creation_strategy_ (0), - delete_creation_strategy_ (false), - accept_strategy_ (0), - delete_accept_strategy_ (false), - concurrency_strategy_ (0), - delete_concurrency_strategy_ (false), - scheduling_strategy_ (0), - delete_scheduling_strategy_ (false), - service_name_ (0), - service_description_ (0) -{ - ACE_TRACE ("ACE_Strategy_Acceptor::ACE_Strategy_Acceptor"); - - if (service_name != 0) - ACE_ALLOCATOR (this->service_name_, - ACE_OS::strdup (service_name)); - if (service_description != 0) - ACE_ALLOCATOR (this->service_description_, - ACE_OS::strdup (service_description)); - this->use_select_ = use_select; - this->reuse_addr_ = reuse_addr; -} - -template -ACE_Strategy_Acceptor::ACE_Strategy_Acceptor - (const ACE_PEER_ACCEPTOR_ADDR &addr, - ACE_Reactor *reactor, - ACE_Creation_Strategy *cre_s, - ACE_Accept_Strategy *acc_s, - ACE_Concurrency_Strategy *con_s, - ACE_Scheduling_Strategy *sch_s, - const ACE_TCHAR service_name[], - const ACE_TCHAR service_description[], - int use_select, - int reuse_addr) - : creation_strategy_ (0), - delete_creation_strategy_ (false), - accept_strategy_ (0), - delete_accept_strategy_ (false), - concurrency_strategy_ (0), - delete_concurrency_strategy_ (false), - scheduling_strategy_ (0), - delete_scheduling_strategy_ (false), - service_name_ (0), - service_description_ (0) -{ - ACE_TRACE ("ACE_Strategy_Acceptor::ACE_Strategy_Acceptor"); - - if (this->open (addr, - reactor, - cre_s, - acc_s, - con_s, - sch_s, - service_name, - service_description, - use_select, - reuse_addr) == -1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Strategy_Acceptor::ACE_Strategy_Acceptor"))); -} - -// Perform termination activities when is removed from the -// . - -template int -ACE_Strategy_Acceptor::handle_close (ACE_HANDLE, - ACE_Reactor_Mask) -{ - ACE_TRACE ("ACE_Strategy_Acceptor::handle_close"); - // Guard against multiple closes. - if (this->reactor () != 0) - { - ACE_HANDLE handle = this->get_handle (); - - if (this->delete_creation_strategy_) - delete this->creation_strategy_; - this->delete_creation_strategy_ = false; - this->creation_strategy_ = 0; - - if (this->delete_accept_strategy_) - delete this->accept_strategy_; - this->delete_accept_strategy_ = false; - this->accept_strategy_ = 0; - - if (this->delete_concurrency_strategy_) - delete this->concurrency_strategy_; - this->delete_concurrency_strategy_ = false; - this->concurrency_strategy_ = 0; - - if (this->delete_scheduling_strategy_) - delete this->scheduling_strategy_; - this->delete_scheduling_strategy_ = false; - this->scheduling_strategy_ = 0; - - // We must use the obtained *before* we deleted the - // accept_strategy_... - - this->reactor ()->remove_handler - (handle, - ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); - - // Set the Reactor to 0 so that we don't try to close down - // again. - this->reactor (0); - } - return 0; -} - -// Bridge method for creating a . The strategy for -// creating a are configured into the Acceptor via it's -// . The default is to create a new -// . However, subclasses can override this strategy to -// perform creation in any way that they like (such as -// creating subclass instances of , using a singleton, -// dynamically linking the handler, etc.). - -template int -ACE_Strategy_Acceptor::make_svc_handler (SVC_HANDLER *&sh) -{ - ACE_TRACE ("ACE_Strategy_Acceptor::make_svc_handler"); - return this->creation_strategy_->make_svc_handler (sh); -} - -// Bridge method for accepting the new connection into the -// . The default behavior delegates to the -// in the Acceptor_Strategy. - -template int -ACE_Strategy_Acceptor::accept_svc_handler - (SVC_HANDLER *svc_handler) -{ - ACE_TRACE ("ACE_Strategy_Acceptor::accept_svc_handler"); - return this->accept_strategy_->accept_svc_handler (svc_handler); -} - -// Bridge method for activating a with the appropriate -// concurrency strategy. The default behavior of this method is to -// activate the SVC_HANDLER by calling its open() method (which allows -// the SVC_HANDLER to define its own concurrency strategy). However, -// subclasses can override this strategy to do more sophisticated -// concurrency activations (such as creating the SVC_HANDLER as an -// "active object" via multi-threading or multi-processing). - -template int -ACE_Strategy_Acceptor::activate_svc_handler - (SVC_HANDLER *svc_handler) -{ - ACE_TRACE ("ACE_Strategy_Acceptor::activate_svc_handler"); - return this->concurrency_strategy_->activate_svc_handler - (svc_handler, - (void *) this); -} - -template -ACE_Strategy_Acceptor::~ACE_Strategy_Acceptor (void) -{ - ACE_TRACE ("ACE_Strategy_Acceptor::~ACE_Strategy_Acceptor"); - ACE_OS::free ((void *) this->service_name_); - ACE_OS::free ((void *) this->service_description_); - this->handle_close (); -} - -// Signal the server to shutdown gracefully. - -template int -ACE_Strategy_Acceptor::handle_signal (int, siginfo_t *, ucontext_t *) -{ - ACE_Reactor::instance()->end_reactor_event_loop (); - return 0; -} - -template int -ACE_Strategy_Acceptor::info (ACE_TCHAR **strp, - size_t length) const -{ - ACE_TRACE ("ACE_Strategy_Acceptor::info"); - - ACE_TCHAR buf[BUFSIZ]; - ACE_TCHAR service_addr_str[BUFSIZ]; - ACE_PEER_ACCEPTOR_ADDR addr; - - if (this->acceptor ().get_local_addr (addr) == -1) - return -1; - else if (addr.addr_to_string (service_addr_str, - sizeof service_addr_str) == -1) - return -1; - - // @@ Should add the protocol in... - ACE_OS::sprintf (buf, - ACE_TEXT ("%s\t %s #%s\n"), - this->service_name_ == 0 - ? ACE_TEXT ("") - : this->service_name_, - service_addr_str, - this->service_description_ == 0 - ? ACE_TEXT ("") - : this->service_description_); - - if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0) - return -1; - else - ACE_OS::strsncpy (*strp, buf, length); - return static_cast (ACE_OS::strlen (buf)); -} - -template int -ACE_Strategy_Acceptor::fini (void) -{ - ACE_TRACE ("ACE_Strategy_Acceptor::fini"); - return this->ACE_Strategy_Acceptor::handle_close (); -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Oneshot_Acceptor) - -template void -ACE_Oneshot_Acceptor::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Oneshot_Acceptor::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nsvc_handler_ = %x"), this->svc_handler_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nrestart_ = %d"), this->restart_)); - this->peer_acceptor_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("delete_concurrency_strategy_ = %d"), - delete_concurrency_strategy_)); - this->concurrency_strategy_->dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template int -ACE_Oneshot_Acceptor::open - (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - ACE_Reactor *reactor, - ACE_Concurrency_Strategy *con_s) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::open"); - this->reactor (reactor); - - // Initialize the concurrency strategy. - - if (con_s == 0) - { - ACE_NEW_RETURN (con_s, - ACE_Concurrency_Strategy, - -1); - this->delete_concurrency_strategy_ = true; - } - this->concurrency_strategy_ = con_s; - - // Reuse the addr, even if it is already in use...! - return this->peer_acceptor_.open (local_addr, 1); -} - -template -ACE_Oneshot_Acceptor::ACE_Oneshot_Acceptor (void) - : svc_handler_ (0), - restart_ (false), - concurrency_strategy_ (0), - delete_concurrency_strategy_ (false) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::ACE_Oneshot_Acceptor"); - this->reactor (0); -} - -template -ACE_Oneshot_Acceptor::ACE_Oneshot_Acceptor - (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - ACE_Reactor *reactor, - ACE_Concurrency_Strategy *cs) - : svc_handler_ (0), - restart_ (false), - concurrency_strategy_ (0), - delete_concurrency_strategy_ (false) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::ACE_Oneshot_Acceptor"); - if (this->open (local_addr, reactor, cs) == -1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Oneshot_Acceptor::ACE_Oneshot_Acceptor"))); -} - -template -ACE_Oneshot_Acceptor::~ACE_Oneshot_Acceptor (void) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::~ACE_Oneshot_Acceptor"); - this->handle_close (); -} - -template int -ACE_Oneshot_Acceptor::close (void) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::close"); - return this->handle_close (); -} - -template int -ACE_Oneshot_Acceptor::handle_close (ACE_HANDLE, - ACE_Reactor_Mask) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::handle_close"); - - // Guard against multiple closes. - if (this->delete_concurrency_strategy_) - { - delete this->concurrency_strategy_; - this->delete_concurrency_strategy_ = false; - this->concurrency_strategy_ = 0; - } - // Note that if we aren't actually registered with the - // ACE_Reactor then it's ok for this call to fail... - - if (this->reactor ()) - this->reactor ()->remove_handler - (this, - ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); - - if (this->peer_acceptor_.close () == -1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("close\n"))); - return 0; -} - -template int -ACE_Oneshot_Acceptor::handle_timeout - (const ACE_Time_Value &tv, - const void *arg) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::handle_timeout"); - errno = ETIME; - - if (this->svc_handler_->handle_timeout (tv, arg) == -1) - this->svc_handler_->handle_close (this->svc_handler_->get_handle (), - ACE_Event_Handler::TIMER_MASK); - - // Since we aren't necessarily registered with the Reactor, don't - // bother to check the return value here... - if (this->reactor ()) - this->reactor ()->remove_handler (this, - ACE_Event_Handler::ACCEPT_MASK); - return 0; -} - -template int -ACE_Oneshot_Acceptor::cancel (void) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::cancel"); - return this->reactor () && this->reactor ()->cancel_timer (this); -} - -template int -ACE_Oneshot_Acceptor::register_handler - (SVC_HANDLER *svc_handler, - const ACE_Synch_Options &synch_options, - bool restart) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::register_handler"); - // Can't do this if we don't have a Reactor. - if (this->reactor () == 0) - { - errno = EINVAL; - return -1; - } - else - { - this->svc_handler_ = svc_handler; - this->restart_ = restart; - ACE_Time_Value *tv = (ACE_Time_Value *) synch_options.time_value (); - - if (tv != 0 - && this->reactor ()->schedule_timer (this, - synch_options.arg (), - *tv) == -1) - return -1; - else - return this->reactor ()->register_handler - (this, - ACE_Event_Handler::ACCEPT_MASK); - } -} - -// Bridge method for activating a with the appropriate -// concurrency strategy. The default behavior of this method is to -// activate the SVC_HANDLER by calling its open() method (which allows -// the SVC_HANDLER to define its own concurrency strategy). However, -// subclasses can override this strategy to do more sophisticated -// concurrency activations (such as creating the SVC_HANDLER as an -// "active object" via multi-threading or multi-processing). - -template int -ACE_Oneshot_Acceptor::activate_svc_handler - (SVC_HANDLER *svc_handler) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::activate_svc_handler"); - return this->concurrency_strategy_->activate_svc_handler - (svc_handler, - (void *) this); -} - -// Factors out the code shared between the and -// methods. - -template int -ACE_Oneshot_Acceptor::shared_accept - (SVC_HANDLER *svc_handler, - ACE_PEER_ACCEPTOR_ADDR *remote_addr, - ACE_Time_Value *timeout, - bool restart, - bool reset_new_handle) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::shared_accept"); - if (svc_handler == 0) - return -1; - - // Accept connection into the Svc_Handler. - else if (this->peer_acceptor_.accept (svc_handler->peer (), // stream - remote_addr, // remote address - timeout, // timeout - restart, // restart - reset_new_handle // reset new handle - ) == -1) - { - // Check whether we just timed out or whether we failed... - if (!(errno == EWOULDBLOCK || errno == ETIME)) - // Close down handler to avoid memory leaks. - svc_handler->close (CLOSE_DURING_NEW_CONNECTION); - return -1; - } - // Activate the using the designated concurrency - // strategy (note that this method becomes responsible for handling - // errors and freeing up the memory if things go awry...) - else - return this->activate_svc_handler (svc_handler); -} - -// Make a SVC_HANDLER, accept the connection into the SVC_HANDLER, and -// then activate the SVC_HANDLER. Note that SVC_HANDLER::open() -// decides what type of concurrency strategy to use. - -template int -ACE_Oneshot_Acceptor::accept - (SVC_HANDLER *svc_handler, - ACE_PEER_ACCEPTOR_ADDR *remote_addr, - const ACE_Synch_Options &synch_options, - bool restart, - bool reset_new_handle) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::accept"); - // Note that if timeout == ACE_Time_Value (x, y) where (x > 0 || y > - // 0) then this->connector_.connect() will block synchronously. If - // is set then we don't want this to happen (since we - // want the ACE_Reactor to do the timeout asynchronously). - // Therefore, we'll force this->connector_ to use ACE_Time_Value (0, - // 0) in this case... - - ACE_Time_Value *timeout; - int use_reactor = synch_options[ACE_Synch_Options::USE_REACTOR]; - - if (use_reactor) - timeout = (ACE_Time_Value *) &ACE_Time_Value::zero; - else - timeout = (ACE_Time_Value *) synch_options.time_value (); - - if (this->shared_accept (svc_handler, // stream - remote_addr, // remote address - timeout, // timeout - restart, // restart - reset_new_handle // reset new handler - ) == -1) - { - if (use_reactor && errno == EWOULDBLOCK) - // We couldn't accept right away, so let's wait in the - // . - this->register_handler (svc_handler, - synch_options, - restart); - return -1; - } - return 0; -} - -// Accepts one pending connection from a client (since we're the -// "oneshot" Acceptor). - -template int -ACE_Oneshot_Acceptor::handle_input (ACE_HANDLE) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::handle_input"); - int result = 0; - - // Cancel any timer that might be pending. - this->cancel (); - - // Try to find out if the implementation of the reactor that we are - // using requires us to reset the event association for the newly - // created handle. This is because the newly created handle will - // inherit the properties of the listen handle, including its event - // associations. - bool const reset_new_handle = this->reactor ()->uses_event_associations (); - - // There is a use-case whereby this object will be gone upon return - // from shared_accept - if the Svc_Handler deletes this Oneshot_Acceptor - // during the shared_accept/activation steps. So, do whatever we need - // to do with this object before calling shared_accept. - if (this->reactor ()) - this->reactor ()->remove_handler - (this, - ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); - - if (this->shared_accept (this->svc_handler_, // stream - 0, // remote address - 0, // timeout - this->restart_, // restart - reset_new_handle // reset new handle - ) == -1) - result = -1; - - return result; -} - -// Hook called by the explicit dynamic linking facility. - -template int -ACE_Oneshot_Acceptor::init (int, ACE_TCHAR *[]) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::init"); - return -1; -} - -template int -ACE_Oneshot_Acceptor::fini (void) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::fini"); - return this->handle_close (); -} - -template int -ACE_Oneshot_Acceptor::info (ACE_TCHAR **strp, - size_t length) const -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::info"); - ACE_TCHAR buf[BUFSIZ]; - ACE_TCHAR addr_str[BUFSIZ]; - ACE_PEER_ACCEPTOR_ADDR addr; - - if (this->peer_acceptor_.get_local_addr (addr) == -1) - return -1; - else if (addr.addr_to_string (addr_str, sizeof addr_str) == -1) - return -1; - - ACE_OS::sprintf (buf, - ACE_TEXT ("%s\t %s %s"), - ACE_TEXT ("ACE_Oneshot_Acceptor"), - addr_str, - ACE_TEXT ("#oneshot acceptor factory\n")); - - if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0) - return -1; - else - ACE_OS::strsncpy (*strp, buf, length); - return static_cast (ACE_OS::strlen (buf)); -} - -template int -ACE_Oneshot_Acceptor::suspend (void) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::suspend"); - return this->reactor () && this->reactor ()->suspend_handler (this); -} - -template int -ACE_Oneshot_Acceptor::resume (void) -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::resume"); - return this->reactor () && this->reactor ()->resume_handler (this); -} - -// Returns ACE_HANDLE of the underlying peer_acceptor. - -template ACE_HANDLE -ACE_Oneshot_Acceptor::get_handle (void) const -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::get_handle"); - return this->peer_acceptor_.get_handle (); -} - -template ACE_PEER_ACCEPTOR & -ACE_Oneshot_Acceptor::acceptor (void) const -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::acceptor"); - return (ACE_PEER_ACCEPTOR &) this->peer_acceptor_; -} - -template -ACE_Oneshot_Acceptor::operator ACE_PEER_ACCEPTOR & () const -{ - ACE_TRACE ("ACE_Oneshot_Acceptor::operator ACE_PEER_ACCEPTOR &"); - return (ACE_PEER_ACCEPTOR &) this->peer_acceptor_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_ACCEPTOR_CPP */ diff --git a/dep/acelite/ace/Acceptor.h b/dep/acelite/ace/Acceptor.h deleted file mode 100644 index fdd00d5a04d..00000000000 --- a/dep/acelite/ace/Acceptor.h +++ /dev/null @@ -1,695 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Acceptor.h - * - * $Id: Acceptor.h 93624 2011-03-22 21:14:05Z johnnyw $ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_ACCEPTOR_H -#define ACE_ACCEPTOR_H - -#include /**/ "ace/pre.h" - -#include "ace/Service_Object.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Strategies_T.h" -#include "ace/Synch_Options.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Acceptor - * - * @brief Abstract factory for creating a service handler - * (SVC_HANDLER), accepting into the SVC_HANDLER, and - * activating the SVC_HANDLER. - * - * Implements the basic strategy for passively establishing - * connections with clients. An ACE_Acceptor is parameterized - * by concrete types that conform to the interfaces of - * PEER_ACCEPTOR and SVC_HANDLER. The PEER_ACCEPTOR is - * instantiated with a transport mechanism that passively - * establishes connections. The SVC_HANDLER is instantiated - * with a concrete type that performs the application-specific - * service. An ACE_Acceptor inherits from ACE_Service_Object, - * which in turn inherits from ACE_Event_Handler. This enables - * the ACE_Reactor to dispatch the ACE_Acceptor's handle_input - * method when connection events occur. The handle_input method - * performs the ACE_Acceptor's default creation, connection - * establishment, and service activation strategies. These - * strategies can be overridden by subclasses individually or as - * a group. - */ -template -class ACE_Acceptor : public ACE_Service_Object -{ -public: - - // Useful STL-style traits. - typedef ACE_PEER_ACCEPTOR_ADDR addr_type; - typedef ACE_PEER_ACCEPTOR acceptor_type; - typedef SVC_HANDLER handler_type; - typedef typename SVC_HANDLER::stream_type stream_type; - - /// "Do-nothing" constructor. - ACE_Acceptor (ACE_Reactor * = 0, - int use_select = 1); - - /** - * Open the contained @c PEER_ACCEPTOR object to begin listening, and - * register with the specified reactor for accept events. An - * acceptor can only listen to one port at a time, so make sure to - * @c close() the acceptor before calling @c open() again. - * - * The @c PEER_ACCEPTOR handle is put into non-blocking mode as a - * safeguard against the race condition that can otherwise occur - * between the time when the passive-mode socket handle is "ready" - * and when the actual @c accept() call is made. During this - * interval, the client can shutdown the connection, in which case, - * the @c accept() call can hang. - * - * @param local_addr The address to listen at. - * @param reactor Pointer to the ACE_Reactor instance to register - * this object with. The default is the singleton. - * @param flags Flags to control what mode an accepted socket - * will be put into after it is accepted. The only - * legal value for this argument is @c ACE_NONBLOCK, - * which enables non-blocking mode on the accepted - * peer stream object in @c SVC_HANDLER. The default - * is 0. - * @param use_select Affects behavior when called back by the reactor - * when a connection can be accepted. If non-zero, - * this object will accept all pending connections, - * instead of just the one that triggered the reactor - * callback. Uses ACE_OS::select() internally to - * detect any remaining acceptable connections. - * The default is 1. - * @param reuse_addr Passed to the @c PEER_ACCEPTOR::open() method with - * @p local_addr. Generally used to request that the - * OS allow reuse of the listen port. The default is 1. - */ - ACE_Acceptor (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - ACE_Reactor *reactor = ACE_Reactor::instance (), - int flags = 0, - int use_select = 1, - int reuse_addr = 1); - - /** - * Open the contained @c PEER_ACCEPTOR object to begin listening, and - * register with the specified reactor for accept events. An - * acceptor can only listen to one port at a time, so make sure to - * @c close() the acceptor before calling @c open() again. - * - * The @c PEER_ACCEPTOR handle is put into non-blocking mode as a - * safeguard against the race condition that can otherwise occur - * between the time when the passive-mode socket handle is "ready" - * and when the actual @c accept() call is made. During this - * interval, the client can shutdown the connection, in which case, - * the @c accept() call can hang. - * - * @param local_addr The address to listen at. - * @param reactor Pointer to the ACE_Reactor instance to register - * this object with. The default is the singleton. - * @param flags Flags to control what mode an accepted socket - * will be put into after it is accepted. The only - * legal value for this argument is @c ACE_NONBLOCK, - * which enables non-blocking mode on the accepted - * peer stream object in @c SVC_HANDLER. The default - * is 0. - * @param use_select Affects behavior when called back by the reactor - * when a connection can be accepted. If non-zero, - * this object will accept all pending connections, - * instead of just the one that triggered the reactor - * callback. Uses ACE_OS::select() internally to - * detect any remaining acceptable connections. - * The default is 1. - * @param reuse_addr Passed to the @c PEER_ACCEPTOR::open() method with - * @p local_addr. Generally used to request that the - * OS allow reuse of the listen port. The default is 1. - * - * @retval 0 Success - * @retval -1 Failure, @c errno contains an error code. - */ - virtual int open (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - ACE_Reactor *reactor = ACE_Reactor::instance (), - int flags = 0, - int use_select = 1, - int reuse_addr = 1); - - /// Close down the Acceptor's resources. - virtual ~ACE_Acceptor (void); - - /// Return the underlying PEER_ACCEPTOR object. - virtual operator ACE_PEER_ACCEPTOR &() const; - - /// Return the underlying PEER_ACCEPTOR object. - virtual ACE_PEER_ACCEPTOR &acceptor (void) const; - - /// Returns the listening acceptor's {ACE_HANDLE}. - virtual ACE_HANDLE get_handle (void) const; - - /// Close down the Acceptor - virtual int close (void); - - /// In the event that an accept fails, this method will be called and - /// the return value will be returned from handle_input(). - virtual int handle_accept_error (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - // = The following three methods define the Acceptor's strategies - // for creating, accepting, and activating SVC_HANDLER's, - // respectively. - - /** - * Bridge method for creating a SVC_HANDLER. The default is to - * create a new {SVC_HANDLER} if {sh} == 0, else {sh} is unchanged. - * However, subclasses can override this policy to perform - * SVC_HANDLER creation in any way that they like (such as creating - * subclass instances of SVC_HANDLER, using a singleton, dynamically - * linking the handler, etc.). Returns -1 on failure, else 0. - */ - virtual int make_svc_handler (SVC_HANDLER *&sh); - - /** - * Bridge method for accepting the new connection into the - * @a svc_handler. The default behavior delegates to the - * PEER_ACCEPTOR::accept. - */ - virtual int accept_svc_handler (SVC_HANDLER *svc_handler); - - /** - * Bridge method for activating a @a svc_handler with the appropriate - * concurrency strategy. The default behavior of this method is to - * activate the SVC_HANDLER by calling its open() method (which - * allows the SVC_HANDLER to define its own concurrency strategy). - * However, subclasses can override this strategy to do more - * sophisticated concurrency activations (such as making the - * SVC_HANDLER as an "active object" via multi-threading or - * multi-processing). - */ - virtual int activate_svc_handler (SVC_HANDLER *svc_handler); - - // = Demultiplexing hooks. - /// Perform termination activities when {this} is removed from the - /// {reactor}. - virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE, - ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); - - /// Accepts all pending connections from clients, and creates and - /// activates SVC_HANDLERs. - virtual int handle_input (ACE_HANDLE); - - // = Dynamic linking hooks. - /// Default version does no work and returns -1. Must be overloaded - /// by application developer to do anything meaningful. - virtual int init (int argc, ACE_TCHAR *argv[]); - - /// Calls {handle_close}. - virtual int fini (void); - - /// Default version returns address info in {buf}. - virtual int info (ACE_TCHAR **buf, size_t) const; - -public: - // = Service management hooks. - /// This method calls {Reactor::suspend}. - virtual int suspend (void); - - /// This method calls {Reactor::resume}. - virtual int resume (void); - -protected: - /// Concrete factory for accepting connections from clients... - ACE_PEER_ACCEPTOR peer_acceptor_; - - /// Needed to reopen the socket if {accept} fails. - ACE_PEER_ACCEPTOR_ADDR peer_acceptor_addr_; - - /** - * Flags that indicate how {SVC_HANDLER}'s should be initialized - * prior to being activated. Right now, the only flag that is - * processed is {ACE_NONBLOCK}, which enabled non-blocking I/O on - * the {SVC_HANDLER} when it is opened. - */ - int flags_; - - /// Flag that indicates whether it shall use {select} in the - /// {accept}-loop. - int use_select_; - - /// Needed to reopen the socket if {accept} fails. - int reuse_addr_; -}; - -/** - * @class ACE_Strategy_Acceptor - * - * @brief Abstract factory for creating a service handler - * (SVC_HANDLER), accepting into the SVC_HANDLER, and activating - * the SVC_HANDLER. - * - * Implements a flexible and extensible set of strategies for - * passively establishing connections with clients. There are - * three main strategies: (1) creating a SVC_HANDLER, (2) - * passively accepting a new connection from a client into the - * SVC_HANDLER, and (3) activating the SVC_HANDLER with a - * particular concurrency mechanism. - */ -template -class ACE_Strategy_Acceptor - : public ACE_Acceptor -{ -public: - - // Useful STL-style traits. - typedef ACE_Creation_Strategy - creation_strategy_type; - typedef ACE_Accept_Strategy - accept_strategy_type; - typedef ACE_Concurrency_Strategy - concurrency_strategy_type; - typedef ACE_Scheduling_Strategy scheduling_strategy_type; - typedef ACE_Acceptor - base_type; - - // = Define some useful (old style) traits. - typedef ACE_Creation_Strategy CREATION_STRATEGY; - typedef ACE_Accept_Strategy ACCEPT_STRATEGY; - typedef ACE_Concurrency_Strategy CONCURRENCY_STRATEGY; - typedef ACE_Scheduling_Strategy SCHEDULING_STRATEGY; - - /// Default constructor. - ACE_Strategy_Acceptor (const ACE_TCHAR service_name[] = 0, - const ACE_TCHAR service_description[] = 0, - int use_select = 1, - int reuse_addr = 1); - - /** - * Initialize the appropriate strategies for creation, passive - * connection acceptance, and concurrency, and then register {this} - * with the Reactor and listen for connection requests at the - * designated {local_addr}. - */ - ACE_Strategy_Acceptor (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - ACE_Reactor * = ACE_Reactor::instance (), - ACE_Creation_Strategy * = 0, - ACE_Accept_Strategy * = 0, - ACE_Concurrency_Strategy * = 0, - ACE_Scheduling_Strategy * = 0, - const ACE_TCHAR service_name[] = 0, - const ACE_TCHAR service_description[] = 0, - int use_select = 1, - int reuse_addr = 1); - - /** - * Open the contained @c PEER_ACCEPTOR object to begin listening, and - * register with the specified reactor for accept events. - * - * The @c PEER_ACCEPTOR handle is put into non-blocking mode as a - * safeguard against the race condition that can otherwise occur - * between the time when the passive-mode socket handle is "ready" - * and when the actual @c accept call is made. During this - * interval, the client can shutdown the connection, in which case, - * the {accept} call can hang. - * - * @param local_addr The address to listen at. - * @param reactor Pointer to the ACE_Reactor instance to register - * this object with. The default is the singleton. - * @param flags Flags to control what mode an accepted socket - * will be put into after it is accepted. The only - * legal value for this argument is @c ACE_NONBLOCK, - * which enables non-blocking mode on the accepted - * peer stream object in @c SVC_HANDLER. The default - * is 0. - * @param use_select Affects behavior when called back by the reactor - * when a connection can be accepted. If non-zero, - * this object will accept all pending connections, - * instead of just the one that triggered the reactor - * callback. Uses ACE_OS::select() internally to - * detect any remaining acceptable connections. - * The default is 1. - * @param reuse_addr Passed to the @c PEER_ACCEPTOR::open() method with - * @p local_addr. Generally used to request that the - * OS allow reuse of the listen port. The default is 1. - * - * @retval 0 Success - * @retval -1 Failure, @c errno contains an error code. - */ - virtual int open (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - ACE_Reactor *reactor, - int flags = 0, - int use_select = 1, - int reuse_addr = 1); - - /** - * Initialize the appropriate strategies for creation, passive - * connection acceptance, and concurrency, and then register {this} - * with the Reactor and listen for connection requests at the - * designated {local_addr}. - */ - virtual int open (const ACE_PEER_ACCEPTOR_ADDR &, - ACE_Reactor * = ACE_Reactor::instance (), - ACE_Creation_Strategy * = 0, - ACE_Accept_Strategy * =0, - ACE_Concurrency_Strategy * = 0, - ACE_Scheduling_Strategy * = 0, - const ACE_TCHAR *service_name = 0, - const ACE_TCHAR *service_description = 0, - int use_select = 1, - int reuse_addr = 1); - - /// Close down the Strategy_Acceptor's resources. - virtual ~ACE_Strategy_Acceptor (void); - - /// Return the underlying PEER_ACCEPTOR object. - virtual operator ACE_PEER_ACCEPTOR &() const; - - /// Return the underlying PEER_ACCEPTOR object. - virtual ACE_PEER_ACCEPTOR &acceptor (void) const; - - /// Returns the listening acceptor's {ACE_HANDLE}. - virtual ACE_HANDLE get_handle (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - // = Service management hooks. - - /// This method delegates to the {Scheduling_Strategy}'s {suspend} - /// method. - virtual int suspend (void); - - /// This method delegates to the {Scheduling_Strategy}'s {resume} - /// method. - virtual int resume (void); - -protected: - - /// Calls {handle_close} when dynamically unlinked. - virtual int fini (void); - - /// Default version returns address info in {buf}. - virtual int info (ACE_TCHAR **buf, size_t) const; - - // = The following three methods define the {Acceptor}'s strategies - // for creating, accepting, and activating {SVC_HANDLER}'s, - // respectively. - - /** - * Bridge method for creating a {SVC_HANDLER}. The strategy for - * creating a {SVC_HANDLER} are configured into the Acceptor via - * it's {creation_strategy_}. The default is to create a new - * {SVC_HANDLER} if {sh} == 0, else {sh} is unchanged. However, - * subclasses can override this policy to perform {SVC_HANDLER} - * creation in any way that they like (such as creating subclass - * instances of {SVC_HANDLER}, using a singleton, dynamically - * linking the handler, etc.). Returns -1 on failure, else 0. - */ - virtual int make_svc_handler (SVC_HANDLER *&); - - /** - * Bridge method for accepting the new connection into the - * {SVC_HANDLER}. The default behavior delegates to the - * {PEER_ACCEPTOR::accept} in the {Acceptor_Strategy}. - */ - virtual int accept_svc_handler (SVC_HANDLER *svc_handler); - - /** - * Bridge method for activating a {SVC_HANDLER} with the appropriate - * concurrency strategy. The default behavior of this method is to - * activate the {SVC_HANDLER} by calling its {open} method (which - * allows the {SVC_HANDLER} to define its own concurrency strategy). - * However, subclasses can override this strategy to do more - * sophisticated concurrency activations (such as creating the - * {SVC_HANDLER} as an "active object" via multi-threading or - * multi-processing). - */ - virtual int activate_svc_handler (SVC_HANDLER *svc_handler); - - // = Demultiplexing hooks. - /// Perform termination activities when {this} is removed from the - /// {Reactor}. - virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE, - ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); - - /// Handle SIGINT. - virtual int handle_signal (int signum, siginfo_t *, ucontext_t *); - - // = These data members are "logically private" but are put in the - // protected part in case subclasses want to access them. - - // = Strategy objects. - - /// Creation strategy for an Acceptor. - CREATION_STRATEGY *creation_strategy_; - - /// true if {Acceptor} created the creation strategy and thus should - /// delete it, else false. - bool delete_creation_strategy_; - - /// Accept strategy for an {Acceptor}. - ACCEPT_STRATEGY *accept_strategy_; - - /// true if {Acceptor} created the accept strategy and thus should delete - /// it, else false. - bool delete_accept_strategy_; - - /// Concurrency strategy for an {Acceptor}. - CONCURRENCY_STRATEGY *concurrency_strategy_; - - /// true if {Acceptor} created the concurrency strategy and thus should - /// delete it, else false. - bool delete_concurrency_strategy_; - - /// Scheduling strategy for an {Acceptor}. - SCHEDULING_STRATEGY *scheduling_strategy_; - - /// true if {Acceptor} created the scheduling strategy and thus should - /// delete it, else false. - bool delete_scheduling_strategy_; - - // = Service information objects. - - /// Name of the service. - ACE_TCHAR *service_name_; - - /// Description of the service. - ACE_TCHAR *service_description_; - - /// Address that the {Strategy_Acceptor} uses to listen for - /// connections. - ACE_PEER_ACCEPTOR_ADDR service_addr_; -}; - -/** - * @class ACE_Oneshot_Acceptor - * - * @brief Generic factory for passively connecting clients and creating - * exactly one service handler of the type SVC_HANDLER specified in the - * template. - * - * This class works similarly to the regular ACE_Acceptor, but - * with the following differences: - * -# ACE_Oneshot_Acceptor doesn't automatically register itself with the - * ACE_Reactor; the caller is expected to call the accept() method - * directly. Since a later call to accept() may require a reactor, - * the constructor and open() methods both accept an ACE_Reactor pointer - * which is saved in case it's needed in accept(). - * -# ACE_Oneshot_Acceptor doesn't need an ACE_Creation_Strategy (because - * the user supplies the SVC_HANDLER) or an ACE_Accept_Strategy (because - * this class only accepts one connection and then removes all traces of - * itself from the ACE_Reactor if it was registered for asynchronous - * accepts). - * - * The usage model for ACE_Oneshot_Acceptor is: - * - Instantiate an object and establish its local address to listen at. - * This can be accomplished using either the address-accepting constructor - * (but there's no error indication) or the default constructor followed - * by a call to open(). - * - Call the accept() method. This will attempt to accept a connection - * immediately. If there is no immediately available connection to accept, - * behavior is governed by the ACE_Synch_Options argument passed to open(). - */ -template -class ACE_Oneshot_Acceptor : public ACE_Service_Object -{ -public: - - // Useful STL-style traits. - typedef ACE_PEER_ACCEPTOR_ADDR addr_type; - typedef ACE_PEER_ACCEPTOR acceptor_type; - typedef SVC_HANDLER handler_type; - typedef typename SVC_HANDLER::stream_type stream_type; - - /// Constructor. - ACE_Oneshot_Acceptor (void); - - /** - * Initialize the appropriate strategies for concurrency and then - * open the acceptor at the designated @a local_addr. Note - * that unlike ACE_Acceptor and ACE_Strategy_Acceptor, this - * method does NOT register this acceptor with the @a reactor at - * this point -- the @a reactor parameter is saved in case it's - * needed later. - */ - ACE_Oneshot_Acceptor (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - ACE_Reactor *reactor = ACE_Reactor::instance (), - ACE_Concurrency_Strategy * = 0); - - /** - * Initialize the appropriate strategies for concurrency and then - * open the acceptor at the designated @a local_addr. Note - * that unlike ACE_Acceptor and ACE_Strategy_Acceptor, this - * method does NOT register this acceptor with the @a reactor at - * this point -- the @a reactor parameter is saved in case it's - * needed later. - */ - int open (const ACE_PEER_ACCEPTOR_ADDR &, - ACE_Reactor *reactor = ACE_Reactor::instance (), - ACE_Concurrency_Strategy * = 0); - - /// Close down the {Oneshot_Acceptor}. - virtual ~ACE_Oneshot_Acceptor (void); - - // = Explicit factory operation. - /// Create a {SVC_HANDLER}, accept the connection into the - /// {SVC_HANDLER}, and activate the {SVC_HANDLER}. - virtual int accept (SVC_HANDLER * = 0, - ACE_PEER_ACCEPTOR_ADDR *remote_addr = 0, - const ACE_Synch_Options &synch_options = ACE_Synch_Options::defaults, - bool restart = true, - bool reset_new_handle = false); - - /// Cancel a oneshot acceptor that was started asynchronously. - virtual int cancel (void); - - /// Return the underlying {PEER_ACCEPTOR} object. - virtual operator ACE_PEER_ACCEPTOR &() const; - - /// Return the underlying {PEER_ACCEPTOR} object. - virtual ACE_PEER_ACCEPTOR &acceptor (void) const; - - /// Close down the {Oneshot_Acceptor}. - virtual int close (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /** - * Bridge method for activating a {svc_handler} with the appropriate - * concurrency strategy. Default behavior is to activate the - * {SVC_HANDLER} as a "passive object." However, subclasses can - * override this strategy to do more sophisticated concurrency - * activations (such as creating the {SVC_HANDLER} as an "active - * object" via multi-threading or multi-processing). - */ - virtual int activate_svc_handler (SVC_HANDLER *svc_handler); - - /// Factors out the code shared between the {accept} and - /// {handle_input} methods. - int shared_accept (SVC_HANDLER *svc_handler, - ACE_PEER_ACCEPTOR_ADDR *remote_addr, - ACE_Time_Value *timeout, - bool restart, - bool reset_new_handle); - - // = Demultiplexing hooks. - /// Returns the listening acceptor's {ACE_HANDLE}. - virtual ACE_HANDLE get_handle (void) const; - - /// Perform termination activities when {this} is removed from the - /// {reactor}. - virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE, - ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); - - /// Accept one connection from a client and activates the - /// SVC_HANDLER. - virtual int handle_input (ACE_HANDLE); - - /// Called when an acceptor times out... - virtual int handle_timeout (const ACE_Time_Value &tv, - const void *arg); - - // = Dynamic linking hooks. - /// Default version does no work and returns -1. Must be overloaded - /// by application developer to do anything meaningful. - virtual int init (int argc, ACE_TCHAR *argv[]); - - /// Default version does no work and returns -1. Must be overloaded - /// by application developer to do anything meaningful. - virtual int fini (void); - - /// Default version returns address info in {buf}. - virtual int info (ACE_TCHAR **, size_t) const; - - // = Service management hooks. - /// Default version does no work and returns -1. Must be overloaded - /// by application developer to do anything meaningful. - virtual int suspend (void); - - /// Default version does no work and returns -1. Must be overloaded - /// by application developer to do anything meaningful. - virtual int resume (void); - -private: - /** - * Insert ourselves into the {ACE_Reactor} so that we can continue - * accepting this connection asynchronously. This method should NOT - * be called by developers directly. - */ - int register_handler (SVC_HANDLER *svc_handler, - const ACE_Synch_Options &options, - bool restart); - - /// Hold the svc_handler_ across asynchrony boundaries. - SVC_HANDLER *svc_handler_; - - /// Hold the restart flag across asynchrony boundaries. - bool restart_; - - /// Factory that establishes connections passively. - ACE_PEER_ACCEPTOR peer_acceptor_; - - /// Concurrency strategy for an Acceptor. - ACE_Concurrency_Strategy *concurrency_strategy_; - - /// true if Acceptor created the concurrency strategy and thus should - /// delete it, else false. - bool delete_concurrency_strategy_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Acceptor.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Acceptor.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_ACCEPTOR_H */ diff --git a/dep/acelite/ace/Activation_Queue.cpp b/dep/acelite/ace/Activation_Queue.cpp deleted file mode 100644 index 777dc3ad03c..00000000000 --- a/dep/acelite/ace/Activation_Queue.cpp +++ /dev/null @@ -1,136 +0,0 @@ -// $Id: Activation_Queue.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/Activation_Queue.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Activation_Queue.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Log_Msg.h" -#include "ace/Method_Request.h" -#include "ace/Malloc_Base.h" -#include "ace/Time_Value.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -void -ACE_Activation_Queue::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("delete_queue_ = %d\n"), - this->delete_queue_)); - ACE_DEBUG ((LM_INFO, ACE_TEXT ("queue_:\n"))); - if (this->queue_) - this->queue_->dump(); - else - //FUZZ: disable check_for_NULL - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(NULL)\n"))); - //FUZZ: enable check_for_NULL - - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Activation_Queue::ACE_Activation_Queue (ACE_Message_Queue *new_queue, - ACE_Allocator *alloc, - ACE_Allocator *db_alloc) - : delete_queue_ (false) - , allocator_(alloc) - , data_block_allocator_(db_alloc) -{ - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - if (new_queue) - this->queue_ = new_queue; - else - { - ACE_NEW (this->queue_, - ACE_Message_Queue); - this->delete_queue_ = true; - } -} - -void -ACE_Activation_Queue::queue (ACE_Message_Queue *q) -{ - // Destroy the internal queue if one exist. - if (this->delete_queue_) - { - // Destroy the current queue. - delete this->queue_; - - // Set the flag to false. NOTE that the delete_queue_ flag is a - // flag used to only indicate whether or not if an internal - // ACE_Message_Queue has been created, therefore, it will not - // affect the user if the user decided to replace the queue with - // their own queue no matter how many time they call on this - // function. - this->delete_queue_ = false; - } - - queue_ = q; -} - -ACE_Activation_Queue::~ACE_Activation_Queue (void) -{ - if (this->delete_queue_) - delete this->queue_; -} - -ACE_Method_Request * -ACE_Activation_Queue::dequeue (ACE_Time_Value *tv) -{ - ACE_Message_Block *mb = 0; - - // Dequeue the message. - if (this->queue_->dequeue_head (mb, tv) != -1) - { - // Get the next . - ACE_Method_Request *mr = - reinterpret_cast (mb->base ()); - // Delete the message block. - mb->release (); - return mr; - } - else - return 0; -} - -int -ACE_Activation_Queue::enqueue (ACE_Method_Request *mr, - ACE_Time_Value *tv) -{ - ACE_Message_Block *mb = 0; - - // We pass sizeof (*mr) here so that flow control will work - // correctly. Since we also pass note that no unnecessary - // memory is actually allocated -- just the size field is set. - ACE_NEW_MALLOC_RETURN (mb, - static_cast (this->allocator_->malloc (sizeof (ACE_Message_Block))), - ACE_Message_Block (sizeof (*mr), // size - ACE_Message_Block::MB_DATA, // type - 0, // cont - (char *) mr, // data - 0, // allocator - 0, // locking strategy - mr->priority (), // priority - ACE_Time_Value::zero, // execution time - ACE_Time_Value::max_time, // absolute time of deadline - this->data_block_allocator_, // data_block allocator - this->allocator_), // message_block allocator - -1); - - // Enqueue in priority order. - int const result = this->queue_->enqueue_prio (mb, tv); - - // Free ACE_Message_Block if enqueue_prio failed. - if (result == -1) - ACE_DES_FREE (mb, this->allocator_->free, ACE_Message_Block); - - return result; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Activation_Queue.h b/dep/acelite/ace/Activation_Queue.h deleted file mode 100644 index ab58eedb586..00000000000 --- a/dep/acelite/ace/Activation_Queue.h +++ /dev/null @@ -1,168 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Activation_Queue.h - * - * $Id: Activation_Queue.h 91066 2010-07-12 11:05:04Z johnnyw $ - * - * @author Andres Kruse - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_ACTIVATION_QUEUE_H -#define ACE_ACTIVATION_QUEUE_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Message_Queue.h" -#include "ace/Copy_Disabled.h" -#include "ace/Condition_Thread_Mutex.h" - -/// Define to be compatible with the terminology in the POSA2 book! -#define ACE_Activation_List ACE_Activation_Queue - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Method_Request; - -/** - * @class ACE_Activation_Queue - * - * @brief - * Reifies a method into a request. Subclasses typically - * represent necessary state and behavior. - * - * Maintains a priority-ordered queue of ACE_Method_Request objects. - * A scheduler class (often derived from ACE_Task) subsequently removes - * each method request and invokes its @c call() method. - * - * This class is discussed in depth in the Active Object chapter - * of POSA2. In that book, it is referred to as an Activation List. - * - * @sa ACE_Method_Request - */ -class ACE_Export ACE_Activation_Queue : private ACE_Copy_Disabled -{ -public: - /// Constructor. - /** - * Initializes a new activation queue. - * - * @param new_queue The activation queue uses an ACE_Message_Queue to - * queue and order the method requests. If this argument - * is 0, a new ACE_Message_Queue is created for this - * object's use and will be deleted when this object is - * destroyed. If a non-zero pointer is supplied, the - * passed object will be used and will not be deleted when - * this object is destroyed. If an ACE_Task is being created - * to act as the scheduler, for instance, its - * ACE_Message_Queue pointer can be passed to this object. - * @param alloc Optional, the allocator to use when allocating - * ACE_Message_Block instances that wrap the method requests - * queued to this activation queue. Defaults to - * ACE_Allocator::instance(). - * @param db_alloc Optional, the allocator to use when allocating - * data blocks for the ACE_Message_Block instances that - * wrap the method requests queued to this activation queue. - * Defaults to ACE_Allocator::instance(). - */ - ACE_Activation_Queue (ACE_Message_Queue *new_queue = 0, - ACE_Allocator *alloc = 0, - ACE_Allocator *db_alloc = 0); - - /// Destructor. - virtual ~ACE_Activation_Queue (void); - - // = Activate Queue operations. - - /// Dequeue the next available ACE_Method_Request. - /** - * @param tv If 0, the method will block until a method request is - * available, else will wait until the absolute time specified - * in the referenced ACE_Time_Value. This method will return, - * earlier, however, if queue is closed, deactivated, or when - * a signal occurs. - * - * @retval Pointer to the dequeued ACE_Method_Request object. - * @retval 0 an error occurs; errno contains further information. If - * the specified timeout elapses, errno will be @c EWOULDBLOCK. - */ - ACE_Method_Request *dequeue (ACE_Time_Value *tv = 0); - - /// Enqueue the ACE_Method_Request in priority order. - /** - * The priority of the method request is obtained via the @c priority() - * method of the queued method request. Priority ordering is determined - * by the ACE_Message_Queue class; 0 is the lowest priority. - * - * @param new_method_request Pointer to the ACE_Method_Request object to - * queue. This object's @c priority() method is called to obtain - * the priority. - * @param tv If 0, the method will block until the method request can - * be queued, else will wait until the absolute time specified - * in the referenced ACE_Time_Value. This method will return, - * earlier, however, if queue is closed, deactivated, or when - * a signal occurs. - * - * @retval >0 The number of method requests on the queue after adding - * the specified request. - * @retval -1 if an error occurs; errno contains further information. If - * the specified timeout elapses, errno will be @c EWOULDBLOCK. - */ - int enqueue (ACE_Method_Request *new_method_request, ACE_Time_Value *tv = 0); - - /// Get the current number of method objects in the queue. - size_t method_count (void) const; - - /// Returns 1 if the queue is empty, 0 otherwise. - int is_empty (void) const; - - /// Returns 1 if the queue is full, 0 otherwise. - int is_full (void) const; - - /// Dump the state of an request. - void dump (void) const; - - /// Get a pointer to the underlying queue. - ACE_Message_Queue *queue (void) const; - - /// Set the pointer to the underlying queue. - void queue (ACE_Message_Queue *q); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - - /// Stores the Method_Requests. - ACE_Message_Queue *queue_; - - /// Keeps track of whether we need to delete the queue. - bool delete_queue_; - -private: - - /// Allocation strategy of the queue. - ACE_Allocator *allocator_; - - /// Allocation strategy of the message blocks. - ACE_Allocator *data_block_allocator_; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Activation_Queue.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_ACTIVATION_QUEUE_H */ diff --git a/dep/acelite/ace/Activation_Queue.inl b/dep/acelite/ace/Activation_Queue.inl deleted file mode 100644 index 4c0ffc049d3..00000000000 --- a/dep/acelite/ace/Activation_Queue.inl +++ /dev/null @@ -1,31 +0,0 @@ -// -*- C++ -*- -// -// $Id: Activation_Queue.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE size_t -ACE_Activation_Queue::method_count (void) const -{ - return queue_->message_count (); -} - -ACE_INLINE int -ACE_Activation_Queue::is_full (void) const -{ - return queue_->is_full (); -} - -ACE_INLINE int -ACE_Activation_Queue::is_empty (void) const -{ - return queue_->is_empty (); -} - -ACE_INLINE ACE_Message_Queue * -ACE_Activation_Queue::queue (void) const -{ - return queue_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Active_Map_Manager.cpp b/dep/acelite/ace/Active_Map_Manager.cpp deleted file mode 100644 index 574bcb85757..00000000000 --- a/dep/acelite/ace/Active_Map_Manager.cpp +++ /dev/null @@ -1,7 +0,0 @@ -// $Id: Active_Map_Manager.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/Active_Map_Manager.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Active_Map_Manager.inl" -#endif /* __ACE_INLINE__ */ diff --git a/dep/acelite/ace/Active_Map_Manager.h b/dep/acelite/ace/Active_Map_Manager.h deleted file mode 100644 index 7bade46aa5b..00000000000 --- a/dep/acelite/ace/Active_Map_Manager.h +++ /dev/null @@ -1,116 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Active_Map_Manager.h - * - * $Id: Active_Map_Manager.h 93359 2011-02-11 11:33:12Z mcorino $ - * - * @author Irfan Pyarali - */ -//============================================================================= - - -#ifndef ACE_ACTIVE_MAP_MANAGER_H -#define ACE_ACTIVE_MAP_MANAGER_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Basic_Types.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Active_Map_Manager_Key - * - * @brief Key used in the Active Object Map. - * - * This key keeps information of the index and the generation - * count of the slot it represents. Since the index information - * is part of the key, lookups are super fast and predictable, - */ -class ACE_Export ACE_Active_Map_Manager_Key -{ -public: - /// Default constructor. - ACE_Active_Map_Manager_Key (void); - - /** - * Constructor given the @a slot_index and @a slot_generation number. - * This is useful once the user has somehow recovered the - * @a slot_index and @a slot_generation number from the client. - */ - ACE_Active_Map_Manager_Key (ACE_UINT32 slot_index, - ACE_UINT32 slot_generation); - - /// Get the slot_index. - ACE_UINT32 slot_index (void) const; - - /// Set the slot_index. - void slot_index (ACE_UINT32 i); - - /// Get the slot_generation number. - ACE_UINT32 slot_generation (void) const; - - /// Set the slot_generation number. - void slot_generation (ACE_UINT32 g); - - /// Size required to store information about active key. - static size_t size (void); - - /// Recover state of active key from @a data. User must make sure - /// that @a data encoded using the encode() method. - void decode (const void *data); - - /// Encode state of the active key into @a data. @a data must be as - /// big as the value returned from size(). - void encode (void *data) const; - - /// Compare keys. - bool operator== (const ACE_Active_Map_Manager_Key &rhs) const; - bool operator!= (const ACE_Active_Map_Manager_Key &rhs) const; - - // = This really should be protected but because of template - // friends, they are not. - - /// Increment the slot_generation number. - void increment_slot_generation_count (void); - -private: - - /** - * @brief Data for the Active Object Map Key. - * - * This separate structure makes it easier to manage copying - * the index and the generation to and from the user buffer. - * - */ - struct key_data - { - /// Slot index in the active map. - ACE_UINT32 slot_index_; - - /// Slot generation number of @c slot_index_ slot in the active map. - ACE_UINT32 slot_generation_; - }; - - /// Data for the Active Object Map Key. - key_data key_data_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Active_Map_Manager.inl" -#endif /* __ACE_INLINE__ */ - -// Include the templates here. -#include "ace/Active_Map_Manager_T.h" - -#include /**/ "ace/post.h" -#endif /* ACE_ACTIVE_MAP_MANAGER_H */ diff --git a/dep/acelite/ace/Active_Map_Manager.inl b/dep/acelite/ace/Active_Map_Manager.inl deleted file mode 100644 index df90ada6a00..00000000000 --- a/dep/acelite/ace/Active_Map_Manager.inl +++ /dev/null @@ -1,95 +0,0 @@ -// -*- C++ -*- -// -// $Id: Active_Map_Manager.inl 80826 2008-03-04 14:51:23Z wotte $ - -#include "ace/OS_NS_string.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Active_Map_Manager_Key::ACE_Active_Map_Manager_Key (void) -{ - // If you change ~0, please change ACE_Map_Manager::free_list_id() - // accordingly. - this->key_data_.slot_index_ = (ACE_UINT32) ~0; - this->key_data_.slot_generation_ = 0; -} - -ACE_INLINE -ACE_Active_Map_Manager_Key::ACE_Active_Map_Manager_Key (ACE_UINT32 slot_index, - ACE_UINT32 slot_generation) -{ - this->key_data_.slot_index_ = slot_index; - this->key_data_.slot_generation_ = slot_generation; -} - -ACE_INLINE ACE_UINT32 -ACE_Active_Map_Manager_Key::slot_index (void) const -{ - return this->key_data_.slot_index_; -} - -ACE_INLINE ACE_UINT32 -ACE_Active_Map_Manager_Key::slot_generation (void) const -{ - return this->key_data_.slot_generation_; -} - -ACE_INLINE bool -ACE_Active_Map_Manager_Key::operator== (const ACE_Active_Map_Manager_Key &rhs) const -{ - return - this->key_data_.slot_index_ == rhs.key_data_.slot_index_ && - this->key_data_.slot_generation_ == rhs.key_data_.slot_generation_; -} - -ACE_INLINE bool -ACE_Active_Map_Manager_Key::operator!= (const ACE_Active_Map_Manager_Key &rhs) const -{ - return !this->operator== (rhs); -} - -ACE_INLINE void -ACE_Active_Map_Manager_Key::slot_index (ACE_UINT32 i) -{ - this->key_data_.slot_index_ = i; -} - -ACE_INLINE void -ACE_Active_Map_Manager_Key::slot_generation (ACE_UINT32 g) -{ - this->key_data_.slot_generation_ = g; -} - -ACE_INLINE void -ACE_Active_Map_Manager_Key::increment_slot_generation_count (void) -{ - ++this->key_data_.slot_generation_; -} - -/* static */ -ACE_INLINE size_t -ACE_Active_Map_Manager_Key::size (void) -{ - return sizeof (ACE_UINT32) + sizeof (ACE_UINT32); -} - -ACE_INLINE void -ACE_Active_Map_Manager_Key::decode (const void *data) -{ - // Copy the information from the user buffer into the key. - ACE_OS::memcpy (&this->key_data_, - data, - sizeof this->key_data_); -} - -ACE_INLINE void -ACE_Active_Map_Manager_Key::encode (void *data) const -{ - // Copy the key data to the user buffer. - ACE_OS::memcpy (data, - &this->key_data_, - sizeof this->key_data_); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Active_Map_Manager_T.cpp b/dep/acelite/ace/Active_Map_Manager_T.cpp deleted file mode 100644 index 732cc295117..00000000000 --- a/dep/acelite/ace/Active_Map_Manager_T.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// $Id: Active_Map_Manager_T.cpp 80826 2008-03-04 14:51:23Z wotte $ - -#ifndef ACE_ACTIVE_MAP_MANAGER_T_CPP -#define ACE_ACTIVE_MAP_MANAGER_T_CPP - -#include "ace/Active_Map_Manager_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (__ACE_INLINE__) -#include "ace/Active_Map_Manager_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Active_Map_Manager) - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_ACTIVE_MAP_MANAGER_T_CPP */ diff --git a/dep/acelite/ace/Active_Map_Manager_T.h b/dep/acelite/ace/Active_Map_Manager_T.h deleted file mode 100644 index 80eaada26a1..00000000000 --- a/dep/acelite/ace/Active_Map_Manager_T.h +++ /dev/null @@ -1,211 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Active_Map_Manager_T.h - * - * $Id: Active_Map_Manager_T.h 84316 2009-02-03 19:46:05Z johnnyw $ - * - * @author Irfan Pyarali - */ -//============================================================================= - - -#ifndef ACE_ACTIVE_MAP_MANAGER_T_H -#define ACE_ACTIVE_MAP_MANAGER_T_H -#include /**/ "ace/pre.h" - -#include "ace/Map_Manager.h" -#include "ace/Active_Map_Manager.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Null_Mutex.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Active_Map_Manager - * - * @brief Define a map abstraction that associates system generated - * keys with user specified values. - * - * Since the key is system generated, searches are very fast and - * take a constant amount of time. - */ -template -class ACE_Active_Map_Manager : public ACE_Map_Manager -{ -public: - - // = Traits. - typedef ACE_Active_Map_Manager_Key key_type; - typedef T mapped_type; - - typedef ACE_Map_Entry ENTRY; - typedef ACE_Map_Iterator ITERATOR; - typedef ACE_Map_Reverse_Iterator REVERSE_ITERATOR; - - typedef ENTRY entry; - typedef ITERATOR iterator; - typedef REVERSE_ITERATOR reverse_iterator; - - // = Initialization and termination methods. - /// Initialize a Active_Map_Manager with the ACE_DEFAULT_MAP_SIZE. - ACE_Active_Map_Manager (ACE_Allocator *alloc = 0); - - /// Initialize a Active_Map_Manager with @a size entries. - ACE_Active_Map_Manager (size_t size, - ACE_Allocator *alloc = 0); - - /// Close down a Active_Map_Manager and release dynamically - /// allocated resources. - ~ACE_Active_Map_Manager (void); - - /// Initialize a Active_Map_Manager with size @a length. - int open (size_t length = ACE_DEFAULT_MAP_SIZE, - ACE_Allocator *alloc = 0); - - /// Close down a Active_Map_Manager and release dynamically - /// allocated resources. - int close (void); - - /// Add @a value to the map, and the corresponding key produced by the - /// Active_Map_Manager is returned through @a key. - int bind (const T &value, - ACE_Active_Map_Manager_Key &key); - - /// Add @a value to the map. The user does not care about the - /// corresponding key produced by the Active_Map_Manager. - int bind (const T &value); - - /** - * Reserves a slot in the internal structure and returns the key and - * a pointer to the value. User should place their @a value into - * @a internal_value. This method is useful in reducing the number - * of copies required in some cases. Note that @a internal_value is - * only a temporary pointer and will change when the map resizes. - * Therefore, the user should use the pointer immediately and not - * hold on to it. - */ - int bind (ACE_Active_Map_Manager_Key &key, - T *&internal_value); - - /// Reassociate @a key with @a value. The function fails if @a key is - /// not in the map. - int rebind (const ACE_Active_Map_Manager_Key &key, - const T &value); - - /** - * Reassociate @a key with @a value, storing the old value into the - * "out" parameter @a old_value. The function fails if @a key is not - * in the map. - */ - int rebind (const ACE_Active_Map_Manager_Key &key, - const T &value, - T &old_value); - - /** - * Reassociate @a key with @a value, storing the old key and value - * into the "out" parameter @a old_key and @a old_value. The function - * fails if @a key is not in the map. - */ - int rebind (const ACE_Active_Map_Manager_Key &key, - const T &value, - ACE_Active_Map_Manager_Key &old_key, - T &old_value); - - /// Locate @a value associated with @a key. - int find (const ACE_Active_Map_Manager_Key &key, - T &value) const; - - /// Is @a key in the map? - int find (const ACE_Active_Map_Manager_Key &key) const; - - /** - * Locate @a value associated with @a key. The value is returned via - * @a internal_value and hence a copy is saved. Note that - * @a internal_value is only a temporary pointer and will change when - * the map resizes. Therefore, the user should use the pointer - * immediately and not hold on to it. - */ - int find (const ACE_Active_Map_Manager_Key &key, - T *&internal_value) const; - - // Creates a key. User should place their @a value into - // <*internal_value>. This method is useful in reducing the number - // of copies required in some cases. - - /// Remove @a key from the map. - int unbind (const ACE_Active_Map_Manager_Key &key); - - /// Remove @a key from the map, and return the @a value associated with - /// @a key. - int unbind (const ACE_Active_Map_Manager_Key &key, - T &value); - - /** - * Locate @a value associated with @a key. The value is returned via - * @a internal_value and hence a copy is saved. Note that - * @a internal_value is only a temporary pointer and will change when - * the map resizes or when this slot is reused. Therefore, the user - * should use the pointer immediately and not hold on to it. - */ - int unbind (const ACE_Active_Map_Manager_Key &key, - T *&internal_value); - - /// Return the current size of the map. - size_t current_size (void) const; - - /// Return the total size of the map. - size_t total_size (void) const; - - /// Returns a key that cannot be found in the map. - static const ACE_Active_Map_Manager_Key npos (void); - - /// Dump the state of an object. - void dump (void) const; - - // = STL styled iterator factory functions. - - /// Return forward iterator. - ACE_Map_Iterator begin (void); - ACE_Map_Iterator end (void); - - /// Return reverse iterator. - ACE_Map_Reverse_Iterator rbegin (void); - ACE_Map_Reverse_Iterator rend (void); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - - /// Private base class - typedef ACE_Map_Manager ACE_AMM_BASE; - -private: - - // = Disallow these operations. - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Active_Map_Manager &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Active_Map_Manager (const ACE_Active_Map_Manager &)) -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Active_Map_Manager_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Active_Map_Manager_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Active_Map_Manager_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_ACTIVE_MAP_MANAGER_T_H */ diff --git a/dep/acelite/ace/Active_Map_Manager_T.inl b/dep/acelite/ace/Active_Map_Manager_T.inl deleted file mode 100644 index 647b55ebd56..00000000000 --- a/dep/acelite/ace/Active_Map_Manager_T.inl +++ /dev/null @@ -1,311 +0,0 @@ -// -*- C++ -*- -// -// $Id: Active_Map_Manager_T.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE int -ACE_Active_Map_Manager::bind (ACE_Active_Map_Manager_Key &key, - T *&internal_value) -{ - ACE_UINT32 slot_index; - int result = this->next_free (slot_index); - - if (result == 0) - { - // Move from free list to occupied list - this->move_from_free_list_to_occupied_list (slot_index); - - // Reset the key. - this->search_structure_[slot_index].ext_id_.increment_slot_generation_count (); - this->search_structure_[slot_index].ext_id_.slot_index (slot_index); - - // Copy the key for the user. - key = this->search_structure_[slot_index].ext_id_; - - // This is where the user should place the value. - internal_value = &this->search_structure_[slot_index].int_id_; - - // Update the current size. - ++this->cur_size_; - } - - return result; -} - -template ACE_INLINE int -ACE_Active_Map_Manager::bind (const T &value, - ACE_Active_Map_Manager_Key &key) -{ - T *internal_value = 0; - int result = this->bind (key, - internal_value); - - if (result == 0) - { - // Store new value. - *internal_value = value; - } - - return result; -} - -template ACE_INLINE int -ACE_Active_Map_Manager::bind (const T &value) -{ - ACE_Active_Map_Manager_Key key; - return this->bind (value, key); -} - -template ACE_INLINE int -ACE_Active_Map_Manager::find (const ACE_Active_Map_Manager_Key &key, - T *&internal_value) const -{ - ACE_UINT32 slot_index = key.slot_index (); - ACE_UINT32 slot_generation = key.slot_generation (); - - if (slot_index > this->total_size_ || -#if defined (ACE_HAS_LAZY_MAP_MANAGER) - this->search_structure_[slot_index].free_ || -#endif /* ACE_HAS_LAZY_MAP_MANAGER */ - this->search_structure_[slot_index].ext_id_.slot_generation () != slot_generation || - this->search_structure_[slot_index].ext_id_.slot_index () == - (ACE_UINT32)this->free_list_id ()) - { - return -1; - } - else - { - // This is where the user value is. - internal_value = &this->search_structure_[slot_index].int_id_; - } - - return 0; -} - -template ACE_INLINE int -ACE_Active_Map_Manager::find (const ACE_Active_Map_Manager_Key &key) const -{ - T *internal_value = 0; - return this->find (key, - internal_value); -} - -template ACE_INLINE int -ACE_Active_Map_Manager::find (const ACE_Active_Map_Manager_Key &key, - T &value) const -{ - T *internal_value = 0; - int result = this->find (key, - internal_value); - - if (result == 0) - value = *internal_value; - - return result; -} - -template ACE_INLINE int -ACE_Active_Map_Manager::rebind (const ACE_Active_Map_Manager_Key &key, - const T &value) -{ - int result = this->find (key); - - if (result == 0) - { - // Store new value. - this->search_structure_[key.slot_index ()].int_id_ = value; - } - - return result; -} - -template ACE_INLINE int -ACE_Active_Map_Manager::rebind (const ACE_Active_Map_Manager_Key &key, - const T &value, - T &old_value) -{ - int result = this->find (key); - - if (result == 0) - { - // Copy old value. - old_value = this->search_structure_[key.slot_index ()].int_id_; - - // Store new value. - this->search_structure_[key.slot_index ()].int_id_ = value; - } - - return result; -} - -template ACE_INLINE int -ACE_Active_Map_Manager::rebind (const ACE_Active_Map_Manager_Key &key, - const T &value, - ACE_Active_Map_Manager_Key &old_key, - T &old_value) -{ - int result = this->find (key); - - if (result == 0) - { - // Copy old key. - old_key = this->search_structure_[key.slot_index ()].ext_id_; - - // Copy old value. - old_value = this->search_structure_[key.slot_index ()].int_id_; - - // Store new value. - this->search_structure_[key.slot_index ()].int_id_ = value; - } - - return result; -} - -template ACE_INLINE int -ACE_Active_Map_Manager::unbind (const ACE_Active_Map_Manager_Key &key, - T *&internal_value) -{ - int result = this->find (key, - internal_value); - - if (result == 0) - { - ACE_UINT32 slot_index = key.slot_index (); - -#if defined (ACE_HAS_LAZY_MAP_MANAGER) - - // - // In the case of lazy map managers, the movement of free slots - // from the occupied list to the free list is delayed until we - // run out of free slots in the free list. - // - - this->search_structure_[slot_index].free_ = 1; - -#else - - // Move from occupied list to free list. - this->move_from_occupied_list_to_free_list (slot_index); - -#endif /* ACE_HAS_LAZY_MAP_MANAGER */ - - // Reset the slot_index. This will tell us that this entry is free. - this->search_structure_[slot_index].ext_id_.slot_index (this->free_list_id ()); - - // Update the current size. - --this->cur_size_; - } - - return result; -} - -template ACE_INLINE int -ACE_Active_Map_Manager::unbind (const ACE_Active_Map_Manager_Key &key, - T &value) -{ - T *internal_value; - int result = this->unbind (key, - internal_value); - - if (result == 0) - { - // Copy old value. - value = *internal_value; - } - - return result; -} - -template ACE_INLINE int -ACE_Active_Map_Manager::unbind (const ACE_Active_Map_Manager_Key &key) -{ - T *internal_value; - return this->unbind (key, - internal_value); -} - -template ACE_INLINE -ACE_Active_Map_Manager::ACE_Active_Map_Manager (ACE_Allocator *alloc) - : ACE_AMM_BASE (alloc) -{ -} - -template ACE_INLINE -ACE_Active_Map_Manager::ACE_Active_Map_Manager (size_t size, - ACE_Allocator *alloc) - : ACE_AMM_BASE (size, - alloc) -{ -} - -template ACE_INLINE -ACE_Active_Map_Manager::~ACE_Active_Map_Manager (void) -{ -} - -template ACE_INLINE int -ACE_Active_Map_Manager::open (size_t length, - ACE_Allocator *alloc) -{ - return ACE_AMM_BASE::open (length, alloc); -} - -template ACE_INLINE int -ACE_Active_Map_Manager::close (void) -{ - return ACE_AMM_BASE::close (); -} - -template ACE_INLINE size_t -ACE_Active_Map_Manager::current_size (void) const -{ - return ACE_AMM_BASE::current_size (); -} - -template ACE_INLINE size_t -ACE_Active_Map_Manager::total_size (void) const -{ - return ACE_AMM_BASE::total_size (); -} - -/* static */ -template ACE_INLINE const ACE_Active_Map_Manager_Key -ACE_Active_Map_Manager::npos (void) -{ - return ACE_Active_Map_Manager_Key (~0, ~0); -} - -template ACE_INLINE void -ACE_Active_Map_Manager::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_AMM_BASE::dump (); -#endif /* ACE_HAS_DUMP */ -} - -template ACE_Map_Iterator -ACE_Active_Map_Manager::begin (void) -{ - return ACE_AMM_BASE::begin (); -} - -template ACE_INLINE ACE_Map_Iterator -ACE_Active_Map_Manager::end (void) -{ - return ACE_AMM_BASE::end (); -} - -template ACE_INLINE ACE_Map_Reverse_Iterator -ACE_Active_Map_Manager::rbegin (void) -{ - return ACE_AMM_BASE::rbegin (); -} - -template ACE_INLINE ACE_Map_Reverse_Iterator -ACE_Active_Map_Manager::rend (void) -{ - return ACE_AMM_BASE::rend (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Addr.cpp b/dep/acelite/ace/Addr.cpp deleted file mode 100644 index 1caf3f6aee4..00000000000 --- a/dep/acelite/ace/Addr.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// $Id: Addr.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/Addr.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Addr.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Log_Msg.h" -#include "ace/os_include/sys/os_socket.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Note: this object requires static construction and destruction. -/* static */ -const ACE_Addr ACE_Addr::sap_any (AF_ANY, -1); - -ACE_ALLOC_HOOK_DEFINE(ACE_Addr) - - -// Initializes instance variables. Note that 0 is an unspecified -// protocol family type... - -ACE_Addr::ACE_Addr (int type, int size) : - addr_type_ (type), - addr_size_ (size) -{ -} - -ACE_Addr::~ACE_Addr (void) -{ -} - -void * -ACE_Addr::get_addr (void) const -{ - return 0; -} - -void -ACE_Addr::set_addr (void *, int) -{ -} - -// Initializes instance variables. - -void -ACE_Addr::base_set (int type, int size) -{ - this->addr_type_ = type; - this->addr_size_ = size; -} - -void -ACE_Addr::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Addr::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("addr_type_ = %d"), this->addr_type_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\naddr_size_ = %d"), this->addr_size_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Addr.h b/dep/acelite/ace/Addr.h deleted file mode 100644 index e58ffe2c0f5..00000000000 --- a/dep/acelite/ace/Addr.h +++ /dev/null @@ -1,103 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Addr.h - * - * $Id: Addr.h 81030 2008-03-20 12:43:29Z johnnyw $ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_ADDR_H -#define ACE_ADDR_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Addr - * - * @brief Defines the base class for the "address family independent" - * address format. - */ -class ACE_Export ACE_Addr -{ -public: - // = Initialization and termination methods. - /// Initializes instance variables. - ACE_Addr (int type = -1, int size = -1); - - /// Destructor. - virtual ~ACE_Addr (void); - - // = Get/set the size of the address. - - /// Return the size of the address. - int get_size (void) const; - - /// Sets the size of the address. - void set_size (int size); - - // = Get/set the type of the address. - - /// Get the type of the address. - int get_type (void) const; - - /// Set the type of the address. - void set_type (int type); - - /// Return a pointer to the address. - virtual void *get_addr (void) const; - - /// Set a pointer to the address. - virtual void set_addr (void *, int len); - - // = Equality/inequality tests - /// Check for address equality. - bool operator == (const ACE_Addr &sap) const; - - /// Check for address inequality. - bool operator != (const ACE_Addr &sap) const; - - /// Initializes instance variables. - void base_set (int type, int size); - - /// Wild-card address. - static const ACE_Addr sap_any; - - /// Returns a hash value. This should be overwritten by a subclass - /// that can produce a better hash value. - virtual unsigned long hash (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// e.g., AF_UNIX, AF_INET, AF_SPIPE, etc. - int addr_type_; - - /// Number of bytes in the address. - int addr_size_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Addr.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_ADDR_H */ diff --git a/dep/acelite/ace/Addr.inl b/dep/acelite/ace/Addr.inl deleted file mode 100644 index 0ff355eaeb7..00000000000 --- a/dep/acelite/ace/Addr.inl +++ /dev/null @@ -1,57 +0,0 @@ -// -*- C++ -*- -// -// $Id: Addr.inl 87295 2009-11-02 14:45:59Z johnnyw $ - -// Return the address of the address. - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE bool -ACE_Addr::operator == (const ACE_Addr &sap) const -{ - return (sap.addr_type_ == this->addr_type_ && - sap.addr_size_ == this->addr_size_ ); -} - -ACE_INLINE bool -ACE_Addr::operator != (const ACE_Addr &sap) const -{ - return (sap.addr_type_ != this->addr_type_ || - sap.addr_size_ != this->addr_size_ ); -} - -/// Return the size of the address. -ACE_INLINE int -ACE_Addr::get_size (void) const -{ - return this->addr_size_; -} - -/// Sets the size of the address. -ACE_INLINE void -ACE_Addr::set_size (int size) -{ - this->addr_size_ = size; -} - -/// Return the type of the address. -ACE_INLINE int -ACE_Addr::get_type (void) const -{ - return this->addr_type_; -} - -/// Set the type of the address. -ACE_INLINE void -ACE_Addr::set_type (int type) -{ - this->addr_type_ = type; -} - -ACE_INLINE unsigned long -ACE_Addr::hash (void) const -{ - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Arg_Shifter.cpp b/dep/acelite/ace/Arg_Shifter.cpp deleted file mode 100644 index 62678603561..00000000000 --- a/dep/acelite/ace/Arg_Shifter.cpp +++ /dev/null @@ -1,226 +0,0 @@ -// $Id: Arg_Shifter.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#ifndef ACE_ARG_SHIFTER_T_CPP -#define ACE_ARG_SHIFTER_T_CPP - -#include "ace/Arg_Shifter.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_strings.h" -#include "ace/OS_Errno.h" -#include "ace/OS_Memory.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Arg_Shifter_T::ACE_Arg_Shifter_T (int& argc, - const CHAR_TYPE** argv, - const CHAR_TYPE** temp) - : argc_ (argc), - total_size_ (argc), - temp_ (temp), - argv_ (argv), - current_index_ (0), - back_ (argc - 1), - front_ (0) -{ - this->init (); -} - -template -ACE_Arg_Shifter_T::ACE_Arg_Shifter_T (int& argc, - CHAR_TYPE** argv, - CHAR_TYPE** temp) - : argc_ (argc), - total_size_ (argc), - temp_ ((const CHAR_TYPE **) temp), - argv_ ((const CHAR_TYPE **) argv), - current_index_ (0), - back_ (argc - 1), - front_ (0) -{ - this->init (); -} - -template -void -ACE_Arg_Shifter_T::init (void) -{ - // If not provided with one, allocate a temporary array. - if (this->temp_ == 0) - ACE_NEW (this->temp_, - const CHAR_TYPE *[this->total_size_]); - - if (this->temp_ != 0) - { - // Fill the temporary array. - this->argc_ = 0; - for (int i = 0; i < this->total_size_; i++) - { - this->temp_[i] = this->argv_[i]; - this->argv_[i] = 0; - } - } - else - { - // Allocation failed, prohibit iteration. - this->current_index_ = this->argc_; - this->front_ = this->argc_; - } -} - -template -ACE_Arg_Shifter_T::~ACE_Arg_Shifter_T (void) -{ - // Delete the temporary vector. - delete [] temp_; -} - -template -const CHAR_TYPE * -ACE_Arg_Shifter_T::get_current (void) const -{ - const CHAR_TYPE * retval = 0; - - if (this->is_anything_left ()) - retval = this->temp_[current_index_]; - - return retval; -} - -template -const CHAR_TYPE * -ACE_Arg_Shifter_T::get_the_parameter (const CHAR_TYPE *flag) -{ - // the return 0's abound because this method - // would otherwise be a deep if { } else { } - - // check to see if any arguments still exist - if (!this->is_anything_left()) - return 0; - - // check to see if the flag is the argument - int const offset = this->cur_arg_strncasecmp (flag); - if (offset == -1) - return 0; - - if (offset == 0) - { - this->consume_arg (); - - if (!this->is_parameter_next()) - { - return 0; - } - } - // the parameter is in the middle somewhere... - return this->temp_[current_index_] + offset; -} - -template -int -ACE_Arg_Shifter_T::cur_arg_strncasecmp (const CHAR_TYPE *flag) -{ - // Check for a current argument - if (this->is_anything_left()) - { - size_t const flag_length = ACE_OS::strlen (flag); - - // Check for presence of the flag - if (ACE_OS::strncasecmp(this->temp_[current_index_], - flag, - flag_length) == 0) - { - if (ACE_OS::strlen(temp_[current_index_]) == flag_length) - { - // match and lengths are equal - return 0; - } - else - { - // matches, with more info to boot! - size_t const remaining = ACE_OS::strspn - (this->temp_[current_index_] + flag_length, - ACE_TEXT (" ")) + flag_length; - return static_cast (remaining); - } - } - } - // failure - return -1; -} - -template -int -ACE_Arg_Shifter_T::consume_arg (int number) -{ - int retval = 0; - - // Stick knowns at the end of the vector (consumed). - if (this->is_anything_left() >= number) - { - for (int i = 0, j = this->back_ - (number - 1); - i < number; - ++i, ++j, ++this->current_index_) - this->argv_[j] = this->temp_[this->current_index_]; - - this->back_ -= number; - retval = 1; - } - - return retval; -} - -template -int -ACE_Arg_Shifter_T::ignore_arg (int number) -{ - int retval = 0; - - // Keep unknowns at the head of the vector. - if (this->is_anything_left () >= number) - { - for (int i = 0; - i < number; - i++, this->current_index_++, this->front_++) - this->argv_[this->front_] = this->temp_[this->current_index_]; - - retval = 1; - this->argc_ += number; - } - - return retval; -} - -template -int -ACE_Arg_Shifter_T::is_anything_left (void) const -{ - return this->total_size_ - this->current_index_; -} - -template -int -ACE_Arg_Shifter_T::is_option_next (void) const -{ - return this->is_anything_left () && - this->temp_[this->current_index_][0] == '-'; -} - -template -int -ACE_Arg_Shifter_T::is_parameter_next (void) const -{ - return this->is_anything_left () - && this->temp_[this->current_index_][0] != '-'; -} - -template -int -ACE_Arg_Shifter_T::num_ignored_args (void) const -{ - return this->front_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_ATOMIC_OP_T_CPP */ diff --git a/dep/acelite/ace/Arg_Shifter.h b/dep/acelite/ace/Arg_Shifter.h deleted file mode 100644 index 123a70560cf..00000000000 --- a/dep/acelite/ace/Arg_Shifter.h +++ /dev/null @@ -1,234 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Arg_Shifter.h - * - * $Id: Arg_Shifter.h 95972 2012-07-26 10:20:42Z johnnyw $ - * - * @author Seth Widoff - */ -//============================================================================= - -#ifndef ACE_ARG_SHIFTER_H -#define ACE_ARG_SHIFTER_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Global_Macros.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Arg_Shifter_T - * - * @brief This ADT operates on a specified set of arguments (@a argv). - * As known arguments are scanned, they are shifted to the back of the - * @a argv vector, so deeper levels of argument parsing can locate the yet - * unprocessed arguments at the beginning of the vector. - * - * Nomenclature: - * argument - a member of the argv array - * option - an argument starting with '-' - * flag - synonym for "option" - * parameter value - an argument not starting with '-' - * parameter - synonym for "parameter value" - * - * The @c ACE_Arg_Shifter copies the pointers of the @a argv vector - * into a temporary array, emptying the original. As the @c ACE_Arg_Shifter - * iterates over the temporary array, it places known arguments in the rear - * of the original array and places the unknown ones in the beginning of the - * original array. It modifies argc to be the number of unknown arguments, - * so it looks to the caller as if the original array contains only unknown - * arguments. So, after @c ACE_Arg_Shifter has visited all the arguments - * in the temporary array, the original @a argv array appears to contain - * only the unknown arguments in their original order (but it actually has - * all the known arguments, too, beyond argc). - */ -template -class ACE_Arg_Shifter_T -{ -public: - // = Initialization and termination methods. - /** - * Initialize the ACE_Arg_Shifter to the vector over which to - * iterate. Optionally, also provide the temporary array for - * use in shifting the arguments. If ACE_Arg_Shifter must allocate - * the temporary vector internally and dynamic allocation fails, the - * ACE_Arg_Shifter will set all indicators to end of the vector, - * forbidding iteration. Following iteration over @a argv, the - * @a argc value will be updated to contain the number of - * unconsumed arguments. - * @param argc The number of strings in @a argv. @a argc will be - * updated to reflect the number of unconsumed arguments. - * @param argv The argument vector to shift. The string pointers in - * the vector will be reordered to place the @a argc unconsumed - * arguments at the front of the vector. - * @param temp A vector of @c CHAR_TYPE pointers at least @a argc - * elements long. The vector will be used for argument shifting as - * the specified @a argv vector is consumed. The vector must not - * be modified while this object exists. If this argument is 0 - * (the default) the object will allocate and free the temporary - * vector transparently. - */ - ACE_Arg_Shifter_T (int& argc, - const CHAR_TYPE **argv, - const CHAR_TYPE **temp = 0); - - /// Same behavior as the preceding constructor, but without the - /// "const" qualifier. - ACE_Arg_Shifter_T (int& argc, - CHAR_TYPE **argv, - CHAR_TYPE **temp = 0); - - /// Destructor. - ~ACE_Arg_Shifter_T (void); - - /// Get the current head of the vector. - const CHAR_TYPE *get_current (void) const; - - /** - * If the @a flag matches the current_arg of arg shifter - * this method will attempt to return the associated - * parameter value - * - * Safe to call without checking that a current arg exists - * - * In the following examples, a pointer to the char* "value" is ret - * - * eg: main -foobar value, main -FooBar value - * main -FOOBARvalue - * - * all of the above will all match the @a flag == -FooBar - * and will return a char* to "value" - * - * main -foobar 4 would succeed and return a char* to "4" - * main -foobar -4 does not succeed (-4 is not a parameter) - * but instead, would return 0 - * - * 0 is returned: - * If the current argument does not match flag - * If there is no parameter found after a 'matched' flag - * - * If the flag is matched and the flag and parameter DO NOT RUN - * together, the flag is consumed, the parameter is returned, - * and the new current argument is the parameter value. - * ie '-foobarflag VALUE' leaves the new cur arg == "VALUE" - * - * If the flag is matched and the flag and parameter RUN - * together '-foobarflagVALUE', the flag is NOT consumed - * and the cur arg is left pointing to the entire flag/value pair - */ - const CHAR_TYPE *get_the_parameter (const CHAR_TYPE* flag); - - /** - * Check if the current argument matches (case insensitive) @a flag - * - * ------------------------------------------------------------ - * - * Case A: Perfect Match (case insensitive) - * 0 is returned. - * - * ie: when current_arg = "-foobar" or "-FOOBAR" or "-fooBAR" - * this->cur_arg_strncasecmp ("-FooBar); - * will return 0 - * - * ------------------------------------------------------------ - * - * Case B: Perfect Match (case insensitive) but the current_arg - * is longer than the flag. Returns a number equal to the index - * in the char* indicating the start of the extra characters - * - * ie: when current_arg = "-foobar98023" - * this->cur_arg_strncasecmp ("-FooBar); - * will return 7 - * - * Notice: this number will always be > 0 - * - * ------------------------------------------------------------ - * - * Case C: If neither of Case A or B is met (no match) - * then -1 is returned - */ - int cur_arg_strncasecmp (const CHAR_TYPE *flag); - - /// Consume @a number argument(s) by sticking them/it on the end of - /// the vector. - int consume_arg (int number = 1); - - /// Place @a number arguments in the same relative order ahead of the - /// known arguments in the vector. - int ignore_arg (int number = 1); - - /// Returns the number of args left to see in the vector. - int is_anything_left (void) const; - - /// Returns 1 if there's a next item in the vector and it begins with - /// '-'. - int is_option_next (void) const; - - /// Returns 1 if there's a next item in the vector and it doesn't - /// begin with '-'. - int is_parameter_next (void) const; - - /// Returns the number of irrelevant args seen. - int num_ignored_args (void) const; - -private: - /// Copy Constructor should not be used. - ACE_UNIMPLEMENTED_FUNC (ACE_Arg_Shifter_T (const ACE_Arg_Shifter_T&)) - - /// Assignment '=' operator should not be used. - ACE_UNIMPLEMENTED_FUNC (ACE_Arg_Shifter_T operator= (const ACE_Arg_Shifter_T&)) - - /// Refactor the constructor logic. - void init (void); - - /// The size of the argument vector. - int& argc_; - - /// The size of argv_. - int total_size_; - - /// The temporary array over which we traverse. - const CHAR_TYPE **temp_; - - /// The array in which the arguments are reordered. - const CHAR_TYPE **argv_; - - /// The element in we're currently examining. - int current_index_; - - /// The index of in which we'll stick the next unknown - /// argument. - int back_; - - /// The index of in which we'll stick the next known - /// argument. - /** This is not really the "front" at all. It's the point after - * which the unknown arguments end and at which the known arguments begin. - */ - int front_; -}; - -typedef ACE_Arg_Shifter_T ACE_Arg_Shifter; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Arg_Shifter.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Arg_Shifter.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_ARG_SHIFTER_H */ diff --git a/dep/acelite/ace/Argv_Type_Converter.cpp b/dep/acelite/ace/Argv_Type_Converter.cpp deleted file mode 100644 index 68b98d99d88..00000000000 --- a/dep/acelite/ace/Argv_Type_Converter.cpp +++ /dev/null @@ -1,192 +0,0 @@ -// $Id: Argv_Type_Converter.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/Argv_Type_Converter.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Argv_Type_Converter.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/OS_NS_string.h" -#include "ace/OS_Errno.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_USES_WCHAR) -ACE_Argv_Type_Converter::ACE_Argv_Type_Converter (int &argc, wchar_t** argv) - : saved_argc_ (argc), - char_argv_ (0), - wchar_argv_ (argv), - before_pass_argc_ (argc), - original_type_ (true), - wchar_passed_ (false), - char_passed_ (false) -{ - this->initialize (); - - for (int i = 0; i < argc; ++i) - this->char_argv_[i] = ACE_OS::strdup (ACE_TEXT_ALWAYS_CHAR (argv[i])); -} -#endif // ACE_USES_WCHAR - - -ACE_Argv_Type_Converter::ACE_Argv_Type_Converter (int &argc, char **argv) - : saved_argc_(argc), - char_argv_(argv) -#if defined (ACE_USES_WCHAR) - , wchar_argv_(0), - before_pass_argc_(argc), - original_type_(false), - wchar_passed_(false), - char_passed_(false) -{ - this->initialize(); - - for (int i = 0; i < argc; ++i) - this->wchar_argv_[i] = ACE_OS::strdup (ACE_TEXT_ANTI_TO_TCHAR (argv[i])); -} -#else -{ -} -#endif // ACE_USES_WCHAR - -ACE_Argv_Type_Converter::~ACE_Argv_Type_Converter (void) -{ -#if defined (ACE_USES_WCHAR) - // selectively delete the 'copy' of argv - if (this->original_type_) - { - // if original type is wchar_t - if (this->char_passed_) - this->align_wchar_with_char (); - - for (int i = 0; i < this->before_pass_argc_; ++i) - ACE_OS::free (this->char_argv_[i]); - - delete [] this->char_argv_; - } - else - { - // if original type is char - if (this->wchar_passed_) - this->align_char_with_wchar (); - - for (int i = 0; i < this->before_pass_argc_; ++i) - ACE_OS::free (this->wchar_argv_[i]); - - delete [] this->wchar_argv_; - } -#endif // ACE_USES_WCHAR -} - -#if defined (ACE_USES_WCHAR) -void -ACE_Argv_Type_Converter::initialize (void) -{ - if (this->original_type_) - { - // Make a copy of argv in 'char'. type Create one more argv entry - // than original argc for the NULL. - ACE_NEW (char_argv_, - char *[this->saved_argc_ + 1]); - this->char_argv_[saved_argc_] = 0; // last entry of argv is - // always a NULL - } - else - { - // make a copy of argv in 'wchar_t' type - ACE_NEW (this->wchar_argv_, - wchar_t*[this->saved_argc_ + 1]); - this->wchar_argv_[saved_argc_] = 0; - } -} - - -void -ACE_Argv_Type_Converter::align_char_with_wchar (void) -{ - for (int wchar_argv_index = 0; wchar_argv_index < this->saved_argc_; - ++wchar_argv_index) - { - wchar_t *match_argv = this->wchar_argv_[wchar_argv_index]; - // if n'th entries of both argv lists are different - if (ACE_OS::strcmp (this->char_argv_[wchar_argv_index], - ACE_TEXT_ALWAYS_CHAR (match_argv)) != 0) - { - // loop through the wchar argv list entries that are after - // wchar_argv_index - for (int i = wchar_argv_index + 1; i < before_pass_argc_; ++i) - { - if (ACE_OS::strcmp (this->char_argv_[i], - ACE_TEXT_ALWAYS_CHAR (match_argv)) == 0) - { - // swap the pointers in the char argv list - char *temp = this->char_argv_[wchar_argv_index]; - this->char_argv_[wchar_argv_index] = this->char_argv_[i]; - this->char_argv_[i] = temp; - break; - } - } - } - } - - this->cleanup (); -} - -void -ACE_Argv_Type_Converter::align_wchar_with_char (void) -{ - for (int char_argv_index = 0; char_argv_index < saved_argc_; - ++char_argv_index) - { - char* match_argv = this->char_argv_[char_argv_index]; - // if n'th entries of both argv lists are different - if (ACE_OS::strcmp ( - ACE_TEXT_ALWAYS_CHAR (this->wchar_argv_[char_argv_index]), - match_argv) != 0) - { - // loop through the wchar argv list entries that are after - // wchar_argv_index - for (int i = char_argv_index + 1; i < this->before_pass_argc_; ++i) - { - if (ACE_OS::strcmp ( - ACE_TEXT_ALWAYS_CHAR(this->wchar_argv_[i]), - match_argv) == 0) { - // swap the pointers in the char argv list - wchar_t* temp = this->wchar_argv_[char_argv_index]; - this->wchar_argv_[char_argv_index] = this->wchar_argv_[i]; - this->wchar_argv_[i] = temp; - break; - } - } - } - } - - this->cleanup(); -} - -void -ACE_Argv_Type_Converter::cleanup (void) -{ - for (int i = this->saved_argc_; i < this->before_pass_argc_; ++i) - { - // Check whether it's ours to delete. - if (original_type_) - { - ACE_OS::free (this->char_argv_[i]); - this->char_argv_[i] = 0; - } - else - { - ACE_OS::free (this->wchar_argv_[i]); - this->wchar_argv_[i] = 0; - } - } - - this->before_pass_argc_ = this->saved_argc_; - - this->wchar_passed_ = false; - this->char_passed_ = false; -} -#endif // ACE_USES_WCHAR - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Argv_Type_Converter.h b/dep/acelite/ace/Argv_Type_Converter.h deleted file mode 100644 index 0cf62fa089e..00000000000 --- a/dep/acelite/ace/Argv_Type_Converter.h +++ /dev/null @@ -1,119 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Argv_Type_Converter.h - * - * $Id: Argv_Type_Converter.h 93359 2011-02-11 11:33:12Z mcorino $ - * - * @author Si Mong Park - */ -//============================================================================= - -#ifndef ACE_ARGV_TYPE_CONVERTER_H -#define ACE_ARGV_TYPE_CONVERTER_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" -#include "ace/OS_Memory.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Argv_Type_Converter - * - * @brief To convert 'char' input/command line parameter to 'wchar_t'. - * - * This class is to convert 'char' type command line parameter to - * wide-character (wchar_t) format and stores the copy of it. - * This is useful for all classes that use 'char**' argv but cannot - * be converted into 'ACE_TCHAR**' version. - * Note that the converted data will be lost upon destruction, so - * classes should use this class as their data member. - */ -class ACE_Export ACE_Argv_Type_Converter -{ -public: - - ACE_Argv_Type_Converter (int &argc, char** argv); - -#if defined (ACE_USES_WCHAR) - ACE_Argv_Type_Converter (int &argc, wchar_t** argv); -#endif // ACE_USES_WCHAR - - ~ACE_Argv_Type_Converter (void); - - /// Returns the pointer of converted command line. - ACE_TCHAR** get_TCHAR_argv (void); - - /// Returns the pointer of ASCII (char) command line. - char** get_ASCII_argv (void); - - /// Returns the number of sub parameters (argc). - int& get_argc (void); - -private: - - /// Copy Constructor should not be used. - ACE_Argv_Type_Converter (const ACE_Argv_Type_Converter&); - - /// Assignment '=' operator should not be used. - ACE_Argv_Type_Converter operator= (const ACE_Argv_Type_Converter&); - -#if defined (ACE_USES_WCHAR) - - /// Perform common initialization for two Ctor's. - void initialize (void); - - /// Align all entries in the char type argv list with wchar_t type - /// argv list. - void align_char_with_wchar (void); - - /// Align all entries in the wchar_t type argv list with char type - /// argv list. - void align_wchar_with_char (void); - - /// Clean up removed (consumed) argv entries and reset the pass flags. - void cleanup (void); -#endif // ACE_USES_WCHAR - -private: - /// Original number of input parameter, same as 'argc'. - int &saved_argc_; - - /// Data member pointer that contains converted argv in ACE_ANTI_TCHAR. - char** char_argv_; - -#if defined (ACE_USES_WCHAR) - /// Data member pointer that contains converted argv in ACE_TCHAR. - wchar_t** wchar_argv_; - - /// argc value before any argv has been passed. - int before_pass_argc_; - - /// false represents original argv passed in is char, and true - /// represents wchar_t. - bool const original_type_; - - /// true indicates wchar_t type argv has been passed. - bool wchar_passed_; - - /// true indicates char type argv has been passed. - bool char_passed_; -#endif /* ACE_USES_WCHAR */ -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Argv_Type_Converter.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_ARGV_TYPE_CONVERTER_H */ diff --git a/dep/acelite/ace/Argv_Type_Converter.inl b/dep/acelite/ace/Argv_Type_Converter.inl deleted file mode 100644 index e4b0ed5a059..00000000000 --- a/dep/acelite/ace/Argv_Type_Converter.inl +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- -// -// $Id: Argv_Type_Converter.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE ACE_TCHAR** -ACE_Argv_Type_Converter::get_TCHAR_argv (void) -{ -#if defined (ACE_USES_WCHAR) - if (this->char_passed_) - { - this->align_wchar_with_char (); - } - - this->wchar_passed_ = true; - return this->wchar_argv_; -#else - return this->char_argv_; -#endif // ACE_USES_WCHAR -} - -ACE_INLINE char** -ACE_Argv_Type_Converter::get_ASCII_argv (void) -{ -#if defined (ACE_USES_WCHAR) - if (this->wchar_passed_) - { - this->align_char_with_wchar (); - } - - this->char_passed_ = true; -#endif // ACE_USES_WCHAR - - return this->char_argv_; -} - -ACE_INLINE int& -ACE_Argv_Type_Converter::get_argc (void) -{ - return this->saved_argc_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Array_Base.cpp b/dep/acelite/ace/Array_Base.cpp deleted file mode 100644 index 49e42e1ad98..00000000000 --- a/dep/acelite/ace/Array_Base.cpp +++ /dev/null @@ -1,235 +0,0 @@ -// $Id: Array_Base.cpp 80826 2008-03-04 14:51:23Z wotte $ - -#ifndef ACE_ARRAY_BASE_CPP -#define ACE_ARRAY_BASE_CPP - -#include "ace/Array_Base.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (__ACE_INLINE__) -#include "ace/Array_Base.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Malloc_Base.h" -#include "ace/os_include/os_errno.h" - -#include - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Dynamically initialize an array. -template -ACE_Array_Base::ACE_Array_Base (typename ACE_Array_Base::size_type size, - ACE_Allocator *alloc) - : max_size_ (size), - cur_size_ (size), - allocator_ (alloc) -{ - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - if (size != 0) - { - ACE_ALLOCATOR (this->array_, - (T *) this->allocator_->malloc (size * sizeof (T))); - for (size_type i = 0; i < size; ++i) - new (&array_[i]) T; - } - else - this->array_ = 0; -} - -template -ACE_Array_Base::ACE_Array_Base (typename ACE_Array_Base::size_type size, - const T &default_value, - ACE_Allocator *alloc) - : max_size_ (size), - cur_size_ (size), - allocator_ (alloc) -{ - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - if (size != 0) - { - ACE_ALLOCATOR (this->array_, - (T *) this->allocator_->malloc (size * sizeof (T))); - for (size_type i = 0; i < size; ++i) - new (&array_[i]) T (default_value); - } - else - this->array_ = 0; -} - -// The copy constructor (performs initialization). - -template -ACE_Array_Base::ACE_Array_Base (const ACE_Array_Base &s) - : max_size_ (s.size ()), - cur_size_ (s.size ()), - allocator_ (s.allocator_) -{ - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - ACE_ALLOCATOR (this->array_, - (T *) this->allocator_->malloc (s.size () * sizeof (T))); - for (size_type i = 0; i < this->size (); ++i) - new (&this->array_[i]) T (s.array_[i]); -} - -// Assignment operator (performs assignment). - -template void -ACE_Array_Base::operator= (const ACE_Array_Base &s) -{ - // Check for "self-assignment". - - if (this != &s) - { - if (this->max_size_ < s.size ()) - { - // Need to reallocate memory. - - // Strongly exception-safe assignment. - // - // Note that we're swapping the allocators here, too. - // Should we? Probably. "*this" should be a duplicate of - // the "right hand side". - ACE_Array_Base tmp (s); - this->swap (tmp); - } - else - { - // Underlying array is large enough. No need to reallocate - // memory. - // - // "*this" still owns the memory for the underlying array. - // Do not swap out the allocator. - // - // @@ Why don't we just drop the explicit destructor and - // placement operator new() calls with a straight - // element-by-element assignment? Is the existing - // approach more efficient? - // -Ossama - - ACE_DES_ARRAY_NOFREE (this->array_, - s.size (), - T); - - this->cur_size_ = s.size (); - - for (size_type i = 0; i < this->size (); ++i) - new (&this->array_[i]) T (s.array_[i]); - } - } -} - -// Set an item in the array at location slot. - -template int -ACE_Array_Base::set (const T &new_item, - typename ACE_Array_Base::size_type slot) -{ - if (this->in_range (slot)) - { - this->array_[slot] = new_item; - return 0; - } - else - return -1; -} - -// Get an item in the array at location slot. - -template int -ACE_Array_Base::get (T &item, - typename ACE_Array_Base::size_type slot) const -{ - if (this->in_range (slot)) - { - // Copies the item. If you don't want to copy, use operator [] - // instead (but then you'll be responsible for range checking). - item = this->array_[slot]; - return 0; - } - else - return -1; -} - -template int -ACE_Array_Base::max_size (typename ACE_Array_Base::size_type new_size) -{ - if (new_size > this->max_size_) - { - T *tmp = 0; - - ACE_ALLOCATOR_RETURN (tmp, - (T *) this->allocator_->malloc (new_size * sizeof (T)), - -1); - for (size_type i = 0; i < this->cur_size_; ++i) - new (&tmp[i]) T (this->array_[i]); - - // Initialize the new portion of the array that exceeds the - // previously allocated section. - for (size_type j = this->cur_size_; j < new_size; ++j) - new (&tmp[j]) T; - - ACE_DES_ARRAY_FREE (this->array_, - this->max_size_, - this->allocator_->free, - T); - this->array_ = tmp; - this->max_size_ = new_size; - this->cur_size_ = new_size; - } - - return 0; -} - -template int -ACE_Array_Base::size (typename ACE_Array_Base::size_type new_size) -{ - int const r = this->max_size (new_size); - - if (r == 0) - this->cur_size_ = new_size; - - return r; -} - -template -void -ACE_Array_Base::swap (ACE_Array_Base & rhs) -{ - std::swap (this->max_size_ , rhs.max_size_); - std::swap (this->cur_size_ , rhs.cur_size_); - std::swap (this->array_ , rhs.array_); - std::swap (this->allocator_, rhs.allocator_); -} - -// **************************************************************** - -template int -ACE_Array_Iterator::next (T *&item) -{ - // ACE_TRACE ("ACE_Array_Iterator::next"); - - if (this->done ()) - { - item = 0; - return 0; - } - else - { - item = &array_[current_]; - return 1; - } -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_ARRAY_BASE_CPP */ diff --git a/dep/acelite/ace/Array_Base.h b/dep/acelite/ace/Array_Base.h deleted file mode 100644 index 9276bf6ee38..00000000000 --- a/dep/acelite/ace/Array_Base.h +++ /dev/null @@ -1,256 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Array_Base.h - * - * $Id: Array_Base.h 93359 2011-02-11 11:33:12Z mcorino $ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_ARRAY_BASE_H -#define ACE_ARRAY_BASE_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Global_Macros.h" -#include "ace/Malloc_Base.h" -#include /* For reverse_iterator adapters */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declaration. -template class ACE_Array_Iterator; - -/** - * @class ACE_Array_Base - * - * @brief Implement a simple dynamic array - * - * This parametric class implements a simple dynamic array; - * resizing must be controlled by the user. No comparison or find - * operations are implemented. - */ -template -class ACE_Array_Base -{ -public: - - // Old/ACE-style traits. - typedef T TYPE; - typedef ACE_Array_Iterator ITERATOR; - - // STL-style typedefs/traits. - typedef T value_type; - typedef value_type * iterator; - typedef value_type const * const_iterator; - typedef value_type & reference; - typedef value_type const & const_reference; - typedef value_type * pointer; - typedef value_type const * const_pointer; - typedef ptrdiff_t difference_type; - typedef ACE_Allocator::size_type size_type; - - ACE_DECLARE_STL_REVERSE_ITERATORS - - // = Initialization and termination methods. - - /// Dynamically create an uninitialized array. - ACE_Array_Base (size_type size = 0, - ACE_Allocator * the_allocator = 0); - - /// Dynamically initialize the entire array to the @a default_value. - ACE_Array_Base (size_type size, - T const & default_value, - ACE_Allocator * the_allocator = 0); - - /** - * The copy constructor performs initialization by making an exact - * copy of the contents of parameter @a s, i.e., *this == s will - * return true. - */ - ACE_Array_Base (ACE_Array_Base const & s); - - /** - * Assignment operator performs an assignment by making an exact - * copy of the contents of parameter @a s, i.e., *this == s will - * return true. Note that if the of is >= than - * we can copy it without reallocating. However, if - * is < we must delete the , - * reallocate a new , and then copy the contents of . - */ - void operator= (ACE_Array_Base const & s); - - /// Clean up the array (e.g., delete dynamically allocated memory). - ~ACE_Array_Base (void); - - // = Set/get methods. - - /// Set item in the array at location @a slot. Doesn't - /// perform range checking. - T & operator[] (size_type slot); - - /// Get item in the array at location @a slot. Doesn't - /// perform range checking. - T const & operator[] (size_type slot) const; - - /// Set an item in the array at location @a slot. Returns - /// -1 if @a slot is not in range, else returns 0. - int set (T const & new_item, size_type slot); - - /** - * Get an item in the array at location @a slot. Returns -1 if - * @a slot is not in range, else returns 0. Note that this function - * copies the item. If you want to avoid the copy, you can use - * the const operator [], but then you'll be responsible for range checking. - */ - int get (T & item, size_type slot) const; - - /// Returns the of the array. - size_type size (void) const; - - /** - * Changes the size of the array to match @a new_size. - * It copies the old contents into the new array. - * Return -1 on failure. - */ - int size (size_type new_size); - - /// Returns the of the array. - size_type max_size (void) const; - - /** - * Changes the size of the array to match @a new_size. - * It copies the old contents into the new array. - * Return -1 on failure. - * It does not affect new_size - */ - int max_size (size_type new_size); - - /** - * @name Forward Iterator Accessors - * - * Forward iterator accessors. - */ - //@{ - iterator begin (void); - iterator end (void); - const_iterator begin (void) const; - const_iterator end (void) const; - //@} - - /** - * @name Reverse Iterator Accessors - * - * Reverse iterator accessors. - */ - //@{ - reverse_iterator rbegin (void); - reverse_iterator rend (void); - const_reverse_iterator rbegin (void) const; - const_reverse_iterator rend (void) const; - //@} - - /// Swap the contents of this array with the given @a array in - /// an exception-safe manner. - void swap (ACE_Array_Base & array); - -protected: - - /// Returns 1 if @a slot is within range, i.e., 0 >= @a slot < - /// @c cur_size_, else returns 0. - bool in_range (size_type slot) const; - - /// Maximum size of the array, i.e., the total number of @c T elements - /// in @c array_. - size_type max_size_; - - /** - * Current size of the array. This starts out being == to - * . However, if we are assigned a smaller array, then - * will become less than . The purpose of - * keeping track of both sizes is to avoid reallocating memory if we - * don't have to. - */ - size_type cur_size_; - - /// Pointer to the array's storage buffer. - value_type * array_; - - /// Allocation strategy of the ACE_Array_Base. - ACE_Allocator * allocator_; - - friend class ACE_Array_Iterator; -}; - -// **************************************************************** - -/** - * @class ACE_Array_Iterator - * - * @brief Implement an iterator over an ACE_Array. - * - * This iterator is safe in the face of array element deletions. - * But it is NOT safe if the array is resized (via the ACE_Array - * assignment operator) during iteration. That would be very - * odd, and dangerous. - */ -template -class ACE_Array_Iterator -{ -public: - // = Initialization method. - ACE_Array_Iterator (ACE_Array_Base &); - - // = Iteration methods. - - /// Pass back the @a next_item that hasn't been seen in the Array. - /// Returns 0 when all items have been seen, else 1. - int next (T *&next_item); - - /// Move forward by one element in the Array. Returns 0 when all the - /// items in the Array have been seen, else 1. - int advance (void); - - /// Returns 1 when all items have been seen, else 0. - int done (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Pointer to the current item in the iteration. - size_t current_; - - /// Pointer to the Array we're iterating over. - ACE_Array_Base &array_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Array_Base.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Array_Base.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Array_Base.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_ARRAY_BASE_H */ diff --git a/dep/acelite/ace/Array_Base.inl b/dep/acelite/ace/Array_Base.inl deleted file mode 100644 index 046c1bffc89..00000000000 --- a/dep/acelite/ace/Array_Base.inl +++ /dev/null @@ -1,146 +0,0 @@ -// -*- C++ -*- -// -// $Id: Array_Base.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Clean up the array (e.g., delete dynamically allocated memory). -template ACE_INLINE -ACE_Array_Base::~ACE_Array_Base (void) -{ - ACE_DES_ARRAY_FREE (this->array_, - this->max_size_, - this->allocator_->free, - T); -} - -template -ACE_INLINE typename ACE_Array_Base::iterator -ACE_Array_Base::begin (void) -{ - return this->array_; -} - -template -ACE_INLINE typename ACE_Array_Base::iterator -ACE_Array_Base::end (void) -{ - return this->array_ + this->cur_size_; -} - -template -ACE_INLINE typename ACE_Array_Base::const_iterator -ACE_Array_Base::begin (void) const -{ - return this->array_; -} - -template -ACE_INLINE typename ACE_Array_Base::const_iterator -ACE_Array_Base::end (void) const -{ - return this->array_ + this->cur_size_; -} - -template -ACE_INLINE typename ACE_Array_Base::reverse_iterator -ACE_Array_Base::rbegin (void) -{ - return reverse_iterator (this->end ()); -} - -template -ACE_INLINE typename ACE_Array_Base::reverse_iterator -ACE_Array_Base::rend (void) -{ - return reverse_iterator (this->begin ()); -} - -template -ACE_INLINE typename ACE_Array_Base::const_reverse_iterator -ACE_Array_Base::rbegin (void) const -{ - return const_reverse_iterator (this->end ()); -} - -template -ACE_INLINE typename ACE_Array_Base::const_reverse_iterator -ACE_Array_Base::rend (void) const -{ - return const_reverse_iterator (this->begin ()); -} - -template ACE_INLINE typename ACE_Array_Base::size_type -ACE_Array_Base::size (void) const -{ - return this->cur_size_; -} - -template ACE_INLINE typename ACE_Array_Base::size_type -ACE_Array_Base::max_size (void) const -{ - return this->max_size_; -} - -template ACE_INLINE bool -ACE_Array_Base::in_range (typename ACE_Array_Base::size_type index) const -{ - return index < this->cur_size_; -} - -template ACE_INLINE T & -ACE_Array_Base::operator[] (typename ACE_Array_Base::size_type index) -{ - return this->array_[index]; -} - -template ACE_INLINE const T & -ACE_Array_Base::operator[] (typename ACE_Array_Base::size_type index) const -{ - return this->array_[index]; -} - -// **************************************************************** - -template ACE_INLINE void -ACE_Array_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - // ACE_TRACE ("ACE_Array_Iterator::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template ACE_INLINE -ACE_Array_Iterator::ACE_Array_Iterator (ACE_Array_Base &a) - : current_ (0), - array_ (a) -{ - // ACE_TRACE ("ACE_Array_Iterator::ACE_Array_Iterator"); -} - -template ACE_INLINE int -ACE_Array_Iterator::advance (void) -{ - // ACE_TRACE ("ACE_Array_Iterator::advance"); - - if (this->current_ < array_.size ()) - { - ++this->current_; - return 1; - } - else - { - // Already finished iterating. - return 0; - } -} - -template ACE_INLINE int -ACE_Array_Iterator::done (void) const -{ - ACE_TRACE ("ACE_Array_Iterator::done"); - - return this->current_ >= array_.size (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Array_Map.cpp b/dep/acelite/ace/Array_Map.cpp deleted file mode 100644 index 25b4e24579c..00000000000 --- a/dep/acelite/ace/Array_Map.cpp +++ /dev/null @@ -1,262 +0,0 @@ -// $Id: Array_Map.cpp 92386 2010-10-28 07:44:37Z johnnyw $ - -#ifndef ACE_ARRAY_MAP_CPP -#define ACE_ARRAY_MAP_CPP - -#include "ace/Array_Map.h" - -#ifndef __ACE_INLINE__ -# include "ace/Array_Map.inl" -#endif /* !__ACE_INLINE__ */ - -#include "ace/checked_iterator.h" - -#include - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -template -ACE_Array_Map::ACE_Array_Map (InputIterator f, - InputIterator l) - : size_ (l - f) - , capacity_ (size_) - , nodes_ (size_ == 0 ? 0 : new value_type[size_]) -{ - (void) std::copy (f, - l, - ACE_make_checked_array_iterator (this->begin (), - this->size_)); - -// iterator n = this->begin (); - -// for (InputIterator i = f; i != l; ++i, ++n) -// *n = *i; -} - -template -ACE_Array_Map::ACE_Array_Map ( - ACE_Array_Map const & map) - : size_ (map.size_) - , capacity_ (map.size_) - , nodes_ (size_ == 0 ? 0 : new value_type[size_]) -{ - std::copy (map.begin (), - map.end (), - ACE_make_checked_array_iterator (this->begin (), - this->size_)); - -// iterator f = map.begin (); -// iterator l = map.end (); -// iterator n = this->begin (); - -// for (iterator i = f; i != l; ++i, ++n) -// *n = *i; -} - -template -ACE_Array_Map::~ACE_Array_Map (void) -{ - delete[] this->nodes_; -} - -template -void -ACE_Array_Map::swap ( - ACE_Array_Map & map) -{ - std::swap (this->size_, map.size_); - std::swap (this->capacity_, map.capacity_); - std::swap (this->nodes_, map.nodes_); -} - -template -std::pair::iterator, bool> -ACE_Array_Map::insert ( - typename ACE_Array_Map::value_type const & x) -{ - // Linear insertion due to linear duplicate key search. - - bool inserted = false; - iterator i = this->find (x.first); - - if (i == this->end ()) - { - // Add the element to the array. - - size_type const old_size = this->size (); - this->grow (1); // Increase size by at least one. - - i = this->begin () + old_size; - *i = x; - - ++this->size_; - - inserted = true; - } - - return std::make_pair (i, inserted); -} - -template -template -void -ACE_Array_Map::insert (InputIterator f, InputIterator l) -{ - this->grow (l - f); // Preallocate storage. - - for (InputIterator i = f; i != l; ++i) - { - (void) this->insert (*i); - } -} - -template -void -ACE_Array_Map::erase ( - typename ACE_Array_Map::iterator pos) -{ - iterator const first = this->begin (); - iterator const last = this->end (); - - if (pos >= first && pos < last) - { - if (pos != last - 1) - { - // Relocate the tail element to the location of the erased - // element to prevent introduction of "holes" in the - // underlying array. - *pos = *(last - 1); - } - - // Explicitly destroy the tail element by assigning a default - // constructed instance to it. Note that this also works for - // the case of a map of size 1. - *(last - 1) = value_type (); - - --this->size_; - } -} - -template -typename ACE_Array_Map::size_type -ACE_Array_Map::erase ( - typename ACE_Array_Map::key_type const & k) -{ - iterator pos = this->find (k); - - size_type const old_size = this->size_; - - this->erase (pos); - - return old_size - this->size_; -} - -template -void -ACE_Array_Map::erase ( - typename ACE_Array_Map::iterator first, - typename ACE_Array_Map::iterator last) -{ - if (this->begin () <= first && first < last && last < this->end ()) - for (iterator i = first; i != last; ++i) - this->erase (i); -} - -template -void -ACE_Array_Map::clear (void) -{ - this->size_ = 0; // No need to deallocate array nor destroy elements. -} - -template -typename ACE_Array_Map::iterator -ACE_Array_Map::find ( - typename ACE_Array_Map::key_type const & k) -{ - iterator const the_end = this->end (); - - EqualTo eq; - - for (iterator i = this->begin (); i != the_end; ++i) - if (eq (k, i->first)) - return i; - - return this->end (); -} - -template -typename ACE_Array_Map::const_iterator -ACE_Array_Map::find ( - typename ACE_Array_Map::key_type const & k) const -{ - const_iterator const the_end = this->end (); - - EqualTo eq; - - for (const_iterator i = this->begin (); i != the_end; ++i) - if (eq (k, i->first)) - return i; - - return this->end (); -} - -template -void -ACE_Array_Map::grow ( - typename ACE_Array_Map::size_type s) -{ - if (this->size () + s > this->capacity_) - { - // This implementation focuses more on static footprint than - // speed. - - // Strongly exception safe. - - ACE_Array_Map temp (this->size () + s); - - std::copy (this->begin (), - this->end (), - ACE_make_checked_array_iterator (temp.begin (), - temp.capacity_)); - - size_type const n = this->size (); // Do not swap out the size - // since we bypassed the - // temporary map's element - // counting code. - this->swap (temp); - - this->size_ = n; - } -} - -// --------------------------------------------------------------- - -template -bool -operator== (ACE_Array_Map const & lhs, - ACE_Array_Map const & rhs) -{ - // Do not include Array_Map capacity in comparison. It isn't useful - // in this case. - - return (lhs.size () == rhs.size () - && std::equal (lhs.begin (), - lhs.end (), - ACE_make_checked_array_iterator (rhs.begin (), - rhs.size ()))); -} - -template -bool -operator< (ACE_Array_Map const & lhs, - ACE_Array_Map const & rhs) -{ - return std::lexicographical_compare (lhs.begin (), lhs.end (), - rhs.begin (), rhs.end ()); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_ARRAY_MAP_CPP */ diff --git a/dep/acelite/ace/Array_Map.h b/dep/acelite/ace/Array_Map.h deleted file mode 100644 index 0bd3b1ffeda..00000000000 --- a/dep/acelite/ace/Array_Map.h +++ /dev/null @@ -1,291 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Array_Map.h - * - * $Id: Array_Map.h 92386 2010-10-28 07:44:37Z johnnyw $ - * - * Light weight array-based map with fast iteration but linear - * (i.e. O(n)) search times. STL-style interface is exposed. - * - * @note This class requires the STL generic algorithms and - * reverse_iterator adapter. - * - * @author Ossama Othman - */ -//============================================================================= - - -#ifndef ACE_ARRAY_MAP_H -#define ACE_ARRAY_MAP_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include -#include -#include - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Array_Map - * - * @brief Light weight array-based map with fast iteration, but linear - * (i.e. O(n)) search times. - * - * Map implementation that focuses on small footprint and fast - * iteration. Search times are, however, linear (O(n)) meaning that - * this map isn't suitable for large data sets that will be searched - * in performance critical areas of code. Iteration over large data - * sets, however, is faster than linked list-based maps, for example, - * since spatial locality is maximized through the use of contiguous - * arrays as the underlying storage. - * @par - * An @c ACE_Array_Map is a unique associative container, meaning that - * duplicate values may not be added to the map. It is also pair - * associative (value_type is a std::pair<>). It is not a sorted - * container. - * @par - * An STL @c std::map -like interface is exposed by this class - * portability. Furthermore, this map's iterators are compatible with - * STL algorithms. - * @par - * Requirements and Performance Characteristics - * - Internal Structure - * Array - * - Duplicates allowed? - * No - * - Random access allowed? - * Yes - * - Search speed - * O(n) - * - Insert/replace speed - * O(n), can be longer if the map has to resize - * - Iterator still valid after change to container? - * No - * - Frees memory for removed elements? - * Yes - * - Items inserted by - * Value - * - Requirements for key type - * -# Default constructor - * -# Copy constructor - * -# operator= - * -# operator== - * - Requirements for object type - * -# Default constructor - * -# Copy constructor - * -# operator= - */ -template > -class ACE_Array_Map -{ -public: - - // STL-style typedefs/traits. - typedef Key key_type; - typedef Value data_type; - typedef std::pair value_type; - typedef value_type * iterator; - typedef value_type const * const_iterator; - typedef value_type & reference; - typedef value_type const & const_reference; - typedef value_type * pointer; - typedef value_type const * const_pointer; - typedef ptrdiff_t difference_type; - typedef size_t size_type; - - ACE_DECLARE_STL_REVERSE_ITERATORS - - /// Default Constructor. - /** - * Create an empty map with a preallocated buffer of size @a s. - */ - ACE_Array_Map (size_type s = 0); - - template - ACE_Array_Map (InputIterator f, InputIterator l); - - ACE_Array_Map (ACE_Array_Map const & map); - ACE_Array_Map & operator= (ACE_Array_Map const & map); - - /// Destructor. - ~ACE_Array_Map (void); - - /** - * @name Forward Iterator Accessors - * - * Forward iterator accessors. - */ - //@{ - iterator begin (void); - iterator end (void); - const_iterator begin (void) const; - const_iterator end (void) const; - //@} - - /** - * @name Reverse Iterator Accessors - * - * Reverse iterator accessors. - */ - //@{ - reverse_iterator rbegin (void); - reverse_iterator rend (void); - const_reverse_iterator rbegin (void) const; - const_reverse_iterator rend (void) const; - //@} - - /// Return current size of map. - /** - * @return The number of elements in the map. - */ - size_type size (void) const; - - /// Maximum number of elements the map can hold. - size_type max_size (void) const; - - /// Return @c true if the map is empty, else @c false. - bool is_empty (void) const; // ACE style - - /** - * Return @c true if the map is empty, else @c false. We recommend - * using @c is_empty() instead since it's more consistent with the - * ACE container naming conventions. - */ - bool empty (void) const; // STL style - - /// Swap the contents of this map with the given @a map in an - /// exception-safe manner. - void swap (ACE_Array_Map & map); - - /// Insert the value @a x into the map. - /** - * STL-style map insertion method. - * - * @param x @c std::pair containing key and datum. - * - * @return @c std::pair::second will be @c false if the map already - * contains a value with the same key as @a x. - */ - std::pair insert (value_type const & x); - - /// Insert range of elements into map. - template - void insert (InputIterator f, InputIterator l); - - /// Remove element at position @a pos from the map. - void erase (iterator pos); - - /// Remove element corresponding to key @a k from the map. - /** - * @return Number of elements that were erased. - */ - size_type erase (key_type const & k); - - /// Remove range of elements [@a first, @a last) from the map. - /** - * @note [@a first, @a last) must be valid range within the map. - */ - void erase (iterator first, iterator last); - - /// Clear contents of map. - /** - * @note This a constant time (O(1)) operation. - */ - void clear (void); - - /** - * @name Search Operations - * - * Search the map for data corresponding to key @a k. - */ - //@{ - /** - * @return @c end() if data corresponding to key @a k is not in the - * map. - */ - iterator find (key_type const & k); - - /** - * @return @c end() if data corresponding to key @a k is not in the - * map. - */ - const_iterator find (key_type const & k) const; - //@} - - /// Count the number of elements corresponding to key @a k. - /** - * @return In the case of this map, the count will always be one if - * such exists in the map. - */ - size_type count (key_type const & k); - - /// Convenience array index operator. - /** - * Array index operator that allows insertion and retrieval of - * elements using an array index syntax, such as: - * @par - * map["Foo"] = 12; - */ - data_type & operator[] (key_type const & k); - -private: - - /// Increase size of underlying buffer by @a s. - void grow (size_type s); - -private: - - /// Number of elements in the map. - size_type size_; - - /// Current size of underlying array. - /** - * @note @c capacity_ is always greater than or equal to @c size_; - */ - size_type capacity_; - - /// Underlying array containing keys and data. - value_type * nodes_; - -}; - -// -------------------------------------------------------------- - -/// @c ACE_Array_Map equality operator. -template -bool operator== (ACE_Array_Map const & lhs, - ACE_Array_Map const & rhs); - -/// @c ACE_Array_Map lexicographical comparison operator. -template -bool operator< (ACE_Array_Map const & lhs, - ACE_Array_Map const & rhs); - -// -------------------------------------------------------------- - -ACE_END_VERSIONED_NAMESPACE_DECL - -#ifdef __ACE_INLINE__ -# include "ace/Array_Map.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -# include "ace/Array_Map.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Array_Map.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_ARRAY_MAP_H */ diff --git a/dep/acelite/ace/Array_Map.inl b/dep/acelite/ace/Array_Map.inl deleted file mode 100644 index b053dc0a441..00000000000 --- a/dep/acelite/ace/Array_Map.inl +++ /dev/null @@ -1,133 +0,0 @@ -// -*- C++ -*- -// -// $Id: Array_Map.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_INLINE -ACE_Array_Map::ACE_Array_Map ( - typename ACE_Array_Map::size_type s) - : size_ (0) - , capacity_ (s) - , nodes_ (s == 0 ? 0 : new value_type[s]) -{ -} - -template -ACE_INLINE ACE_Array_Map & -ACE_Array_Map::operator= ( - ACE_Array_Map const & map) -{ - // Strongly exception-safe assignment. - - ACE_Array_Map temp (map); - this->swap (temp); - return *this; -} - -template -ACE_INLINE typename ACE_Array_Map::iterator -ACE_Array_Map::begin (void) -{ - return this->nodes_; -} - -template -ACE_INLINE typename ACE_Array_Map::iterator -ACE_Array_Map::end (void) -{ - return this->nodes_ + this->size_; -} - -template -ACE_INLINE typename ACE_Array_Map::const_iterator -ACE_Array_Map::begin (void) const -{ - return this->nodes_; -} - -template -ACE_INLINE typename ACE_Array_Map::const_iterator -ACE_Array_Map::end (void) const -{ - return this->nodes_ + this->size_; -} - -template -ACE_INLINE typename ACE_Array_Map::reverse_iterator -ACE_Array_Map::rbegin (void) -{ - return reverse_iterator (this->end ()); -} - -template -ACE_INLINE typename ACE_Array_Map::reverse_iterator -ACE_Array_Map::rend (void) -{ - return reverse_iterator (this->begin ()); -} - -template -ACE_INLINE typename ACE_Array_Map::const_reverse_iterator -ACE_Array_Map::rbegin (void) const -{ - return const_reverse_iterator (this->end ()); -} - -template -ACE_INLINE typename ACE_Array_Map::const_reverse_iterator -ACE_Array_Map::rend (void) const -{ - return const_reverse_iterator (this->begin ()); -} - -template -ACE_INLINE typename ACE_Array_Map::size_type -ACE_Array_Map::size (void) const -{ - return this->size_; -} - -template -ACE_INLINE typename ACE_Array_Map::size_type -ACE_Array_Map::max_size (void) const -{ - return size_type (-1) / sizeof (value_type); -} - -template -ACE_INLINE bool -ACE_Array_Map::is_empty (void) const -{ - return this->size_ == 0; -} - -// The following method is deprecated. - -template -ACE_INLINE bool -ACE_Array_Map::empty (void) const -{ - return this->is_empty (); -} - -template -ACE_INLINE typename ACE_Array_Map::size_type -ACE_Array_Map::count ( - typename ACE_Array_Map::key_type const & k) -{ - return - (this->find (k) == this->end () ? 0 : 1); // Only one datum per key. -} - -template -ACE_INLINE typename ACE_Array_Map::data_type & -ACE_Array_Map::operator[] ( - typename ACE_Array_Map::key_type const & k) -{ - iterator i = (this->insert (value_type (k, data_type ()))).first; - return (*i).second; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Assert.cpp b/dep/acelite/ace/Assert.cpp deleted file mode 100644 index 5268996217f..00000000000 --- a/dep/acelite/ace/Assert.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// $Id: Assert.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/Assert.h" -#include "ace/Log_Msg.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// The following ASSERT macro is courtesy of Alexandre Karev -// . -void -__ace_assert(const char *file, int line, const ACE_TCHAR *expression) -{ - int error = ACE_Log_Msg::last_error_adapter (); - ACE_Log_Msg *log = ACE_Log_Msg::instance (); - - log->set (file, line, -1, error, log->restart (), - log->msg_ostream (), log->msg_callback ()); - - log->log (LM_ERROR, ACE_TEXT ("ACE_ASSERT: file %N, line %l assertion failed for '%s'.%a\n"), expression, -1); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Assert.h b/dep/acelite/ace/Assert.h deleted file mode 100644 index 89363d4c69a..00000000000 --- a/dep/acelite/ace/Assert.h +++ /dev/null @@ -1,40 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Assert.h - * - * $Id: Assert.h 82808 2008-09-23 11:27:27Z smcqueen $ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_ASSERT_H -#define ACE_ASSERT_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#include /**/ "ace/config-all.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -ACE_Export void __ace_assert(const char *file, int line, const ACE_TCHAR *expression); -ACE_END_VERSIONED_NAMESPACE_DECL - -#define ACE_TEST_ASSERT(X) \ - ((X) \ - ? static_cast(0) \ - : ACE_VERSIONED_NAMESPACE_NAME::__ace_assert(__FILE__, __LINE__, ACE_TEXT_CHAR_TO_TCHAR (#X))) - -#if defined (ACE_NDEBUG) -#define ACE_ASSERT(x) \ - (static_cast(0)) -#else -#define ACE_ASSERT(X) ACE_TEST_ASSERT(X) -#endif /* ACE_NDEBUG */ - -#include /**/ "ace/post.h" - -#endif /* ACE_ASSERT */ diff --git a/dep/acelite/ace/Asynch_Acceptor.cpp b/dep/acelite/ace/Asynch_Acceptor.cpp deleted file mode 100644 index 916b250b7af..00000000000 --- a/dep/acelite/ace/Asynch_Acceptor.cpp +++ /dev/null @@ -1,508 +0,0 @@ -/* -*- C++ -*- */ -// $Id: Asynch_Acceptor.cpp 95630 2012-03-22 13:04:47Z johnnyw $ - -#ifndef ACE_ASYNCH_ACCEPTOR_C -#define ACE_ASYNCH_ACCEPTOR_C - -#include "ace/Asynch_Acceptor.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) -// This only works on platforms that support async i/o. - -#include "ace/OS_Errno.h" -#include "ace/OS_Memory.h" -#include "ace/OS_NS_sys_socket.h" -#include "ace/Log_Msg.h" -#include "ace/Message_Block.h" -#include "ace/INET_Addr.h" -#include "ace/SOCK_Stream.h" -#include "ace/Sock_Connect.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Asynch_Acceptor::ACE_Asynch_Acceptor (void) - : listen_handle_ (ACE_INVALID_HANDLE), - pass_addresses_ (false), - validate_new_connection_ (false), - reissue_accept_ (1), - bytes_to_read_ (0), - addr_family_ (0) -{ -} - -template -ACE_Asynch_Acceptor::~ACE_Asynch_Acceptor (void) -{ - // Close down the listen socket - if (this->listen_handle_ != ACE_INVALID_HANDLE) - { - ACE_OS::closesocket (this->listen_handle_); - this->listen_handle_ = ACE_INVALID_HANDLE; - } -} - -template int -ACE_Asynch_Acceptor::open (const ACE_INET_Addr &address, - size_t bytes_to_read, - bool pass_addresses, - int backlog, - int reuse_addr, - ACE_Proactor *proactor, - bool validate_new_connection, - int reissue_accept, - int number_of_initial_accepts) -{ - ACE_TRACE ("ACE_Asynch_Acceptor<>::open"); - - this->proactor (proactor); - this->pass_addresses_ = pass_addresses; - this->bytes_to_read_ = bytes_to_read; - this->validate_new_connection_ = validate_new_connection; - this->reissue_accept_ = reissue_accept; - this->addr_family_ = address.get_type (); - - // Create the listener socket - this->listen_handle_ = ACE_OS::socket (address.get_type (), SOCK_STREAM, 0); - if (this->listen_handle_ == ACE_INVALID_HANDLE) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_OS::socket")), - -1); - // Initialize the ACE_Asynch_Accept - if (this->asynch_accept_.open (*this, - this->listen_handle_, - 0, - this->proactor ()) == -1) - { - ACE_Errno_Guard g (errno); - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Asynch_Accept::open"))); - ACE_OS::closesocket (this->listen_handle_); - this->listen_handle_ = ACE_INVALID_HANDLE; - return -1; - } - - if (reuse_addr) - { - // Reuse the address - int one = 1; - if (ACE_OS::setsockopt (this->listen_handle_, - SOL_SOCKET, - SO_REUSEADDR, - (const char*) &one, - sizeof one) == -1) - { - ACE_Errno_Guard g (errno); - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_OS::setsockopt"))); - ACE_OS::closesocket (this->listen_handle_); - this->listen_handle_ = ACE_INVALID_HANDLE; - return -1; - } - } - - // If port is not specified, bind to any port. - static ACE_INET_Addr sa (ACE_sap_any_cast (const ACE_INET_Addr &)); - - if (address == sa && - ACE::bind_port (this->listen_handle_, - INADDR_ANY, - address.get_type()) == -1) - { - ACE_Errno_Guard g (errno); - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE::bind_port"))); - ACE_OS::closesocket (this->listen_handle_); - this->listen_handle_ = ACE_INVALID_HANDLE; - return -1; - } - - // Bind to the specified port. - if (ACE_OS::bind (this->listen_handle_, - reinterpret_cast (address.get_addr ()), - address.get_size ()) == -1) - { - ACE_Errno_Guard g (errno); - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_OS::bind"))); - ACE_OS::closesocket (this->listen_handle_); - this->listen_handle_ = ACE_INVALID_HANDLE; - return -1; - } - - // Start listening. - if (ACE_OS::listen (this->listen_handle_, backlog) == -1) - { - ACE_Errno_Guard g (errno); - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_OS::listen"))); - ACE_OS::closesocket (this->listen_handle_); - this->listen_handle_ = ACE_INVALID_HANDLE; - return -1; - } - - // For the number of . - if (number_of_initial_accepts == -1) - number_of_initial_accepts = backlog; - - for (int i = 0; i < number_of_initial_accepts; i++) - { - // Initiate accepts. - if (this->accept (bytes_to_read) == -1) - { - ACE_Errno_Guard g (errno); - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Asynch_Acceptor::accept"))); - ACE_OS::closesocket (this->listen_handle_); - this->listen_handle_ = ACE_INVALID_HANDLE; - return -1; - } - } - - return 0; -} - -template int -ACE_Asynch_Acceptor::set_handle (ACE_HANDLE listen_handle) -{ - ACE_TRACE ("ACE_Asynch_Acceptor<>::set_handle"); - - // Take ownership of the - this->listen_handle_ = listen_handle; - - // Reinitialize the ACE_Asynch_Accept - if (this->asynch_accept_.open (*this, - this->listen_handle_, - 0, - this->proactor ()) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Asynch_Accept::open")), - -1); - return 0; -} - -template ACE_HANDLE -ACE_Asynch_Acceptor::get_handle (void) const -{ - return this->listen_handle_; -} - -template int -ACE_Asynch_Acceptor::accept (size_t bytes_to_read, const void *act) -{ - ACE_TRACE ("ACE_Asynch_Acceptor<>::accept"); - - ACE_Message_Block *message_block = 0; - // The space_needed calculation is drive by needs of Windows. POSIX doesn't - // need to extra 16 bytes, but it doesn't hurt. - size_t space_needed = sizeof (sockaddr_in) + 16; -#if defined (ACE_HAS_IPV6) - if (PF_INET6 == this->addr_family_) - space_needed = sizeof (sockaddr_in6) + 16; -#endif /* ACE_HAS_IPV6 */ - space_needed = (2 * space_needed) + bytes_to_read; - - // Create a new message block big enough for the addresses and data - ACE_NEW_RETURN (message_block, - ACE_Message_Block (space_needed), - -1); - - // Initiate asynchronous accepts - if (this->asynch_accept_.accept (*message_block, - bytes_to_read, - ACE_INVALID_HANDLE, - act, - 0, - ACE_SIGRTMIN, - this->addr_family_) == -1) - { - // Cleanup on error - message_block->release (); - return -1; - } - return 0; -} - -template void -ACE_Asynch_Acceptor::handle_accept (const ACE_Asynch_Accept::Result &result) -{ - ACE_TRACE ("ACE_Asynch_Acceptor<>::handle_accept"); - - // Variable for error tracking - int error = 0; - - // If the asynchronous accept fails. - if (!result.success () || result.accept_handle () == ACE_INVALID_HANDLE) - { - error = 1; - } - -#if defined (ACE_WIN32) - // In order to use accept handle with other Window Sockets 1.1 - // functions, we call the setsockopt function with the - // SO_UPDATE_ACCEPT_CONTEXT option. This option initializes the - // socket so that other Windows Sockets routines to access the - // socket correctly. - if (!error && - ACE_OS::setsockopt (result.accept_handle (), - SOL_SOCKET, - SO_UPDATE_ACCEPT_CONTEXT, - (char *) &this->listen_handle_, - sizeof (this->listen_handle_)) == -1) - { - error = 1; - } -#endif /* ACE_WIN32 */ - - // Parse address. - ACE_INET_Addr local_address; - ACE_INET_Addr remote_address; - if (!error && - (this->validate_new_connection_ || this->pass_addresses_)) - // Parse the addresses. - this->parse_address (result, - remote_address, - local_address); - - // Validate remote address - if (!error && - this->validate_new_connection_ && - (this->validate_connection (result, remote_address, local_address) == -1)) - { - error = 1; - } - - HANDLER *new_handler = 0; - if (!error) - { - // The Template method - new_handler = this->make_handler (); - if (new_handler == 0) - { - error = 1; - } - } - - // If no errors - if (!error) - { - // Update the Proactor unless make_handler() or constructed handler - // set up its own. - if (new_handler->proactor () == 0) - new_handler->proactor (this->proactor ()); - - // Pass the addresses - if (this->pass_addresses_) - new_handler->addresses (remote_address, - local_address); - - // Pass the ACT - if (result.act () != 0) - new_handler->act (result.act ()); - - // Set up the handler's new handle value - new_handler->handle (result.accept_handle ()); - - // Initiate the handler - new_handler->open (result.accept_handle (), - result.message_block ()); - } - - // On failure, no choice but to close the socket - if (error && - result.accept_handle() != ACE_INVALID_HANDLE ) - ACE_OS::closesocket (result.accept_handle ()); - - // Delete the dynamically allocated message_block - result.message_block ().release (); - - // Start off another asynchronous accept to keep the backlog going, - // unless we closed the listen socket already (from the destructor), - // or this callback is the result of a canceled/aborted accept. - if (this->should_reissue_accept () && - this->listen_handle_ != ACE_INVALID_HANDLE -#if defined (ACE_WIN32) - && result.error () != ERROR_OPERATION_ABORTED -#else - && result.error () != ECANCELED -#endif - ) - this->accept (this->bytes_to_read_, result.act ()); -} - -template int -ACE_Asynch_Acceptor::validate_connection - (const ACE_Asynch_Accept::Result& /* result */, - const ACE_INET_Addr& /* remote */, - const ACE_INET_Addr& /* local */) -{ - // Default implementation always validates the remote address. - return 0; -} - -template int -ACE_Asynch_Acceptor::cancel (void) -{ - ACE_TRACE ("ACE_Asynch_Acceptor<>::cancel"); - - // All I/O operations that are canceled will complete with the error - // ERROR_OPERATION_ABORTED. All completion notifications for the I/O - // operations will occur normally. -#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) - return (int) ::CancelIo (this->listen_handle_); -#else - // Supported now - return this->asynch_accept_.cancel(); -#endif /* defined (ACE_HAS_WIN32_OVERLAPPED_IO) */ -} - -template void -ACE_Asynch_Acceptor::parse_address (const - ACE_Asynch_Accept::Result &result, - ACE_INET_Addr &remote_address, - ACE_INET_Addr &local_address) -{ - ACE_TRACE ("ACE_Asynch_Acceptor<>::parse_address"); - -#if defined (ACE_HAS_AIO_CALLS) - - // Use an ACE_SOCK to get the addresses - it knows how to deal with - // ACE_INET_Addr objects and get IPv4/v6 addresses. - ACE_SOCK_Stream str (result.accept_handle ()); - str.get_local_addr (local_address); - str.get_remote_addr (remote_address); - -#elif defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) - - ACE_Message_Block &message_block = result.message_block (); - - sockaddr *local_addr = 0; - sockaddr *remote_addr = 0; - int local_size = 0; - int remote_size = 0; - // This matches setup in accept(). - size_t addr_size = sizeof (sockaddr_in) + 16; -#if defined (ACE_HAS_IPV6) - if (this->addr_family_ == PF_INET6) - addr_size = sizeof (sockaddr_in6) + 16; -#endif /* ACE_HAS_IPV6 */ - - ::GetAcceptExSockaddrs (message_block.rd_ptr (), - static_cast (this->bytes_to_read_), - static_cast (addr_size), - static_cast (addr_size), - &local_addr, - &local_size, - &remote_addr, - &remote_size); - - local_address.set (reinterpret_cast (local_addr), - local_size); - remote_address.set (reinterpret_cast (remote_addr), - remote_size); -#else - // just in case - errno = ENOTSUP; -#endif /* defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) */ - return; -} - -template ACE_HANDLE -ACE_Asynch_Acceptor::handle (void) const -{ - return this->listen_handle_; -} - -template void -ACE_Asynch_Acceptor::handle (ACE_HANDLE h) -{ - ACE_Handler::handle (h); -} - -template ACE_Asynch_Accept & -ACE_Asynch_Acceptor::asynch_accept (void) -{ - return this->asynch_accept_; -} - -template HANDLER * -ACE_Asynch_Acceptor::make_handler (void) -{ - // Default behavior - HANDLER *handler = 0; - ACE_NEW_RETURN (handler, - HANDLER, - 0); - return handler; -} - -template bool -ACE_Asynch_Acceptor::pass_addresses (void) const -{ - return this->pass_addresses_; -} - -template void -ACE_Asynch_Acceptor::pass_addresses (bool new_value) -{ - this->pass_addresses_ = new_value; -} - -template bool -ACE_Asynch_Acceptor::validate_new_connection (void) const -{ - return this->validate_new_connection_; -} - -template void -ACE_Asynch_Acceptor::validate_new_connection (bool new_value) -{ - this->validate_new_connection_ = new_value; -} - -template int -ACE_Asynch_Acceptor::reissue_accept (void) const -{ - return this->reissue_accept_; -} - -template void -ACE_Asynch_Acceptor::reissue_accept (int new_value) -{ - this->reissue_accept_ = new_value; -} - -template size_t -ACE_Asynch_Acceptor::bytes_to_read (void) const -{ - return this->bytes_to_read_; -} - -template void -ACE_Asynch_Acceptor::bytes_to_read (size_t new_value) -{ - this->bytes_to_read_ = new_value; -} - -template int -ACE_Asynch_Acceptor::should_reissue_accept (void) -{ - return this->reissue_accept_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_WIN32 || ACE_HAS_AIO_CALLS */ -#endif /* ACE_ASYNCH_ACCEPTOR_C */ diff --git a/dep/acelite/ace/Asynch_Acceptor.h b/dep/acelite/ace/Asynch_Acceptor.h deleted file mode 100644 index b806d6e4596..00000000000 --- a/dep/acelite/ace/Asynch_Acceptor.h +++ /dev/null @@ -1,276 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Asynch_Acceptor.h - * - * $Id: Asynch_Acceptor.h 91693 2010-09-09 12:57:54Z johnnyw $ - * - * @author Irfan Pyarali (irfan@cs.wustl.edu) - */ -//============================================================================= - -#ifndef ACE_ASYNCH_ACCEPTOR_H -#define ACE_ASYNCH_ACCEPTOR_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) -// This only works on platforms that support async i/o. - -#include "ace/Default_Constants.h" -#include "ace/Asynch_IO.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declarations -class ACE_Message_Block; -class ACE_INET_Addr; - -/** - * @class ACE_Asynch_Acceptor - * - * @brief This class is an example of the Acceptor Pattern. This class - * will accept new connections and create new HANDLER to handle - * the new connections. - * - * Unlike the ACE_Acceptor, however, this class is designed to - * be used asynchronously. - */ -template -class ACE_Asynch_Acceptor : public ACE_Handler -{ -public: - /// A do nothing constructor. - ACE_Asynch_Acceptor (void); - - /// Virtual destruction - virtual ~ACE_Asynch_Acceptor (void); - - /** - * @c open starts one or more asynchronous accept requests on a - * @a address. Each accept operation may optionally read an - * initial buffer from the new connection when accepted. - * - * @param address The address to listen/accept connections on. - * If the address does not specify a port, a random - * port is selected and bound. - * @param bytes_to_read Optional, specifies the maximum number of bytes - * to read with the accept. The buffer for the initial - * data is allocated internally and passed to the - * @c ACE_Service_Handler::open() hook method. It is - * legitimate only during the @c open() method and must - * be copied if required after @c open() returns. - * This pre-read function works only on Windows. - * @param pass_addresses Optional, a non-zero value indicates that - * the local and peer addresses should be passed to the - * associated @c ACE_Service_Handler::addresses() method - * after any call to @c validate_new_connection() and prior - * to the @c open() hook method call. - * @param backlog Optional, defaulting to @c ACE_DEFAULT_ASYNCH_BACKLOG (which - * can be adjusted in your platform's @c config.h file). - * Specifies the listening backlog for the listening socket. - * @param reuse_addr Optional, indicates whether the @c SO_REUSEADDR - * option is set on the listening socket or not. - * @param proactor Optional, pointer to the @c ACE_Proactor to use for - * demultiplexing asynchronous accepts. If 0, the - * process's singleton @c ACE_Proactor is used. - * @param validate_new_connection Optional, if true, this object's - * @c validate_connection() method is called after - * the accept completes, but before the service handler's - * @c open() hook method is called. If @c - * validate_connection() returns -1, the newly-accepted - * socket is immediately closed, and the @c addresses() - * method is not called. - * @param reissue_accept Optional, if non-zero (the default), a new - * asynchronous accept operation is started after each - * completion, whether the completion is for success or - * failure, and whether or not a successfully-accepted - * connection is subsequently refused. - * @param number_of_initial_accepts Optional, the number of asynchronous - * accepts that are started immediately. If -1 (the - * default), the value of @a backlog is used. - * - * @note On Windows, the peer address is only available at the time - * the connection is accepted. Therefore, if you require the peer - * address on Windows, do not rely on the - * @c ACE_SOCK::get_remote_addr() method - it won't work. You must - * supply a non-zero value for @a pass_addresses and obtain the - * peer address in the @c ACE_Service_Handler::addresses() method. - * - * @see ACE_INET_Addr - * @see ACE_Service_Handler - */ - virtual int open (const ACE_INET_Addr &address, - size_t bytes_to_read = 0, - bool pass_addresses = false, - int backlog = ACE_DEFAULT_ASYNCH_BACKLOG, - int reuse_addr = 1, - ACE_Proactor *proactor = 0, - bool validate_new_connection = false, - int reissue_accept = 1, - int number_of_initial_accepts = -1); - - /// Get the underlying handle. - virtual ACE_HANDLE get_handle (void) const; - - /** - * Set the underlying listen handle. It is the user's responsibility - * to make sure that the old listen handle has been appropriately - * closed and the all outstanding asynchronous operations have - * either completed or have been canceled on the old listen handle. - */ - virtual int set_handle (ACE_HANDLE handle); - - /// This initiates a new asynchronous accept operation. - /** - * You need only call this method if the @a reissue_accept argument - * passed to @c open() was 0. - */ - virtual int accept (size_t bytes_to_read = 0, const void *act = 0); - - /** - * Cancels all pending accepts operations issued by this object. - * - * @note On Windows, only accept operations initiated by the calling thread - * are canceled. - */ - virtual int cancel (void); - - /** - * Template method to validate peer before service is opened. - * This method is called after a new connection is accepted if the - * @a validate_connection argument to @c open() was non-zero or - * the @c validate_new_connection() method is called to turn this - * feature on. The default implementation returns 0. Users can - * reimplement this method to perform validation of the peer - * using it's address, running an authentication procedure (such as - * SSL) or anything else necessary or desireable. The return value - * from this method determines whether or not ACE will continue - * opening the service or abort the connection. - * - * @param result Result of the connection acceptance. - * @param remote Peer's address. - * @param local Local address connection was accepted at. - * - * @retval -1 ACE_Asynch_Acceptor will close the connection, and - * the service will not be opened. - * @retval 0 Service opening will proceeed. - */ - virtual int validate_connection (const ACE_Asynch_Accept::Result& result, - const ACE_INET_Addr &remote, - const ACE_INET_Addr& local); - - /** - * Template method for deciding whether to reissue accept. - * - * This hook method is called after each accept completes to decide if - * another accept should be initiated. If the method returns a non-zero - * value, another accept is initiated. - * - * The default implemenation always returns the value passed as the - * @c open() method's @a reissue_accept argument. That value can also - * be changed using the @c reissue_accept() method. - */ - virtual int should_reissue_accept (void); - - // - // These are low level tweaking methods - // - - /// Get flag that indicates if parsing and passing of addresses to - /// the service_handler is necessary. - virtual bool pass_addresses (void) const; - - /// Set flag that indicates if parsing and passing of addresses to - /// the service_handler is necessary. - virtual void pass_addresses (bool new_value); - - /// Get flag that indicates if address validation is required. - virtual bool validate_new_connection (void) const; - - /// Set flag that indicates if address validation is required. - virtual void validate_new_connection (bool new_value); - - /// Get flag that indicates if a new accept should be reissued when a accept - /// completes. - virtual int reissue_accept (void) const; - - /// Set flag that indicates if a new accept should be reissued when a accept - /// completes. - virtual void reissue_accept (int new_value); - - /// Get bytes to be read with the call. - virtual size_t bytes_to_read (void) const; - - /// Set bytes to be read with the call. - virtual void bytes_to_read (size_t new_value); - -protected: - - /// This is called when an outstanding accept completes. - virtual void handle_accept (const ACE_Asynch_Accept::Result &result); - - /// Return the listen handle. - ACE_HANDLE handle (void) const; - /// Set the listen handle. - void handle (ACE_HANDLE h); - - /// This parses the address from read buffer. - void parse_address (const ACE_Asynch_Accept::Result &result, - ACE_INET_Addr &remote_address, - ACE_INET_Addr &local_address); - - /// Return the asynch accept object. - ACE_Asynch_Accept &asynch_accept (void); - - /** - * This is the template method used to create new handler. - * Subclasses must overwrite this method if a new handler creation - * strategy is required. - */ - virtual HANDLER *make_handler (void); - -private: - /// Handle used to listen for new connections. - ACE_HANDLE listen_handle_; - - /// Asynch_Accept used to make life easier :-) - ACE_Asynch_Accept asynch_accept_; - - /// Flag that indicates if parsing of addresses is necessary. - bool pass_addresses_; - - /// Flag that indicates if address validation is required. - bool validate_new_connection_; - - /// Flag that indicates if a new accept should be reissued when a - /// accept completes. - int reissue_accept_; - - /// Bytes to be read with the call. - size_t bytes_to_read_; - - /// Address family used to open this object. Obtained from @a address passed - /// to @c open(). - int addr_family_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Asynch_Acceptor.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Asynch_Acceptor.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ -#include /**/ "ace/post.h" -#endif /* ACE_ASYNCH_ACCEPTOR_H */ diff --git a/dep/acelite/ace/Asynch_Connector.cpp b/dep/acelite/ace/Asynch_Connector.cpp deleted file mode 100644 index 466d48646fc..00000000000 --- a/dep/acelite/ace/Asynch_Connector.cpp +++ /dev/null @@ -1,270 +0,0 @@ -// $Id: Asynch_Connector.cpp 92069 2010-09-28 11:38:59Z johnnyw $ - -#ifndef ACE_ASYNCH_CONNECTOR_CPP -#define ACE_ASYNCH_CONNECTOR_CPP - -#include "ace/Asynch_Connector.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if (defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)) && !defined(ACE_HAS_WINCE) -// This only works on platforms that support async I/O. - -#include "ace/OS_NS_sys_socket.h" -#include "ace/OS_Memory.h" -#include "ace/Flag_Manip.h" -#include "ace/Log_Msg.h" -#include "ace/Message_Block.h" -#include "ace/INET_Addr.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Asynch_Connector::ACE_Asynch_Connector (void) - : pass_addresses_ (false), - validate_new_connection_ (false) -{ -} - -template -ACE_Asynch_Connector::~ACE_Asynch_Connector (void) -{ - //this->asynch_connect_.close (); -} - -template int -ACE_Asynch_Connector::open (bool pass_addresses, - ACE_Proactor *proactor, - bool validate_new_connection) -{ - this->proactor (proactor); - this->pass_addresses_ = pass_addresses; - this->validate_new_connection_ = validate_new_connection; - - // Initialize the ACE_Asynch_Connect - if (this->asynch_connect_.open (*this, - ACE_INVALID_HANDLE, - 0, - this->proactor ()) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Asynch_Connect::open")), - -1); - return 0; -} - -template int -ACE_Asynch_Connector::connect (const ACE_INET_Addr & remote_sap, - const ACE_INET_Addr & local_sap, - int reuse_addr, - const void *act) -{ - // Initiate asynchronous connect - if (this->asynch_connect_.connect (ACE_INVALID_HANDLE, - remote_sap, - local_sap, - reuse_addr, - act) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Asynch_Connect::connect")), - -1); - return 0; -} - -template void -ACE_Asynch_Connector::handle_connect (const ACE_Asynch_Connect::Result &result) -{ - // Variable for error tracking - int error = 0; - - // If the asynchronous connect fails. - if (!result.success () || - result.connect_handle () == ACE_INVALID_HANDLE) - { - error = 1; - } - - if (result.error () != 0) - { - error = 1; - } - - // set blocking mode - if (!error && - ACE::clr_flags - (result.connect_handle (), ACE_NONBLOCK) != 0) - { - error = 1; - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Asynch_Connector::handle_connect : Set blocking mode"))); - } - - // Parse the addresses. - ACE_INET_Addr local_address; - ACE_INET_Addr remote_address; - if (!error && - (this->validate_new_connection_ || this->pass_addresses_)) - this->parse_address (result, - remote_address, - local_address); - - // Call validate_connection even if there was an error - it's the only - // way the application can learn the connect disposition. - if (this->validate_new_connection_ && - this->validate_connection (result, remote_address, local_address) == -1) - { - error = 1; - } - - HANDLER *new_handler = 0; - if (!error) - { - // The Template method - new_handler = this->make_handler (); - if (new_handler == 0) - { - error = 1; - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Asynch_Connector::handle_connect : Making of new handler failed"))); - } - } - - // If no errors - if (!error) - { - // Update the Proactor. - new_handler->proactor (this->proactor ()); - - // Pass the addresses - if (this->pass_addresses_) - new_handler->addresses (remote_address, - local_address); - - // Pass the ACT - if (result.act () != 0) - new_handler->act (result.act ()); - - // Set up the handler's new handle value - new_handler->handle (result.connect_handle ()); - - ACE_Message_Block mb; - - // Initiate the handler with empty message block; - new_handler->open (result.connect_handle (), mb); - } - - // On failure, no choice but to close the socket - if (error && - result.connect_handle() != ACE_INVALID_HANDLE) - ACE_OS::closesocket (result.connect_handle ()); -} - -template int -ACE_Asynch_Connector::validate_connection - (const ACE_Asynch_Connect::Result &, - const ACE_INET_Addr & /* remote_address */, - const ACE_INET_Addr & /* local_address */) -{ - // Default implementation always validates the remote address. - return 0; -} - -template int -ACE_Asynch_Connector::cancel (void) -{ - return this->asynch_connect_.cancel (); -} - -template void -ACE_Asynch_Connector::parse_address (const ACE_Asynch_Connect::Result &result, - ACE_INET_Addr &remote_address, - ACE_INET_Addr &local_address) -{ -#if defined (ACE_HAS_IPV6) - // Getting the addresses. - sockaddr_in6 local_addr; - sockaddr_in6 remote_addr; -#else - // Getting the addresses. - sockaddr_in local_addr; - sockaddr_in remote_addr; -#endif /* ACE_HAS_IPV6 */ - - // Get the length. - int local_size = sizeof (local_addr); - int remote_size = sizeof (remote_addr); - - // Get the local address. - if (ACE_OS::getsockname (result.connect_handle (), - reinterpret_cast (&local_addr), - &local_size) < 0) - ACE_ERROR ((LM_ERROR, - ACE_TEXT("%p\n"), - ACE_TEXT("ACE_Asynch_Connector:: failed"))); - - // Get the remote address. - if (ACE_OS::getpeername (result.connect_handle (), - reinterpret_cast (&remote_addr), - &remote_size) < 0) - ACE_ERROR ((LM_ERROR, - ACE_TEXT("%p\n"), - ACE_TEXT("ACE_Asynch_Connector:: failed"))); - - // Set the addresses. - local_address.set (reinterpret_cast (&local_addr), - local_size); - remote_address.set (reinterpret_cast (&remote_addr), - remote_size); - - return; -} - - -template ACE_Asynch_Connect & -ACE_Asynch_Connector::asynch_connect (void) -{ - return this->asynch_connect_; -} - -template HANDLER * -ACE_Asynch_Connector::make_handler (void) -{ - // Default behavior - HANDLER *handler = 0; - ACE_NEW_RETURN (handler, HANDLER, 0); - return handler; -} - -template bool -ACE_Asynch_Connector::pass_addresses (void) const -{ - return this->pass_addresses_; -} - -template void -ACE_Asynch_Connector::pass_addresses (bool new_value) -{ - this->pass_addresses_ = new_value; -} - -template bool -ACE_Asynch_Connector::validate_new_connection (void) const -{ - return this->validate_new_connection_; -} - -template void -ACE_Asynch_Connector::validate_new_connection (bool new_value) -{ - this->validate_new_connection_ = new_value; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_WIN32 || ACE_HAS_AIO_CALLS */ -#endif /* ACE_ASYNCH_CONNECTOR_CPP */ diff --git a/dep/acelite/ace/Asynch_Connector.h b/dep/acelite/ace/Asynch_Connector.h deleted file mode 100644 index 7c7969cc20d..00000000000 --- a/dep/acelite/ace/Asynch_Connector.h +++ /dev/null @@ -1,171 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Asynch_Connector.h - * - * $Id: Asynch_Connector.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Alexander Libman - */ -//============================================================================= - -#ifndef ACE_ASYNCH_CONNECTOR_H -#define ACE_ASYNCH_CONNECTOR_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if (defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)) && !defined(ACE_HAS_WINCE) -// This only works on platforms that support async i/o. - -#include "ace/Asynch_IO.h" -#include "ace/INET_Addr.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declarations -class ACE_Message_Block; - -/** - * @class ACE_Asynch_Connector - * - * @brief This class is an example of the Connector pattern. This class - * will establish new connections and create new HANDLER objects to handle - * the new connections. - * - * Unlike the ACE_Connector, however, this class is designed to - * be used asynchronously with the ACE Proactor framework. - */ - -template -class ACE_Asynch_Connector : public ACE_Handler -{ -public: - /// A do nothing constructor. - ACE_Asynch_Connector (void); - - /// Virtual destruction - virtual ~ACE_Asynch_Connector (void); - - /** - * This opens asynch connector - */ - virtual int open (bool pass_addresses = false, - ACE_Proactor *proactor = 0, - bool validate_new_connection = true); - - /// This initiates a new asynchronous connect - virtual int connect (const ACE_INET_Addr &remote_sap, - const ACE_INET_Addr &local_sap = - (const ACE_INET_Addr &)ACE_Addr::sap_any, - int reuse_addr = 1, - const void *act = 0); - - /** - * This cancels all pending accepts operations that were issued by - * the calling thread. - * - * @note On Windows, this method does not cancel connect operations - * issued by other threads. - * - * @note On POSIX, delegates cancelation to ACE_POSIX_Asynch_Connect. - */ - virtual int cancel (void); - - - /** - * Template method to validate peer before service is opened. - * This method is called when the connection attempt completes, - * whether it succeeded or failed, if the @a validate_connection - * argument to @c open() was non-zero or the @c validate_new_connection() - * method is called to turn this feature on. The default implementation - * returns 0. Users can (and probably should) reimplement this method - * to learn about the success or failure of the connection attempt. - * If the connection completed successfully, this method can be used to - * perform validation of the peer using it's address, running an - * authentication procedure (such as SSL) or anything else necessary or - * desireable. The return value from this method determines whether or - * not ACE will continue opening the service or abort the connection. - * - * @param result Result of the connection acceptance. Use - * result.success() to determine success or failure of - * the connection attempt. - * @param remote Peer's address. If the connection failed, this object - * is undefined. - * @param local Local address connection was completed from. If the - * connection failed, this object is undefined. - * - * @retval -1 ACE_Asynch_Connector will close the connection, and - * the service will not be opened. - * @retval 0 Service opening will proceeed. - * @return Return value is ignored if the connection attempt failed. - */ - virtual int validate_connection (const ACE_Asynch_Connect::Result& result, - const ACE_INET_Addr &remote, - const ACE_INET_Addr& local); - - // - // These are low level tweaking methods - // - - /// Set and get flag that indicates if parsing and passing of - /// addresses to the service_handler is necessary. - virtual bool pass_addresses (void) const; - virtual void pass_addresses (bool new_value); - - /// Set and get flag that indicates if address validation is - /// required. - virtual bool validate_new_connection (void) const; - virtual void validate_new_connection (bool new_value); - -protected: - - /// This is called when an outstanding accept completes. - virtual void handle_connect (const ACE_Asynch_Connect::Result &result); - - - /// This parses the address from read buffer. - void parse_address (const ACE_Asynch_Connect::Result &result, - ACE_INET_Addr &remote_address, - ACE_INET_Addr &local_address); - - /// Return the asynch Connect object. - ACE_Asynch_Connect & asynch_connect (void); - - /** - * This is the template method used to create new handler. - * Subclasses must overwrite this method if a new handler creation - * strategy is required. - */ - virtual HANDLER *make_handler (void); - -private: - - /// Asynch_Connect used to make life easier :-) - ACE_Asynch_Connect asynch_connect_; - - /// Flag that indicates if parsing of addresses is necessary. - bool pass_addresses_; - - /// Flag that indicates if address validation is required. - bool validate_new_connection_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Asynch_Connector.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Asynch_Connector.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#endif /* ACE_WIN32 || ACE_HAS_AIO_CALLS */ -#include /**/ "ace/post.h" -#endif /* ACE_ASYNCH_CONNECTOR_H */ diff --git a/dep/acelite/ace/Asynch_IO.cpp b/dep/acelite/ace/Asynch_IO.cpp deleted file mode 100644 index 1913ae10bc9..00000000000 --- a/dep/acelite/ace/Asynch_IO.cpp +++ /dev/null @@ -1,1412 +0,0 @@ -// $Id: Asynch_IO.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/Asynch_IO.h" - -#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) -// This only works on platforms with Asynchronous IO - -#include "ace/Proactor.h" -#include "ace/Message_Block.h" -#include "ace/INET_Addr.h" -#include "ace/Asynch_IO_Impl.h" -#include "ace/os_include/os_errno.h" -#include "ace/Truncate.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -size_t -ACE_Asynch_Result::bytes_transferred (void) const -{ - return this->implementation ()->bytes_transferred (); -} - -const void * -ACE_Asynch_Result::act (void) const -{ - return this->implementation ()->act (); -} - -int -ACE_Asynch_Result::success (void) const -{ - return this->implementation ()->success (); -} - -const void * -ACE_Asynch_Result::completion_key (void) const -{ - return this->implementation ()->completion_key (); -} - -unsigned long -ACE_Asynch_Result::error (void) const -{ - return this->implementation ()->error (); -} - -ACE_HANDLE -ACE_Asynch_Result::event (void) const -{ - return this->implementation ()->event (); -} - -unsigned long -ACE_Asynch_Result::offset (void) const -{ - return this->implementation ()->offset (); -} - -unsigned long -ACE_Asynch_Result::offset_high (void) const -{ - return this->implementation ()->offset_high (); -} - -int -ACE_Asynch_Result::priority (void) const -{ - return this->implementation ()->priority (); -} - -int -ACE_Asynch_Result::signal_number (void) const -{ - return this->implementation ()->signal_number (); -} - -ACE_Asynch_Result::ACE_Asynch_Result (ACE_Asynch_Result_Impl *implementation) - : implementation_ (implementation) -{ -} - -ACE_Asynch_Result::~ACE_Asynch_Result (void) -{ - // Proactor deletes the implementation when the finishes. -} - -ACE_Asynch_Result_Impl * -ACE_Asynch_Result::implementation (void) const -{ - return this->implementation_; -} - -// ********************************************************************* - -int -ACE_Asynch_Operation::open (ACE_Handler &handler, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - return this->implementation ()->open (handler.proxy (), - handle, - completion_key, - proactor); -} - -int -ACE_Asynch_Operation::cancel (void) -{ - if (0 == this->implementation ()) - { - errno = EFAULT; - return -1; - } - return this->implementation ()->cancel (); -} - -ACE_Proactor * -ACE_Asynch_Operation::proactor (void) const -{ - if (0 == this->implementation ()) - { - errno = EFAULT; - return 0; - } - return this->implementation ()->proactor (); -} - -ACE_Asynch_Operation::ACE_Asynch_Operation (void) -{ -} - -ACE_Asynch_Operation::~ACE_Asynch_Operation (void) -{ -} - -ACE_Proactor * -ACE_Asynch_Operation::get_proactor (ACE_Proactor *user_proactor, - ACE_Handler &handler) const -{ - if (user_proactor == 0) - { - // Grab the singleton proactor if proactor> is zero - user_proactor = handler.proactor (); - if (user_proactor == 0) - user_proactor = ACE_Proactor::instance (); - } - - return user_proactor; -} - -// ************************************************************ - -ACE_Asynch_Read_Stream::ACE_Asynch_Read_Stream (void) - : implementation_ (0) -{ -} - -ACE_Asynch_Read_Stream::~ACE_Asynch_Read_Stream (void) -{ - // Delete the implementation. - delete this->implementation_; - this->implementation_ = 0; -} - -int -ACE_Asynch_Read_Stream::open (ACE_Handler &handler, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - // Get a proactor for/from the user. - proactor = this->get_proactor (proactor, handler); - - // Now let us get the implementation initialized. - if ((this->implementation_ = proactor->create_asynch_read_stream ()) == 0) - return -1; - - // Call the method of the base class. - return ACE_Asynch_Operation::open (handler, - handle, - completion_key, - proactor); -} - -int -ACE_Asynch_Read_Stream::read (ACE_Message_Block &message_block, - size_t bytes_to_read, - const void *act, - int priority, - int signal_number) -{ - if (0 == this->implementation_) - { - errno = EFAULT; - return -1; - } - return this->implementation_->read (message_block, - bytes_to_read, - act, - priority, - signal_number); -} - -#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) -int -ACE_Asynch_Read_Stream::readv (ACE_Message_Block &message_block, - size_t bytes_to_read, - const void *act, - int priority, - int signal_number) -{ - if (0 == this->implementation_) - { - errno = EFAULT; - return -1; - } - return this->implementation_->readv (message_block, - bytes_to_read, - act, - priority, - signal_number); -} -#endif /* ACE_HAS_WIN32_OVERLAPPED_IO */ - -ACE_Asynch_Operation_Impl * -ACE_Asynch_Read_Stream::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - -size_t -ACE_Asynch_Read_Stream::Result::bytes_to_read (void) const -{ - return this->implementation ()->bytes_to_read (); -} - -ACE_Message_Block & -ACE_Asynch_Read_Stream::Result::message_block (void) const -{ - return this->implementation ()->message_block (); -} - -ACE_HANDLE -ACE_Asynch_Read_Stream::Result::handle (void) const -{ - return this->implementation ()->handle (); -} - -ACE_Asynch_Read_Stream::Result::Result (ACE_Asynch_Read_Stream_Result_Impl *implementation) - : ACE_Asynch_Result (implementation), - implementation_ (implementation) -{ -} - -ACE_Asynch_Read_Stream::Result::~Result (void) -{ - // Proactor will delete the implementation after is - // finished. -} - -ACE_Asynch_Read_Stream_Result_Impl * -ACE_Asynch_Read_Stream::Result::implementation (void) const -{ - return this->implementation_; -} - -// *************************************************** - -ACE_Asynch_Write_Stream::ACE_Asynch_Write_Stream (void) - : implementation_ (0) -{ -} - -ACE_Asynch_Write_Stream::~ACE_Asynch_Write_Stream (void) -{ - // Delete the implementation. - delete this->implementation_; - this->implementation_ = 0; -} - -int -ACE_Asynch_Write_Stream::open (ACE_Handler &handler, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - // Get a proactor for/from the user. - proactor = this->get_proactor (proactor, handler); - - // Now let us get the implementation initialized. - if ((this->implementation_ = proactor->create_asynch_write_stream ()) == 0) - return -1; - - // Call the method of the base class. - return ACE_Asynch_Operation::open (handler, - handle, - completion_key, - proactor); -} - -int -ACE_Asynch_Write_Stream::write (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act, - int priority, - int signal_number) -{ - if (0 == this->implementation_) - { - errno = EFAULT; - return -1; - } - return this->implementation_->write (message_block, - bytes_to_write, - act, - priority, - signal_number); -} - -#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) -int -ACE_Asynch_Write_Stream::writev (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act, - int priority, - int signal_number) -{ - if (0 == this->implementation_) - { - errno = EFAULT; - return -1; - } - return this->implementation_->writev (message_block, - bytes_to_write, - act, - priority, - signal_number); -} -#endif /* ACE_HAS_WIN32_OVERLAPPED_IO */ - -ACE_Asynch_Operation_Impl * -ACE_Asynch_Write_Stream::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - -size_t -ACE_Asynch_Write_Stream::Result::bytes_to_write (void) const -{ - return this->implementation ()->bytes_to_write (); -} - -ACE_Message_Block & -ACE_Asynch_Write_Stream::Result::message_block (void) const -{ - return this->implementation ()->message_block (); -} - -ACE_HANDLE -ACE_Asynch_Write_Stream::Result::handle (void) const -{ - return this->implementation ()->handle (); -} - -ACE_Asynch_Write_Stream::Result::Result (ACE_Asynch_Write_Stream_Result_Impl *implementation) - : ACE_Asynch_Result (implementation), - implementation_ (implementation) -{ -} - -ACE_Asynch_Write_Stream::Result::~Result (void) -{ - // Proactor will delte the implementation when the call - // finishes. -} - -ACE_Asynch_Write_Stream_Result_Impl * -ACE_Asynch_Write_Stream::Result::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - -ACE_Asynch_Read_File::ACE_Asynch_Read_File (void) - : implementation_ (0) -{ -} - -ACE_Asynch_Read_File::~ACE_Asynch_Read_File (void) -{ - // Delete the implementation. - delete this->implementation_; - this->implementation_ = 0; -} - -int -ACE_Asynch_Read_File::open (ACE_Handler &handler, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - // Get a proactor for/from the user. - proactor = this->get_proactor (proactor, handler); - - // Now let us get the implementation initialized. - if ((this->implementation_ = proactor->create_asynch_read_file ()) == 0) - return -1; - - // Call the method of the base class. - return ACE_Asynch_Operation::open (handler, - handle, - completion_key, - proactor); -} - -int -ACE_Asynch_Read_File::read (ACE_Message_Block &message_block, - size_t bytes_to_read, - unsigned long offset, - unsigned long offset_high, - const void *act, - int priority, - int signal_number) -{ - if (0 == this->implementation_) - { - errno = EFAULT; - return -1; - } - return this->implementation_->read (message_block, - bytes_to_read, - offset, - offset_high, - act, - priority, - signal_number); -} - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) -int -ACE_Asynch_Read_File::readv (ACE_Message_Block &message_block, - size_t bytes_to_read, - unsigned long offset, - unsigned long offset_high, - const void *act, - int priority, - int signal_number) -{ - if (0 == this->implementation_) - { - errno = EFAULT; - return -1; - } - return this->implementation_->readv (message_block, - bytes_to_read, - offset, - offset_high, - act, - priority, - signal_number); -} -#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ - -ACE_Asynch_Operation_Impl * -ACE_Asynch_Read_File::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - -ACE_Asynch_Read_File::Result::Result (ACE_Asynch_Read_File_Result_Impl *implementation) - : ACE_Asynch_Read_Stream::Result (implementation), - implementation_ (implementation) -{ -} - -ACE_Asynch_Read_File::Result::~Result (void) -{ - // Proactor will delete the implementation when call - // completes. -} - -ACE_Asynch_Read_File_Result_Impl * -ACE_Asynch_Read_File::Result::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - -ACE_Asynch_Write_File::ACE_Asynch_Write_File (void) - : implementation_ (0) -{ -} - -ACE_Asynch_Write_File::~ACE_Asynch_Write_File (void) -{ - // Delete the implementation. - delete this->implementation_; - this->implementation_ = 0; -} - -int -ACE_Asynch_Write_File::open (ACE_Handler &handler, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - // Get a proactor for/from the user. - proactor = this->get_proactor (proactor, handler); - - // Now let us get the implementation initialized. - if ((this->implementation_ = proactor->create_asynch_write_file ()) == 0) - return -1; - - // Call the method of the base class. - return ACE_Asynch_Operation::open (handler, - handle, - completion_key, - proactor); -} - -int -ACE_Asynch_Write_File::write (ACE_Message_Block &message_block, - size_t bytes_to_write, - unsigned long offset, - unsigned long offset_high, - const void *act, - int priority, - int signal_number) -{ - if (0 == this->implementation_) - { - errno = EFAULT; - return -1; - } - return this->implementation_->write (message_block, - bytes_to_write, - offset, - offset_high, - act, - priority, - signal_number); -} - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) -int -ACE_Asynch_Write_File::writev (ACE_Message_Block &message_block, - size_t bytes_to_write, - unsigned long offset, - unsigned long offset_high, - const void *act, - int priority, - int signal_number) -{ - if (0 == this->implementation_) - { - errno = EFAULT; - return -1; - } - return this->implementation_->writev (message_block, - bytes_to_write, - offset, - offset_high, - act, - priority, - signal_number); -} -#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ - -ACE_Asynch_Operation_Impl * -ACE_Asynch_Write_File::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - -ACE_Asynch_Write_File::Result::Result (ACE_Asynch_Write_File_Result_Impl *implementation) - : ACE_Asynch_Write_Stream::Result (implementation), - implementation_ (implementation) -{ -} - -ACE_Asynch_Write_File::Result::~Result (void) -{ - // Proactor will delete the implementation when the call - // completes. -} - -ACE_Asynch_Write_File_Result_Impl * -ACE_Asynch_Write_File::Result::implementation (void) const -{ - return this->implementation_; -} - -// ********************************************************************* - -ACE_Asynch_Accept::ACE_Asynch_Accept (void) - : implementation_ (0) -{ -} - -ACE_Asynch_Accept::~ACE_Asynch_Accept (void) -{ - // Delete the implementation. - delete this->implementation_; - this->implementation_ = 0; -} - -int -ACE_Asynch_Accept::open (ACE_Handler &handler, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - // Get a proactor for/from the user. - proactor = this->get_proactor (proactor, handler); - - // Now let us get the implementation initialized. - if ((this->implementation_ = proactor->create_asynch_accept ()) == 0) - return -1; - - // Call the method of the base class. - return ACE_Asynch_Operation::open (handler, - handle, - completion_key, - proactor); -} - -int -ACE_Asynch_Accept::accept (ACE_Message_Block &message_block, - size_t bytes_to_read, - ACE_HANDLE accept_handle, - const void *act, - int priority, - int signal_number, - int addr_family) -{ - if (0 == this->implementation_) - { - errno = EFAULT; - return -1; - } - return this->implementation_->accept (message_block, - bytes_to_read, - accept_handle, - act, - priority, - signal_number, - addr_family); -} - -ACE_Asynch_Operation_Impl * -ACE_Asynch_Accept::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - -size_t -ACE_Asynch_Accept::Result::bytes_to_read (void) const -{ - return this->implementation ()->bytes_to_read (); -} - -ACE_Message_Block & -ACE_Asynch_Accept::Result::message_block (void) const -{ - return this->implementation ()->message_block (); -} - -ACE_HANDLE -ACE_Asynch_Accept::Result::listen_handle (void) const -{ - return this->implementation ()->listen_handle (); -} - -ACE_HANDLE -ACE_Asynch_Accept::Result::accept_handle (void) const -{ - return this->implementation ()->accept_handle (); -} - -ACE_Asynch_Accept::Result::Result (ACE_Asynch_Accept_Result_Impl *implementation) - : ACE_Asynch_Result (implementation), - implementation_ (implementation) -{ -} - -ACE_Asynch_Accept::Result::~Result (void) -{ - // Proactor will delete the implementation when the call - // completes. -} - -ACE_Asynch_Accept_Result_Impl * -ACE_Asynch_Accept::Result::implementation (void) const -{ - return this->implementation_; -} - - - -// ********************************************************************* - -ACE_Asynch_Connect::ACE_Asynch_Connect (void) - : implementation_ (0) -{ -} - -ACE_Asynch_Connect::~ACE_Asynch_Connect (void) -{ - // Delete the implementation. - delete this->implementation_; - this->implementation_ = 0; -} - -int -ACE_Asynch_Connect::open (ACE_Handler &handler, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - // Get a proactor for/from the user. - proactor = this->get_proactor (proactor, handler); - - // Now let us get the implementation initialized. - if ((this->implementation_ = proactor->create_asynch_connect ()) == 0) - return -1; - - // Call the method of the base class. - return ACE_Asynch_Operation::open (handler, - handle, - completion_key, - proactor); -} - -int -ACE_Asynch_Connect::connect (ACE_HANDLE connect_handle, - const ACE_Addr & remote_sap, - const ACE_Addr & local_sap, - int reuse_addr, - const void *act, - int priority, - int signal_number) -{ - if (0 == this->implementation_) - { - errno = EFAULT; - return -1; - } - return this->implementation_->connect (connect_handle, - remote_sap, - local_sap, - reuse_addr, - act, - priority, - signal_number); -} - -ACE_Asynch_Operation_Impl * -ACE_Asynch_Connect::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - -ACE_Asynch_Connect::Result::Result (ACE_Asynch_Connect_Result_Impl *implementation) - : ACE_Asynch_Result (implementation), - implementation_ (implementation) -{ -} - -ACE_Asynch_Connect::Result::~Result (void) -{ - // Proactor will delete the implementation when the call - // completes. -} - -ACE_HANDLE -ACE_Asynch_Connect::Result::connect_handle (void) const -{ - return this->implementation ()->connect_handle (); -} - - -ACE_Asynch_Connect_Result_Impl * -ACE_Asynch_Connect::Result::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - -ACE_Asynch_Transmit_File::ACE_Asynch_Transmit_File (void) - : implementation_ (0) -{ -} - -ACE_Asynch_Transmit_File::~ACE_Asynch_Transmit_File (void) -{ - // Delete the implementation. - delete this->implementation_; - this->implementation_ = 0; -} - -int -ACE_Asynch_Transmit_File::open (ACE_Handler &handler, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - // Get a proactor for/from the user. - proactor = this->get_proactor (proactor, handler); - - // Now let us get the implementation initialized. - if ((this->implementation_ = proactor->create_asynch_transmit_file ()) == 0) - return -1; - - // Call the method of the base class. - return ACE_Asynch_Operation::open (handler, - handle, - completion_key, - proactor); -} - -int -ACE_Asynch_Transmit_File::transmit_file (ACE_HANDLE file, - Header_And_Trailer *header_and_trailer, - size_t bytes_to_write, - unsigned long offset, - unsigned long offset_high, - size_t bytes_per_send, - unsigned long flags, - const void *act, - int priority, - int signal_number) -{ - if (0 == this->implementation_) - { - errno = EFAULT; - return -1; - } - return this->implementation_->transmit_file (file, - header_and_trailer, - bytes_to_write, - offset, - offset_high, - bytes_per_send, - flags, - act, - priority, - signal_number); -} - -ACE_Asynch_Operation_Impl * -ACE_Asynch_Transmit_File::implementation (void) const -{ - return this->implementation_; -} - -// **************************************************************************** - -ACE_HANDLE -ACE_Asynch_Transmit_File::Result::socket (void) const -{ - return this->implementation ()->socket (); -} - -ACE_HANDLE -ACE_Asynch_Transmit_File::Result::file (void) const -{ - return this->implementation ()->file (); -} - -ACE_Asynch_Transmit_File::Header_And_Trailer * -ACE_Asynch_Transmit_File::Result::header_and_trailer (void) const -{ - return this->implementation ()->header_and_trailer (); -} - -size_t -ACE_Asynch_Transmit_File::Result::bytes_to_write (void) const -{ - return this->implementation ()->bytes_to_write (); -} - -size_t -ACE_Asynch_Transmit_File::Result::bytes_per_send (void) const -{ - return this->implementation ()->bytes_per_send (); -} - -unsigned long -ACE_Asynch_Transmit_File::Result::flags (void) const -{ - return this->implementation ()->flags (); -} - -ACE_Asynch_Transmit_File::Result::Result (ACE_Asynch_Transmit_File_Result_Impl *implementation) - : ACE_Asynch_Result (implementation), - implementation_ (implementation) -{ -} - -ACE_Asynch_Transmit_File::Result::~Result (void) -{ -} - -ACE_Asynch_Transmit_File_Result_Impl * -ACE_Asynch_Transmit_File::Result::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - -ACE_Asynch_Transmit_File::Header_And_Trailer::Header_And_Trailer (ACE_Message_Block *header, - size_t header_bytes, - ACE_Message_Block *trailer, - size_t trailer_bytes) - : header_ (header), - header_bytes_ (header_bytes), - trailer_ (trailer), - trailer_bytes_ (trailer_bytes) -{ -} - -ACE_Asynch_Transmit_File::Header_And_Trailer::~Header_And_Trailer (void) -{ -} - -void -ACE_Asynch_Transmit_File::Header_And_Trailer::header_and_trailer (ACE_Message_Block *header, - size_t header_bytes, - ACE_Message_Block *trailer, - size_t trailer_bytes) -{ - this->header (header); - this->header_bytes (header_bytes); - this->trailer (trailer); - this->trailer_bytes (trailer_bytes); -} - -ACE_Message_Block * -ACE_Asynch_Transmit_File::Header_And_Trailer::header (void) const -{ - return this->header_; -} - -void -ACE_Asynch_Transmit_File::Header_And_Trailer::header (ACE_Message_Block *message_block) -{ - this->header_ = message_block; -} - -size_t -ACE_Asynch_Transmit_File::Header_And_Trailer::header_bytes (void) const -{ - return this->header_bytes_; -} - -void -ACE_Asynch_Transmit_File::Header_And_Trailer::header_bytes (size_t bytes) -{ - this->header_bytes_ = bytes; -} - -ACE_Message_Block * -ACE_Asynch_Transmit_File::Header_And_Trailer::trailer (void) const -{ - return this->trailer_; -} - -void -ACE_Asynch_Transmit_File::Header_And_Trailer::trailer (ACE_Message_Block *message_block) -{ - this->trailer_ = message_block; -} - -size_t -ACE_Asynch_Transmit_File::Header_And_Trailer::trailer_bytes (void) const -{ - return this->trailer_bytes_; -} - -void -ACE_Asynch_Transmit_File::Header_And_Trailer::trailer_bytes (size_t bytes) -{ - this->trailer_bytes_ = bytes; -} - -ACE_LPTRANSMIT_FILE_BUFFERS -ACE_Asynch_Transmit_File::Header_And_Trailer::transmit_buffers (void) -{ - // If both are zero, return zero - if (this->header_ == 0 && this->trailer_ == 0) - { - return 0; - } - else - { - // Something is valid - - // If header is valid, set the fields - if (this->header_ != 0) - { - this->transmit_buffers_.Head = this->header_->rd_ptr (); -#if defined (ACE_WIN64) || defined (ACE_WIN32) - this->transmit_buffers_.HeadLength = - ACE_Utils::truncate_cast (this->header_bytes_); -#else - this->transmit_buffers_.HeadLength = this->header_bytes_; -#endif /* ACE_WIN64 || ACE_WIN32 */ - } - else - { - this->transmit_buffers_.Head = 0; - this->transmit_buffers_.HeadLength = 0; - } - - // If trailer is valid, set the fields - if (this->trailer_ != 0) - { - this->transmit_buffers_.Tail = this->trailer_->rd_ptr (); -#if defined(ACE_WIN64) || defined (ACE_WIN32) - this->transmit_buffers_.TailLength = - ACE_Utils::truncate_cast (this->trailer_bytes_); -#else - this->transmit_buffers_.TailLength = this->trailer_bytes_; -#endif /* ACE_WIN64 || ACE_WIN32 */ - } - else - { - this->transmit_buffers_.Tail = 0; - this->transmit_buffers_.TailLength = 0; - } - - // Return the transmit buffers - return &this->transmit_buffers_; - } -} - -// ********************************************************************* - -ACE_Handler::ACE_Handler (void) - : proactor_ (0), handle_ (ACE_INVALID_HANDLE) -{ - ACE_Handler::Proxy *p; - ACE_NEW (p, ACE_Handler::Proxy (this)); - this->proxy_.reset (p); -} - -ACE_Handler::ACE_Handler (ACE_Proactor *d) - : proactor_ (d), handle_ (ACE_INVALID_HANDLE) -{ - ACE_Handler::Proxy *p; - ACE_NEW (p, ACE_Handler::Proxy (this)); - this->proxy_.reset (p); -} - -ACE_Handler::~ACE_Handler (void) -{ - ACE_Handler::Proxy *p = this->proxy_.get (); - if (p) - p->reset (); -} - -void -ACE_Handler::handle_read_stream (const ACE_Asynch_Read_Stream::Result & /* result */) -{ -} - -void -ACE_Handler::handle_write_stream (const ACE_Asynch_Write_Stream::Result & /* result */) -{ -} - -void -ACE_Handler::handle_write_dgram (const ACE_Asynch_Write_Dgram::Result & /* result */) -{ -} - -void -ACE_Handler::handle_read_dgram (const ACE_Asynch_Read_Dgram::Result & /* result */) -{ -} - -void -ACE_Handler::handle_accept (const ACE_Asynch_Accept::Result & /* result */) -{ -} - -void -ACE_Handler::handle_connect (const ACE_Asynch_Connect::Result & /* result */) -{ -} - -void -ACE_Handler::handle_transmit_file (const ACE_Asynch_Transmit_File::Result & /* result */) -{ -} - -void -ACE_Handler::handle_read_file (const ACE_Asynch_Read_File::Result & /* result */) -{ -} - -void -ACE_Handler::handle_write_file (const ACE_Asynch_Write_File::Result & /* result */) -{ -} - -void -ACE_Handler::handle_time_out (const ACE_Time_Value & /* tv */, - const void * /* act */) -{ -} - -void -ACE_Handler::handle_wakeup (void) -{ -} - -ACE_Proactor * -ACE_Handler::proactor (void) -{ - return this->proactor_; -} - -void -ACE_Handler::proactor (ACE_Proactor *p) -{ - this->proactor_ = p; -} - -ACE_HANDLE -ACE_Handler::handle (void) const -{ - return this->handle_; -} - -void -ACE_Handler::handle (ACE_HANDLE h) -{ - this->handle_ = h; -} - -ACE_Refcounted_Auto_Ptr & -ACE_Handler::proxy (void) -{ - return this->proxy_; -} - -// ************************************************************ - -ACE_Service_Handler::ACE_Service_Handler (void) -{ -} - -ACE_Service_Handler::~ACE_Service_Handler (void) -{ -} - -void -ACE_Service_Handler::addresses (const ACE_INET_Addr & /* remote_address */, - const ACE_INET_Addr & /* local_address */ ) -{ -} - -void -ACE_Service_Handler::act (const void *) -{ -} - -void -ACE_Service_Handler::open (ACE_HANDLE, - ACE_Message_Block &) -{ -} - - -// ************************************************************ - -ACE_Asynch_Read_Dgram::ACE_Asynch_Read_Dgram (void) - : implementation_ (0) -{ -} - -ACE_Asynch_Read_Dgram::~ACE_Asynch_Read_Dgram (void) -{ - // Delete the implementation. - delete this->implementation_; - this->implementation_ = 0; -} - -int -ACE_Asynch_Read_Dgram::open (ACE_Handler &handler, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - // Get a proactor for/from the user. - proactor = this->get_proactor (proactor, handler); - - // Now let us get the implementation initialized. - if ((this->implementation_ = proactor->create_asynch_read_dgram ()) == 0) - return -1; - - // Call the method of the base class. - return ACE_Asynch_Operation::open (handler, - handle, - completion_key, - proactor); -} - -ssize_t -ACE_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block, - size_t &number_of_bytes_recvd, - int flags, - int protocol_family, - const void *act, - int priority, - int signal_number) -{ - if (0 == this->implementation_) - { - errno = EFAULT; - return -1; - } - return this->implementation_->recv (message_block, - number_of_bytes_recvd, - flags, - protocol_family, - act, - priority, - signal_number); -} - -ACE_Asynch_Operation_Impl * -ACE_Asynch_Read_Dgram::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - -int -ACE_Asynch_Read_Dgram::Result::remote_address (ACE_Addr& addr) const -{ - return this->implementation ()->remote_address (addr); -} - -ACE_Message_Block* -ACE_Asynch_Read_Dgram::Result::message_block (void) const -{ - return this->implementation ()->message_block (); -} - -int -ACE_Asynch_Read_Dgram::Result::flags (void) const -{ - return this->implementation ()->flags (); -} - -size_t -ACE_Asynch_Read_Dgram::Result::bytes_to_read (void) const -{ - return this->implementation ()->bytes_to_read (); -} - -ACE_HANDLE -ACE_Asynch_Read_Dgram::Result::handle (void) const -{ - return this->implementation ()->handle(); -} - -ACE_Asynch_Read_Dgram::Result::Result (ACE_Asynch_Read_Dgram_Result_Impl *implementation) -: ACE_Asynch_Result (implementation), - implementation_ (implementation) -{ -} - -ACE_Asynch_Read_Dgram::Result::~Result (void) -{ -} - -ACE_Asynch_Read_Dgram_Result_Impl * -ACE_Asynch_Read_Dgram::Result::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - - -ACE_Asynch_Write_Dgram::ACE_Asynch_Write_Dgram (void) - : implementation_ (0) -{ -} - -ACE_Asynch_Write_Dgram::~ACE_Asynch_Write_Dgram (void) -{ - // Delete the implementation. - delete this->implementation_; - this->implementation_ = 0; -} - -int -ACE_Asynch_Write_Dgram::open (ACE_Handler &handler, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) -{ - // Get a proactor for/from the user. - proactor = this->get_proactor (proactor, handler); - - // Now let us get the implementation initialized. - if ((this->implementation_ = proactor->create_asynch_write_dgram ()) == 0) - return -1; - - // Call the method of the base class. - return ACE_Asynch_Operation::open (handler, - handle, - completion_key, - proactor); -} - -ssize_t -ACE_Asynch_Write_Dgram::send (ACE_Message_Block *message_block, - size_t &number_of_bytes_sent, - int flags, - const ACE_Addr& remote_addr, - const void *act, - int priority, - int signal_number) -{ - if (0 == this->implementation_) - { - errno = EFAULT; - return -1; - } - return this->implementation_->send (message_block, - number_of_bytes_sent, - flags, - remote_addr, - act, - priority, - signal_number); -} - -ACE_Asynch_Operation_Impl * -ACE_Asynch_Write_Dgram::implementation (void) const -{ - return this->implementation_; -} - -// ************************************************************ - -size_t -ACE_Asynch_Write_Dgram::Result::bytes_to_write (void) const -{ - return this->implementation ()->bytes_to_write (); -} - -ACE_Message_Block* -ACE_Asynch_Write_Dgram::Result::message_block () const -{ - return this->implementation ()->message_block (); -} - -int -ACE_Asynch_Write_Dgram::Result::flags (void) const -{ - return this->implementation ()->flags (); -} - -ACE_HANDLE -ACE_Asynch_Write_Dgram::Result::handle (void) const -{ - return this->implementation ()->handle (); -} - -ACE_Asynch_Write_Dgram_Result_Impl * -ACE_Asynch_Write_Dgram::Result::implementation (void) const -{ - return this->implementation_; -} - -ACE_Asynch_Write_Dgram::Result::Result (ACE_Asynch_Write_Dgram_Result_Impl *implementation) -: ACE_Asynch_Result (implementation), - implementation_ (implementation) -{ -} - -ACE_Asynch_Write_Dgram::Result::~Result (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ diff --git a/dep/acelite/ace/Asynch_IO.h b/dep/acelite/ace/Asynch_IO.h deleted file mode 100644 index 641e22a8de4..00000000000 --- a/dep/acelite/ace/Asynch_IO.h +++ /dev/null @@ -1,1761 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Asynch_IO.h - * - * $Id: Asynch_IO.h 84837 2009-03-16 13:01:15Z johnnyw $ - * - * This works on Win32 (defined (ACE_WIN32) && !defined - * (ACE_HAS_WINCE)) platforms and on POSIX4 platforms with {aio_*} - * routines (defined (ACE_HAS_AIO_CALLS)) - * - * On Win32 platforms, the implementation of - * {ACE_Asynch_Transmit_File} and {ACE_Asynch_Accept} are only - * supported if ACE_HAS_WINSOCK2 is defined or you are on WinNT 4.0 - * or higher. - * - * @author Irfan Pyarali - * @author Tim Harrison - * @author Alexander Babu Arulanthu - * @author Roger Tragin - * @author Alexander Libman - */ -//============================================================================= - -#ifndef ACE_ASYNCH_IO_H -#define ACE_ASYNCH_IO_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) - -#include "ace/Synch_Traits.h" -#if defined (ACE_HAS_THREADS) -# include "ace/Thread_Mutex.h" -#else -# include "ace/Null_Mutex.h" -#endif /* ACE_HAS_THREADS */ -#include "ace/Refcounted_Auto_Ptr.h" - -#include "ace/os_include/os_signal.h" -#include "ace/os_include/sys/os_socket.h" -#include "ace/os_include/sys/os_types.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -# if defined (ACE_HAS_WIN32_OVERLAPPED_IO) -typedef TRANSMIT_FILE_BUFFERS ACE_TRANSMIT_FILE_BUFFERS; -typedef LPTRANSMIT_FILE_BUFFERS ACE_LPTRANSMIT_FILE_BUFFERS; -typedef PTRANSMIT_FILE_BUFFERS ACE_PTRANSMIT_FILE_BUFFERS; - -# define ACE_INFINITE INFINITE -# define ACE_STATUS_TIMEOUT STATUS_TIMEOUT -# define ACE_WAIT_FAILED WAIT_FAILED -# define ACE_WAIT_TIMEOUT WAIT_TIMEOUT -# else /* ACE_HAS_WIN32_OVERLAPPED_IO */ -struct ACE_TRANSMIT_FILE_BUFFERS -{ - void *Head; - size_t HeadLength; - void *Tail; - size_t TailLength; -}; -typedef ACE_TRANSMIT_FILE_BUFFERS* ACE_PTRANSMIT_FILE_BUFFERS; -typedef ACE_TRANSMIT_FILE_BUFFERS* ACE_LPTRANSMIT_FILE_BUFFERS; - -# if !defined (ACE_INFINITE) -# define ACE_INFINITE LONG_MAX -# endif /* ACE_INFINITE */ -# define ACE_STATUS_TIMEOUT LONG_MAX -# define ACE_WAIT_FAILED LONG_MAX -# define ACE_WAIT_TIMEOUT LONG_MAX -# endif /* ACE_HAS_WIN32_OVERLAPPED_IO */ - -// Forward declarations -class ACE_Proactor; -class ACE_Handler; -class ACE_Message_Block; -class ACE_INET_Addr; -class ACE_Addr; - -// Forward declarations -class ACE_Asynch_Result_Impl; -class ACE_Time_Value; - -/** - * @class ACE_Asynch_Result - * - * @brief An interface base class which allows users access to common - * information related to an asynchronous operation. - * - * An interface base class from which you can obtain some basic - * information like the number of bytes transferred, the ACT - * associated with the asynchronous operation, indication of - * success or failure, etc. Subclasses may want to store more - * information that is particular to the asynchronous operation - * it represents. - */ -class ACE_Export ACE_Asynch_Result -{ - -public: - /// Number of bytes transferred by the operation. - size_t bytes_transferred (void) const; - - /// ACT associated with the operation. - const void *act (void) const; - - /// Did the operation succeed? - int success (void) const; - - /** - * This is the ACT associated with the handle on which the - * Asynch_Operation takes place. - * - * On WIN32, this returns the ACT associated with the handle when it - * was registered with the I/O completion port. - * - * @@ This is not implemented for POSIX4 platforms. Returns 0. - */ - const void *completion_key (void) const; - - /// Error value if the operation fails. - unsigned long error (void) const; - - /** - * On WIN32, this returns the event associated with the OVERLAPPED - * structure. - * - * This returns ACE_INVALID_HANDLE on POSIX4-Unix platforms. - */ - ACE_HANDLE event (void) const; - - /** - * This really makes sense only when doing file I/O. - * - * On WIN32, these are represented in the OVERLAPPED datastructure. - * - * @@ On POSIX4-Unix, offset_high should be supported using - * aiocb64. - */ - unsigned long offset (void) const; - unsigned long offset_high (void) const; - - /** - * Priority of the operation. - * - * On POSIX4-Unix, this is supported. Priority works like {nice} in - * Unix. Negative values are not allowed. 0 means priority of the - * operation same as the process priority. 1 means priority of the - * operation is one less than process. And so forth. - * - * On Win32, this is a no-op. - */ - int priority (void) const; - - /** - * POSIX4 real-time signal number to be used for the - * operation. {signal_number} ranges from ACE_SIGRTMIN to ACE_SIGRTMAX. By - * default, ACE_SIGRTMIN is used to issue {aio_} calls. This is a no-op - * on non-POSIX4 systems and returns 0. - */ - int signal_number (void) const; - - - /// Destructor. - virtual ~ACE_Asynch_Result (void); - -protected: - /// Constructor. This implementation will not be deleted. The - /// implementation will be deleted by the Proactor. - ACE_Asynch_Result (ACE_Asynch_Result_Impl *implementation); - - /// Get the implementation class. - ACE_Asynch_Result_Impl *implementation (void) const; - - /// Implementation class. - ACE_Asynch_Result_Impl *implementation_; -}; - -// Forward declarations -class ACE_Asynch_Operation_Impl; - -/** - * @class ACE_Asynch_Operation - * - * @brief This is an interface base class for all asynch - * operations. The resposiblility of this class is to forward - * all methods to its delegation/implementation class, e.g., - * ACE_WIN32_Asynch_Operation or ACE_POSIX_Asynch_Operation. - * - * There are some attributes and functionality which is common - * to all asychronous operations. The delegation classes of this - * class will factor out this code. - */ -class ACE_Export ACE_Asynch_Operation -{ - -public: - /** - * Initializes the factory with information which will be used with - * each asynchronous call. If ({handle} == ACE_INVALID_HANDLE), - * {ACE_Handler::handle} will be called on the {handler} to get the - * correct handle. - */ - int open (ACE_Handler &handler, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor); - - /** - * (Attempts to) cancel the asynchronous operation pending against - * the {handle} registered with this Operation. - * - * All completion notifications for the I/O operations will occur - * normally. - * - * = Return Values: - * - * -1 : Operation failed. (can get only in POSIX). - * 0 : All the operations were cancelled. - * 1 : All the operations were already finished in this - * handle. Unable to cancel them. - * 2 : Atleast one of the requested operations cannot be - * cancelled. - * - * There is slight difference in the semantics between NT and POSIX - * platforms which is given below. - * - * = Win32 : - * - * cancels all pending accepts operations that were issued by the - * calling thread. The function does not cancel asynchronous - * operations issued by other threads. - * All I/O operations that are canceled will complete with the - * error ERROR_OPERATION_ABORTED. - * - * = POSIX: - * - * Attempts to cancel one or more asynchronous I/O requests - * currently outstanding against the {handle} registered in this - * operation. - * For requested operations that are successfully canceled, the - * associated error status is set to ECANCELED. - */ - int cancel (void); - - - // = Access methods. - - /// Return the underlying proactor. - ACE_Proactor* proactor (void) const; - - /// Destructor. - virtual ~ACE_Asynch_Operation (void); - -protected: - /// Constructor. - ACE_Asynch_Operation (void); - - /// Return the underlying implementation class. - virtual ACE_Asynch_Operation_Impl *implementation (void) const = 0; - - /// Get a proactor for/from the user - ACE_Proactor *get_proactor (ACE_Proactor *user_proactor, - ACE_Handler &handler) const; -}; - -// Forward declarations -class ACE_Asynch_Read_Stream_Result_Impl; -class ACE_Asynch_Read_Stream_Impl; - -/** - * @class ACE_Asynch_Read_Stream - * - * @brief This class is a factory for starting off asynchronous reads - * on a stream. This class forwards all methods to its - * implementation class. - * - * Once {open} is called, multiple asynchronous {read}s can - * started using this class. An ACE_Asynch_Read_Stream::Result - * will be passed back to the {handler} when the asynchronous - * reads completes through the {ACE_Handler::handle_read_stream} - * callback. - */ -class ACE_Export ACE_Asynch_Read_Stream : public ACE_Asynch_Operation -{ - -public: - /// A do nothing constructor. - ACE_Asynch_Read_Stream (void); - - /// Destructor - virtual ~ACE_Asynch_Read_Stream (void); - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. - * - * @param handler The ACE_Handler that will be called to handle completions - * for operations initiated using this factory. - * @param handle The handle that future read operations will use. - * If handle == @c ACE_INVALID_HANDLE, - * ACE_Handler::handle() will be called on @ handler - * to get the correct handle. - * - * @retval 0 for success. - * @retval -1 for failure; consult @c errno for further information. - */ - int open (ACE_Handler &handler, - ACE_HANDLE handle = ACE_INVALID_HANDLE, - const void *completion_key = 0, - ACE_Proactor *proactor = 0); - - /** - * Initiate an asynchronous read operation. - * - * @param message_block The ACE_Message_Block to receive the data. - * Received bytes will be placed in the block - * beginning at its current write pointer. - * If data is read, the message block's write - * pointer will be advanced by the number of - * bytes read. - * @param num_bytes_to_read The maximum number of bytes to read. - * @param act Asynchronous Completion Token; passed through to - * the completion handler in the Result object. - * @param priority Priority of the operation. On POSIX4-Unix, - * this is supported. Works like @c nice in Unix. - * Negative values are not allowed. 0 means - * priority of the operation same as the process - * priority. 1 means priority of the operation is - * one less than process priority, etc. - * Ignored on Windows. - * @param signal_number The POSIX4 real-time signal number to be used - * to signal completion of the operation. Values - * range from ACE_SIGRTMIN to ACE_SIGRTMAX. - * This argument is ignored on non-POSIX4 systems. - */ - int read (ACE_Message_Block &message_block, - size_t num_bytes_to_read, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - -#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) - /** - * Same as above but with scatter support, through chaining of composite - * message blocks using the continuation field. - */ - int readv (ACE_Message_Block &message_block, - size_t num_bytes_to_read, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); -#endif /* defined (ACE_HAS_WIN32_OVERLAPPED_IO) */ - - /// Return the underlying implementation class. - // (this should be protected...) - virtual ACE_Asynch_Operation_Impl *implementation (void) const; - -protected: - /// Implementation class that all methods will be forwarded to. - ACE_Asynch_Read_Stream_Impl *implementation_; - -public: -/** - * @class Result - * - * @brief This is the class which will be passed back to the - * ACE_Handler::handle_read_stream when the asynchronous read completes. - * This class forwards all the methods to the implementation classes. - * - * This class has all the information necessary for the - * handler to uniquiely identify the completion of the - * asynchronous read. - */ - class ACE_Export Result : public ACE_Asynch_Result - { - - /// The concrete implementation result classes only construct this - /// class. - friend class ACE_POSIX_Asynch_Read_Stream_Result; - friend class ACE_WIN32_Asynch_Read_Stream_Result; - - public: - /// The number of bytes which were requested at the start of the - /// asynchronous read. - size_t bytes_to_read (void) const; - - /// Message block which contains the read data. - ACE_Message_Block &message_block (void) const; - - /// I/O handle used for reading. - ACE_HANDLE handle (void) const; - - /// Get the implementation class. - ACE_Asynch_Read_Stream_Result_Impl *implementation (void) const; - - protected: - /// Constructor. - Result (ACE_Asynch_Read_Stream_Result_Impl *implementation); - - /// Destructor. - virtual ~Result (void); - - /// The implementation class. - ACE_Asynch_Read_Stream_Result_Impl *implementation_; - }; -private: - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Asynch_Read_Stream &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Asynch_Read_Stream (const ACE_Asynch_Read_Stream &)) -}; - -// Forward declarations -class ACE_Asynch_Write_Stream_Impl; -class ACE_Asynch_Write_Stream_Result_Impl; - -/** - * @class ACE_Asynch_Write_Stream - * - * @brief This class is a factory for initiating asynchronous writes - * on a connected TCP/IP stream. This class forwards all methods to its - * implementation class. - * - * Once open() is called, multiple asynchronous writes can be - * started using this class. An ACE_Asynch_Write_Stream::Result - * will be passed to the ACE_Handler::handle_write_stream() method on the - * opened ACE_Handler object when the asynchronous write completes. - */ -class ACE_Export ACE_Asynch_Write_Stream : public ACE_Asynch_Operation -{ - -public: - /// A do nothing constructor. - ACE_Asynch_Write_Stream (void); - - /// Destructor. - virtual ~ACE_Asynch_Write_Stream (void); - - /** - * Initializes the factory with information which will be used with - * each asynchronous operation. - * - * @param handler ACE_Handler to be notified when operations initiated - * via this factory complete. The handle_write_stream() - * method will be called on this object. - * @param handle The socket handle to initiate write operations on. - * If handle is @c ACE_INVALID_HANDLE, - * ACE_Handler::handle() will be called on handler to - * get the handle value. - * @param completion_key A token that is passed to the completion handler. - * @param proactor The ACE_Proactor object which will control operation - * completion and dispatching the results to handler. - * If this is 0, the process's singleton ACE_Proactor - * will be used. - * - * @retval 0 for success. - * @retval -1 for failure; consult @c errno for further information. - */ - int open (ACE_Handler &handler, - ACE_HANDLE handle = ACE_INVALID_HANDLE, - const void *completion_key = 0, - ACE_Proactor *proactor = 0); - - /** - * Initiates an asynchronous write on a socket. If the operation completes - * the ACE_Handler object registered in open() will receive a completion - * callback via its handle_write_stream() method. - * - * @param bytes_to_write The number of bytes to write. - * @param message_block The ACE_Message_Block containing data to write. - * Data is written to the socket beginning at the - * block's rd_ptr. Upon successful completion - * of the write operation, the message_block rd_ptr - * is updated to reflect the data that was written. - * @param act Token that is passed through to the completion - * handler. - * @param priority Priority of the operation. This argument only has - * an affect on POSIX4-Unix. Works like @c nice in - * Unix; negative values are not allowed. 0 means - * priority of the operation same as the process - * priority. 1 means priority of the operation is one - * less than the process, and so forth. - * @param signal_number The POSIX4 real-time signal number to be used - * for the operation. signal_number ranges from - * ACE_SIGRTMIN to ACE_SIGRTMAX. This argument is - * not used on other platforms. - * - * @retval 0 for success, and the handle_write_stream associated - * with the opened ACE_Handler will be called. An - * instance of ACE_Asynch_Write_Stream::Result will be - * passed to the completion handler. - * @retval -1 for failure; consult @c errno for further information. - */ - int write (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - -#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) - /** - * Same as above but with gather support, through chaining of composite - * message blocks using the continuation field. - */ - int writev (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); -#endif /* defined (ACE_HAS_WIN32_OVERLAPPED_IO) */ - - /// Return the underlying implementation class. - /// @todo (this should be protected...) - virtual ACE_Asynch_Operation_Impl *implementation (void) const; - -protected: - /// Implementation class that all methods will be forwarded to. - ACE_Asynch_Write_Stream_Impl *implementation_; - -public: -/** - * @class Result - * - * @brief This is that class which will be passed back to the - * ACE_Handler when the asynchronous write completes. This class - * forwards all the methods to the implementation class. - * - * This class has all the information necessary for the - * handler to uniquiely identify the completion of the - * asynchronous write. - */ - class ACE_Export Result : public ACE_Asynch_Result - { - - /// The concrete implementation result classes only construct this - /// class. - friend class ACE_POSIX_Asynch_Write_Stream_Result; - friend class ACE_WIN32_Asynch_Write_Stream_Result; - - public: - /// The number of bytes which were requested at the start of the - /// asynchronous write. - size_t bytes_to_write (void) const; - - /// Message block that contains the data to be written. - ACE_Message_Block &message_block (void) const; - - /// I/O handle used for writing. - ACE_HANDLE handle (void) const; - - /// Get the implementation class. - ACE_Asynch_Write_Stream_Result_Impl *implementation (void) const; - - protected: - /// Constructor. - Result (ACE_Asynch_Write_Stream_Result_Impl *implementation); - - /// Destructor. - virtual ~Result (void); - - /// Implementation class. - ACE_Asynch_Write_Stream_Result_Impl *implementation_; - }; -private: - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Asynch_Write_Stream &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Asynch_Write_Stream (const ACE_Asynch_Write_Stream &)) -}; - -// Forward declarations -class ACE_Asynch_Read_File_Impl; -class ACE_Asynch_Read_File_Result_Impl; - -/** - * @class ACE_Asynch_Read_File - * - * @brief This class is a factory for starting off asynchronous reads - * on a file. This class forwards all methods to its - * implementation class. - * - * Once open() is called, multiple asynchronous reads can - * started using this class. An ACE_Asynch_Read_File::Result - * will be passed back to the completion handler's - * ACE_Handler::handle_read_file() method when each asynchronous - * read completes. - * This class differs slightly from ACE_Asynch_Read_Stream as it - * allows the user to specify an offset for the read. - */ -class ACE_Export ACE_Asynch_Read_File : public ACE_Asynch_Read_Stream -{ - -public: - /// A do nothing constructor. - ACE_Asynch_Read_File (void); - - /// Destructor. - virtual ~ACE_Asynch_Read_File (void); - - /** - * Initializes the factory with information which will be used with - * each asynchronous operation. - * - * @param handler ACE_Handler to be notified when operations initiated - * via this factory complete. The - * ACE_Handler::handle_read_file() method will be - * called on this object. - * @param handle The file handle to initiate read operations on. - * If handle is @c ACE_INVALID_HANDLE, - * ACE_Handler::handle() will be called on handler to - * get the handle value. - * @param completion_key A token that is passed to the completion handler. - * @param proactor The ACE_Proactor object which will control operation - * completion and dispatching the results to handler. - * If this is 0, the process's singleton ACE_Proactor - * will be used. - * - * @retval 0 for success. - * @retval -1 for failure; consult @c errno for further information. - */ - int open (ACE_Handler &handler, - ACE_HANDLE handle = ACE_INVALID_HANDLE, - const void *completion_key = 0, - ACE_Proactor *proactor = 0); - - /** - * This starts off an asynchronous read. Upto {bytes_to_read} will - * be read and stored in the {message_block}. The read will start - * at {offset} from the beginning of the file. Priority of the - * operation is specified by {priority}. On POSIX4-Unix, this is - * supported. Works like {nice} in Unix. Negative values are not - * allowed. 0 means priority of the operation same as the process - * priority. 1 means priority of the operation is one less than - * process. And so forth. On Win32, this argument is a no-op. - * {signal_number} is the POSIX4 real-time signal number to be used - * for the operation. {signal_number} ranges from ACE_SIGRTMIN to - * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems. - */ - int read (ACE_Message_Block &message_block, - size_t bytes_to_read, - unsigned long offset = 0, - unsigned long offset_high = 0, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) - /** - * Same as above but with scatter support, through chaining of composite - * message blocks using the continuation field. - * @note In win32 Each data block payload must be at least the size of a system - * memory page and must be aligned on a system memory page size boundary - */ - int readv (ACE_Message_Block &message_block, - size_t bytes_to_read, - unsigned long offset = 0, - unsigned long offset_high = 0, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); -#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ - - /// Return the underlying implementation class. - // (this should be protected...) - virtual ACE_Asynch_Operation_Impl *implementation (void) const; - -protected: - /// Delegation/implementation class that all methods will be - /// forwarded to. - ACE_Asynch_Read_File_Impl *implementation_; - -public: -/** - * @class Result - * - * @brief This is that class which will be passed back to the - * {handler} when the asynchronous read completes. This class - * forwards all the methods to the implementation class. - * - * This class has all the information necessary for the - * {handler} to uniquiely identify the completion of the - * asynchronous read. - * This class differs slightly from - * ACE_Asynch_Read_Stream::Result as it calls back - * {ACE_Handler::handle_read_file} on the {handler} instead of - * {ACE_Handler::handle_read_stream}. No additional state is - * required by this class as ACE_Asynch_Result can store the - * {offset}. - */ - class ACE_Export Result : public ACE_Asynch_Read_Stream::Result - { - - /// The concrete implementation result classes only construct this - /// class. - friend class ACE_POSIX_Asynch_Read_File_Result; - friend class ACE_WIN32_Asynch_Read_File_Result; - - public: - /// Get the implementation class. - ACE_Asynch_Read_File_Result_Impl *implementation (void) const; - - protected: - /// Constructor. This implementation will not be deleted. - Result (ACE_Asynch_Read_File_Result_Impl *implementation); - - /// Destructor. - virtual ~Result (void); - - /// The implementation class. - ACE_Asynch_Read_File_Result_Impl *implementation_; - - private: - /// Here just to provide an dummpy implementation, since the - /// one auto generated by MSVC is flagged as infinitely recursive - void operator= (Result &) {} - }; -private: - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Asynch_Read_File &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Asynch_Read_File (const ACE_Asynch_Read_File &)) -}; - -// Forward declarations -class ACE_Asynch_Write_File_Impl; -class ACE_Asynch_Write_File_Result_Impl; - -/** - * @class ACE_Asynch_Write_File - * - * @brief This class is a factory for starting off asynchronous writes - * on a file. This class forwards all methods to its - * implementation class. - * - * Once {open} is called, multiple asynchronous {write}s can be - * started using this class. A ACE_Asynch_Write_File::Result - * will be passed back to the {handler} when the asynchronous - * writes completes through the {ACE_Handler::handle_write_file} - * callback. - * This class differs slightly from ACE_Asynch_Write_Stream as - * it allows the user to specify an offset for the write. - */ -class ACE_Export ACE_Asynch_Write_File : public ACE_Asynch_Write_Stream -{ - -public: - /// A do nothing constructor. - ACE_Asynch_Write_File (void); - - /// Destructor. - virtual ~ACE_Asynch_Write_File (void); - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. If ({handle} == ACE_INVALID_HANDLE), - * {ACE_Handler::handle} will be called on the {handler} to get the - * correct handle. - */ - int open (ACE_Handler &handler, - ACE_HANDLE handle = ACE_INVALID_HANDLE, - const void *completion_key = 0, - ACE_Proactor *proactor = 0); - - /** - * This starts off an asynchronous write. Upto {bytes_to_write} - * will be written from the {message_block}, starting at the - * block's {rd_ptr}. The write will go to the file, starting - * {offset} bytes from the beginning of the file. Priority of the - * operation is specified by {priority}. On POSIX4-Unix, this is - * supported. Works like {nice} in Unix. Negative values are not - * allowed. 0 means priority of the operation same as the process - * priority. 1 means priority of the operation is one less than - * process. And so forth. On Win32, this is a no-op. - * {signal_number} is the POSIX4 real-time signal number to be used - * for the operation. {signal_number} ranges from ACE_SIGRTMIN to - * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems. - */ - int write (ACE_Message_Block &message_block, - size_t bytes_to_write, - unsigned long offset = 0, - unsigned long offset_high = 0, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) - /** - * Same as above but with gather support, through chaining of composite - * message blocks using the continuation field. - * @note In win32 Each data block payload must be at least the size of a system - * memory page and must be aligned on a system memory page size boundary - */ - int writev (ACE_Message_Block &message_block, - size_t bytes_to_write, - unsigned long offset = 0, - unsigned long offset_high = 0, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); -#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ - - /// Return the underlying implementation class. - // (this should be protected...) - virtual ACE_Asynch_Operation_Impl *implementation (void) const; - -protected: - /// Implementation object. - ACE_Asynch_Write_File_Impl *implementation_; - -public: -/** - * @class Result - * - * @brief This is that class which will be passed back to the - * {handler} when the asynchronous write completes. This class - * forwards all the methods to the implementation class. - * - * This class has all the information necessary for the - * {handler} to uniquiely identify the completion of the - * asynchronous write. - * This class differs slightly from - * ACE_Asynch_Write_Stream::Result as it calls back - * {ACE_Handler::handle_write_file} on the {handler} instead - * of {ACE_Handler::handle_write_stream}. No additional state - * is required by this class as ACE_Asynch_Result can store - * the {offset}. - */ - class ACE_Export Result : public ACE_Asynch_Write_Stream::Result - { - - /// The concrete implementation result classes only construct this - /// class. - friend class ACE_POSIX_Asynch_Write_File_Result; - friend class ACE_WIN32_Asynch_Write_File_Result; - - public: - /// Get the implementation class. - ACE_Asynch_Write_File_Result_Impl *implementation (void) const; - - protected: - /// Constructor. This implementation will not be deleted. - Result (ACE_Asynch_Write_File_Result_Impl *implementation); - - /// Destructor. - virtual ~Result (void); - - /// The implementation class. - ACE_Asynch_Write_File_Result_Impl *implementation_; - - private: - /// Here just to provide an dummpy implementation, since the - /// one auto generated by MSVC is flagged as infinitely recursive - void operator= (Result &) {}; - }; -private: - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Asynch_Write_File &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Asynch_Write_File (const ACE_Asynch_Write_File &)) -}; - -// Forward declarations -class ACE_Asynch_Accept_Result_Impl; -class ACE_Asynch_Accept_Impl; - -/** - * @class ACE_Asynch_Accept - * - * @brief This class is a factory for starting off asynchronous accepts - * on a listen handle. This class forwards all methods to its - * implementation class. - * - * Once {open} is called, multiple asynchronous {accept}s can - * started using this class. A ACE_Asynch_Accept::Result will - * be passed back to the {handler} when the asynchronous accept - * completes through the {ACE_Handler::handle_accept} - * callback. - */ -class ACE_Export ACE_Asynch_Accept : public ACE_Asynch_Operation -{ - -public: - /// A do nothing constructor. - ACE_Asynch_Accept (void); - - /// Destructor. - virtual ~ACE_Asynch_Accept (void); - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. If ({handle} == ACE_INVALID_HANDLE), - * {ACE_Handler::handle} will be called on the {handler} to get the - * correct handle. - */ - int open (ACE_Handler &handler, - ACE_HANDLE handle = ACE_INVALID_HANDLE, - const void *completion_key = 0, - ACE_Proactor *proactor = 0); - - /** - * This starts off an asynchronous accept. The asynchronous accept - * call also allows any initial data to be returned to the - * handler specified to @c open(). - * @param message_block A message block to receive initial data, as well - * as the local and remote addresses when the - * connection is made. Since the block receives - * the addresses regardless of whether or not - * initial data is available or requested, the - * message block size must be at least - * @a bytes_to_read plus two times the size of - * the addresses used (IPv4 or IPv6). - * @param bytes_to_read The maximum number of bytes of initial data - * to read into @a message_block. - * @param accept_handle The handle that the new connection will be - * accepted on. If @c INVALID_HANDLE, a new - * handle will be created using @a addr_family. - * @param act Value to be passed in result when operation - * completes. - * @param priority Priority of the operation. On POSIX4-Unix, this - * is supported. Works like @c nice in Unix. - * Negative values are not allowed. 0 means - * priority of the operation same as the process - * priority. 1 means priority of the operation is - * one less than process. And so forth. - * On Win32, this argument is ignored. - * @param signal_number The POSIX4 real-time signal number to be used - * for the operation. Value range is from - * @c ACE_SIGRTMIN to @c ACE_SIGRTMAX. - * This argument is ignored on non-POSIX4 systems. - * @param addr_family The address family to use if @a accept_handle - * is @c ACE_INVALID_HANDLE and a new handle must - * be opened. Values are @c AF_INET and @c PF_INET6. - */ - int accept (ACE_Message_Block &message_block, - size_t bytes_to_read, - ACE_HANDLE accept_handle = ACE_INVALID_HANDLE, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN, - int addr_family = AF_INET); - - /// Return the underlying implementation class. - // (this should be protected...) - virtual ACE_Asynch_Operation_Impl *implementation (void) const; - -protected: - /// Delegation/implementation class that all methods will be - /// forwarded to. - ACE_Asynch_Accept_Impl *implementation_; - -public: -/** - * @class Result - * - * @brief This is that class which will be passed back to the - * {handler} when the asynchronous accept completes. - * - * This class has all the information necessary for the - * {handler} to uniquiely identify the completion of the - * asynchronous accept. - */ - class ACE_Export Result : public ACE_Asynch_Result - { - - /// The concrete implementation result classes only construct this - /// class. - friend class ACE_POSIX_Asynch_Accept_Result; - friend class ACE_WIN32_Asynch_Accept_Result; - - public: - /// The number of bytes which were requested at the start of the - /// asynchronous accept. - size_t bytes_to_read (void) const; - - /// Message block which contains the read data. - ACE_Message_Block &message_block (void) const; - - /// I/O handle used for accepting new connections. - ACE_HANDLE listen_handle (void) const; - - /// I/O handle for the new connection. - ACE_HANDLE accept_handle (void) const; - - /// Get the implementation. - ACE_Asynch_Accept_Result_Impl *implementation (void) const; - - protected: - /// Contructor. Implementation will not be deleted. - Result (ACE_Asynch_Accept_Result_Impl *implementation); - - /// Destructor. - virtual ~Result (void); - - /// Impelmentation class. - ACE_Asynch_Accept_Result_Impl *implementation_; - }; -private: - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Asynch_Accept &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Asynch_Accept (const ACE_Asynch_Accept &)) -}; -// Forward declarations -class ACE_Asynch_Connect_Result_Impl; -class ACE_Asynch_Connect_Impl; - -/** - * @class ACE_Asynch_Connect - * - * @brief This class is a factory for starting off asynchronous connects - * This class forwards all methods to its implementation class. - * - * Once @c open is called, multiple asynchronous connect operationss can - * started using this class. A ACE_Asynch_Connect::Result will - * be passed back to the associated ACE_Handler when the asynchronous connect - * completes through the ACE_Handler::handle_connect() callback. - */ -class ACE_Export ACE_Asynch_Connect : public ACE_Asynch_Operation -{ - -public: - /// A do nothing constructor. - ACE_Asynch_Connect (void); - - /// Destructor. - virtual ~ACE_Asynch_Connect (void); - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. - * - * @note @arg handle is ignored and should be @c ACE_INVALID_HANDLE. - */ - int open (ACE_Handler &handler, - ACE_HANDLE handle = ACE_INVALID_HANDLE, - const void *completion_key = 0, - ACE_Proactor *proactor = 0); - - /** - * This starts off an asynchronous Connect. - */ - int connect (ACE_HANDLE connect_handle, - const ACE_Addr & remote_sap, - const ACE_Addr & local_sap, - int reuse_addr, - const void *act=0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - - /// Return the underlying implementation class. - // (this should be protected...) - virtual ACE_Asynch_Operation_Impl *implementation (void) const; - -protected: - /// Delegation/implementation class that all methods will be - /// forwarded to. - ACE_Asynch_Connect_Impl *implementation_; - -public: -/** - * @class Result - * - * @brief This is that class which will be passed back to the - * handler when the asynchronous connect completes. - * - * This class has all the information necessary for the - * handler to uniquely identify the completion of the - * asynchronous connect. - */ - class ACE_Export Result : public ACE_Asynch_Result - { - - /// The concrete implementation result classes only construct this - /// class. - friend class ACE_POSIX_Asynch_Connect_Result; - friend class ACE_WIN32_Asynch_Connect_Result; - - public: - - /// I/O handle for the connection. - ACE_HANDLE connect_handle (void) const; - - /// Get the implementation. - ACE_Asynch_Connect_Result_Impl *implementation (void) const; - - protected: - /// Contructor. Implementation will not be deleted. - Result (ACE_Asynch_Connect_Result_Impl *implementation); - - /// Destructor. - virtual ~Result (void); - - /// Impelmentation class. - ACE_Asynch_Connect_Result_Impl *implementation_; - }; -private: - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Asynch_Connect &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Asynch_Connect (const ACE_Asynch_Connect &)) -}; - -// Forward declarations -class ACE_Asynch_Transmit_File_Result_Impl; -class ACE_Asynch_Transmit_File_Impl; - -/** - * @class ACE_Asynch_Transmit_File - * - * @brief This class is a factory for starting off asynchronous - * transmit files on a stream. - * - * Once {open} is called, multiple asynchronous {transmit_file}s - * can started using this class. A - * ACE_Asynch_Transmit_File::Result will be passed back to the - * {handler} when the asynchronous transmit file completes - * through the {ACE_Handler::handle_transmit_file} callback. - * The transmit_file function transmits file data over a - * connected network connection. The function uses the operating - * system's cache manager to retrieve the file data. This - * function provides high-performance file data transfer over - * network connections. This function would be of great use in - * a Web Server, Image Server, etc. - */ -class ACE_Export ACE_Asynch_Transmit_File : public ACE_Asynch_Operation -{ - -public: - // Forward declarations - class Header_And_Trailer; - - /// A do nothing constructor. - ACE_Asynch_Transmit_File (void); - - /// Destructor. - virtual ~ACE_Asynch_Transmit_File (void); - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. If ({handle} == ACE_INVALID_HANDLE), - * {ACE_Handler::handle} will be called on the {handler} to get the - * correct handle. - */ - int open (ACE_Handler &handler, - ACE_HANDLE handle = ACE_INVALID_HANDLE, - const void *completion_key = 0, - ACE_Proactor *proactor = 0); - - /** - * This starts off an asynchronous transmit file. The {file} is a - * handle to an open file. {header_and_trailer} is a pointer to a - * data structure that contains pointers to data to send before and - * after the file data is sent. Set this parameter to 0 if you only - * want to transmit the file data. Upto {bytes_to_write} will be - * written to the {socket}. If you want to send the entire file, - * let {bytes_to_write} = 0. {bytes_per_send} is the size of each - * block of data sent per send operation. Please read the Win32 - * documentation on what the flags should be. Priority of the - * operation is specified by {priority}. On POSIX4-Unix, this is - * supported. Works like {nice} in Unix. Negative values are not - * allowed. 0 means priority of the operation same as the process - * priority. 1 means priority of the operation is one less than - * process. And so forth. On Win32, this is a no-op. - * {signal_number} is the POSIX4 real-time signal number to be used - * for the operation. {signal_number} ranges from ACE_SIGRTMIN to - * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems. - */ - int transmit_file (ACE_HANDLE file, - Header_And_Trailer *header_and_trailer = 0, - size_t bytes_to_write = 0, - unsigned long offset = 0, - unsigned long offset_high = 0, - size_t bytes_per_send = 0, - unsigned long flags = 0, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - - /// Return the underlying implementation class. - // (this should be protected...) - virtual ACE_Asynch_Operation_Impl *implementation (void) const; - -protected: - /// The implementation class. - ACE_Asynch_Transmit_File_Impl *implementation_; - -public: -/** - * @class Result - * - * @brief This is that class which will be passed back to the - * {handler} when the asynchronous transmit file completes. - * - * This class has all the information necessary for the - * {handler} to uniquiely identify the completion of the - * asynchronous transmit file. - */ - class ACE_Export Result : public ACE_Asynch_Result - { - - /// The concrete implementation result classes only construct this - /// class. - friend class ACE_POSIX_Asynch_Transmit_File_Result; - friend class ACE_WIN32_Asynch_Transmit_File_Result; - - public: - /// Socket used for transmitting the file. - ACE_HANDLE socket (void) const; - - /// File from which the data is read. - ACE_HANDLE file (void) const; - - /// Header and trailer data associated with this transmit file. - Header_And_Trailer *header_and_trailer (void) const; - - /// The number of bytes which were requested at the start of the - /// asynchronous transmit file. - size_t bytes_to_write (void) const; - - /// Number of bytes per send requested at the start of the transmit - /// file. - size_t bytes_per_send (void) const; - - /// Flags which were passed into transmit file. - unsigned long flags (void) const; - - /// Get the implementation class. - ACE_Asynch_Transmit_File_Result_Impl *implementation (void) const; - - protected: - /// Constructor. - Result (ACE_Asynch_Transmit_File_Result_Impl *implementation); - - /// Destructor. - virtual ~Result (void); - - /// The implementation class. - ACE_Asynch_Transmit_File_Result_Impl *implementation_; - }; - -/** - * @class Header_And_Trailer - * - * @brief The class defines a data structure that contains pointers - * to data to send before and after the file data is sent. - * - * This class provides a wrapper over TRANSMIT_FILE_BUFFERS - * and provided a consistent use of ACE_Message_Blocks. - */ - class ACE_Export Header_And_Trailer - { - - public: - /// Constructor. - Header_And_Trailer (ACE_Message_Block *header = 0, - size_t header_bytes = 0, - ACE_Message_Block *trailer = 0, - size_t trailer_bytes = 0); - - /// Destructor - virtual ~Header_And_Trailer (void); - - /// This method allows all the member to be set in one fell swoop. - void header_and_trailer (ACE_Message_Block *header = 0, - size_t header_bytes = 0, - ACE_Message_Block *trailer = 0, - size_t trailer_bytes = 0); - - /// Get header which goes before the file data. - ACE_Message_Block *header (void) const; - - /// Set header which goes before the file data. - void header (ACE_Message_Block *message_block); - - /// Get size of the header data. - size_t header_bytes (void) const; - - /// Set size of the header data. - void header_bytes (size_t bytes); - - /// Get trailer which goes after the file data. - ACE_Message_Block *trailer (void) const; - - /// Set trailer which goes after the file data. - void trailer (ACE_Message_Block *message_block); - - /// Get size of the trailer data. - size_t trailer_bytes (void) const; - - /// Set size of the trailer data. - void trailer_bytes (size_t bytes); - - /// Conversion routine. - ACE_LPTRANSMIT_FILE_BUFFERS transmit_buffers (void); - - protected: - /// Header data. - ACE_Message_Block *header_; - - /// Size of header data. - size_t header_bytes_; - - /// Trailer data. - ACE_Message_Block *trailer_; - - /// Size of trailer data. - size_t trailer_bytes_; - - /// Target data structure. - ACE_TRANSMIT_FILE_BUFFERS transmit_buffers_; - }; -private: - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Asynch_Transmit_File &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Asynch_Transmit_File (const ACE_Asynch_Transmit_File &)) -}; - - -// Forward declarations -class ACE_Asynch_Read_Dgram_Result_Impl; -class ACE_Asynch_Read_Dgram_Impl; -class ACE_Addr; - -/** - * @class ACE_Asynch_Read_Dgram - * - * @brief This class is a factory for starting off asynchronous reads - * on a UDP socket. This class forwards all methods to its - * implementation class. - * - * Once {open} is called, multiple asynchronous {read}s can be - * started using this class. An ACE_Asynch_Read_Dgram::Result - * will be passed back to the {handler} when the asynchronous - * reads completes through the {ACE_Handler::handle_read_dgram} - * callback. - */ -class ACE_Export ACE_Asynch_Read_Dgram : public ACE_Asynch_Operation -{ - -public: - /// A do nothing constructor. - ACE_Asynch_Read_Dgram (void); - - /// Destructor - virtual ~ACE_Asynch_Read_Dgram (void); - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. If ({handle} == ACE_INVALID_HANDLE), - * {ACE_Handler::handle} will be called on the {handler} to get the - * correct handle. - */ - int open (ACE_Handler &handler, - ACE_HANDLE handle = ACE_INVALID_HANDLE, - const void *completion_key = 0, - ACE_Proactor *proactor = 0); - - /** This starts off an asynchronous read. Upto - * {message_block->total_size()} will be read and stored in the - * {message_block}. {message_block}'s {wr_ptr} will be updated to reflect - * the added bytes if the read operation is successfully completed. - * Return code of 1 means immediate success and {number_of_bytes_recvd} - * will contain number of bytes read. The {ACE_Handler::handle_read_dgram} - * method will still be called. Return code of 0 means the IO will - * complete proactively. Return code of -1 means there was an error, use - * errno to get the error code. - * - * Scatter/gather is supported on WIN32 by using the {message_block->cont()} - * method. Up to ACE_IOV_MAX {message_block}'s are supported. Upto - * {message_block->size()} bytes will be read into each {message block} for - * a total of {message_block->total_size()} bytes. All {message_block}'s - * {wr_ptr}'s will be updated to reflect the added bytes for each - * {message_block} - * - * Priority of the operation is specified by {priority}. On POSIX4-Unix, - * this is supported. Works like {nice} in Unix. Negative values are not - * allowed. 0 means priority of the operation same as the process - * priority. 1 means priority of the operation is one less than - * process. And so forth. On Win32, {priority} is a no-op. - * {signal_number} is the POSIX4 real-time signal number to be used - * for the operation. {signal_number} ranges from ACE_SIGRTMIN to - * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems. - */ - ssize_t recv (ACE_Message_Block *message_block, - size_t &number_of_bytes_recvd, - int flags, - int protocol_family = PF_INET, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - - /// Return the underlying implementation class. - // (this should be protected...) - virtual ACE_Asynch_Operation_Impl *implementation (void) const; - -protected: - /// Implementation class that all methods will be forwarded to. - ACE_Asynch_Read_Dgram_Impl *implementation_; - -public: -/** - * @class Result - * - * @brief This is the class which will be passed back to the - * {handler} when the asynchronous read completes. This class - * forwards all the methods to the implementation classes. - * - * This class has all the information necessary for the - * {handler} to uniquiely identify the completion of the - * asynchronous read. - */ - class ACE_Export Result : public ACE_Asynch_Result - { - - /// The concrete implementation result classes only construct this - /// class. - friend class ACE_POSIX_Asynch_Read_Dgram_Result; - friend class ACE_WIN32_Asynch_Read_Dgram_Result; - - public: - - /// The number of bytes which were requested at the start of the - /// asynchronous read. - size_t bytes_to_read (void) const; - - /// Message block which contains the read data - ACE_Message_Block *message_block (void) const; - - /// The flags used in the read - int flags (void) const; - - /// The address of where the packet came from - int remote_address (ACE_Addr& addr) const; - - /// I/O handle used for reading. - ACE_HANDLE handle (void) const; - - /// Get the implementation class. - ACE_Asynch_Read_Dgram_Result_Impl *implementation (void) const; - - protected: - /// Constructor. - Result (ACE_Asynch_Read_Dgram_Result_Impl *implementation); - - /// Destructor. - virtual ~Result (void); - - /// The implementation class. - ACE_Asynch_Read_Dgram_Result_Impl *implementation_; - }; -private: - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Asynch_Read_Dgram &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Asynch_Read_Dgram (const ACE_Asynch_Read_Dgram &)) -}; - -// Forward declarations -class ACE_Asynch_Write_Dgram_Impl; -class ACE_Asynch_Write_Dgram_Result_Impl; - -/** - * @class ACE_Asynch_Write_Dgram - * - * @brief This class is a factory for starting off asynchronous writes - * on a UDP socket. This class forwards all methods to its - * implementation class. - * - * Once {open} is called, multiple asynchronous {writes}s can - * started using this class. An ACE_Asynch_Write_Dgram::Result - * will be passed back to the {handler} when the asynchronous - * write completes through the - * {ACE_Handler::handle_write_dgram} callback. - */ -class ACE_Export ACE_Asynch_Write_Dgram : public ACE_Asynch_Operation -{ - -public: - /// A do nothing constructor. - ACE_Asynch_Write_Dgram (void); - - /// Destructor. - virtual ~ACE_Asynch_Write_Dgram (void); - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. If ({handle} == ACE_INVALID_HANDLE), - * {ACE_Handler::handle} will be called on the {handler} to get the - * correct handle. - */ - int open (ACE_Handler &handler, - ACE_HANDLE handle = ACE_INVALID_HANDLE, - const void *completion_key = 0, - ACE_Proactor *proactor = 0); - - /** This starts off an asynchronous send. Upto - * {message_block->total_length()} will be sent. {message_block}'s - * {rd_ptr} will be updated to reflect the sent bytes if the send operation - * is successfully completed. - * Return code of 1 means immediate success and {number_of_bytes_sent} - * is updated to number of bytes sent. The {ACE_Handler::handle_write_dgram} - * method will still be called. Return code of 0 means the IO will - * complete proactively. Return code of -1 means there was an error, use - * errno to get the error code. - * - * Scatter/gather is supported on WIN32 by using the {message_block->cont()} - * method. Up to ACE_IOV_MAX {message_block}'s are supported. Upto - * {message_block->length()} bytes will be sent from each {message block} - * for a total of {message_block->total_length()} bytes. All - * {message_block}'s {rd_ptr}'s will be updated to reflect the bytes sent - * from each {message_block}. - * - * Priority of the operation is specified by {priority}. On POSIX4-Unix, - * this is supported. Works like {nice} in Unix. Negative values are not - * allowed. 0 means priority of the operation same as the process - * priority. 1 means priority of the operation is one less than - * process. And so forth. On Win32, this argument is a no-op. - * {signal_number} is the POSIX4 real-time signal number to be used - * for the operation. {signal_number} ranges from ACE_SIGRTMIN to - * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems. - */ - ssize_t send (ACE_Message_Block *message_block, - size_t &number_of_bytes_sent, - int flags, - const ACE_Addr& remote_addr, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - - /// Return the underlying implementation class. - // (this should be protected...) - virtual ACE_Asynch_Operation_Impl *implementation (void) const; - -protected: - /// Implementation class that all methods will be forwarded to. - ACE_Asynch_Write_Dgram_Impl *implementation_; - -public: -/** - * @class Result - * - * @brief This is that class which will be passed back to the - * {handler} when the asynchronous write completes. This class - * forwards all the methods to the implementation class. - * - * This class has all the information necessary for the - * {handler} to uniquiely identify the completion of the - * asynchronous write. - */ - class ACE_Export Result : public ACE_Asynch_Result - { - - /// The concrete implementation result classes only construct this - /// class. - friend class ACE_POSIX_Asynch_Write_Dgram_Result; - friend class ACE_WIN32_Asynch_Write_Dgram_Result; - - public: - - /// The number of bytes which were requested at the start of the - /// asynchronous write. - size_t bytes_to_write (void) const; - - /// Message block which contains the sent data - ACE_Message_Block *message_block (void) const; - - /// The flags using in the write - int flags (void) const; - - /// I/O handle used for writing. - ACE_HANDLE handle (void) const; - - /// Get the implementation class. - ACE_Asynch_Write_Dgram_Result_Impl *implementation (void) const; - - protected: - /// Constructor. - Result (ACE_Asynch_Write_Dgram_Result_Impl *implementation); - - /// Destructor. - virtual ~Result (void); - - /// Implementation class. - ACE_Asynch_Write_Dgram_Result_Impl *implementation_; - }; -private: - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Asynch_Write_Dgram &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Asynch_Write_Dgram (const ACE_Asynch_Write_Dgram &)) -}; - - -/** - * @class ACE_Handler - * - * @brief This base class defines the interface for receiving the - * results of asynchronous operations. - * - * Subclasses of this class will fill in appropriate methods. - */ -class ACE_Export ACE_Handler -{ -public: - /// A do nothing constructor. - ACE_Handler (void); - - /// A do nothing constructor which allows proactor to be set to \. - ACE_Handler (ACE_Proactor *p); - - /// Virtual destruction. - virtual ~ACE_Handler (void); - - /// This method will be called when an asynchronous read completes on - /// a stream. - virtual void handle_read_stream (const ACE_Asynch_Read_Stream::Result &result); - - /// This method will be called when an asynchronous write completes - /// on a UDP socket. - virtual void handle_write_dgram (const ACE_Asynch_Write_Dgram::Result &result); - - /// This method will be called when an asynchronous read completes on - /// a UDP socket. - virtual void handle_read_dgram (const ACE_Asynch_Read_Dgram::Result &result); - - /// This method will be called when an asynchronous write completes - /// on a stream. - virtual void handle_write_stream (const ACE_Asynch_Write_Stream::Result &result); - - /// This method will be called when an asynchronous read completes on - /// a file. - virtual void handle_read_file (const ACE_Asynch_Read_File::Result &result); - - /// This method will be called when an asynchronous write completes - /// on a file. - virtual void handle_write_file (const ACE_Asynch_Write_File::Result &result); - - /// This method will be called when an asynchronous accept completes. - virtual void handle_accept (const ACE_Asynch_Accept::Result &result); - - /// This method will be called when an asynchronous connect completes. - virtual void handle_connect (const ACE_Asynch_Connect::Result &result); - - /// This method will be called when an asynchronous transmit file - /// completes. - virtual void handle_transmit_file (const ACE_Asynch_Transmit_File::Result &result); - - /// Called when timer expires. {tv} was the requested time value and - /// {act} is the ACT passed when scheduling the timer. - virtual void handle_time_out (const ACE_Time_Value &tv, - const void *act = 0); - - /** - * This is method works with the {run_event_loop} of the - * ACE_Proactor. A special {Wake_Up_Completion} is used to wake up - * all the threads that are blocking for completions. - */ - virtual void handle_wakeup (void); - - /// Get the proactor associated with this handler. - ACE_Proactor *proactor (void); - - /// Set the proactor. - void proactor (ACE_Proactor *p); - - /** - * Get the I/O handle used by this {handler}. This method will be - * called by the ACE_Asynch_* classes when an ACE_INVALID_HANDLE is - * passed to {open}. - */ - virtual ACE_HANDLE handle (void) const; - - /// Set the ACE_HANDLE value for this Handler. - virtual void handle (ACE_HANDLE); - - /** - * @class Proxy - * - * @brief The Proxy class acts as a proxy for dispatch of completions - * to operations issued for the associated handler. It allows the handler - * to be deleted while operations are outstanding. The proxy must be used - * to get the ACE_Handler pointer for dispatching, and if it's 0, the - * handler is no longer valid and the result should not be dispatched. - */ - class ACE_Export Proxy - { - public: - Proxy (ACE_Handler *handler) : handler_ (handler) {}; - void reset (void) { this->handler_ = 0; }; - ACE_Handler *handler (void) { return this->handler_; }; - private: - ACE_Handler *handler_; - }; - typedef ACE_Refcounted_Auto_Ptr - Proxy_Ptr; - - Proxy_Ptr &proxy (void); - -protected: - /// The proactor associated with this handler. - ACE_Proactor *proactor_; - - /// The ACE_HANDLE in use with this handler. - ACE_HANDLE handle_; - - /// Refers to proxy for this handler. - ACE_Refcounted_Auto_Ptr proxy_; - - ACE_UNIMPLEMENTED_FUNC (ACE_Handler (const ACE_Handler &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Handler operator= (const ACE_Handler &)) -}; - -// Forward declarations -class ACE_INET_Addr; - -// Forward declarations -template -class ACE_Asynch_Acceptor; - -/** - * @class ACE_Service_Handler - * - * @brief This base class defines the interface for the - * ACE_Asynch_Acceptor to call into when new connection are - * accepted. - * - * Subclasses of this class will fill in appropriate methods to - * define application specific behavior. - */ -class ACE_Export ACE_Service_Handler : public ACE_Handler -{ - - /// The Acceptor is the factory and therefore should have special - /// privileges. - friend class ACE_Asynch_Acceptor; - -public: - /// A do nothing constructor. - ACE_Service_Handler (void); - - /// Virtual destruction. - virtual ~ACE_Service_Handler (void); - - /** - * {open} is called by ACE_Asynch_Acceptor to initialize a new - * instance of ACE_Service_Handler that has been created after the - * new connection is accepted. The handle for the new connection is - * passed along with the initial data that may have shown up. - */ - virtual void open (ACE_HANDLE new_handle, - ACE_Message_Block &message_block); - - // protected: - // This should be corrected after the correct semantics of the - // friend has been figured out. - - /// Called by ACE_Asynch_Acceptor to pass the addresses of the new - /// connections. - virtual void addresses (const ACE_INET_Addr &remote_address, - const ACE_INET_Addr &local_address); - - /// Called by ACE_Asynch_Acceptor to pass the act. - virtual void act (const void *); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_WIN32 || ACE_HAS_AIO_CALLS*/ -#include /**/ "ace/post.h" -#endif /* ACE_ASYNCH_IO_H */ diff --git a/dep/acelite/ace/Asynch_IO_Impl.cpp b/dep/acelite/ace/Asynch_IO_Impl.cpp deleted file mode 100644 index b4b47eda55c..00000000000 --- a/dep/acelite/ace/Asynch_IO_Impl.cpp +++ /dev/null @@ -1,117 +0,0 @@ -// $Id: Asynch_IO_Impl.cpp 80826 2008-03-04 14:51:23Z wotte $ - -#include "ace/Asynch_IO_Impl.h" - -#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) -// This only works on Win32 platforms and on Unix platforms supporting -// aio calls. - -#if !defined (__ACE_INLINE__) -#include "ace/Asynch_IO_Impl.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Asynch_Result_Impl::~ACE_Asynch_Result_Impl (void) -{ -} - -ACE_Asynch_Operation_Impl::~ACE_Asynch_Operation_Impl (void) -{ -} - -ACE_Asynch_Read_Stream_Impl::~ACE_Asynch_Read_Stream_Impl (void) -{ -} - -ACE_Asynch_Read_Stream_Result_Impl::~ACE_Asynch_Read_Stream_Result_Impl (void) -{ -} - -ACE_Asynch_Write_Stream_Impl::~ACE_Asynch_Write_Stream_Impl (void) -{ -} - -ACE_Asynch_Write_Stream_Result_Impl::~ACE_Asynch_Write_Stream_Result_Impl (void) -{ -} - -ACE_Asynch_Read_File_Impl::~ACE_Asynch_Read_File_Impl (void) -{ -} - -ACE_Asynch_Write_File_Impl::~ACE_Asynch_Write_File_Impl (void) -{ -} - -ACE_Asynch_Read_File_Result_Impl::~ACE_Asynch_Read_File_Result_Impl (void) -{ -} - -ACE_Asynch_Write_File_Result_Impl::~ACE_Asynch_Write_File_Result_Impl (void) -{ -} - -ACE_Asynch_Accept_Result_Impl::~ACE_Asynch_Accept_Result_Impl (void) -{ -} - -ACE_Asynch_Connect_Result_Impl::~ACE_Asynch_Connect_Result_Impl (void) -{ -} - -ACE_Asynch_Accept_Impl::~ACE_Asynch_Accept_Impl (void) -{ -} - -ACE_Asynch_Connect_Impl::~ACE_Asynch_Connect_Impl (void) -{ -} - -ACE_Asynch_Transmit_File_Impl::~ACE_Asynch_Transmit_File_Impl (void) -{ -} - -ACE_Asynch_Transmit_File_Result_Impl::~ACE_Asynch_Transmit_File_Result_Impl (void) -{ -} - -ACE_Asynch_Read_Dgram_Impl::~ACE_Asynch_Read_Dgram_Impl (void) -{ -} - -ACE_Asynch_Read_Dgram_Impl::ACE_Asynch_Read_Dgram_Impl (void) -{ -} - -ACE_Asynch_Write_Dgram_Impl::~ACE_Asynch_Write_Dgram_Impl (void) -{ -} - -ACE_Asynch_Write_Dgram_Impl::ACE_Asynch_Write_Dgram_Impl (void) -{ -} - -//*********************************************** - -ACE_Asynch_Read_Dgram_Result_Impl::~ACE_Asynch_Read_Dgram_Result_Impl (void) -{ -} - -ACE_Asynch_Read_Dgram_Result_Impl::ACE_Asynch_Read_Dgram_Result_Impl (void) -{ -} - -//*********************************************** - -ACE_Asynch_Write_Dgram_Result_Impl::~ACE_Asynch_Write_Dgram_Result_Impl (void) -{ -} - -ACE_Asynch_Write_Dgram_Result_Impl::ACE_Asynch_Write_Dgram_Result_Impl (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ diff --git a/dep/acelite/ace/Asynch_IO_Impl.h b/dep/acelite/ace/Asynch_IO_Impl.h deleted file mode 100644 index e820529dfb5..00000000000 --- a/dep/acelite/ace/Asynch_IO_Impl.h +++ /dev/null @@ -1,816 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Asynch_IO_Impl.h - * - * $Id: Asynch_IO_Impl.h 93359 2011-02-11 11:33:12Z mcorino $ - * - * - * This class contains asbtract base classes for all the concrete - * implementation classes for the various asynchronous operations - * that are used with the Praoctor. - * - * - * @author Irfan Pyarali (irfan@cs.wustl.edu) - * @author Tim Harrison (harrison@cs.wustl.edu) - * @author Alexander Babu Arulanthu - * @author Roger Tragin - * @author Alexander Libman - */ -//============================================================================= - -#ifndef ACE_ASYNCH_IO_IMPL_H -#define ACE_ASYNCH_IO_IMPL_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) -// This only works on Win32 platforms and on Unix platforms supporting -// aio calls. - -#include "ace/Asynch_IO.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declaration. -class ACE_Proactor_Impl; - -/** - * @class ACE_Asynch_Result_Impl - * - * @brief Abstract base class for the all the classes that provide - * concrete implementations for ACE_Asynch_Result. - * - */ -class ACE_Export ACE_Asynch_Result_Impl -{ -public: - virtual ~ACE_Asynch_Result_Impl (void); - - /// Number of bytes transferred by the operation. - virtual size_t bytes_transferred (void) const = 0; - - /// ACT associated with the operation. - virtual const void *act (void) const = 0; - - /// Did the operation succeed? - virtual int success (void) const = 0; - - /// This ACT is not the same as the ACT associated with the - /// asynchronous operation. - virtual const void *completion_key (void) const = 0; - - /// Error value if the operation fail. - virtual u_long error (void) const = 0; - - /// Event associated with the OVERLAPPED structure. - virtual ACE_HANDLE event (void) const = 0; - - /// This really make sense only when doing file I/O. - virtual u_long offset (void) const = 0; - virtual u_long offset_high (void) const = 0; - - /// Priority of the operation. - virtual int priority (void) const = 0; - - /** - * POSIX4 real-time signal number to be used for the - * operation. signal_number ranges from SIGRTMIN to SIGRTMAX. By - * default, SIGRTMIN is used to issue calls. This is a no-op - * on non-POSIX4 systems and returns 0. - */ - virtual int signal_number (void) const = 0; - - // protected: - // - // These two should really be protected. But sometimes it - // simplifies code to be able to "fake" a result. Use carefully. - /// This is called when the asynchronous operation completes. - virtual void complete (size_t bytes_transferred, - int success, - const void *completion_key, - u_long error = 0) = 0; - - /// Post @c this to the Proactor's completion port. - virtual int post_completion (ACE_Proactor_Impl *proactor) = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Result_Impl (void); -}; - -/** - * @class ACE_Asynch_Operation_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Operation. - */ -class ACE_Export ACE_Asynch_Operation_Impl -{ -public: - virtual ~ACE_Asynch_Operation_Impl (void); - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. If @a handle == ACE_INVALID_HANDLE, - * ACE_Handler::handle() will be called on the proxied handler to get the - * correct handle. - */ - virtual int open (const ACE_Handler::Proxy_Ptr &handler_proxy, - ACE_HANDLE handle, - const void *completion_key, - ACE_Proactor *proactor) = 0; - - /** - * This cancels all pending accepts operations that were issued by - * the calling thread. The function does not cancel asynchronous - * operations issued by other threads. - */ - virtual int cancel (void) = 0; - - // = Access methods. - - /// Return the underlying proactor. - virtual ACE_Proactor* proactor (void) const = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Operation_Impl (void); -}; - -/** - * @class ACE_Asynch_Read_Stream_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Read_Stream - * - */ -class ACE_Export ACE_Asynch_Read_Stream_Impl : public virtual ACE_Asynch_Operation_Impl -{ -public: - virtual ~ACE_Asynch_Read_Stream_Impl (void); - - /// This starts off an asynchronous read. Upto @a bytes_to_read will - /// be read and stored in the @a message_block. - virtual int read (ACE_Message_Block &message_block, - size_t bytes_to_read, - const void *act, - int priority, - int signal_number) = 0; - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) - /** - * Same as above but with scatter support, through chaining of composite - * message blocks using the continuation field. - */ - virtual int readv (ACE_Message_Block &message_block, - size_t bytes_to_read, - const void *act, - int priority, - int signal_number) = 0; -#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ - -protected: - /// Do-nothing constructor. - ACE_Asynch_Read_Stream_Impl (void); -}; - -/** - * @class ACE_Asynch_Read_Stream_Result_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Read_Stream::Result class. - * - */ -class ACE_Export ACE_Asynch_Read_Stream_Result_Impl : public virtual ACE_Asynch_Result_Impl -{ -public: - virtual ~ACE_Asynch_Read_Stream_Result_Impl (void); - - /// The number of bytes which were requested at the start of the - /// asynchronous read. - virtual size_t bytes_to_read (void) const = 0; - - /// Message block which contains the read data. - virtual ACE_Message_Block &message_block (void) const = 0; - - /// I/O handle used for reading. - virtual ACE_HANDLE handle (void) const = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Read_Stream_Result_Impl (void); -}; - -/** - * @class ACE_Asynch_Write_Stream_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Write_Stream class. - * - */ -class ACE_Export ACE_Asynch_Write_Stream_Impl : public virtual ACE_Asynch_Operation_Impl -{ -public: - virtual ~ACE_Asynch_Write_Stream_Impl (void); - - /// This starts off an asynchronous write. Upto @a bytes_to_write - /// will be written from the @a message_block. - virtual int write (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act, - int priority, - int signal_number) = 0; - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) - /** - * Same as above but with gather support, through chaining of composite - * message blocks using the continuation field. - */ - virtual int writev (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act, - int priority, - int signal_number) = 0; -#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ - -protected: - /// Do-nothing constructor. - ACE_Asynch_Write_Stream_Impl (void); -}; - -/** - * @class ACE_Asynch_Write_Stream_Result_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Write_Stream::Result. - * - */ -class ACE_Export ACE_Asynch_Write_Stream_Result_Impl : public virtual ACE_Asynch_Result_Impl -{ -public: - virtual ~ACE_Asynch_Write_Stream_Result_Impl (void); - - /// The number of bytes which were requested at the start of the - /// asynchronous write. - virtual size_t bytes_to_write (void) const = 0; - - /// Message block that contains the data to be written. - virtual ACE_Message_Block &message_block (void) const = 0; - - /// I/O handle used for writing. - virtual ACE_HANDLE handle (void) const = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Write_Stream_Result_Impl (void); -}; - -/** - * @class ACE_Asynch_Read_File_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Read_File::Result. - * - */ -class ACE_Export ACE_Asynch_Read_File_Impl : public virtual ACE_Asynch_Read_Stream_Impl -{ -public: - virtual ~ACE_Asynch_Read_File_Impl (void); - - /** - * This starts off an asynchronous read. Upto @a bytes_to_read will - * be read and stored in the @a message_block. The read will start - * at @a offset from the beginning of the file. - */ - virtual int read (ACE_Message_Block &message_block, - size_t bytes_to_read, - u_long offset, - u_long offset_high, - const void *act, - int priority, - int signal_number) = 0; - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) - /** - * Same as above but with scatter support, through chaining of composite - * message blocks using the continuation field. - * @note In win32 Each data block payload must be at least the size of a system - * memory page and must be aligned on a system memory page size boundary - */ - virtual int readv (ACE_Message_Block &message_block, - size_t bytes_to_read, - u_long offset, - u_long offset_high, - const void *act, - int priority, - int signal_number) = 0; -#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ - - /// This starts off an asynchronous read. Upto @a bytes_to_read will - /// be read and stored in the @a message_block. - virtual int read (ACE_Message_Block &message_block, - size_t bytes_to_read, - const void *act, - int priority, - int signal_number) = 0; - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) - /** - * Same as above but with scatter support, through chaining of composite - * message blocks using the continuation field. - */ - virtual int readv (ACE_Message_Block &message_block, - size_t bytes_to_read, - const void *act, - int priority, - int signal_number) = 0; -#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ - -protected: - /// Do-nothing constructor. - ACE_Asynch_Read_File_Impl (void); -}; - -/** - * @class ACE_Asynch_Read_File_Result_Impl - * - * @brief This is the abstract base class for all the concrete - * implementation classes for ACE_Asynch_Read_File::Result. - * - */ -class ACE_Export ACE_Asynch_Read_File_Result_Impl : public virtual ACE_Asynch_Read_Stream_Result_Impl -{ -public: - /// Destructor. - virtual ~ACE_Asynch_Read_File_Result_Impl (void); - -protected: - /// Do-nothing constructor. - ACE_Asynch_Read_File_Result_Impl (void); -}; - -/** - * @class ACE_Asynch_Write_File_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Write_File. - * - */ -class ACE_Export ACE_Asynch_Write_File_Impl : public virtual ACE_Asynch_Write_Stream_Impl -{ -public: - virtual ~ACE_Asynch_Write_File_Impl (void); - - /** - * This starts off an asynchronous write. Upto @a bytes_to_write - * will be write and stored in the @a message_block. The write will - * start at @a offset from the beginning of the file. - */ - virtual int write (ACE_Message_Block &message_block, - size_t bytes_to_write, - u_long offset, - u_long offset_high, - const void *act, - int priority, - int signal_number) = 0; - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) - /** - * Same as above but with gather support, through chaining of composite - * message blocks using the continuation field. - * @note In win32 Each data block payload must be at least the size of a system - * memory page and must be aligned on a system memory page size boundary - */ - virtual int writev (ACE_Message_Block &message_block, - size_t bytes_to_write, - u_long offset, - u_long offset_high, - const void *act, - int priority, - int signal_number) = 0; -#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ - - /// This starts off an asynchronous write. Upto @a bytes_to_write - /// will be written from the @a message_block. - virtual int write (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act, - int priority, - int signal_number) = 0; - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) - /** - * Same as above but with gather support, through chaining of composite - * message blocks using the continuation field. - */ - virtual int writev (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act, - int priority, - int signal_number) = 0; -#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ - -protected: - /// Do-nothing constructor. - ACE_Asynch_Write_File_Impl (void); -}; - -/** - * @class ACE_Asynch_Write_File_Result_Impl - * - * @brief This is the abstract base class for all the concrete - * implementation classes that provide different implementations - * for the ACE_Asynch_Write_File::Result. - * - */ -class ACE_Export ACE_Asynch_Write_File_Result_Impl : public virtual ACE_Asynch_Write_Stream_Result_Impl -{ -public: - virtual ~ACE_Asynch_Write_File_Result_Impl (void); - -protected: - /// Do-nothing constructor. - ACE_Asynch_Write_File_Result_Impl (void); -}; - -/** - * @class ACE_Asynch_Accept_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Accept. - * - */ -class ACE_Export ACE_Asynch_Accept_Impl : public virtual ACE_Asynch_Operation_Impl -{ -public: - virtual ~ACE_Asynch_Accept_Impl (void); - - /** - * This starts off an asynchronous accept. The asynchronous accept - * call also allows any initial data to be returned to the - * . Upto @a bytes_to_read will be read and stored in the - * @a message_block. The @a accept_handle will be used for the - * call. If (@a accept_handle == INVALID_HANDLE), a new - * handle will be created. - * - * @a message_block must be specified. This is because the address of - * the new connection is placed at the end of this buffer. - */ - virtual int accept (ACE_Message_Block &message_block, - size_t bytes_to_read, - ACE_HANDLE accept_handle, - const void *act, - int priority, - int signal_number, - int addr_family) = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Accept_Impl (void); -}; - -/** - * @class ACE_Asynch_Accept_Result_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Accept. - * - */ -class ACE_Export ACE_Asynch_Accept_Result_Impl : public virtual ACE_Asynch_Result_Impl -{ -public: - virtual ~ACE_Asynch_Accept_Result_Impl (void); - - /// The number of bytes which were requested at the start of the - /// asynchronous accept. - virtual size_t bytes_to_read (void) const = 0; - - /// Message block which contains the read data. - virtual ACE_Message_Block &message_block (void) const = 0; - - /// I/O handle used for accepting new connections. - virtual ACE_HANDLE listen_handle (void) const = 0; - - /// I/O handle for the new connection. - virtual ACE_HANDLE accept_handle (void) const = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Accept_Result_Impl (void); -}; - - -/** - * @class ACE_Asynch_Connect_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Connect. - * - */ -class ACE_Export ACE_Asynch_Connect_Impl : public virtual ACE_Asynch_Operation_Impl -{ -public: - virtual ~ACE_Asynch_Connect_Impl (void); - - /** - * This starts off an asynchronous connect - */ - virtual int connect (ACE_HANDLE connect_handle, - const ACE_Addr & remote_sap, - const ACE_Addr & local_sap, - int reuse_addr, - const void *act, - int priority, - int signal_number) = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Connect_Impl (void); -}; - -/** - * @class ACE_Asynch_Connect_Result_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Connect. - * - */ -class ACE_Export ACE_Asynch_Connect_Result_Impl : public virtual ACE_Asynch_Result_Impl -{ -public: - virtual ~ACE_Asynch_Connect_Result_Impl (void); - - /// I/O handle for the connection. - virtual ACE_HANDLE connect_handle (void) const = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Connect_Result_Impl (void); -}; - - -/** - * @class ACE_Asynch_Transmit_File_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Transmit_File. - * - */ -class ACE_Asynch_Transmit_File_Impl : public virtual ACE_Asynch_Operation_Impl -{ -public: - virtual ~ACE_Asynch_Transmit_File_Impl (void); - - /// This starts off an asynchronous transmit file. - virtual int transmit_file (ACE_HANDLE file, - ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, - size_t bytes_to_write, - u_long offset, - u_long offset_high, - size_t bytes_per_send, - u_long flags, - const void *act, - int priority, - int signal_number) = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Transmit_File_Impl (void); -}; - -/** - * @class ACE_Asynch_Transmit_File_Result_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Transmit_File::Result. - * - */ -class ACE_Export ACE_Asynch_Transmit_File_Result_Impl : public virtual ACE_Asynch_Result_Impl -{ -public: - virtual ~ACE_Asynch_Transmit_File_Result_Impl (void); - - /// Socket used for transmitting the file. - virtual ACE_HANDLE socket (void) const = 0; - - /// File from which the data is read. - virtual ACE_HANDLE file (void) const = 0; - - /// Header and trailer data associated with this transmit file. - virtual ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer (void) const = 0; - - /// The number of bytes which were requested at the start of the - /// asynchronous transmit file. - virtual size_t bytes_to_write (void) const = 0; - - /// Number of bytes per send requested at the start of the transmit - /// file. - virtual size_t bytes_per_send (void) const = 0; - - /// Flags which were passed into transmit file. - virtual u_long flags (void) const = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Transmit_File_Result_Impl (void); -}; - - -/** - * @class ACE_Asynch_Read_Dgram_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Read_Dgram - * - */ -class ACE_Export ACE_Asynch_Read_Dgram_Impl : public virtual ACE_Asynch_Operation_Impl -{ -public: - virtual ~ACE_Asynch_Read_Dgram_Impl (void); - - /** This starts off an asynchronous read. Upto - * total_size()> will be read and stored in the - * @a message_block. @a message_block's will be updated to reflect - * the added bytes if the read operation is successful completed. - * Return code of 1 means immediate success and - * will contain number of bytes read. The - * method will still be called. Return code of 0 means the IO will - * complete proactively. Return code of -1 means there was an error, use - * errno to get the error code. - * - * Scatter/gather is supported on WIN32 by using the cont()> - * method. Up to ACE_IOV_MAX @a message_block's are supported. Upto - * size()> bytes will be read into each for - * a total of total_size()> bytes. All @a message_block's - * 's will be updated to reflect the added bytes for each - * @a message_block - * - * Priority of the operation is specified by @a priority. On POSIX4-Unix, - * this is supported. Works like in Unix. Negative values are not - * allowed. 0 means priority of the operation same as the process - * priority. 1 means priority of the operation is one less than - * process. And so forth. On Win32, @a priority is a no-op. - * @a signal_number is the POSIX4 real-time signal number to be used - * for the operation. @a signal_number ranges from ACE_SIGRTMIN to - * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems. - */ - virtual ssize_t recv (ACE_Message_Block *message_block, - size_t &number_of_bytes_recvd, - int flags, - int protocol_family, - const void *act, - int priority, - int signal_number) = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Read_Dgram_Impl (void); -}; - -/** - * @class ACE_Asynch_Read_Dgram_Result_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Read_Dgram::Result class. - * - */ -class ACE_Export ACE_Asynch_Read_Dgram_Result_Impl : public virtual ACE_Asynch_Result_Impl -{ -public: - virtual ~ACE_Asynch_Read_Dgram_Result_Impl (void); - - /// Message block which contains the read data - virtual ACE_Message_Block *message_block (void) const = 0; - - /// The number of bytes which were requested at the start of the - /// asynchronous read. - virtual size_t bytes_to_read (void) const = 0; - - /// The address of where the packet came from - virtual int remote_address (ACE_Addr& addr) const = 0; - - /// The flags used in the read - virtual int flags (void) const = 0; - - /// I/O handle used for reading. - virtual ACE_HANDLE handle (void) const = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Read_Dgram_Result_Impl (void); -}; - -/** - * @class ACE_Asynch_Write_Dgram_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Write_Dgram class. - * - */ -class ACE_Export ACE_Asynch_Write_Dgram_Impl : public virtual ACE_Asynch_Operation_Impl -{ -public: - virtual ~ACE_Asynch_Write_Dgram_Impl (void); - - /** This starts off an asynchronous send. Upto - * total_length()> will be sent. @a message_block's - * will be updated to reflect the sent bytes if the send operation - * is successful completed. - * Return code of 1 means immediate success and - * is updated to number of bytes sent. The - * method will still be called. Return code of 0 means the IO will - * complete proactively. Return code of -1 means there was an error, use - * errno to get the error code. - * - * Scatter/gather is supported on WIN32 by using the cont()> - * method. Up to ACE_IOV_MAX @a message_block's are supported. Upto - * length()> bytes will be sent from each - * for a total of total_length()> bytes. All - * @a message_block's 's will be updated to reflect the bytes sent - * from each @a message_block. - * - * Priority of the operation is specified by @a priority. On POSIX4-Unix, - * this is supported. Works like in Unix. Negative values are not - * allowed. 0 means priority of the operation same as the process - * priority. 1 means priority of the operation is one less than - * process. And so forth. On Win32, this argument is a no-op. - * @a signal_number is the POSIX4 real-time signal number to be used - * for the operation. @a signal_number ranges from ACE_SIGRTMIN to - * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems. - */ - virtual ssize_t send (ACE_Message_Block *message_block, - size_t &number_of_bytes_sent, - int flags, - const ACE_Addr &addr, - const void *act, - int priority, - int signal_number) = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Write_Dgram_Impl (void); -}; - -/** - * @class ACE_Asynch_Write_Dgram_Result_Impl - * - * @brief Abstract base class for all the concrete implementation - * classes that provide different implementations for the - * ACE_Asynch_Write_Dgram::Result class. - * - */ -class ACE_Export ACE_Asynch_Write_Dgram_Result_Impl : public virtual ACE_Asynch_Result_Impl -{ -public: - virtual ~ACE_Asynch_Write_Dgram_Result_Impl (void); - - /// The number of bytes which were requested at the start of the - /// asynchronous write. - virtual size_t bytes_to_write (void) const = 0; - - /// Message block which contains the sent data - virtual ACE_Message_Block *message_block (void) const = 0; - - /// The flags using in the write - virtual int flags (void) const = 0; - - /// I/O handle used for writing. - virtual ACE_HANDLE handle (void) const = 0; - -protected: - /// Do-nothing constructor. - ACE_Asynch_Write_Dgram_Result_Impl (void); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Asynch_IO_Impl.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ -#include /**/ "ace/post.h" -#endif /* ACE_ASYNCH_IO_IMPL_H */ diff --git a/dep/acelite/ace/Asynch_IO_Impl.inl b/dep/acelite/ace/Asynch_IO_Impl.inl deleted file mode 100644 index 60dc69dfb31..00000000000 --- a/dep/acelite/ace/Asynch_IO_Impl.inl +++ /dev/null @@ -1,106 +0,0 @@ -// -*- C++ -*- -// -// $Id: Asynch_IO_Impl.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Asynch_Result_Impl::ACE_Asynch_Result_Impl (void) -{ -} - -ACE_INLINE -ACE_Asynch_Operation_Impl::ACE_Asynch_Operation_Impl (void) -{ -} - -ACE_INLINE -ACE_Asynch_Read_Stream_Impl::ACE_Asynch_Read_Stream_Impl (void) - : ACE_Asynch_Operation_Impl () -{ -} - -ACE_INLINE -ACE_Asynch_Read_Stream_Result_Impl::ACE_Asynch_Read_Stream_Result_Impl (void) - : ACE_Asynch_Result_Impl () -{ -} - -ACE_INLINE -ACE_Asynch_Write_Stream_Impl::ACE_Asynch_Write_Stream_Impl (void) - : ACE_Asynch_Operation_Impl () -{ -} - -ACE_INLINE -ACE_Asynch_Write_Stream_Result_Impl::ACE_Asynch_Write_Stream_Result_Impl (void) - : ACE_Asynch_Result_Impl () -{ -} - -ACE_INLINE -ACE_Asynch_Read_File_Impl::ACE_Asynch_Read_File_Impl (void) - : ACE_Asynch_Operation_Impl (), - ACE_Asynch_Read_Stream_Impl () -{ -} - -ACE_INLINE -ACE_Asynch_Read_File_Result_Impl::ACE_Asynch_Read_File_Result_Impl (void) - : ACE_Asynch_Result_Impl (), - ACE_Asynch_Read_Stream_Result_Impl () -{ -} - -ACE_INLINE -ACE_Asynch_Write_File_Impl::ACE_Asynch_Write_File_Impl (void) - : ACE_Asynch_Operation_Impl (), - ACE_Asynch_Write_Stream_Impl () -{ -} - -ACE_INLINE -ACE_Asynch_Write_File_Result_Impl::ACE_Asynch_Write_File_Result_Impl (void) - : ACE_Asynch_Result_Impl (), - ACE_Asynch_Write_Stream_Result_Impl () -{ -} - -ACE_INLINE -ACE_Asynch_Accept_Impl::ACE_Asynch_Accept_Impl (void) - : ACE_Asynch_Operation_Impl () -{ -} - -ACE_INLINE -ACE_Asynch_Accept_Result_Impl::ACE_Asynch_Accept_Result_Impl (void) - : ACE_Asynch_Result_Impl () -{ -} - -ACE_INLINE -ACE_Asynch_Connect_Impl::ACE_Asynch_Connect_Impl (void) - : ACE_Asynch_Operation_Impl () -{ -} - -ACE_INLINE -ACE_Asynch_Connect_Result_Impl::ACE_Asynch_Connect_Result_Impl (void) - : ACE_Asynch_Result_Impl () -{ -} - - -ACE_INLINE -ACE_Asynch_Transmit_File_Impl::ACE_Asynch_Transmit_File_Impl (void) - : ACE_Asynch_Operation_Impl () -{ -} - -ACE_INLINE -ACE_Asynch_Transmit_File_Result_Impl::ACE_Asynch_Transmit_File_Result_Impl (void) - : ACE_Asynch_Result_Impl () -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Asynch_Pseudo_Task.cpp b/dep/acelite/ace/Asynch_Pseudo_Task.cpp deleted file mode 100644 index e5d4b3b4e3c..00000000000 --- a/dep/acelite/ace/Asynch_Pseudo_Task.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// $Id: Asynch_Pseudo_Task.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/Asynch_Pseudo_Task.h" - -#include "ace/OS_NS_errno.h" -#include "ace/OS_NS_signal.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Asynch_Pseudo_Task::ACE_Asynch_Pseudo_Task () - : select_reactor_ (), // should be initialized before reactor_ - reactor_ (&select_reactor_, 0) // don't delete implementation -{ -} - -ACE_Asynch_Pseudo_Task::~ACE_Asynch_Pseudo_Task () -{ - this->stop (); -} - -int -ACE_Asynch_Pseudo_Task::start (void) -{ - if (this->reactor_.initialized () == 0) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("%N:%l:%p\n"), - ACE_TEXT ("start reactor is not initialized")), - -1); - - return this->activate () == -1 ? -1 : 0; // If started, return 0 -} - -int -ACE_Asynch_Pseudo_Task::stop (void) -{ - if (this->thr_count () == 0) // already stopped - return 0; - - if (this->reactor_.end_reactor_event_loop () == -1) - return -1; - - this->wait (); - this->reactor_.close (); - return 0; -} - -int -ACE_Asynch_Pseudo_Task::svc (void) -{ -#if !defined (ACE_WIN32) - - sigset_t RT_signals; - - sigemptyset (&RT_signals); - for (int si = ACE_SIGRTMIN; si <= ACE_SIGRTMAX; si++) - sigaddset (&RT_signals, si); - - if (ACE_OS::pthread_sigmask (SIG_BLOCK, &RT_signals, 0) != 0) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Error:(%P | %t):%p\n"), - ACE_TEXT ("pthread_sigmask"))); -#endif - - reactor_.owner (ACE_Thread::self ()); - reactor_.run_reactor_event_loop (); - - return 0; -} - - - -int -ACE_Asynch_Pseudo_Task::register_io_handler (ACE_HANDLE handle, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask, - int flg_suspend) -{ - // Register the handler with the reactor. - if (-1 == this->reactor_.register_handler (handle, handler, mask)) - return -1; - - if (flg_suspend == 0) - return 0; - - // Suspend the handle now. Enable only when the accept is issued - // by the application. - if (this->reactor_.suspend_handler (handle) == -1) - { - ACE_ERROR - ((LM_ERROR, - ACE_TEXT ("%N:%l:%p\n"), - ACE_TEXT ("register_io_handler (suspended)"))); - this->reactor_.remove_handler (handle, ACE_Event_Handler::ALL_EVENTS_MASK - | ACE_Event_Handler::DONT_CALL); - return -1; - } - - return 0; -} - -int -ACE_Asynch_Pseudo_Task::remove_io_handler (ACE_HANDLE handle) -{ - return this->reactor_.remove_handler (handle, - ACE_Event_Handler::ALL_EVENTS_MASK - | ACE_Event_Handler::DONT_CALL); -} - -int -ACE_Asynch_Pseudo_Task::remove_io_handler (ACE_Handle_Set &set) -{ - return this->reactor_.remove_handler (set, ACE_Event_Handler::ALL_EVENTS_MASK - | ACE_Event_Handler::DONT_CALL); -} - -int -ACE_Asynch_Pseudo_Task::suspend_io_handler (ACE_HANDLE handle) -{ - return this->reactor_.suspend_handler (handle); -} - -int -ACE_Asynch_Pseudo_Task::resume_io_handler (ACE_HANDLE handle) -{ - return this->reactor_.resume_handler (handle); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Asynch_Pseudo_Task.h b/dep/acelite/ace/Asynch_Pseudo_Task.h deleted file mode 100644 index 6e2c3a1d427..00000000000 --- a/dep/acelite/ace/Asynch_Pseudo_Task.h +++ /dev/null @@ -1,73 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Asynch_Pseudo_Task.h - * - * $Id: Asynch_Pseudo_Task.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Alexander Libman - */ -//============================================================================= - -#ifndef ACE_ASYNCH_PSEUDO_TASK_H -#define ACE_ASYNCH_PSEUDO_TASK_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Reactor.h" -#include "ace/Select_Reactor.h" -#include "ace/Task.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/* - * Specialization hook to replace the Reactor with the - * concrete Reactor implementation, e.g., select_st, - * select_mt etc. - */ -//@@ REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK - -/** - * @class ACE_Asynch_Pseudo_Task - * - */ -class ACE_Export ACE_Asynch_Pseudo_Task : public ACE_Task -{ -public: - ACE_Asynch_Pseudo_Task(); - virtual ~ACE_Asynch_Pseudo_Task(); - - int start (void); - int stop (void); - - int register_io_handler (ACE_HANDLE handle, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask, - int flg_suspend); - - int remove_io_handler (ACE_HANDLE handle); - int remove_io_handler (ACE_Handle_Set &set); - int resume_io_handler (ACE_HANDLE handle); - int suspend_io_handler (ACE_HANDLE handle); - -protected: - virtual int svc (void); - - /// Should be initialized before reactor_ - ACE_Select_Reactor select_reactor_; - - ACE_Reactor reactor_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_ASYNCH_PSEUDO_TASK_H */ diff --git a/dep/acelite/ace/Atomic_Op.cpp b/dep/acelite/ace/Atomic_Op.cpp deleted file mode 100644 index 32e5c11364d..00000000000 --- a/dep/acelite/ace/Atomic_Op.cpp +++ /dev/null @@ -1,306 +0,0 @@ -// $Id: Atomic_Op.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/Atomic_Op.h" -#include "ace/OS_NS_unistd.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Atomic_Op.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_HAS_BUILTIN_ATOMIC_OP) - -#if defined (ACE_INCLUDE_ATOMIC_OP_SPARC) -# include "ace/Atomic_Op_Sparc.h" -#endif /* ACE_INCLUDE_ATOMIC_OP_SPARC */ - -namespace { - -#if defined (_MSC_VER) -// Disable "no return value" warning, as we will be putting -// the return values directly into the EAX register. -#pragma warning (push) -#pragma warning (disable: 4035) -#endif /* _MSC_VER */ - -long -single_cpu_increment (volatile long *value) -{ -#if defined (ACE_HAS_INTEL_ASSEMBLY) - long tmp = 1; - unsigned long addr = reinterpret_cast (value); - asm( "xadd %0, (%1)" : "+r"(tmp) : "r"(addr) ); - return tmp + 1; -#elif !defined (ACE_HAS_SOLARIS_ATOMIC_LIB) && (defined (sun) || \ - (defined (__SUNPRO_CC) && (defined (__i386) || defined (__x86_64)))) - return ace_atomic_add_long ( - reinterpret_cast (value), 1); -#elif defined(__GNUC__) && defined(PPC) - long tmp; - asm("lwz %0,%1" : "=r" (tmp) : "m" (*value) ); - asm("addi %0,%0,1" : "+r" (tmp) ); - asm("stw %0,%1" : "+r" (tmp), "=m" (*value) ); - return tmp; -#else /* ACE_HAS_INTEL_ASSEMBLY*/ - ACE_UNUSED_ARG (value); - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_INTEL_ASSEMBLY*/ -} - -long -single_cpu_decrement (volatile long *value) -{ -#if defined (ACE_HAS_INTEL_ASSEMBLY) - long tmp = -1; - unsigned long addr = reinterpret_cast (value); - asm( "xadd %0, (%1)" : "+r"(tmp) : "r"(addr) ); - return tmp - 1; -#elif !defined (ACE_HAS_SOLARIS_ATOMIC_LIB) && (defined (sun) || \ - (defined (__SUNPRO_CC) && (defined (__i386) || defined (__x86_64)))) - return ace_atomic_add_long ( - reinterpret_cast (value), -1); -#elif defined(__GNUC__) && defined(PPC) - long tmp; - asm("lwz %0,%1" : "=r" (tmp) : "m" (*value) ); - asm("addi %0,%0,-1" : "+r" (tmp) ); - asm("stw %0,%1" : "+r" (tmp), "=m" (*value) ); - return tmp; -#else /* ACE_HAS_INTEL_ASSEMBLY*/ - ACE_UNUSED_ARG (value); - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_INTEL_ASSEMBLY*/ -} - -long -single_cpu_exchange (volatile long *value, long rhs) -{ -#if defined (ACE_HAS_INTEL_ASSEMBLY) - unsigned long addr = reinterpret_cast (value); - asm( "xchg %0, (%1)" : "+r"(rhs) : "r"(addr) ); - return rhs; -#elif !defined (ACE_HAS_SOLARIS_ATOMIC_LIB) && (defined (sun) || \ - (defined (__SUNPRO_CC) && (defined (__i386) || defined (__x86_64)))) - return ace_atomic_swap_long ( - reinterpret_cast (value), rhs); -#elif defined(__GNUC__) && defined(PPC) - long tmp; - asm("lwz %0,%1" : "=r" (tmp) : "m" (rhs) ); - asm("stw %0,%1" : "+r" (tmp), "=m" (*value) ); - return tmp; -#else /* ACE_HAS_INTEL_ASSEMBLY*/ - ACE_UNUSED_ARG (value); - ACE_UNUSED_ARG (rhs); - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_INTEL_ASSEMBLY*/ -} - -long -single_cpu_exchange_add (volatile long *value, long rhs) -{ -#if defined (ACE_HAS_INTEL_ASSEMBLY) - unsigned long addr = reinterpret_cast (value); - asm( "xadd %0, (%1)" : "+r"(rhs) : "r"(addr) ); - return rhs; -#elif !defined (ACE_HAS_SOLARIS_ATOMIC_LIB) && (defined (sun) || \ - (defined (__SUNPRO_CC) && (defined (__i386) || defined (__x86_64)))) - return ace_atomic_swap_add_long ( - reinterpret_cast (value), rhs); -#elif defined(__GNUC__) && defined(PPC) - long tmp; - asm("add %0,%1,%2" : "=r" (tmp) : "r" (*value), "r" (rhs) ); - asm("stw %0,%1" : "+r" (tmp), "=m" (*value) ); - return tmp; -#elif defined (WIN32) && !defined (ACE_HAS_INTERLOCKED_EXCHANGEADD) -# if defined (_MSC_VER) - __asm - { - mov eax, rhs - mov edx, value - xadd [edx], eax - } - // Return value is already in EAX register. -# elif defined (__BORLANDC__) - _EAX = rhs; - _EDX = reinterpret_cast (value); - __emit__(0x0F, 0xC1, 0x02); // xadd [edx], eax - // Return value is already in EAX register. -# else /* _MSC_VER */ - ACE_UNUSED_ARG (value); - ACE_UNUSED_ARG (rhs); - ACE_NOTSUP_RETURN (-1); -# endif /* _MSC_VER */ -#else /* ACE_HAS_INTEL_ASSEMBLY*/ - ACE_UNUSED_ARG (value); - ACE_UNUSED_ARG (rhs); - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_INTEL_ASSEMBLY*/ -} - -long -multi_cpu_increment (volatile long *value) -{ -#if defined (ACE_HAS_INTEL_ASSEMBLY) - long tmp = 1; - unsigned long addr = reinterpret_cast (value); - asm( "lock ; xadd %0, (%1)" : "+r"(tmp) : "r"(addr) ); - return tmp + 1; -#elif !defined (ACE_HAS_SOLARIS_ATOMIC_LIB) && (defined (sun) || \ - (defined (__SUNPRO_CC) && (defined (__i386) || defined (__x86_64)))) - return ace_atomic_add_long ( - reinterpret_cast (value), 1); -#else /* ACE_HAS_INTEL_ASSEMBLY*/ - ACE_UNUSED_ARG (value); - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_INTEL_ASSEMBLY*/ -} - -long -multi_cpu_decrement (volatile long *value) -{ -#if defined (ACE_HAS_INTEL_ASSEMBLY) - long tmp = -1; - unsigned long addr = reinterpret_cast (value); - asm( "lock ; xadd %0, (%1)" : "+r"(tmp) : "r"(addr) ); - return tmp - 1; -#elif !defined (ACE_HAS_SOLARIS_ATOMIC_LIB) && (defined (sun) || \ - (defined (__SUNPRO_CC) && (defined (__i386) || defined (__x86_64)))) - return ace_atomic_add_long ( - reinterpret_cast (value), -1); -#else /* ACE_HAS_INTEL_ASSEMBLY*/ - ACE_UNUSED_ARG (value); - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_INTEL_ASSEMBLY*/ -} - -long -multi_cpu_exchange (volatile long *value, long rhs) -{ -#if defined (ACE_HAS_INTEL_ASSEMBLY) - unsigned long addr = reinterpret_cast (value); - // The XCHG instruction automatically follows LOCK semantics - asm( "xchg %0, (%1)" : "+r"(rhs) : "r"(addr) ); - return rhs; -#elif !defined (ACE_HAS_SOLARIS_ATOMIC_LIB) && (defined (sun) || \ - (defined (__SUNPRO_CC) && (defined (__i386) || defined (__x86_64)))) - return ace_atomic_swap_long ( - reinterpret_cast (value), rhs); -#else /* ACE_HAS_INTEL_ASSEMBLY*/ - ACE_UNUSED_ARG (value); - ACE_UNUSED_ARG (rhs); - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_INTEL_ASSEMBLY*/ -} - -long -multi_cpu_exchange_add (volatile long *value, long rhs) -{ -#if defined (ACE_HAS_INTEL_ASSEMBLY) - unsigned long addr = reinterpret_cast (value); - asm( "lock ; xadd %0, (%1)" : "+r"(rhs) : "r"(addr) ); - return rhs; -#elif !defined (ACE_HAS_SOLARIS_ATOMIC_LIB) && (defined (sun) || \ - (defined (__SUNPRO_CC) && (defined (__i386) || defined (__x86_64)))) - return ace_atomic_swap_add_long ( - reinterpret_cast (value), rhs); -#elif defined (WIN32) && !defined (ACE_HAS_INTERLOCKED_EXCHANGEADD) -# if defined (_MSC_VER) - __asm - { - mov eax, rhs - mov edx, value - lock xadd [edx], eax - } - // Return value is already in EAX register. -# elif defined (__BORLANDC__) - _EAX = rhs; - _EDX = reinterpret_cast (value); - __emit__(0xF0, 0x0F, 0xC1, 0x02); // lock xadd [edx], eax - // Return value is already in EAX register. -# else /* _MSC_VER */ - ACE_UNUSED_ARG (value); - ACE_UNUSED_ARG (rhs); - ACE_NOTSUP_RETURN (-1); -# endif /* _MSC_VER */ -#else /* ACE_HAS_INTEL_ASSEMBLY*/ - ACE_UNUSED_ARG (value); - ACE_UNUSED_ARG (rhs); - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_INTEL_ASSEMBLY*/ -} - -#if defined (_MSC_VER) -#pragma warning (pop) -#endif /* _MSC_VER */ - -} // end namespace - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -long (*ACE_Atomic_Op::increment_fn_) (volatile long *) = multi_cpu_increment; -long (*ACE_Atomic_Op::decrement_fn_) (volatile long *) = multi_cpu_decrement; -long (*ACE_Atomic_Op::exchange_fn_) (volatile long *, long) = multi_cpu_exchange; -long (*ACE_Atomic_Op::exchange_add_fn_) (volatile long *, long) = multi_cpu_exchange_add; - -void -ACE_Atomic_Op::init_functions (void) -{ - if (ACE_OS::num_processors () == 1) - { - increment_fn_ = single_cpu_increment; - decrement_fn_ = single_cpu_decrement; - exchange_fn_ = single_cpu_exchange; - exchange_add_fn_ = single_cpu_exchange_add; - } - else - { - increment_fn_ = multi_cpu_increment; - decrement_fn_ = multi_cpu_decrement; - exchange_fn_ = multi_cpu_exchange; - exchange_add_fn_ = multi_cpu_exchange_add; - } -} - -void -ACE_Atomic_Op::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -long (*ACE_Atomic_Op::increment_fn_) (volatile long *) = multi_cpu_increment; -long (*ACE_Atomic_Op::decrement_fn_) (volatile long *) = multi_cpu_decrement; -long (*ACE_Atomic_Op::exchange_fn_) (volatile long *, long) = multi_cpu_exchange; -long (*ACE_Atomic_Op::exchange_add_fn_) (volatile long *, long) = multi_cpu_exchange_add; - -void -ACE_Atomic_Op::init_functions (void) -{ - if (ACE_OS::num_processors () == 1) - { - increment_fn_ = single_cpu_increment; - decrement_fn_ = single_cpu_decrement; - exchange_fn_ = single_cpu_exchange; - exchange_add_fn_ = single_cpu_exchange_add; - } - else - { - increment_fn_ = multi_cpu_increment; - decrement_fn_ = multi_cpu_decrement; - exchange_fn_ = multi_cpu_exchange; - exchange_add_fn_ = multi_cpu_exchange_add; - } -} - -void -ACE_Atomic_Op::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_BUILTIN_ATOMIC_OP */ diff --git a/dep/acelite/ace/Atomic_Op.h b/dep/acelite/ace/Atomic_Op.h deleted file mode 100644 index e2f477fbbc7..00000000000 --- a/dep/acelite/ace/Atomic_Op.h +++ /dev/null @@ -1,361 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Atomic_Op.h - * - * $Id: Atomic_Op.h 95225 2011-12-05 20:25:15Z shuston $ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_ATOMIC_OP_H -#define ACE_ATOMIC_OP_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Thread_Mutex.h" - -// Include the templates here. -#include "ace/Atomic_Op_T.h" - -// Determine whether builtin atomic op support is -// available on this platform. -#if defined (ACE_HAS_THREADS) -# if defined (WIN32) -# if defined (ACE_HAS_INTRINSIC_INTERLOCKED) -# define ACE_HAS_BUILTIN_ATOMIC_OP -# endif /* ACE_HAS_INTRINSIC_INTERLOCKED */ -# if defined (ACE_HAS_INTERLOCKED_EXCHANGEADD) -# define ACE_HAS_BUILTIN_ATOMIC_OP -# else /* ACE_HAS_INTERLOCKED_EXCHANGEADD */ - // Inline assembly emulation of InterlockedExchangeAdd - // is currently only implemented for MSVC (x86 only) and Borland. -# if (defined (_MSC_VER) && defined (_M_IX86)) || defined (__BORLANDC__) -# define ACE_HAS_BUILTIN_ATOMIC_OP -# endif /* _MSC_VER || __BORLANDC__ */ -# endif /* ACE_HAS_INTERLOCKED_EXCHANGEADD */ -# elif defined (ACE_HAS_INTEL_ASSEMBLY) -# define ACE_HAS_BUILTIN_ATOMIC_OP -# elif defined (ACE_HAS_VXATOMICLIB) -# define ACE_HAS_BUILTIN_ATOMIC_OP -# elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) && !defined (ACE_HAS_BUILTIN_ATOMIC_OP) -# define ACE_HAS_BUILTIN_ATOMIC_OP -# endif /* WIN32 */ -#endif /* ACE_HAS_THREADS */ - -// If we have the GCC Atomic builtin support, use it -#if defined (ACE_HAS_GCC_ATOMIC_BUILTINS) && (ACE_HAS_GCC_ATOMIC_BUILTINS == 1) -# undef ACE_HAS_BUILTIN_ATOMIC_OP -#endif - -// Include the templates here. -#include "ace/Atomic_Op_GCC_T.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_HAS_BUILTIN_ATOMIC_OP) - -/** - * @brief Specialization of ACE_Atomic_Op for platforms that - * support atomic integer operations. - * - * Specialization of ACE_Atomic_Op for platforms that support atomic - * integer operations. - */ -template<> -class ACE_Export ACE_Atomic_Op -{ -public: - /// Initialize @c value_ to 0. - ACE_Atomic_Op (void); - - /// Initialize @c value_ to c. - ACE_Atomic_Op (long c); - - /// Manage copying... - ACE_Atomic_Op (const ACE_Atomic_Op &c); - - /// Atomically pre-increment @c value_. - long operator++ (void); - - /// Atomically post-increment @c value_. - long operator++ (int); - - /// Atomically increment @c value_ by rhs. - long operator+= (long rhs); - - /// Atomically pre-decrement @c value_. - long operator-- (void); - - /// Atomically post-decrement @c value_. - long operator-- (int); - - /// Atomically decrement @c value_ by rhs. - long operator-= (long rhs); - - /// Atomically compare @c value_ with rhs. - bool operator== (long rhs) const; - - /// Atomically compare @c value_ with rhs. - bool operator!= (long rhs) const; - - /// Atomically check if @c value_ greater than or equal to rhs. - bool operator>= (long rhs) const; - - /// Atomically check if @c value_ greater than rhs. - bool operator> (long rhs) const; - - /// Atomically check if @c value_ less than or equal to rhs. - bool operator<= (long rhs) const; - - /// Atomically check if @c value_ less than rhs. - bool operator< (long rhs) const; - - /// Atomically assign rhs to @c value_. - ACE_Atomic_Op &operator= (long rhs); - - /// Atomically assign to @c value_. - ACE_Atomic_Op &operator= (const ACE_Atomic_Op &rhs); - - /// Exchange value with @a newval. - long exchange (long newval); - - /// Explicitly return @c value_. - long value (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Explicitly return @c value_ (by reference). - volatile long &value_i (void); - - // ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. - - /// Used during ACE object manager initialization to optimize the fast - /// atomic op implementation according to the number of CPUs. - static void init_functions (void); - -private: - - /// This function cannot be supported by this template specialization. - /// If you need access to an underlying lock, use the ACE_Atomic_Op_Ex - /// template instead. - ACE_Thread_Mutex &mutex (void); - -private: - - /// Current object decorated by the atomic op. - volatile long value_; - - /// Pointers to selected atomic op implementations. - static long (*increment_fn_) (volatile long *); - static long (*decrement_fn_) (volatile long *); - static long (*exchange_fn_) (volatile long *, long); - static long (*exchange_add_fn_) (volatile long *, long); -}; - -/** - * @brief Specialization of ACE_Atomic_Op for platforms that - * support atomic integer operations. - * - * Specialization of ACE_Atomic_Op for platforms that support atomic - * integer operations. - */ -template<> -class ACE_Export ACE_Atomic_Op -{ -public: - /// Initialize @c value_ to 0. - ACE_Atomic_Op (void); - - /// Initialize @c value_ to c. - ACE_Atomic_Op (unsigned long c); - - /// Manage copying... - ACE_Atomic_Op (const ACE_Atomic_Op &c); - - /// Atomically pre-increment @c value_. - unsigned long operator++ (void); - - /// Atomically post-increment @c value_. - unsigned long operator++ (int); - - /// Atomically increment @c value_ by rhs. - unsigned long operator+= (unsigned long rhs); - - /// Atomically pre-decrement @c value_. - unsigned long operator-- (void); - - /// Atomically post-decrement @c value_. - unsigned long operator-- (int); - - /// Atomically decrement @c value_ by rhs. - unsigned long operator-= (unsigned long rhs); - - /// Atomically compare @c value_ with rhs. - bool operator== (unsigned long rhs) const; - - /// Atomically compare @c value_ with rhs. - bool operator!= (unsigned long rhs) const; - - /// Atomically check if @c value_ greater than or equal to rhs. - bool operator>= (unsigned long rhs) const; - - /// Atomically check if @c value_ greater than rhs. - bool operator> (unsigned long rhs) const; - - /// Atomically check if @c value_ less than or equal to rhs. - bool operator<= (unsigned long rhs) const; - - /// Atomically check if @c value_ less than rhs. - bool operator< (unsigned long rhs) const; - - /// Atomically assign rhs to @c value_. - ACE_Atomic_Op &operator= (unsigned long rhs); - - /// Atomically assign to @c value_. - ACE_Atomic_Op &operator= (const ACE_Atomic_Op &rhs); - - /// Exchange value with @a newval. - unsigned long exchange (unsigned long newval); - - /// Explicitly return @c value_. - unsigned long value (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Explicitly return @c value_ (by reference). - volatile unsigned long &value_i (void); - - // ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. - - /// Used during ACE object manager initialization to optimize the fast - /// atomic op implementation according to the number of CPUs. - static void init_functions (void); - -private: - - /// This function cannot be supported by this template specialization. - /// If you need access to an underlying lock, use the ACE_Atomic_Op_Ex - /// template instead. - ACE_Thread_Mutex &mutex (void); - -private: - - /// Current object decorated by the atomic op. - volatile unsigned long value_; - - // Pointers to selected atomic op implementations. - static long (*increment_fn_) (volatile long *); - static long (*decrement_fn_) (volatile long *); - static long (*exchange_fn_) (volatile long *, long); - static long (*exchange_add_fn_) (volatile long *, long); -}; - -#endif /* !ACE_HAS_BUILTIN_ATOMIC_OP */ - -#if defined (ACE_HAS_GCC_ATOMIC_BUILTINS) && (ACE_HAS_GCC_ATOMIC_BUILTINS == 1) - -template<> -class ACE_Export ACE_Atomic_Op -: public ACE_Atomic_Op_GCC -{ -public: - ACE_Atomic_Op (void); - ACE_Atomic_Op (int c); - ACE_Atomic_Op (const ACE_Atomic_Op &c); - ACE_Atomic_Op &operator= (int rhs); -}; - -template<> -class ACE_Export ACE_Atomic_Op -: public ACE_Atomic_Op_GCC -{ -public: - ACE_Atomic_Op (void); - ACE_Atomic_Op (unsigned int c); - ACE_Atomic_Op (const ACE_Atomic_Op &c); - ACE_Atomic_Op &operator= (unsigned int rhs); -}; - -// If we have built in atomic op, use that, the assignment operator -// is faster for a long/unsinged long -template<> -class ACE_Export ACE_Atomic_Op -: public ACE_Atomic_Op_GCC -{ -public: - ACE_Atomic_Op (void); - ACE_Atomic_Op (long c); - ACE_Atomic_Op (const ACE_Atomic_Op &c); - ACE_Atomic_Op &operator= (long rhs); -}; - -template<> -class ACE_Export ACE_Atomic_Op -: public ACE_Atomic_Op_GCC -{ -public: - ACE_Atomic_Op (void); - ACE_Atomic_Op (unsigned long c); - ACE_Atomic_Op (const ACE_Atomic_Op &c); - ACE_Atomic_Op &operator= (unsigned long rhs); -}; - -#if !defined (ACE_LACKS_GCC_ATOMIC_BUILTINS_2) -template<> -class ACE_Export ACE_Atomic_Op -: public ACE_Atomic_Op_GCC -{ -public: - ACE_Atomic_Op (void); - ACE_Atomic_Op (short c); - ACE_Atomic_Op (const ACE_Atomic_Op &c); - ACE_Atomic_Op &operator= (short rhs); -}; - -template<> -class ACE_Export ACE_Atomic_Op -: public ACE_Atomic_Op_GCC -{ -public: - ACE_Atomic_Op (void); - ACE_Atomic_Op (unsigned short c); - ACE_Atomic_Op (const ACE_Atomic_Op &c); - ACE_Atomic_Op &operator= (unsigned short rhs); -}; -#endif - -#if !defined (ACE_LACKS_GCC_ATOMIC_BUILTINS_1) -template<> -class ACE_Export ACE_Atomic_Op -: public ACE_Atomic_Op_GCC -{ -public: - ACE_Atomic_Op (void); - ACE_Atomic_Op (bool c); - ACE_Atomic_Op (const ACE_Atomic_Op &c); - ACE_Atomic_Op &operator= (bool rhs); -}; -#endif - -#endif /* ACE_HAS_BUILTIN_ATOMIC_OP */ - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Atomic_Op.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /*ACE_ATOMIC_OP_H*/ diff --git a/dep/acelite/ace/Atomic_Op.inl b/dep/acelite/ace/Atomic_Op.inl deleted file mode 100644 index e1f1ca21143..00000000000 --- a/dep/acelite/ace/Atomic_Op.inl +++ /dev/null @@ -1,613 +0,0 @@ -// -*- C++ -*- -// $Id: Atomic_Op.inl 95225 2011-12-05 20:25:15Z shuston $ - -#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) -# include "ace/os_include/os_intrin.h" -# pragma intrinsic (_InterlockedExchange, _InterlockedExchangeAdd, _InterlockedIncrement, _InterlockedDecrement) -#endif /* ACE_HAS_INTRINSIC_INTERLOCKED */ - -#if defined (ACE_HAS_VXATOMICLIB) -# include -#endif - -#if defined (ACE_HAS_SOLARIS_ATOMIC_LIB) -# include -#endif - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_HAS_BUILTIN_ATOMIC_OP) - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (void) - : value_ (0) -{ -} - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (long c) - : value_ (c) -{ -} - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op ( - const ACE_Atomic_Op &rhs) - : value_ (rhs.value_) -{ -} - -ACE_INLINE long -ACE_Atomic_Op::operator++ (void) -{ -#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) - return ::_InterlockedIncrement (const_cast (&this->value_)); -#elif defined (WIN32) - return ::InterlockedIncrement (const_cast (&this->value_)); -#elif defined (ACE_HAS_VXATOMICLIB) - return ::vxAtomicInc (reinterpret_cast (const_cast (&this->value_))) + 1; -#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) - return ::atomic_inc_ulong_nv (reinterpret_cast(&this->value_)); -#else /* WIN32 */ - return (*increment_fn_) (&this->value_); -#endif /* WIN32 */ -} - -ACE_INLINE long -ACE_Atomic_Op::operator++ (int) -{ - return ++*this - 1; -} - -ACE_INLINE long -ACE_Atomic_Op::operator-- (void) -{ -#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) - return ::_InterlockedDecrement (const_cast (&this->value_)); -#elif defined (WIN32) - return ::InterlockedDecrement (const_cast (&this->value_)); -#elif defined (ACE_HAS_VXATOMICLIB) - return ::vxAtomicDec (reinterpret_cast (const_cast (&this->value_))) - 1; -#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) - return ::atomic_dec_ulong_nv (reinterpret_cast(&this->value_)); -#else /* WIN32 */ - return (*decrement_fn_) (&this->value_); -#endif /* WIN32 */ -} - -ACE_INLINE long -ACE_Atomic_Op::operator-- (int) -{ - return --*this + 1; -} - -ACE_INLINE long -ACE_Atomic_Op::operator+= (long rhs) -{ -#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) - return ::_InterlockedExchangeAdd (const_cast (&this->value_), - rhs) + rhs; -#elif defined (WIN32) && defined (ACE_HAS_INTERLOCKED_EXCHANGEADD) - return ::InterlockedExchangeAdd (const_cast (&this->value_), - rhs) + rhs; -#elif defined (ACE_HAS_VXATOMICLIB) - return ::vxAtomicAdd (reinterpret_cast (const_cast (&this->value_)), rhs) + rhs; -#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) - return ::atomic_add_long_nv (reinterpret_cast(&this->value_), rhs); -#else /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ - return (*exchange_add_fn_) (&this->value_, rhs) + rhs; -#endif /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ -} - -ACE_INLINE long -ACE_Atomic_Op::operator-= (long rhs) -{ -#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) - return ::_InterlockedExchangeAdd (const_cast (&this->value_), - -rhs) - rhs; -#elif defined (WIN32) && defined (ACE_HAS_INTERLOCKED_EXCHANGEADD) - return ::InterlockedExchangeAdd (const_cast (&this->value_), - -rhs) - rhs; -#elif defined (ACE_HAS_VXATOMICLIB) - return ::vxAtomicSub (reinterpret_cast (const_cast (&this->value_)), rhs) - rhs; -#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) - return ::atomic_add_long_nv (reinterpret_cast(&this->value_), -rhs); -#else /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ - return (*exchange_add_fn_) (&this->value_, -rhs) - rhs; -#endif /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ -} - -ACE_INLINE bool -ACE_Atomic_Op::operator== (long rhs) const -{ - return (this->value_ == rhs); -} - -ACE_INLINE bool -ACE_Atomic_Op::operator!= (long rhs) const -{ - return (this->value_ != rhs); -} - -ACE_INLINE bool -ACE_Atomic_Op::operator>= (long rhs) const -{ - return (this->value_ >= rhs); -} - -ACE_INLINE bool -ACE_Atomic_Op::operator> (long rhs) const -{ - return (this->value_ > rhs); -} - -ACE_INLINE bool -ACE_Atomic_Op::operator<= (long rhs) const -{ - return (this->value_ <= rhs); -} - -ACE_INLINE bool -ACE_Atomic_Op::operator< (long rhs) const -{ - return (this->value_ < rhs); -} - -ACE_INLINE ACE_Atomic_Op & -ACE_Atomic_Op::operator= (long rhs) -{ -#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) - ::_InterlockedExchange (const_cast (&this->value_), rhs); -#elif defined (WIN32) - ::InterlockedExchange (const_cast (&this->value_), rhs); -#elif defined (ACE_HAS_VXATOMICLIB) - ::vxAtomicSet (reinterpret_cast (const_cast (&this->value_)), rhs); -#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) - ::atomic_swap_ulong (reinterpret_cast(&this->value_), rhs); -#else /* WIN32 */ - (*exchange_fn_) (&this->value_, rhs); -#endif /* WIN32 */ - return *this; -} - -ACE_INLINE ACE_Atomic_Op & -ACE_Atomic_Op::operator= ( - const ACE_Atomic_Op &rhs) -{ -#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) - ::_InterlockedExchange (const_cast (&this->value_), rhs.value_); -#elif defined (WIN32) - ::InterlockedExchange (const_cast (&this->value_), rhs.value_); -#elif defined (ACE_HAS_VXATOMICLIB) - ::vxAtomicSet (reinterpret_cast (const_cast (&this->value_)), rhs.value_); -#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) - ::atomic_swap_ulong (reinterpret_cast(&this->value_), rhs.value_); -#else /* WIN32 */ - (*exchange_fn_) (&this->value_, rhs.value_); -#endif /* WIN32 */ - return *this; -} - -ACE_INLINE long -ACE_Atomic_Op::exchange (long newval) -{ -#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) - return ::_InterlockedExchange (const_cast (&this->value_), newval); -#elif defined (WIN32) - return ::InterlockedExchange (const_cast (&this->value_), newval); -#elif defined (ACE_HAS_VXATOMICLIB) - return ::vxAtomicSet (reinterpret_cast (const_cast (&this->value_)), newval); -#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) - return ::atomic_swap_ulong (reinterpret_cast(&this->value_), newval); -#else /* WIN32 */ - return (*exchange_fn_) (&this->value_, newval); -#endif /* WIN32 */ -} - -ACE_INLINE long -ACE_Atomic_Op::value (void) const -{ - return this->value_; -} - -ACE_INLINE volatile long & -ACE_Atomic_Op::value_i (void) -{ - return this->value_; -} - - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (void) - : value_ (0) -{ -} - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (unsigned long c) - : value_ (c) -{ -} - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op ( - const ACE_Atomic_Op &rhs) - : value_ (rhs.value_) -{ -} - -ACE_INLINE unsigned long -ACE_Atomic_Op::operator++ (void) -{ -#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) - return static_cast (::_InterlockedIncrement (const_cast (reinterpret_cast(&this->value_)))); -#elif defined (WIN32) - return static_cast (::InterlockedIncrement (const_cast (reinterpret_cast(&this->value_)))); -#elif defined (ACE_HAS_VXATOMICLIB) - return static_cast (::vxAtomicInc (reinterpret_cast (const_cast (reinterpret_cast(&this->value_))))) + 1; -#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) - return ::atomic_inc_ulong_nv (&this->value_); -#else /* WIN32 */ - return static_cast ((*increment_fn_) (reinterpret_cast (&this->value_))); -#endif /* WIN32 */ -} - -ACE_INLINE unsigned long -ACE_Atomic_Op::operator++ (int) -{ - return ++*this - 1; -} - -ACE_INLINE unsigned long -ACE_Atomic_Op::operator-- (void) -{ -#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) - return static_cast (::_InterlockedDecrement (const_cast (reinterpret_cast(&this->value_)))); -#elif defined (WIN32) - return static_cast (::InterlockedDecrement (const_cast (reinterpret_cast(&this->value_)))); -#elif defined (ACE_HAS_VXATOMICLIB) - return static_cast (::vxAtomicDec (reinterpret_cast (const_cast (reinterpret_cast(&this->value_))))) - 1; -#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) - return ::atomic_dec_ulong_nv (&this->value_); -#else /* WIN32 */ - return static_cast ((*decrement_fn_) (reinterpret_cast (&this->value_))); -#endif /* WIN32 */ -} - -ACE_INLINE unsigned long -ACE_Atomic_Op::operator-- (int) -{ - return --*this + 1; -} - -ACE_INLINE unsigned long -ACE_Atomic_Op::operator+= (unsigned long rhs) -{ -#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) - return static_cast (::_InterlockedExchangeAdd (const_cast (reinterpret_cast (&this->value_)), - rhs)) + rhs; -#elif defined (WIN32) && defined (ACE_HAS_INTERLOCKED_EXCHANGEADD) - return static_cast (::InterlockedExchangeAdd (const_cast (reinterpret_cast (&this->value_)), - rhs)) + rhs; -#elif defined (ACE_HAS_VXATOMICLIB) - return static_cast (::vxAtomicAdd (reinterpret_cast (const_cast (reinterpret_cast(&this->value_))), rhs)) + rhs; -#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) - return ::atomic_add_long_nv (&this->value_, rhs); -#else /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ - return static_cast ((*exchange_add_fn_) (reinterpret_cast (&this->value_), rhs)) + rhs; -#endif /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ -} - -ACE_INLINE unsigned long -ACE_Atomic_Op::operator-= (unsigned long rhs) -{ -#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) - return static_cast (::_InterlockedExchangeAdd (const_cast (reinterpret_cast(&this->value_)), - -static_cast(rhs))) - rhs; -#elif defined (WIN32) && defined (ACE_HAS_INTERLOCKED_EXCHANGEADD) - return static_cast (::InterlockedExchangeAdd (const_cast (reinterpret_cast(&this->value_)), - -static_cast(rhs))) - rhs; -#elif defined (ACE_HAS_VXATOMICLIB) - return static_cast (::vxAtomicSub (reinterpret_cast (const_cast (reinterpret_cast(&this->value_))), rhs)) - rhs; -#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) - return ::atomic_add_long_nv (&this->value_, -rhs); -#else /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ - long l_rhs = static_cast (rhs); - return static_cast ((*exchange_add_fn_) (reinterpret_cast (&this->value_), -l_rhs)) - rhs; -#endif /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ -} - -ACE_INLINE bool -ACE_Atomic_Op::operator== (unsigned long rhs) const -{ - return (this->value_ == rhs); -} - -ACE_INLINE bool -ACE_Atomic_Op::operator!= (unsigned long rhs) const -{ - return (this->value_ != rhs); -} - -ACE_INLINE bool -ACE_Atomic_Op::operator>= (unsigned long rhs) const -{ - return (this->value_ >= rhs); -} - -ACE_INLINE bool -ACE_Atomic_Op::operator> (unsigned long rhs) const -{ - return (this->value_ > rhs); -} - -ACE_INLINE bool -ACE_Atomic_Op::operator<= (unsigned long rhs) const -{ - return (this->value_ <= rhs); -} - -ACE_INLINE bool -ACE_Atomic_Op::operator< (unsigned long rhs) const -{ - return (this->value_ < rhs); -} - -ACE_INLINE ACE_Atomic_Op & -ACE_Atomic_Op::operator= (unsigned long rhs) -{ -#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) - ::_InterlockedExchange (const_cast (reinterpret_cast (&this->value_)), rhs); -#elif defined (WIN32) - ::InterlockedExchange (const_cast (reinterpret_cast (&this->value_)), rhs); -#elif defined (ACE_HAS_VXATOMICLIB) - ::vxAtomicSet (reinterpret_cast (const_cast (reinterpret_cast (&this->value_))), rhs); -#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) - ::atomic_swap_ulong (&this->value_, rhs); -#else /* WIN32 */ - (*exchange_fn_) (reinterpret_cast (&this->value_), rhs); -#endif /* WIN32 */ - return *this; -} - -ACE_INLINE ACE_Atomic_Op & -ACE_Atomic_Op::operator= ( - const ACE_Atomic_Op &rhs) -{ -#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) - ::_InterlockedExchange (const_cast (reinterpret_cast (&this->value_)), rhs.value_); -#elif defined (WIN32) - ::InterlockedExchange (const_cast (reinterpret_cast (&this->value_)), rhs.value_); -#elif defined (ACE_HAS_VXATOMICLIB) - ::vxAtomicSet (reinterpret_cast (const_cast (reinterpret_cast (&this->value_))), rhs.value_); -#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) - ::atomic_swap_ulong (&this->value_, rhs.value_); -#else /* WIN32 */ - (*exchange_fn_) (reinterpret_cast (&this->value_), rhs.value_); -#endif /* WIN32 */ - return *this; -} - -ACE_INLINE unsigned long -ACE_Atomic_Op::exchange (unsigned long newval) -{ -#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) - return ::_InterlockedExchange (const_cast (reinterpret_cast (&this->value_)), newval); -#elif defined (WIN32) - return ::InterlockedExchange (const_cast (reinterpret_cast (&this->value_)), newval); -#elif defined (ACE_HAS_VXATOMICLIB) - return ::vxAtomicSet (reinterpret_cast (const_cast (reinterpret_cast (&this->value_))), newval); -#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) - return ::atomic_swap_ulong (&this->value_, newval); -#else /* WIN32 */ - return (*exchange_fn_) (reinterpret_cast (&this->value_), newval); -#endif /* WIN32 */ -} - -ACE_INLINE unsigned long -ACE_Atomic_Op::value (void) const -{ - return this->value_; -} - -ACE_INLINE volatile unsigned long & -ACE_Atomic_Op::value_i (void) -{ - return this->value_; -} - -#endif /* ACE_HAS_BUILTIN_ATOMIC_OP */ - -#if defined (ACE_HAS_GCC_ATOMIC_BUILTINS) && (ACE_HAS_GCC_ATOMIC_BUILTINS == 1) - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (void) : - ACE_Atomic_Op_GCC () -{ -} - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (int c) : - ACE_Atomic_Op_GCC(c) -{ -} - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (const ACE_Atomic_Op &c) : - ACE_Atomic_Op_GCC(c) -{ -} - -ACE_INLINE -ACE_Atomic_Op& -ACE_Atomic_Op::operator= (int rhs) -{ - ACE_Atomic_Op_GCC::operator= (rhs); - return *this; -} - - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (void) : - ACE_Atomic_Op_GCC() -{ -} - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (const ACE_Atomic_Op &c) : - ACE_Atomic_Op_GCC(c) -{ -} - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (unsigned int c) : - ACE_Atomic_Op_GCC(c) -{ -} - -ACE_INLINE -ACE_Atomic_Op& -ACE_Atomic_Op::operator= (unsigned int rhs) -{ - ACE_Atomic_Op_GCC::operator= (rhs); - return *this; -} - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (void) : - ACE_Atomic_Op_GCC() -{ -} - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (long c) : - ACE_Atomic_Op_GCC(c) -{ -} - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (const ACE_Atomic_Op &c) : - ACE_Atomic_Op_GCC(c) -{ -} - -ACE_INLINE -ACE_Atomic_Op& -ACE_Atomic_Op::operator= (long rhs) -{ - ACE_Atomic_Op_GCC::operator= (rhs); - return *this; -} - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (void) : - ACE_Atomic_Op_GCC () -{ -} - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (unsigned long c) : - ACE_Atomic_Op_GCC(c) -{ -} - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (const ACE_Atomic_Op &c) : - ACE_Atomic_Op_GCC(c) -{ -} - -ACE_INLINE -ACE_Atomic_Op& -ACE_Atomic_Op::operator= (unsigned long rhs) -{ - ACE_Atomic_Op_GCC::operator= (rhs); - return *this; -} - -#if !defined (ACE_LACKS_GCC_ATOMIC_BUILTINS_2) -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (void) : - ACE_Atomic_Op_GCC() -{ -} - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (short c) : - ACE_Atomic_Op_GCC(c) -{ -} - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (const ACE_Atomic_Op &c) : - ACE_Atomic_Op_GCC(c) -{ -} - -ACE_INLINE -ACE_Atomic_Op& -ACE_Atomic_Op::operator= (short rhs) -{ - ACE_Atomic_Op_GCC::operator= (rhs); - return *this; -} - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (void) : - ACE_Atomic_Op_GCC () -{ -} - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (unsigned short c) : - ACE_Atomic_Op_GCC(c) -{ -} - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (const ACE_Atomic_Op &c) : - ACE_Atomic_Op_GCC(c) -{ -} - -ACE_INLINE -ACE_Atomic_Op& -ACE_Atomic_Op::operator= (unsigned short rhs) -{ - ACE_Atomic_Op_GCC::operator= (rhs); - return *this; -} -#endif - -#if !defined (ACE_LACKS_GCC_ATOMIC_BUILTINS_1) -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (void) : - ACE_Atomic_Op_GCC () -{ -} - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (bool c) : - ACE_Atomic_Op_GCC(c) -{ -} - -ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op (const ACE_Atomic_Op &c) : - ACE_Atomic_Op_GCC(c) -{ -} - -ACE_INLINE -ACE_Atomic_Op& -ACE_Atomic_Op::operator= (bool rhs) -{ - ACE_Atomic_Op_GCC::operator= (rhs); - return *this; -} -#endif - -#endif /* ACE_HAS_GCC_ATOMIC_BUILTINS==1 */ - -ACE_END_VERSIONED_NAMESPACE_DECL - diff --git a/dep/acelite/ace/Atomic_Op_GCC_T.cpp b/dep/acelite/ace/Atomic_Op_GCC_T.cpp deleted file mode 100644 index 6b1eb60a2b3..00000000000 --- a/dep/acelite/ace/Atomic_Op_GCC_T.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// $Id: Atomic_Op_GCC_T.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/OS_NS_unistd.h" - -#if defined (ACE_HAS_GCC_ATOMIC_BUILTINS) && (ACE_HAS_GCC_ATOMIC_BUILTINS == 1) - -#if !defined (__ACE_INLINE__) -#include "ace/Atomic_Op_GCC_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -void -ACE_Atomic_Op_GCC::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_GCC_ATOMIC_BUILTINS */ diff --git a/dep/acelite/ace/Atomic_Op_GCC_T.h b/dep/acelite/ace/Atomic_Op_GCC_T.h deleted file mode 100644 index f980f7f022e..00000000000 --- a/dep/acelite/ace/Atomic_Op_GCC_T.h +++ /dev/null @@ -1,139 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Atomic_Op_GCC_T.h - * - * $Id: Atomic_Op_GCC_T.h 95225 2011-12-05 20:25:15Z shuston $ - * - * @author Johnny Willemsen -class ACE_Export ACE_Atomic_Op_GCC -{ -public: - /// Atomically pre-increment @c value_. - T operator++ (void); - - /// Atomically post-increment @c value_. - T operator++ (int); - - /// Atomically increment @c value_ by rhs. - T operator+= (T rhs); - - /// Atomically pre-decrement @c value_. - T operator-- (void); - - /// Atomically post-decrement @c value_. - T operator-- (int); - - /// Atomically decrement @c value_ by rhs. - T operator-= (T rhs); - - /// Atomically compare @c value_ with rhs. - bool operator== (T rhs) const; - - /// Atomically compare @c value_ with rhs. - bool operator!= (T rhs) const; - - /// Atomically check if @c value_ greater than or equal to rhs. - bool operator>= (T rhs) const; - - /// Atomically check if @c value_ greater than rhs. - bool operator> (T rhs) const; - - /// Atomically check if @c value_ less than or equal to rhs. - bool operator<= (T rhs) const; - - /// Atomically check if @c value_ less than rhs. - bool operator< (T rhs) const; - - /// Exchange value with @a newval. - T exchange (T newval); - - /// Explicitly return @c value_. - T value (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Explicitly return @c value_ (by reference). - volatile T &value_i (void); - - // ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. - -protected: - /// Atomically assign rhs to @c value_. - ACE_Atomic_Op_GCC &operator= (T rhs); - - /// Atomically assign to @c value_. - ACE_Atomic_Op_GCC &operator= (const ACE_Atomic_Op_GCC &rhs); - - /// Initialize @c value_ to 0. - ACE_Atomic_Op_GCC (void); - - /// Initialize @c value_ to c. - ACE_Atomic_Op_GCC (T c); - - /// Manage copying... - ACE_Atomic_Op_GCC (const ACE_Atomic_Op_GCC &c); - -private: - - // This function cannot be supported by this template specialization. - // If you need access to an underlying lock, use the ACE_Atomic_Op_Ex - // template instead. - ACE_Thread_Mutex &mutex (void); - -private: - - /// Current object decorated by the atomic op. - volatile T value_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Atomic_Op_GCC_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Atomic_Op_GCC_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Atomic_Op_GCC_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - - -#endif /* ACE_HAS_GCC_ATOMIC_BUILTINS */ - -#include /**/ "ace/post.h" -#endif /*ACE_ATOMIC_OP_GCC_T_H*/ diff --git a/dep/acelite/ace/Atomic_Op_GCC_T.inl b/dep/acelite/ace/Atomic_Op_GCC_T.inl deleted file mode 100644 index 9559e1ec6e4..00000000000 --- a/dep/acelite/ace/Atomic_Op_GCC_T.inl +++ /dev/null @@ -1,154 +0,0 @@ -// -*- C++ -*- -// $Id: Atomic_Op_GCC_T.inl 95225 2011-12-05 20:25:15Z shuston $ - -#if defined (ACE_HAS_GCC_ATOMIC_BUILTINS) && (ACE_HAS_GCC_ATOMIC_BUILTINS == 1) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_INLINE -ACE_Atomic_Op_GCC::ACE_Atomic_Op_GCC (void) - : value_ (0) -{ -} - -template -ACE_INLINE -ACE_Atomic_Op_GCC::ACE_Atomic_Op_GCC (T c) - : value_ (c) -{ -} - -template -ACE_INLINE -ACE_Atomic_Op_GCC::ACE_Atomic_Op_GCC ( - const ACE_Atomic_Op_GCC &rhs) - : value_ (rhs.value_) -{ -} - -template -ACE_INLINE T -ACE_Atomic_Op_GCC::operator++ (void) -{ - return __sync_add_and_fetch (&this->value_, 1); -} - -template -ACE_INLINE T -ACE_Atomic_Op_GCC::operator++ (int) -{ - return __sync_fetch_and_add (&this->value_, 1); -} - -template -ACE_INLINE T -ACE_Atomic_Op_GCC::operator-- (void) -{ - return __sync_sub_and_fetch (&this->value_, 1); -} - -template -ACE_INLINE T -ACE_Atomic_Op_GCC::operator-- (int) -{ - return __sync_fetch_and_sub (&this->value_, 1); -} - -template -ACE_INLINE T -ACE_Atomic_Op_GCC::operator+= (T rhs) -{ - return __sync_add_and_fetch (&this->value_, rhs); -} - -template -ACE_INLINE T -ACE_Atomic_Op_GCC::operator-= (T rhs) -{ - return __sync_sub_and_fetch (&this->value_, rhs); -} - -template -ACE_INLINE bool -ACE_Atomic_Op_GCC::operator== (T rhs) const -{ - return (this->value_ == rhs); -} - -template -ACE_INLINE bool -ACE_Atomic_Op_GCC::operator!= (T rhs) const -{ - return (this->value_ != rhs); -} - -template -ACE_INLINE bool -ACE_Atomic_Op_GCC::operator>= (T rhs) const -{ - return (this->value_ >= rhs); -} - -template -ACE_INLINE bool -ACE_Atomic_Op_GCC::operator> (T rhs) const -{ - return (this->value_ > rhs); -} - -template -ACE_INLINE bool -ACE_Atomic_Op_GCC::operator<= (T rhs) const -{ - return (this->value_ <= rhs); -} - -template -ACE_INLINE bool -ACE_Atomic_Op_GCC::operator< (T rhs) const -{ - return (this->value_ < rhs); -} - -template -ACE_INLINE ACE_Atomic_Op_GCC & -ACE_Atomic_Op_GCC::operator= (T rhs) -{ - (void) __sync_lock_test_and_set (&this->value_, rhs); - return *this; -} - -template -ACE_INLINE ACE_Atomic_Op_GCC & -ACE_Atomic_Op_GCC::operator= ( - const ACE_Atomic_Op_GCC &rhs) -{ - (void) __sync_lock_test_and_set (&this->value_, rhs.value_); - return *this; -} - -template -ACE_INLINE T -ACE_Atomic_Op_GCC::exchange (T newval) -{ - return __sync_val_compare_and_swap (&this->value_, this->value_, newval); -} - -template -ACE_INLINE T -ACE_Atomic_Op_GCC::value (void) const -{ - return this->value_; -} - -template -ACE_INLINE volatile T & -ACE_Atomic_Op_GCC::value_i (void) -{ - return this->value_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_GCC_ATOMIC_BUILTINS */ diff --git a/dep/acelite/ace/Atomic_Op_Sparc.c b/dep/acelite/ace/Atomic_Op_Sparc.c deleted file mode 100644 index 842673e58cc..00000000000 --- a/dep/acelite/ace/Atomic_Op_Sparc.c +++ /dev/null @@ -1,187 +0,0 @@ -/* $Id: Atomic_Op_Sparc.c 80826 2008-03-04 14:51:23Z wotte $ - * - * This is a C file for a reason. The Sun C++ compiler does not accept - * inline assembler. - * - * Portions of this code are based on atomic operations found in the - * linux kernel source code. - */ - -#if defined (ACE_INCLUDE_ATOMIC_OP_SPARC) - -#if defined(__i386) && defined(__SUNPRO_C) -static void -__sunpro_asm_code() { - __asm("\n\ - .globl ace_atomic_add_long \n\ - .type ace_atomic_add_long,@function \n\ - .align 4 \n\ -ace_atomic_add_long: \n\ - movl 0x00000004(%esp), %edx \n\ - movl 0x00000008(%esp), %eax \n\ - lock; xadd %eax, (%edx) \n\ - addl 0x00000008(%esp), %eax \n\ - ret \n\ - "); - - __asm("\n\ - .globl ace_atomic_swap_long \n\ - .type ace_atomic_swap_long,@function \n\ - .align 4 \n\ -ace_atomic_swap_long: \n\ - movl 0x00000004(%esp), %edx \n\ - movl 0x00000008(%esp), %eax \n\ - xchg %eax, (%edx) \n\ - ret \n\ - "); - - __asm("\n\ - .globl ace_atomic_swap_add_long \n\ - .type ace_atomic_swap_add_long,@function \n\ - .align 4 \n\ -ace_atomic_swap_add_long: \n\ - movl 0x00000004(%esp), %edx \n\ - movl 0x00000008(%esp), %eax \n\ - lock; xadd %eax, (%edx) \n\ - ret \n\ - "); -} - -#elif defined(__x86_64) && defined(__SUNPRO_C) - -static void -__sunpro_asm_code() { - __asm("\n\ - .globl ace_atomic_add_long \n\ - .type ace_atomic_add_long,@function \n\ - .align 16 \n\ -ace_atomic_add_long: \n\ - movq %rsi, %rax \n\ - lock; xaddq %rax, (%rdi) \n\ - addq %rsi, %rax \n\ - ret \n\ - "); - - __asm("\n\ - .globl ace_atomic_swap_long \n\ - .type ace_atomic_swap_long,@function \n\ - .align 16 \n\ -ace_atomic_swap_long: \n\ - xchgq %rsi, (%rdi) \n\ - movq %rsi, %rax \n\ - ret \n\ - "); - - __asm("\n\ - .globl ace_atomic_swap_add_long \n\ - .type ace_atomic_swap_add_long,@function \n\ - .align 16 \n\ -ace_atomic_swap_add_long: \n\ - lock; xaddq %rsi, (%rdi) \n\ - movq %rsi, %rax \n\ - ret \n\ - "); -} - -#elif defined (__sparcv9) - -unsigned long -ace_atomic_add_long (volatile unsigned long *dest, long rhs) -{ - __asm ("restore\n" - "ldx [%o0], %o2\n" - ".again_add:\n" - "add %o2, %o1, %o3\n" - "casx [%o0], %o2, %o3\n" - "cmp %o2, %o3\n" - "bne,pn %xcc, .again_add\n" - "mov %o3, %o2\n" - "retl\n" - "add %o2, %o1, %o0\n"); -} - -unsigned long -ace_atomic_swap_long (volatile unsigned long *dest, unsigned long rhs) -{ - __asm ("restore\n" - "ldx [%o0], %o2\n" - ".again_swap:\n" - "mov %o1, %o3\n" - "casx [%o0], %o2, %o3\n" - "cmp %o2, %o3\n" - "bne,pn %xcc, .again_swap\n" - "mov %o3, %o2\n" - "retl\n" - "mov %o3, %o0\n"); -} - -unsigned long -ace_atomic_swap_add_long (volatile unsigned long *dest, long rhs) -{ - __asm ("restore\n" - "ldx [%o0], %o2\n" - ".again_swap_add:\n" - "mov %o2, %o4\n" - "add %o2, %o1, %o3\n" - "casx [%o0], %o2, %o3\n" - "cmp %o2, %o3\n" - "bne,pn %xcc, .again_swap_add\n" - "mov %o3, %o2\n" - "retl\n" - "mov %o4, %o0\n"); -} - -#else - -unsigned long -ace_atomic_add_long (volatile unsigned long *dest, long rhs) -{ - __asm ("restore\n" - "ld [%o0], %o2\n" - ".again_add:\n" - "add %o2, %o1, %o3\n" - "cas [%o0], %o2, %o3\n" - "cmp %o2, %o3\n" - "bne,pn %icc, .again_add\n" - "mov %o3, %o2\n" - "retl\n" - "add %o2, %o1, %o0\n"); -} - -unsigned long -ace_atomic_swap_long (volatile unsigned long *dest, unsigned long rhs) -{ - __asm ("restore\n" - "ld [%o0], %o2\n" - ".again_swap:\n" - "mov %o1, %o3\n" - "cas [%o0], %o2, %o3\n" - "cmp %o2, %o3\n" - "bne,pn %icc, .again_swap\n" - "mov %o3, %o2\n" - "retl\n" - "mov %o3, %o0\n"); -} - -unsigned long -ace_atomic_swap_add_long (volatile unsigned long *dest, long rhs) -{ - __asm ("restore\n" - "ld [%o0], %o2\n" - ".again_swap_add:\n" - "mov %o2, %o4\n" - "add %o2, %o1, %o3\n" - "cas [%o0], %o2, %o3\n" - "cmp %o2, %o3\n" - "bne,pn %icc, .again_swap_add\n" - "mov %o3, %o2\n" - "retl\n" - "mov %o4, %o0\n"); -} - -# endif /* __sparcv9 */ - -#elif !defined (__GNUC__) && !defined (__INTEL_COMPILER) -/* Make compilers stop complaining about an empty translation unit */ -static int shut_up_compiler = 0; -#endif /* ACE_INCLUDE_ATOMIC_OP_SPARC */ diff --git a/dep/acelite/ace/Atomic_Op_Sparc.h b/dep/acelite/ace/Atomic_Op_Sparc.h deleted file mode 100644 index 75b9ad6eaa2..00000000000 --- a/dep/acelite/ace/Atomic_Op_Sparc.h +++ /dev/null @@ -1,14 +0,0 @@ -/* -*- C++ -*- */ -// $Id: Atomic_Op_Sparc.h 80826 2008-03-04 14:51:23Z wotte $ - -#ifndef ACE_ATOMIC_OP_SPARC_H -#define ACE_ATOMIC_OP_SPARC_H - -extern "C" -{ - unsigned long ace_atomic_add_long (volatile unsigned long *dest, long rhs); - unsigned long ace_atomic_swap_long (volatile unsigned long *dest, unsigned long rhs); - unsigned long ace_atomic_swap_add_long (volatile unsigned long *dest, long rhs); -} - -#endif /* ACE_ATOMIC_OP_SPARC_H */ diff --git a/dep/acelite/ace/Atomic_Op_T.cpp b/dep/acelite/ace/Atomic_Op_T.cpp deleted file mode 100644 index de1fd7dd021..00000000000 --- a/dep/acelite/ace/Atomic_Op_T.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// $Id: Atomic_Op_T.cpp 92052 2010-09-27 14:20:22Z vzykov $ - -#ifndef ACE_ATOMIC_OP_T_CPP -#define ACE_ATOMIC_OP_T_CPP - -#include "ace/Atomic_Op_T.h" - -#ifdef ACE_HAS_DUMP -# include "ace/Log_Msg.h" -#endif /* ACE_HAS_DUMP */ - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (__ACE_INLINE__) -#include "ace/Atomic_Op_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Atomic_Op_Ex) -ACE_ALLOC_HOOK_DEFINE(ACE_Atomic_Op) - -// ************************************************* -template ACE_LOCK & -ACE_Atomic_Op_Ex::mutex (void) -{ - // ACE_TRACE ("ACE_Atomic_Op_Ex::mutex"); - return this->mutex_; -} - -template -void -ACE_Atomic_Op_Ex::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - // ACE_TRACE ("ACE_Atomic_Op_Ex::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - this->mutex_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Atomic_Op_Ex::ACE_Atomic_Op_Ex (ACE_LOCK & mtx) - : mutex_ (mtx) - , value_ (0) -{ - // ACE_TRACE ("ACE_Atomic_Op_Ex::ACE_Atomic_Op_Ex"); -} - -template -ACE_Atomic_Op_Ex::ACE_Atomic_Op_Ex ( - ACE_LOCK & mtx, - typename ACE_Atomic_Op_Ex::arg_type c) - : mutex_ (mtx) - , value_ (c) -{ - // ACE_TRACE ("ACE_Atomic_Op_Ex::ACE_Atomic_Op_Ex"); -} - -// **************************************************************** - -template -ACE_Atomic_Op::ACE_Atomic_Op (void) - : impl_ (this->own_mutex_) -{ - // ACE_TRACE ("ACE_Atomic_Op::ACE_Atomic_Op"); -} - -template -ACE_Atomic_Op::ACE_Atomic_Op ( - typename ACE_Atomic_Op::arg_type c) - : impl_ (own_mutex_, c) -{ - // ACE_TRACE ("ACE_Atomic_Op::ACE_Atomic_Op"); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_ATOMIC_OP_T_CPP */ diff --git a/dep/acelite/ace/Atomic_Op_T.h b/dep/acelite/ace/Atomic_Op_T.h deleted file mode 100644 index 944c0454c38..00000000000 --- a/dep/acelite/ace/Atomic_Op_T.h +++ /dev/null @@ -1,359 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Atomic_Op_T.h - * - * $Id: Atomic_Op_T.h 95761 2012-05-15 18:23:04Z johnnyw $ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_ATOMIC_OP_T_H -#define ACE_ATOMIC_OP_T_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -struct ACE_Type_Traits -{ - typedef TYPE const & parameter_type; -}; - -template<> -struct ACE_Type_Traits -{ - typedef bool parameter_type; -}; - -template<> -struct ACE_Type_Traits -{ - typedef char parameter_type; -}; - -template<> -struct ACE_Type_Traits -{ - typedef signed char parameter_type; -}; - -template<> -struct ACE_Type_Traits -{ - typedef unsigned char parameter_type; -}; - -template<> -struct ACE_Type_Traits -{ - typedef short parameter_type; -}; - -template<> -struct ACE_Type_Traits -{ - typedef unsigned short parameter_type; -}; - -template<> -struct ACE_Type_Traits -{ - typedef int parameter_type; -}; - -template<> -struct ACE_Type_Traits -{ - typedef unsigned int parameter_type; -}; - -template<> -struct ACE_Type_Traits -{ - typedef long parameter_type; -}; - -template<> -struct ACE_Type_Traits -{ - typedef unsigned long parameter_type; -}; - -template<> -struct ACE_Type_Traits -{ - typedef long long parameter_type; -}; - -template<> -struct ACE_Type_Traits -{ - typedef unsigned long long parameter_type; -}; - -template<> -struct ACE_Type_Traits -{ - typedef float parameter_type; -}; - -template<> -struct ACE_Type_Traits -{ - typedef double parameter_type; -}; - -template<> -struct ACE_Type_Traits -{ - typedef long double parameter_type; -}; - -template -struct ACE_Type_Traits -{ - typedef TYPE* parameter_type; -}; - -/** - * @class ACE_Atomic_Op_Ex - * - * @brief Transparently parameterizes synchronization into basic - * arithmetic operations. - * - * This class is described in an article in the July/August 1994 - * issue of the C++ Report magazine. It implements a - * templatized version of the Decorator pattern from the GoF book. - * - * ACE_Atomic_Op_Ex objects must be constructed with a reference - * to an existing lock. A single lock can be shared between - * multiple ACE_Atomic_Op_Ex objects. If you do not require this - * ability consider using the ACE_Atomic_Op class instead, which - * may be able to take advantage of platform-specific - * optimisations to provide atomic operations without requiring a - * lock. - */ -template -class ACE_Atomic_Op_Ex -{ -public: - - typedef typename ACE_Type_Traits::parameter_type arg_type; - - // = Initialization methods. - - /// Initialize @c value_ to 0. - ACE_Atomic_Op_Ex (ACE_LOCK & mtx); - - /// Initialize @c value_ to c. - ACE_Atomic_Op_Ex (ACE_LOCK & mtx, arg_type c); - - // = Accessors. - - /// Atomically pre-increment @c value_. - TYPE operator++ (void); - - /// Atomically post-increment @c value_. - TYPE operator++ (int); - - /// Atomically increment @c value_ by rhs. - TYPE operator+= (arg_type rhs); - - /// Atomically pre-decrement @c value_. - TYPE operator-- (void); - - /// Atomically post-decrement @c value_. - TYPE operator-- (int); - - /// Atomically decrement @c value_ by rhs. - TYPE operator-= (arg_type rhs); - - /// Atomically compare @c value_ with rhs. - bool operator== (arg_type rhs) const; - - /// Atomically compare @c value_ with rhs. - bool operator!= (arg_type rhs) const; - - /// Atomically check if @c value_ greater than or equal to rhs. - bool operator>= (arg_type rhs) const; - - /// Atomically check if @c value_ greater than rhs. - bool operator> (arg_type rhs) const; - - /// Atomically check if @c value_ less than or equal to rhs. - bool operator<= (arg_type rhs) const; - - /// Atomically check if @c value_ less than rhs. - bool operator< (arg_type rhs) const; - - /// Atomically assign rhs to @c value_. - ACE_Atomic_Op_Ex &operator= (arg_type rhs); - - /// Atomically assign to @c value_. - ACE_Atomic_Op_Ex &operator= ( - ACE_Atomic_Op_Ex const & rhs); - - /// Exchange value with @a newval. - TYPE exchange (TYPE newval); - - /// Explicitly return @c value_. - TYPE value (void) const; - - /// Dump the state of an object. - void dump (void) const; - - // ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. - - /// Manage copying... - ACE_Atomic_Op_Ex (ACE_Atomic_Op_Ex const &); - - /** - * Returns a reference to the underlying ACE_LOCK. This makes it - * possible to acquire the lock explicitly, which can be useful in - * some cases if you instantiate the ACE_Atomic_Op_Ex with an - * ACE_Recursive_Mutex or ACE_Process_Mutex. - * - * @note The right name would be lock_, but HP/C++ will choke on that! - */ - ACE_LOCK & mutex (void); - - /** - * Explicitly return @c value_ (by reference). This gives the user - * full, unrestricted access to the underlying value. This method - * will usually be used in conjunction with explicit access to the - * lock. Use with care ;-) - */ - TYPE & value_i (void); - -private: - /// Type of synchronization mechanism. - ACE_LOCK & mutex_; - - /// Current object decorated by the atomic op. - TYPE value_; -}; - -/** - * @class ACE_Atomic_Op - * - * @brief Transparently parameterizes synchronization into basic - * arithmetic operations. - * - * This class is described in an article in the July/August 1994 - * issue of the C++ Report magazine. It implements a - * templatized version of the Decorator pattern from the GoF book. - * - * Certain platforms may provide a template specialization for - * ACE_Atomic_Op that provides optimized - * atomic integer operations without actually requiring a mutex. - */ -template -class ACE_Atomic_Op -{ -public: - - typedef typename ACE_Type_Traits::parameter_type arg_type; - - /// Initialize @c value_ to 0. - ACE_Atomic_Op (void); - - /// Initialize @c value_ to c. - ACE_Atomic_Op (arg_type c); - - /// Manage copying... - ACE_Atomic_Op (ACE_Atomic_Op const & c); - - /// Atomically assign @a rhs to @c value_. - ACE_Atomic_Op & operator= (arg_type rhs); - - /// Atomically assign @a rhs to @c value_. - ACE_Atomic_Op & operator= ( - ACE_Atomic_Op const & rhs); - - /// Atomically pre-increment @c value_. - TYPE operator++ (void); - - /// Atomically post-increment @c value_. - TYPE operator++ (int); - - /// Atomically increment @c value_ by rhs. - TYPE operator+= (arg_type rhs); - - /// Atomically pre-decrement @c value_. - TYPE operator-- (void); - - /// Atomically post-decrement @c value_. - TYPE operator-- (int); - - /// Atomically decrement @c value_ by @a rhs. - TYPE operator-= (arg_type rhs); - - /// Atomically compare @c value_ with @a rhs. - bool operator== (arg_type rhs) const; - - /// Atomically compare @c value_ with @a rhs. - bool operator!= (arg_type rhs) const; - - /// Atomically check if @c value_ greater than or equal to @a rhs. - bool operator>= (arg_type rhs) const; - - /// Atomically check if @c value_ greater than @a rhs. - bool operator> (arg_type rhs) const; - - /// Atomically check if @c value_ less than or equal to @a rhs. - bool operator<= (arg_type rhs) const; - - /// Atomically check if @c value_ less than @a rhs. - bool operator< (arg_type rhs) const; - - /// Exchange value with @a newval. - TYPE exchange (TYPE newval); - - /// Explicitly return @c value_. - TYPE value (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /** - * Explicitly return @c value_ (by reference). This gives the user - * full, unrestricted access to the underlying value. This method - * will usually be used in conjunction with explicit access to the - * lock. Use with care ;-) - */ - TYPE & value_i (void); - -private: - /// Type of synchronization mechanism. - ACE_LOCK own_mutex_; - - /// Underlying atomic op implementation. - ACE_Atomic_Op_Ex impl_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Atomic_Op_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Atomic_Op_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Atomic_Op_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /*ACE_ATOMIC_OP_T_H*/ diff --git a/dep/acelite/ace/Atomic_Op_T.inl b/dep/acelite/ace/Atomic_Op_T.inl deleted file mode 100644 index 87e6b55d7be..00000000000 --- a/dep/acelite/ace/Atomic_Op_T.inl +++ /dev/null @@ -1,349 +0,0 @@ -// -*- C++ -*- -// -// $Id: Atomic_Op_T.inl 95225 2011-12-05 20:25:15Z shuston $ - -#include "ace/Guard_T.h" - -#include - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// -// ACE_Atomic_Op_Ex inline functions -// - -template -ACE_INLINE TYPE -ACE_Atomic_Op_Ex::operator++ (void) -{ - // ACE_TRACE ("ACE_Atomic_Op_Ex::operator++"); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); - return ++this->value_; -} - -template -ACE_INLINE TYPE -ACE_Atomic_Op_Ex::operator+= ( - typename ACE_Atomic_Op_Ex::arg_type rhs) -{ - // ACE_TRACE ("ACE_Atomic_Op_Ex::operator+="); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); - return this->value_ += rhs; -} - -template -ACE_INLINE TYPE -ACE_Atomic_Op_Ex::operator-- (void) -{ - // ACE_TRACE ("ACE_Atomic_Op_Ex::operator--"); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); - return --this->value_; -} - -template -ACE_INLINE TYPE -ACE_Atomic_Op_Ex::operator-= ( - typename ACE_Atomic_Op_Ex::arg_type rhs) -{ - // ACE_TRACE ("ACE_Atomic_Op_Ex::operator-="); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); - return this->value_ -= rhs; -} - -template -ACE_INLINE -ACE_Atomic_Op_Ex::ACE_Atomic_Op_Ex ( - ACE_Atomic_Op_Ex const & rhs) - : mutex_ (rhs.mutex_) - , value_ (rhs.value ()) // rhs.value() returns atomically -{ - // ACE_TRACE ("ACE_Atomic_Op_Ex::ACE_Atomic_Op_Ex"); -} - -template -ACE_INLINE TYPE -ACE_Atomic_Op_Ex::operator++ (int) -{ - // ACE_TRACE ("ACE_Atomic_Op_Ex::operator++"); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); - return this->value_++; -} - -template -ACE_INLINE TYPE -ACE_Atomic_Op_Ex::operator-- (int) -{ - // ACE_TRACE ("ACE_Atomic_Op_Ex::operator--"); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); - return this->value_--; -} - -template -ACE_INLINE bool -ACE_Atomic_Op_Ex::operator== ( - typename ACE_Atomic_Op_Ex::arg_type rhs) const -{ - // ACE_TRACE ("ACE_Atomic_Op_Ex::operator=="); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, false); - return this->value_ == rhs; -} - -template -ACE_INLINE bool -ACE_Atomic_Op_Ex::operator!= ( - typename ACE_Atomic_Op_Ex::arg_type rhs) const -{ - // ACE_TRACE ("ACE_Atomic_Op_Ex::operator!="); - return !(*this == rhs); -} - -template -ACE_INLINE bool -ACE_Atomic_Op_Ex::operator>= ( - typename ACE_Atomic_Op_Ex::arg_type rhs) const -{ - // ACE_TRACE ("ACE_Atomic_Op_Ex::operator>="); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, false); - return this->value_ >= rhs; -} - -template -ACE_INLINE bool -ACE_Atomic_Op_Ex::operator> ( - typename ACE_Atomic_Op_Ex::arg_type rhs) const -{ - // ACE_TRACE ("ACE_Atomic_Op_Ex::operator>"); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, false); - return this->value_ > rhs; -} - -template -ACE_INLINE bool -ACE_Atomic_Op_Ex::operator<= ( - typename ACE_Atomic_Op_Ex::arg_type rhs) const -{ - // ACE_TRACE ("ACE_Atomic_Op_Ex::operator<="); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, false); - return this->value_ <= rhs; -} - -template -ACE_INLINE bool -ACE_Atomic_Op_Ex::operator< ( - typename ACE_Atomic_Op_Ex::arg_type rhs) const -{ - // ACE_TRACE ("ACE_Atomic_Op_Ex::operator<"); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, false); - return this->value_ < rhs; -} - -template -ACE_INLINE ACE_Atomic_Op_Ex & -ACE_Atomic_Op_Ex::operator= ( - ACE_Atomic_Op_Ex const & rhs) -{ - // ACE_TRACE ("ACE_Atomic_Op_Ex::operator="); - - ACE_Atomic_Op_Ex tmp (rhs); - - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, *this); - std::swap (this->value_, tmp.value_); - - return *this; -} - -template -ACE_INLINE TYPE -ACE_Atomic_Op_Ex::exchange (TYPE newval) -{ - // ACE_TRACE ("ACE_Atomic_Op_Ex::exchange"); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); - std::swap (this->value_, newval); - return newval; -} - -template -ACE_INLINE TYPE -ACE_Atomic_Op_Ex::value (void) const -{ - // ACE_TRACE ("ACE_Atomic_Op_Ex::value"); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); - return this->value_; -} - -template -ACE_INLINE TYPE & -ACE_Atomic_Op_Ex::value_i (void) -{ - // Explicitly return (by reference). This gives the user - // full, unrestricted access to the underlying value. This method - // will usually be used in conjunction with explicit access to the - // lock. Use with care ;-) - return this->value_; -} - -template -ACE_INLINE ACE_Atomic_Op_Ex & -ACE_Atomic_Op_Ex::operator= ( - typename ACE_Atomic_Op_Ex::arg_type rhs) -{ - // ACE_TRACE ("ACE_Atomic_Op_Ex::operator="); - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, *this); - this->value_ = rhs; - return *this; -} - -// -// ACE_Atomic_Op inline functions -// - -template ACE_INLINE -ACE_Atomic_Op::ACE_Atomic_Op ( - ACE_Atomic_Op const & rhs) - : impl_ (own_mutex_, rhs.value ()) -{ - // ACE_TRACE ("ACE_Atomic_Op::ACE_Atomic_Op"); -} - - -template -ACE_INLINE ACE_Atomic_Op & -ACE_Atomic_Op::operator= ( - typename ACE_Atomic_Op::arg_type i) -{ - this->impl_ = i; - return *this; -} - -template -ACE_INLINE ACE_Atomic_Op & -ACE_Atomic_Op::operator= ( - ACE_Atomic_Op const & rhs) -{ - this->impl_ = rhs.impl_; - return *this; -} - -template -ACE_INLINE TYPE -ACE_Atomic_Op::operator++ (void) -{ - return ++this->impl_; -} - -template -ACE_INLINE TYPE -ACE_Atomic_Op::operator++ (int) -{ - return this->impl_++; -} - -template -ACE_INLINE TYPE -ACE_Atomic_Op::operator+= ( - typename ACE_Atomic_Op::arg_type rhs) -{ - return this->impl_ += rhs; -} - -template -ACE_INLINE TYPE -ACE_Atomic_Op::operator-- (void) -{ - return --this->impl_; -} - -template -ACE_INLINE TYPE -ACE_Atomic_Op::operator-- (int) -{ - return this->impl_--; -} - -template -ACE_INLINE TYPE -ACE_Atomic_Op::operator-= ( - typename ACE_Atomic_Op::arg_type rhs) -{ - return this->impl_ -= rhs; -} - -template -ACE_INLINE bool -ACE_Atomic_Op::operator== ( - typename ACE_Atomic_Op::arg_type rhs) const -{ - return this->impl_ == rhs; -} - -template -ACE_INLINE bool -ACE_Atomic_Op::operator!= ( - typename ACE_Atomic_Op::arg_type rhs) const -{ - return this->impl_ != rhs; -} - -template -ACE_INLINE bool -ACE_Atomic_Op::operator>= ( - typename ACE_Atomic_Op::arg_type rhs) const -{ - return this->impl_ >= rhs; -} - -template -ACE_INLINE bool -ACE_Atomic_Op::operator> ( - typename ACE_Atomic_Op::arg_type rhs) const -{ - return this->impl_ > rhs; -} - -template -ACE_INLINE bool -ACE_Atomic_Op::operator<= ( - typename ACE_Atomic_Op::arg_type rhs) const -{ - return this->impl_ <= rhs; -} - -template -ACE_INLINE bool -ACE_Atomic_Op::operator< ( - typename ACE_Atomic_Op::arg_type rhs) const -{ - return this->impl_ < rhs; -} - -template -ACE_INLINE TYPE -ACE_Atomic_Op::exchange (TYPE newval) -{ - return this->impl_.exchange (newval); -} - -template -ACE_INLINE TYPE -ACE_Atomic_Op::value (void) const -{ - return this->impl_.value (); -} - -template -ACE_INLINE void -ACE_Atomic_Op::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - this->impl_.dump (); -#endif /* ACE_HAS_DUMP */ - return; -} -template -ACE_INLINE TYPE & -ACE_Atomic_Op::value_i (void) -{ - return this->impl_.value_i (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Auto_Event.cpp b/dep/acelite/ace/Auto_Event.cpp deleted file mode 100644 index 331edb4bf79..00000000000 --- a/dep/acelite/ace/Auto_Event.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// $Id: Auto_Event.cpp 91368 2010-08-16 13:03:34Z mhengstmengel $ - -#include "ace/Auto_Event.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Auto_Event.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Auto_Event::ACE_Auto_Event (int initial_state, - int type, - const char *name, - void *arg) - : ACE_Event (0, - initial_state, - type, - ACE_TEXT_CHAR_TO_TCHAR (name), - arg) -{ -} - -#if defined (ACE_HAS_WCHAR) -ACE_Auto_Event::ACE_Auto_Event (int initial_state, - int type, - const wchar_t *name, - void *arg) - : ACE_Event (0, - initial_state, - type, - ACE_TEXT_WCHAR_TO_TCHAR (name), - arg) -{ -} -#endif /* ACE_HAS_WCHAR */ - -void -ACE_Auto_Event::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_Event::dump (); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Auto_Event.h b/dep/acelite/ace/Auto_Event.h deleted file mode 100644 index 9699759ad3c..00000000000 --- a/dep/acelite/ace/Auto_Event.h +++ /dev/null @@ -1,73 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Auto_Event.h - * - * $Id: Auto_Event.h 91781 2010-09-15 12:49:15Z johnnyw $ - * - * Moved from Synch.h. - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_AUTO_EVENT_H -#define ACE_AUTO_EVENT_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Event.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Auto_Event - * - * @brief Auto Events. - * - * Specialization of Event mechanism which wakes up one waiting - * thread on @c signal. All platforms support process-scope locking - * support. However, only Win32 platforms support global naming and - * system-scope locking support. - */ -class ACE_Export ACE_Auto_Event : public ACE_Event -{ -public: - /// Constructor which will create auto event - ACE_Auto_Event (int initial_state = 0, - int type = USYNC_THREAD, - const char *name = 0, - void *arg = 0); - -#if defined (ACE_HAS_WCHAR) - /// Constructor which will create auto event (wchar_t version) - ACE_Auto_Event (int initial_state, - int type, - const wchar_t *name, - void *arg = 0); -#endif /* ACE_HAS_WCHAR */ - - /// Default dtor. - ~ACE_Auto_Event (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Auto_Event.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_AUTO_EVENT_H */ diff --git a/dep/acelite/ace/Auto_Event.inl b/dep/acelite/ace/Auto_Event.inl deleted file mode 100644 index b614e0b0d77..00000000000 --- a/dep/acelite/ace/Auto_Event.inl +++ /dev/null @@ -1,12 +0,0 @@ -// -*- C++ -*- -// -// $Id: Auto_Event.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Auto_Event::~ACE_Auto_Event (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Auto_Functor.cpp b/dep/acelite/ace/Auto_Functor.cpp deleted file mode 100644 index 9d0dc79aa52..00000000000 --- a/dep/acelite/ace/Auto_Functor.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// $Id: Auto_Functor.cpp 80826 2008-03-04 14:51:23Z wotte $ - -#ifndef ACE_AUTO_FUNCTOR_CPP -#define ACE_AUTO_FUNCTOR_CPP - -#include "ace/Auto_Functor.h" - -#if !defined(__ACE_INLINE__) -# include "ace/Auto_Functor.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Utils::Auto_Functor::~Auto_Functor() -{ - reset(0); -} - -template void -ACE_Utils::Auto_Functor::reset(X * p) -{ - if(p_ != 0) - { - f_(p_); - } - p_ = p; -} - -templatevoid -ACE_Utils::Auto_Functor::reset(X * p, Functor f) -{ - reset(p); - f_ = f; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /*ACE_AUTO_FUNCTOR_CPP*/ diff --git a/dep/acelite/ace/Auto_Functor.h b/dep/acelite/ace/Auto_Functor.h deleted file mode 100644 index 393a11c73bc..00000000000 --- a/dep/acelite/ace/Auto_Functor.h +++ /dev/null @@ -1,121 +0,0 @@ -// -*- C++ -*- -//============================================================================= -/** - * @file Auto_Functor.h - * - * $Id: Auto_Functor.h 92386 2010-10-28 07:44:37Z johnnyw $ - * - * @author Carlos O'Ryan - */ -//============================================================================= -#ifndef ACE_AUTO_FUNCTOR_H -#define ACE_AUTO_FUNCTOR_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Global_Macros.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace ACE_Utils -{ -/** - * @class Auto_Functor_Ref - * - * @brief Helper class to implement assignment and copy-construction - * as expected - */ -template -struct Auto_Functor_Ref -{ - X * p_; - Functor f_; - - Auto_Functor_Ref(X * p, Functor f); -}; - -/** - * @class Auto_Functor - * - * @brief Helper template to implement auto_ptr<>-like classes, but - * executing a functor in the destructor, instead of always - * deleting things. - * - * The functor is called in the destructor, and it must implement: - * - * Functor() throw();
- * Functor(Functor const &) throw();
- * Functor & operator=(Functor const &) throw();
- * void operator()(X * p) throw();
- * - */ -template -class Auto_Functor -{ -public: - typedef X element_type; - typedef Functor functor_type; - - /// Constructor - explicit Auto_Functor (X * p = 0, - Functor functor = Functor()); // throw() - - Auto_Functor (Auto_Functor & rhs); // throw() - - Auto_Functor& operator= (Auto_Functor & rhs); // throw() - - template - Auto_Functor(Auto_Functor& rhs); // throw() - - template - Auto_Functor& operator= (Auto_Functor& rhs); // throw() - - ~Auto_Functor(); // throw() - - X & operator*() const; // throw() - - X * operator->() const; // throw() - - X * get(); // throw() - - X * release(); // throw() - - void reset (X * p = 0); // throw() - - void reset (X * p, Functor f); // throw() - - Functor const & functor() const; // throw() - - Auto_Functor(Auto_Functor_Ref rhs); // throw() - - Auto_Functor & operator=(Auto_Functor_Ref rhs); // throw() - - template operator Auto_Functor_Ref(); // throw() - - template operator Auto_Functor(); // throw() - -private: - X * p_; - - Functor f_; -}; - -} // namespace ACE_Utils - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined(__ACE_INLINE__) -# include "ace/Auto_Functor.inl" -#endif /* __ACE_INLINE__ */ - -#if defined(ACE_TEMPLATES_REQUIRE_SOURCE) -# include "ace/Auto_Functor.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#include /**/ "ace/post.h" -#endif /* ACE_AUTO_FUNCTOR_H*/ diff --git a/dep/acelite/ace/Auto_Functor.inl b/dep/acelite/ace/Auto_Functor.inl deleted file mode 100644 index 5e714e01410..00000000000 --- a/dep/acelite/ace/Auto_Functor.inl +++ /dev/null @@ -1,120 +0,0 @@ -// -*- C++ -*- -// -// $Id: Auto_Functor.inl 92386 2010-10-28 07:44:37Z johnnyw $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE -ACE_Utils::Auto_Functor_Ref:: -Auto_Functor_Ref(X * p, Functor f) - : p_(p) - , f_(f) -{ -} - -template ACE_INLINE -ACE_Utils::Auto_Functor::Auto_Functor(X * p, Functor f) - : p_(p) - , f_(f) -{ -} - -template ACE_INLINE -ACE_Utils::Auto_Functor::Auto_Functor(Auto_Functor & rhs) - : p_(rhs.release()) - , f_(rhs.f_) -{ -} - -template -ACE_INLINE ACE_Utils::Auto_Functor& -ACE_Utils::Auto_Functor:: operator=(Auto_Functor & rhs) -{ - reset(rhs.release()); - f_ = rhs.f_; - return *this; -} - -template template ACE_INLINE -ACE_Utils::Auto_Functor::Auto_Functor(Auto_Functor& rhs) - : p_(rhs.release()) - , f_(rhs.f_) -{ -} - -template template -ACE_INLINE ACE_Utils::Auto_Functor& -ACE_Utils::Auto_Functor::operator=(Auto_Functor& rhs) -{ - reset(rhs.release()); - return *this; -} - -template ACE_INLINE X & -ACE_Utils::Auto_Functor::operator*() const -{ - return *p_; -} - -template -ACE_INLINE X * -ACE_Utils::Auto_Functor::operator->() const -{ - return p_; -} - -template -ACE_INLINE X * -ACE_Utils::Auto_Functor::get() -{ - return p_; -} - -template -ACE_INLINE X * -ACE_Utils::Auto_Functor::release() -{ - X * tmp = p_; - p_ = 0; - return tmp; -} - -template -ACE_INLINE Functor const & -ACE_Utils::Auto_Functor::functor() const -{ - return f_; -} - -template ACE_INLINE -ACE_Utils::Auto_Functor::Auto_Functor(Auto_Functor_Ref rhs) - : p_(rhs.p_) - , f_(rhs.f_) -{ -} - -template -ACE_INLINE ACE_Utils::Auto_Functor & -ACE_Utils::Auto_Functor::operator=(Auto_Functor_Ref rhs) -{ - if(rhs.p_ != p_) - { - reset(rhs.p_); - f_ = rhs.f_; - } - return *this; -} - -template template ACE_INLINE -ACE_Utils::Auto_Functor::operator ACE_Utils::Auto_Functor_Ref() -{ - return ACE_Utils::Auto_Functor_Ref(release(), f_); -} - -template template ACE_INLINE -ACE_Utils::Auto_Functor::operator ACE_Utils::Auto_Functor() -{ - return ACE_Utils::Auto_Functor(release(), f_); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Auto_IncDec_T.cpp b/dep/acelite/ace/Auto_IncDec_T.cpp deleted file mode 100644 index ccef122edcf..00000000000 --- a/dep/acelite/ace/Auto_IncDec_T.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// $Id: Auto_IncDec_T.cpp 80826 2008-03-04 14:51:23Z wotte $ - -#ifndef ACE_AUTO_INCDEC_T_CPP -#define ACE_AUTO_INCDEC_T_CPP - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Auto_IncDec_T.h" -#include "ace/Log_Msg.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Auto_IncDec_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Auto_IncDec) - -template void -ACE_Auto_IncDec::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_Auto_IncDec::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_AUTO_INCDEC_T_CPP */ diff --git a/dep/acelite/ace/Auto_IncDec_T.h b/dep/acelite/ace/Auto_IncDec_T.h deleted file mode 100644 index 86fa6552370..00000000000 --- a/dep/acelite/ace/Auto_IncDec_T.h +++ /dev/null @@ -1,75 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Auto_IncDec_T.h - * - * $Id: Auto_IncDec_T.h 92353 2010-10-25 06:34:35Z johnnyw $ - * - * @author Edan Ayal - */ -//============================================================================= - - -#ifndef ACE_AUTO_INCDEC_T_H -#define ACE_AUTO_INCDEC_T_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Global_Macros.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Auto_IncDec - * - * @brief This class automatically increments and decrements a - * parameterized counter. - * - * This data structure is meant to be used within a method, - * function, or scope. The actual parameter given for the - * @c ACE_SAFELY_INCREMENTABLE_DECREMENTABLE template parameter - * must provide at least operators ++ and --. - */ -template -class ACE_Auto_IncDec : private ACE_Copy_Disabled -{ -public: - /// Implicitly increment the counter. - ACE_Auto_IncDec (ACE_SAFELY_INCREMENTABLE_DECREMENTABLE &counter); - - /// Implicitly decrement the counter. - ~ACE_Auto_IncDec (void); - - /// Dump the state of an object. - void dump (void) const; - -protected: - /// Reference to the @c ACE_SAFELY_INCREMENTABLE_DECREMENTABLE counter - /// we're incrementing/decrementing. - ACE_SAFELY_INCREMENTABLE_DECREMENTABLE &counter_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Auto_IncDec_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Auto_IncDec_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Auto_IncDec_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_AUTO_INCDEC_T_H */ diff --git a/dep/acelite/ace/Auto_IncDec_T.inl b/dep/acelite/ace/Auto_IncDec_T.inl deleted file mode 100644 index e61980e7192..00000000000 --- a/dep/acelite/ace/Auto_IncDec_T.inl +++ /dev/null @@ -1,25 +0,0 @@ -// -*- C++ -*- -// -// $Id: Auto_IncDec_T.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Implicitly and automatically increment the counter. - -template ACE_INLINE -ACE_Auto_IncDec::ACE_Auto_IncDec - (ACE_SAFELY_INCREMENTABLE_DECREMENTABLE &counter) - : counter_ (counter) -{ - ++this->counter_; -} - -// Implicitly and automatically decrement the counter. - -template ACE_INLINE -ACE_Auto_IncDec::~ACE_Auto_IncDec (void) -{ - --this->counter_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Auto_Ptr.cpp b/dep/acelite/ace/Auto_Ptr.cpp deleted file mode 100644 index 81f458d34a9..00000000000 --- a/dep/acelite/ace/Auto_Ptr.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// $Id: Auto_Ptr.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#ifndef ACE_AUTO_PTR_CPP -#define ACE_AUTO_PTR_CPP - -#include "ace/Auto_Ptr.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Auto_Ptr.inl" -#endif /* __ACE_INLINE__ */ - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Auto_Basic_Ptr) -ACE_ALLOC_HOOK_DEFINE(ACE_Auto_Basic_Array_Ptr) - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_AUTO_PTR_CPP */ diff --git a/dep/acelite/ace/Auto_Ptr.h b/dep/acelite/ace/Auto_Ptr.h deleted file mode 100644 index e9468a73bc7..00000000000 --- a/dep/acelite/ace/Auto_Ptr.h +++ /dev/null @@ -1,228 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Auto_Ptr.h - * - * $Id: Auto_Ptr.h 92580 2010-11-15 09:48:02Z johnnyw $ - * - * @author Doug Schmidt - * @author Irfan Pyarali - * @author Jack Reeves - * @author Dr. Harald M. Mueller - */ -//============================================================================= - -#ifndef ACE_AUTO_PTR_H -#define ACE_AUTO_PTR_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (_MSC_VER) -// Suppress warning e.g. "return type for -// 'ACE_Auto_Array_Pointer::operator ->' is 'type *' (i.e., not a UDT -// or reference to a UDT. Will produce errors if applied using infix -// notation)" -# pragma warning(push) -# pragma warning(disable: 4284) -#endif /* _MSC_VER */ - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Auto_Basic_Ptr - * - * @brief Implements the draft C++ standard auto_ptr abstraction. - * This class allows one to work on non-object (basic) types - */ -template -class ACE_Auto_Basic_Ptr -{ -public: - typedef X element_type; - - // = Initialization and termination methods - explicit ACE_Auto_Basic_Ptr (X * p = 0) : p_ (p) {} - - ACE_Auto_Basic_Ptr (ACE_Auto_Basic_Ptr & ap); - ACE_Auto_Basic_Ptr &operator= (ACE_Auto_Basic_Ptr & rhs); - ~ACE_Auto_Basic_Ptr (void); - - // = Accessor methods. - X &operator *() const; - X *get (void) const; - X *release (void); - void reset (X * p = 0); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - X *p_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if !defined (ACE_LACKS_AUTO_PTR) && \ - defined (ACE_HAS_STANDARD_CPP_LIBRARY) && \ - (ACE_HAS_STANDARD_CPP_LIBRARY != 0) -#include -#if defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) && \ - (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB != 0) -using std::auto_ptr; -#endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ -#else /* ACE_HAS_STANDARD_CPP_LIBRARY */ - -/** - * @class auto_ptr - * - * @brief Implements the draft C++ standard auto_ptr abstraction. - */ -template -class auto_ptr : public ACE_Auto_Basic_Ptr -{ -public: - typedef X element_type; - - // = Initialization and termination methods - explicit auto_ptr (X * p = 0) : ACE_Auto_Basic_Ptr (p) {} - auto_ptr (auto_ptr & ap) : ACE_Auto_Basic_Ptr (ap.release ()) {} - - X *operator-> () const; -}; - -#endif /* ACE_HAS_STANDARD_CPP_LIBRARY */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @brief Implements the draft C++ standard auto_ptr abstraction. - * This version can be used instead of auto_ptr - */ -template -class ACE_Auto_Ptr : public ACE_Auto_Basic_Ptr -{ -public: - typedef X element_type; - - // = Initialization and termination methods - explicit ACE_Auto_Ptr (X * p = 0) : ACE_Auto_Basic_Ptr (p) {} - - X *operator-> () const; -}; - -/** - * @class ACE_Auto_Basic_Array_Ptr - * - * @brief Implements an extension to the draft C++ standard auto_ptr - * abstraction. This class allows one to work on non-object - * (basic) types that must be treated as an array, e.g., - * deallocated via "delete [] foo". - */ -template -class ACE_Auto_Basic_Array_Ptr -{ -public: - typedef X element_type; - - // = Initialization and termination methods. - explicit ACE_Auto_Basic_Array_Ptr (X * p = 0) : p_ (p) {} - - ACE_Auto_Basic_Array_Ptr (ACE_Auto_Basic_Array_Ptr & ap); - ACE_Auto_Basic_Array_Ptr &operator= (ACE_Auto_Basic_Array_Ptr & rhs); - ~ACE_Auto_Basic_Array_Ptr (void); - - // = Accessor methods. - X & operator* () const; - X & operator[] (int i) const; - X * get (void) const; - X * release (void); - void reset (X * p = 0); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - X * p_; -}; - -/** - * @class ACE_Auto_Array_Ptr - * - * @brief Implements an extension to the draft C++ standard auto_ptr - * abstraction. - */ -template -class ACE_Auto_Array_Ptr : public ACE_Auto_Basic_Array_Ptr -{ -public: - typedef X element_type; - - // = Initialization and termination methods. - explicit ACE_Auto_Array_Ptr (X *p = 0) - : ACE_Auto_Basic_Array_Ptr (p) {} - - X *operator-> () const; -}; - - -/** - * @brief Reset given @c auto_ptr element to new element. - * - * Some platforms have an older version of auto_ptr support, which - * lacks reset, and cannot be disabled easily. Portability to these - * platforms requires use of this function template. This function - * template also works for the @c ACE_Auto_{Basic_}Array_Ptr class - * template, as well. - */ -template -inline void -ACE_auto_ptr_reset (AUTO_PTR_TYPE & ap, - PTR_TYPE * p) -{ -#if defined (ACE_AUTO_PTR_LACKS_RESET) - // Allow compiler to adjust pointer to potential base class pointer - // of element type found in auto_ptr. - typename AUTO_PTR_TYPE::element_type * const tp = p; - if (tp != ap.get ()) - { - ap = AUTO_PTR_TYPE (tp); - } -#else - ap.reset (p); -#endif /* ACE_AUTO_PTR_LACKS_RESET */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Auto_Ptr.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Auto_Ptr.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Auto_Ptr.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#if defined (_MSC_VER) -// Restore the warning state to what it was before entry. -# pragma warning(pop) -#endif /* _MSC_VER */ - -#include /**/ "ace/post.h" -#endif /* ACE_AUTO_PTR_H */ diff --git a/dep/acelite/ace/Auto_Ptr.inl b/dep/acelite/ace/Auto_Ptr.inl deleted file mode 100644 index 9ea47c3f208..00000000000 --- a/dep/acelite/ace/Auto_Ptr.inl +++ /dev/null @@ -1,171 +0,0 @@ -// -*- C++ -*- -// -// $Id: Auto_Ptr.inl 80826 2008-03-04 14:51:23Z wotte $ - -#include "ace/Global_Macros.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE void -ACE_Auto_Basic_Ptr::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Auto_Basic_Ptr::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template ACE_INLINE void -ACE_Auto_Basic_Array_Ptr::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Auto_Basic_Array_Ptr::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template ACE_INLINE -ACE_Auto_Basic_Ptr::ACE_Auto_Basic_Ptr (ACE_Auto_Basic_Ptr &rhs) - : p_ (rhs.release ()) -{ - ACE_TRACE ("ACE_Auto_Basic_Ptr::ACE_Auto_Basic_Ptr"); -} - -template ACE_INLINE X * -ACE_Auto_Basic_Ptr::get (void) const -{ - ACE_TRACE ("ACE_Auto_Basic_Ptr::get"); - return this->p_; -} - -template ACE_INLINE X * -ACE_Auto_Basic_Ptr::release (void) -{ - ACE_TRACE ("ACE_Auto_Basic_Ptr::release"); - X *old = this->p_; - this->p_ = 0; - return old; -} - -template ACE_INLINE void -ACE_Auto_Basic_Ptr::reset (X *p) -{ - ACE_TRACE ("ACE_Auto_Basic_Ptr::reset"); - if (this->get () != p) - delete this->get (); - this->p_ = p; -} - -template ACE_INLINE ACE_Auto_Basic_Ptr & -ACE_Auto_Basic_Ptr::operator= (ACE_Auto_Basic_Ptr &rhs) -{ - ACE_TRACE ("ACE_Auto_Basic_Ptr::operator="); - if (this != &rhs) - { - this->reset (rhs.release ()); - } - return *this; -} - -template ACE_INLINE -ACE_Auto_Basic_Ptr::~ACE_Auto_Basic_Ptr (void) -{ - ACE_TRACE ("ACE_Auto_Basic_Ptr::~ACE_Auto_Basic_Ptr"); - delete this->get (); -} - -template ACE_INLINE X & -ACE_Auto_Basic_Ptr::operator *() const -{ - ACE_TRACE ("ACE_Auto_Basic_Ptr::operator *()"); - return *this->get (); -} - -#if defined (ACE_LACKS_AUTO_PTR) || \ - !defined (ACE_HAS_STANDARD_CPP_LIBRARY) || \ - (ACE_HAS_STANDARD_CPP_LIBRARY == 0) - -template ACE_INLINE X * -auto_ptr::operator-> () const -{ - ACE_TRACE ("auto_ptr::operator->"); - return this->get (); -} - -#endif /* ACE_HAS_STANDARD_CPP_LIBRARY */ - -template ACE_INLINE X * -ACE_Auto_Ptr::operator-> () const -{ - ACE_TRACE ("ACE_Auto_Ptr::operator->"); - return this->get (); -} - -template ACE_INLINE X * -ACE_Auto_Basic_Array_Ptr::get (void) const -{ - ACE_TRACE ("ACE_Auto_Basic_Array_Ptr::get"); - return this->p_; -} - -template ACE_INLINE X * -ACE_Auto_Basic_Array_Ptr::release (void) -{ - ACE_TRACE ("ACE_Auto_Basic_Array_Ptr::release"); - X *old = this->p_; - this->p_ = 0; - return old; -} - -template ACE_INLINE void -ACE_Auto_Basic_Array_Ptr::reset (X *p) -{ - ACE_TRACE ("ACE_Auto_Basic_Array_Ptr::reset"); - if (this->get () != p) - delete [] this->get (); - this->p_ = p; -} - -template ACE_INLINE -ACE_Auto_Basic_Array_Ptr::ACE_Auto_Basic_Array_Ptr (ACE_Auto_Basic_Array_Ptr &rhs) - : p_ (rhs.release ()) -{ - ACE_TRACE ("ACE_Auto_Basic_Array_Ptr::ACE_Auto_Basic_Array_Ptr"); -} - -template ACE_INLINE ACE_Auto_Basic_Array_Ptr & -ACE_Auto_Basic_Array_Ptr::operator= (ACE_Auto_Basic_Array_Ptr &rhs) -{ - ACE_TRACE ("ACE_Auto_Basic_Array_Ptr::operator="); - if (this != &rhs) - { - this->reset (rhs.release ()); - } - return *this; -} - -template ACE_INLINE -ACE_Auto_Basic_Array_Ptr::~ACE_Auto_Basic_Array_Ptr (void) -{ - ACE_TRACE ("ACE_Auto_Basic_Array_Ptr::~ACE_Auto_Basic_Array_Ptr"); - delete [] this->get (); -} - -template ACE_INLINE X & -ACE_Auto_Basic_Array_Ptr::operator *() const -{ - return *this->get (); -} - -template ACE_INLINE X & -ACE_Auto_Basic_Array_Ptr::operator[](int i) const -{ - X *array = this->get (); - return array[i]; -} - -template ACE_INLINE X * -ACE_Auto_Array_Ptr::operator->() const -{ - return this->get (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Barrier.cpp b/dep/acelite/ace/Barrier.cpp deleted file mode 100644 index b55ee1c411a..00000000000 --- a/dep/acelite/ace/Barrier.cpp +++ /dev/null @@ -1,172 +0,0 @@ -// $Id: Barrier.cpp 92069 2010-09-28 11:38:59Z johnnyw $ - -#include "ace/Barrier.h" - -#if defined (ACE_HAS_THREADS) - -#if !defined (__ACE_INLINE__) -#include "ace/Barrier.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Guard_T.h" -#include "ace/OS_NS_errno.h" - -#if defined (ACE_HAS_DUMP) -# include "ace/Log_Msg.h" -#endif /* ACE_HAS_DUMP */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Sub_Barrier) - -void -ACE_Sub_Barrier::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_Sub_Barrier::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - this->barrier_finished_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("running_threads_ = %d\n"), this->running_threads_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Sub_Barrier::ACE_Sub_Barrier (unsigned int count, - ACE_Thread_Mutex &lock, - const ACE_TCHAR *name, - void *arg) - : barrier_finished_ (lock, name, arg), - running_threads_ (count) -{ -// ACE_TRACE ("ACE_Sub_Barrier::ACE_Sub_Barrier"); -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Barrier) - -void -ACE_Barrier::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_Barrier::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - this->lock_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("current_generation_ = %d"), this->current_generation_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ncount_ = %d"), this->count_)); - this->sub_barrier_1_.dump (); - this->sub_barrier_2_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Barrier::ACE_Barrier (unsigned int count, - const ACE_TCHAR *name, - void *arg) - : lock_ (name, (ACE_mutexattr_t *) arg), - current_generation_ (0), - count_ (count), - sub_barrier_1_ (count, lock_, name, arg), - sub_barrier_2_ (count, lock_, name, arg) -{ - ACE_TRACE ("ACE_Barrier::ACE_Barrier"); - this->sub_barrier_[0] = &this->sub_barrier_1_; - this->sub_barrier_[1] = &this->sub_barrier_2_; -} - -int -ACE_Barrier::wait (void) -{ - ACE_TRACE ("ACE_Barrier::wait"); - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); - - ACE_Sub_Barrier *sbp = - this->sub_barrier_[this->current_generation_]; - - // Check for shutdown... - if (sbp == 0) - { - errno = ESHUTDOWN; - return -1; - } - - int retval = 0; - - if (sbp->running_threads_ == 1) - { - // We're the last running thread, so swap generations and tell - // all the threads waiting on the barrier to continue on their - // way. - sbp->running_threads_ = this->count_; - // Swap generations. - this->current_generation_ = 1 - this->current_generation_; - sbp->barrier_finished_.broadcast (); - } - else - { - --sbp->running_threads_; - - // Block until all the other threads wait(). - while (sbp->running_threads_ != this->count_) - sbp->barrier_finished_.wait (); - - // We're awake and the count has completed. See if it completed - // because all threads hit the barrier, or because the barrier - // was shut down. - if (this->sub_barrier_[this->current_generation_] == 0) - { - errno = ESHUTDOWN; - retval = -1; - } - } - - return retval; -} - -int -ACE_Barrier::shutdown (void) -{ - ACE_TRACE ("ACE_Barrier::shutdown"); - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); - - ACE_Sub_Barrier *sbp = - this->sub_barrier_[this->current_generation_]; - - // Check for shutdown... - if (sbp == 0) - { - errno = ESHUTDOWN; - return -1; - } - - // Flag the shutdown - this->sub_barrier_[0] = 0; - this->sub_barrier_[1] = 0; - // Tell all the threads waiting on the barrier to continue on their way. - sbp->running_threads_ = this->count_; - sbp->barrier_finished_.broadcast (); - - return 0; -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Barrier) - -ACE_Thread_Barrier::ACE_Thread_Barrier (unsigned int count, - const ACE_TCHAR *name) - : ACE_Barrier (count, name) -{ -// ACE_TRACE ("ACE_Thread_Barrier::ACE_Thread_Barrier"); -} - -void -ACE_Thread_Barrier::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_Thread_Barrier::dump"); - ACE_Barrier::dump (); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_THREADS */ diff --git a/dep/acelite/ace/Barrier.h b/dep/acelite/ace/Barrier.h deleted file mode 100644 index e1e3815e190..00000000000 --- a/dep/acelite/ace/Barrier.h +++ /dev/null @@ -1,192 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Barrier.h - * - * $Id: Barrier.h 93359 2011-02-11 11:33:12Z mcorino $ - * - * Moved from Synch.h. - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_BARRIER_H -#define ACE_BARRIER_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include /**/ "ace/config-all.h" - -// ACE platform supports some form of threading. -#if !defined (ACE_HAS_THREADS) - -#include "ace/OS_NS_errno.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Barrier - * - * @brief This is a no-op to make ACE "syntactically consistent." - */ -class ACE_Export ACE_Barrier -{ -public: - ACE_Barrier (unsigned int, const ACE_TCHAR * = 0, void * = 0) {} - ~ACE_Barrier (void) {} - int wait (void) { ACE_NOTSUP_RETURN (-1); } - void dump (void) const {} -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#else /* ACE_HAS_THREADS */ - -#include "ace/Condition_Thread_Mutex.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -struct ACE_Export ACE_Sub_Barrier -{ - // = Initialization. - ACE_Sub_Barrier (unsigned int count, - ACE_Thread_Mutex &lock, - const ACE_TCHAR *name = 0, - void *arg = 0); - - ~ACE_Sub_Barrier (void); - - /// True if this generation of the barrier is done. - ACE_Condition_Thread_Mutex barrier_finished_; - - /// Number of threads that are still running. - int running_threads_; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -/** - * @class ACE_Barrier - * - * @brief Implements "barrier synchronization". - * - * This class allows number of threads to synchronize - * their completion of (one round of) a task, which is known as - * "barrier synchronization". After all the threads call - * on the barrier they are all atomically released and can begin a new - * round. - * - * This implementation uses a "sub-barrier generation numbering" - * scheme to avoid overhead and to ensure that all threads wait to - * leave the barrier correct. This code is based on an article from - * SunOpsis Vol. 4, No. 1 by Richard Marejka - * (Richard.Marejka@canada.sun.com). - */ -class ACE_Export ACE_Barrier -{ -public: - /// Initialize the barrier to synchronize @a count threads. - ACE_Barrier (unsigned int count, - const ACE_TCHAR *name = 0, - void *arg = 0); - - /// Default destructor. - ~ACE_Barrier (void); - - /// Block the caller until all @c count threads have called @c wait and - /// then allow all the caller threads to continue in parallel. - /// - /// @retval 0 after successfully waiting for all threads to wait. - /// @retval -1 if an error occurs or the barrier is shut - /// down (@sa shutdown ()). - int wait (void); - - /// Shut the barrier down, aborting the wait of all waiting threads. - /// Any threads waiting on the barrier when it is shut down will return with - /// value -1, errno ESHUTDOWN. - /// - /// @retval 0 for success, -1 if already shut down. - /// - /// @since ACE beta 5.4.9. - int shutdown (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Serialize access to the barrier state. - ACE_Thread_Mutex lock_; - - /// Either 0 or 1, depending on whether we are the first generation - /// of waiters or the next generation of waiters. - int current_generation_; - - /// Total number of threads that can be waiting at any one time. - int count_; - - /** - * We keep two @c sub_barriers, one for the first "generation" of - * waiters, and one for the next "generation" of waiters. This - * efficiently solves the problem of what to do if all the first - * generation waiters don't leave the barrier before one of the - * threads calls wait() again (i.e., starts up the next generation - * barrier). - */ - ACE_Sub_Barrier sub_barrier_1_; - ACE_Sub_Barrier sub_barrier_2_; - ACE_Sub_Barrier *sub_barrier_[2]; - -private: - // = Prevent assignment and initialization. - void operator= (const ACE_Barrier &); - ACE_Barrier (const ACE_Barrier &); -}; - -/** - * @class ACE_Thread_Barrier - * - * @brief Implements "barrier synchronization" using ACE_Thread_Mutexes! - * - * This class is just a simple wrapper for ACE_Barrier that - * selects the USYNC_THREAD variant for the locks. - */ -class ACE_Export ACE_Thread_Barrier : public ACE_Barrier -{ -public: - /// Create a Thread_Barrier, passing in the optional @a name. - ACE_Thread_Barrier (unsigned int count, const ACE_TCHAR *name = 0); - - /// Default destructor. - ~ACE_Thread_Barrier (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Barrier.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* !ACE_HAS_THREADS */ - -#include /**/ "ace/post.h" -#endif /* ACE_BARRIER_H */ diff --git a/dep/acelite/ace/Barrier.inl b/dep/acelite/ace/Barrier.inl deleted file mode 100644 index 10430d917a3..00000000000 --- a/dep/acelite/ace/Barrier.inl +++ /dev/null @@ -1,22 +0,0 @@ -// -*- C++ -*- -// -// $Id: Barrier.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Sub_Barrier::~ACE_Sub_Barrier (void) -{ -} - -ACE_INLINE -ACE_Barrier::~ACE_Barrier (void) -{ -} - -ACE_INLINE -ACE_Thread_Barrier::~ACE_Thread_Barrier (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Base_Thread_Adapter.cpp b/dep/acelite/ace/Base_Thread_Adapter.cpp deleted file mode 100644 index 4b7b6a84c08..00000000000 --- a/dep/acelite/ace/Base_Thread_Adapter.cpp +++ /dev/null @@ -1,130 +0,0 @@ -// $Id: Base_Thread_Adapter.cpp 95595 2012-03-07 13:33:25Z johnnyw $ - -#include "ace/Base_Thread_Adapter.h" - -#if !defined (ACE_HAS_INLINED_OSCALLS) -# include "ace/Base_Thread_Adapter.inl" -#endif /* ACE_HAS_INLINED_OSCALLS */ - -#if defined (ACE_HAS_TSS_EMULATION) -# include "ace/OS_NS_Thread.h" -#endif /* ACE_HAS_TSS_EMULATION */ - -#include "ace/Service_Config.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INIT_LOG_MSG_HOOK ACE_Base_Thread_Adapter::init_log_msg_hook_ = 0; -ACE_INHERIT_LOG_MSG_HOOK ACE_Base_Thread_Adapter::inherit_log_msg_hook_ = 0; -ACE_CLOSE_LOG_MSG_HOOK ACE_Base_Thread_Adapter::close_log_msg_hook_ = 0; -ACE_SYNC_LOG_MSG_HOOK ACE_Base_Thread_Adapter::sync_log_msg_hook_ = 0; -ACE_THR_DESC_LOG_MSG_HOOK ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_ = 0; - -ACE_Base_Thread_Adapter::ACE_Base_Thread_Adapter ( - ACE_THR_FUNC user_func, - void *arg, - ACE_THR_C_FUNC entry_point, - ACE_OS_Thread_Descriptor *td -#if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) - , ACE_SEH_EXCEPT_HANDLER selector - , ACE_SEH_EXCEPT_HANDLER handler -#endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ - , long cancel_flags - ) - : user_func_ (user_func) - , arg_ (arg) - , entry_point_ (entry_point) - , thr_desc_ (td) - , ctx_ (ACE_Service_Config::current()) - , flags_ (cancel_flags) -{ - ACE_OS_TRACE ("ACE_Base_Thread_Adapter::ACE_Base_Thread_Adapter"); - - if (ACE_Base_Thread_Adapter::init_log_msg_hook_ != 0) - (*ACE_Base_Thread_Adapter::init_log_msg_hook_) ( - this->log_msg_attributes_ -# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) - , selector - , handler -# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ - ); -#ifdef ACE_USES_GPROF - getitimer (ITIMER_PROF, &itimer_); -#endif // ACE_USES_GPROF -} - -ACE_Base_Thread_Adapter::~ACE_Base_Thread_Adapter (void) -{ -} - -void -ACE_Base_Thread_Adapter::inherit_log_msg (void) -{ - if (ACE_Base_Thread_Adapter::inherit_log_msg_hook_ != 0) - (*ACE_Base_Thread_Adapter::inherit_log_msg_hook_)( - this->thr_desc_, - this->log_msg_attributes_); - - // Initialize the proper configuration context for the new thread - // Placed here since inherit_log_msg() gets called from any of our - // descendants (before self-destructing) - ACE_Service_Config::current (this->ctx_); -} - -void -ACE_Base_Thread_Adapter::close_log_msg (void) -{ - if (ACE_Base_Thread_Adapter::close_log_msg_hook_ != 0) - (*ACE_Base_Thread_Adapter::close_log_msg_hook_) (); -} - -void -ACE_Base_Thread_Adapter::sync_log_msg (const ACE_TCHAR *prg) -{ - if (ACE_Base_Thread_Adapter::sync_log_msg_hook_ != 0) - (*ACE_Base_Thread_Adapter::sync_log_msg_hook_) (prg); -} - -ACE_OS_Thread_Descriptor::~ACE_OS_Thread_Descriptor (void) -{ -} - -ACE_OS_Thread_Descriptor * -ACE_Base_Thread_Adapter::thr_desc_log_msg (void) -{ - if (ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_ != 0) - return (*ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_) (); - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -// Run the thread entry point for the . This must -// be an extern "C" to make certain compilers happy... - -extern "C" ACE_THR_FUNC_RETURN -ACE_THREAD_ADAPTER_NAME (void *args) -{ - ACE_OS_TRACE ("ACE_THREAD_ADAPTER_NAME"); - -#if defined (ACE_HAS_TSS_EMULATION) - // As early as we can in the execution of the new thread, allocate - // its local TS storage. Allocate it on the stack, to save dynamic - // allocation/dealloction. - void *ts_storage[ACE_TSS_Emulation::ACE_TSS_THREAD_KEYS_MAX]; - ACE_TSS_Emulation::tss_open (ts_storage); -#endif /* ACE_HAS_TSS_EMULATION */ - - ACE_Base_Thread_Adapter * const thread_args = - static_cast (args); - -#ifdef ACE_USES_GPROF - setitimer (ITIMER_PROF, thread_args->timerval (), 0); -#endif // ACE_USES_GPROF - - // Invoke the user-supplied function with the args. - ACE_THR_FUNC_RETURN status = thread_args->invoke (); - - return status; -} - diff --git a/dep/acelite/ace/Base_Thread_Adapter.h b/dep/acelite/ace/Base_Thread_Adapter.h deleted file mode 100644 index 2075e9122ad..00000000000 --- a/dep/acelite/ace/Base_Thread_Adapter.h +++ /dev/null @@ -1,199 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Base_Thread_Adapter.h - * - * $Id: Base_Thread_Adapter.h 95595 2012-03-07 13:33:25Z johnnyw $ - * - * @author Nanbor Wang - */ -//============================================================================= - -#ifndef ACE_BASE_THREAD_ADAPTER_H -#define ACE_BASE_THREAD_ADAPTER_H -#include /**/ "ace/pre.h" - -#include "ace/OS_Log_Msg_Attributes.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include /**/ "ace/ACE_export.h" -#include "ace/OS_Log_Msg_Attributes.h" - -#ifdef ACE_USES_GPROF -#include "os_include/sys/os_time.h" -#endif // ACE_USES_GPROF - -#if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1) -# define ACE_THREAD_ADAPTER_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ace_thread_adapter) -#else -# define ACE_THREAD_ADAPTER_NAME ace_thread_adapter -#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */ - -/// Run the thread entry point for the ACE_Thread_Adapter. This must -/// be an extern "C" to make certain compilers happy... -extern "C" ACE_Export ACE_THR_FUNC_RETURN ACE_THREAD_ADAPTER_NAME (void *args); - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_OS_Thread_Descriptor - * - * @brief Parent class of all ACE_Thread_Descriptor classes. - * - * Container for ACE_Thread_Descriptor members that are - * used in ACE_OS. - */ -class ACE_Export ACE_OS_Thread_Descriptor -{ -public: - /// Get the thread creation flags. - long flags (void) const; - - virtual ~ACE_OS_Thread_Descriptor (void); - -protected: - /// For use by ACE_Thread_Descriptor. - ACE_OS_Thread_Descriptor (long flags = 0); - - /** - * Keeps track of whether this thread was created "detached" or not. - * If a thread is *not* created detached then if someone calls - * ACE_Thread_Manager::wait(), we need to join with that thread (and - * close down the handle). - */ - long flags_; -}; - -class ACE_Service_Gestalt; - -/** - * @class ACE_Base_Thread_Adapter - * - * @brief Base class for all the Thread_Adapters. - * - * Converts a C++ function into a function that can be - * called from a thread creation routine - * (e.g., pthread_create() or _beginthreadex()) that expects an - * extern "C" entry point. This class also makes it possible to - * transparently provide hooks to register a thread with an - * ACE_Thread_Manager. - * This class is used in ACE_OS::thr_create(). In general, the - * thread that creates an object of this class is different from - * the thread that calls @c invoke() on this object. Therefore, - * the @c invoke() method is responsible for deleting itself. - */ -class ACE_Export ACE_Base_Thread_Adapter -{ -public: - - virtual ~ACE_Base_Thread_Adapter (void); - - /// Virtual method invoked by the thread entry point. - virtual ACE_THR_FUNC_RETURN invoke (void) = 0; - - /// Accessor for the C entry point function to the OS thread creation - /// routine. - ACE_THR_C_FUNC entry_point (void); - -#ifdef ACE_USES_GPROF - /// Accessor to the itimer_ - /// followed http://sam.zoy.org/writings/programming/gprof.html - struct itimerval* timerval (void); -#endif // ACE_USES_PROF - - /// Invoke the close_log_msg_hook, if it is present - static void close_log_msg (void); - - /// Invoke the sync_log_msg_hook, if it is present - static void sync_log_msg (const ACE_TCHAR *prog_name); - - /// Invoke the thr_desc_log_msg_hook, if it is present - static ACE_OS_Thread_Descriptor *thr_desc_log_msg (void); - -protected: - /// Constructor. - ACE_Base_Thread_Adapter (ACE_THR_FUNC user_func, - void *arg, - ACE_THR_C_FUNC entry_point = (ACE_THR_C_FUNC) ACE_THREAD_ADAPTER_NAME, - ACE_OS_Thread_Descriptor *td = 0 -# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) - , ACE_SEH_EXCEPT_HANDLER selector = 0 - , ACE_SEH_EXCEPT_HANDLER handler = 0 -# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ - , long cancel_flags = 0 - ); - /// Inherit the logging features if the parent thread has an - /// ACE_Log_Msg. - void inherit_log_msg (void); - -private: - /// The hooks to inherit and cleanup the Log_Msg attributes - static ACE_INIT_LOG_MSG_HOOK init_log_msg_hook_; - static ACE_INHERIT_LOG_MSG_HOOK inherit_log_msg_hook_; - static ACE_CLOSE_LOG_MSG_HOOK close_log_msg_hook_; - static ACE_SYNC_LOG_MSG_HOOK sync_log_msg_hook_; - static ACE_THR_DESC_LOG_MSG_HOOK thr_desc_log_msg_hook_; - - /// Set the Log_Msg hooks - static void set_log_msg_hooks (ACE_INIT_LOG_MSG_HOOK init_hook, - ACE_INHERIT_LOG_MSG_HOOK inherit_hook, - ACE_CLOSE_LOG_MSG_HOOK close_hook, - ACE_SYNC_LOG_MSG_HOOK sync_hook, - ACE_THR_DESC_LOG_MSG_HOOK thr_desc); - - /// Allow the ACE_Log_Msg class to set its hooks. - friend class ACE_Log_Msg; - -protected: - /// Thread startup function passed in by the user (C++ linkage). - ACE_THR_FUNC user_func_; - - /// Argument to thread startup function. - void *arg_; - - /// Entry point to the underlying OS thread creation call (C - /// linkage). - ACE_THR_C_FUNC entry_point_; - - /** - * Optional thread descriptor. Passing this pointer in will force - * the spawned thread to cache this location in Log_Msg and wait - * until Thread_Manager fills in all information in thread - * descriptor. - */ - ACE_OS_Thread_Descriptor *thr_desc_; - - /// The ACE_Log_Msg attributes. - ACE_OS_Log_Msg_Attributes log_msg_attributes_; - - /// That is useful for gprof, define itimerval -#ifdef ACE_USES_GPROF - struct itimerval itimer_; -#endif // ACE_USES_GPROF - - /// Keep a reference to the configuration context that spawns the - /// thread so the child can inherit it. - ACE_Service_Gestalt * const ctx_; - - /// Pass through the thread-creation flags that can only be acted on by - /// the spawned thread. Currently this is only the cancellation-related - /// flags. - long flags_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -# if defined (ACE_HAS_INLINED_OSCALLS) -# if defined (ACE_INLINE) -# undef ACE_INLINE -# endif /* ACE_INLINE */ -# define ACE_INLINE inline -# include "ace/Base_Thread_Adapter.inl" -# endif /* ACE_HAS_INLINED_OSCALLS */ - -#include /**/ "ace/post.h" -#endif /* ACE_BASE_THREAD_ADAPTER_H */ diff --git a/dep/acelite/ace/Base_Thread_Adapter.inl b/dep/acelite/ace/Base_Thread_Adapter.inl deleted file mode 100644 index 3bac80246dd..00000000000 --- a/dep/acelite/ace/Base_Thread_Adapter.inl +++ /dev/null @@ -1,48 +0,0 @@ -// -*- C++ -*- -// -// $Id: Base_Thread_Adapter.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE long -ACE_OS_Thread_Descriptor::flags (void) const -{ - return flags_; -} - -ACE_INLINE -ACE_OS_Thread_Descriptor::ACE_OS_Thread_Descriptor (long flags) - : flags_ (flags) -{ -} - -ACE_INLINE void -ACE_Base_Thread_Adapter::set_log_msg_hooks ( - ACE_INIT_LOG_MSG_HOOK init_hook, - ACE_INHERIT_LOG_MSG_HOOK inherit_hook, - ACE_CLOSE_LOG_MSG_HOOK close_hook, - ACE_SYNC_LOG_MSG_HOOK sync_hook, - ACE_THR_DESC_LOG_MSG_HOOK thr_desc_hook) -{ - ACE_Base_Thread_Adapter::init_log_msg_hook_ = init_hook; - ACE_Base_Thread_Adapter::inherit_log_msg_hook_ = inherit_hook; - ACE_Base_Thread_Adapter::close_log_msg_hook_ = close_hook; - ACE_Base_Thread_Adapter::sync_log_msg_hook_ = sync_hook; - ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_ = thr_desc_hook; -} - -ACE_INLINE ACE_THR_C_FUNC -ACE_Base_Thread_Adapter::entry_point (void) -{ - return this->entry_point_; -} - -#ifdef ACE_USES_GPROF -ACE_INLINE itimerval* -ACE_Base_Thread_Adapter::timerval (void) -{ - return &(this->itimer_); -} -#endif // ACE_USES_GPROF - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Based_Pointer_Repository.cpp b/dep/acelite/ace/Based_Pointer_Repository.cpp deleted file mode 100644 index 4ebe8b82c7a..00000000000 --- a/dep/acelite/ace/Based_Pointer_Repository.cpp +++ /dev/null @@ -1,119 +0,0 @@ -// $Id: Based_Pointer_Repository.cpp 80826 2008-03-04 14:51:23Z wotte $ - -#include "ace/Map_Manager.h" -#include "ace/Based_Pointer_Repository.h" -#include "ace/Guard_T.h" -#include "ace/Null_Mutex.h" -#include "ace/Synch_Traits.h" -#include "ace/RW_Thread_Mutex.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Based_Pointer_Repository_Rep - * - * @brief Implementation for the ACE_Based_Pointer_Repository. - * - * Every memory pool in ACE binds it's mapping base address and - * the mapped size to this repository every time it maps/remaps a - * new chunk of memory successfully. - */ -class ACE_Based_Pointer_Repository_Rep -{ -public: - // Useful typedefs. - typedef ACE_Map_Manager MAP_MANAGER; - typedef ACE_Map_Iterator MAP_ITERATOR; - typedef ACE_Map_Entry MAP_ENTRY; - - /// Keeps track of the mapping between addresses and their associated - /// values. - MAP_MANAGER addr_map_; - - /// Synchronize concurrent access to the map. - ACE_SYNCH_MUTEX lock_; -}; - -ACE_Based_Pointer_Repository::ACE_Based_Pointer_Repository (void) -{ - ACE_TRACE ("ACE_Based_Pointer_Repository::ACE_Based_Pointer_Repository"); - ACE_NEW (this->rep_, - ACE_Based_Pointer_Repository_Rep); -} - -ACE_Based_Pointer_Repository::~ACE_Based_Pointer_Repository (void) -{ - ACE_TRACE ("ACE_Based_Pointer_Repository::~ACE_Based_Pointer_Repository"); - delete this->rep_; -} - -// Search for appropriate base address in repository - -int -ACE_Based_Pointer_Repository::find (void *addr, void *&base_addr) -{ - ACE_TRACE ("ACE_Based_Pointer_Repository::find"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->rep_->lock_, -1); - ACE_Based_Pointer_Repository_Rep::MAP_ENTRY *ce = 0; - - for (ACE_Based_Pointer_Repository_Rep::MAP_ITERATOR iter (this->rep_->addr_map_); - iter.next (ce) != 0; - iter.advance ()) - // Check to see if is within any of the regions. - if (addr >= ce->ext_id_ - && addr < ((char *)ce->ext_id_ + ce->int_id_)) - { - // Assign the base address. - base_addr = ce->ext_id_; - return 1; - } - - // Assume base address 0 (e.g., if new'ed). - base_addr = 0; - return 0; -} - -// Bind a new entry to the repository or update the size of an -// existing entry. - -int -ACE_Based_Pointer_Repository::bind (void *addr, size_t size) -{ - ACE_TRACE ("ACE_Based_Pointer_Repository::bind"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->rep_->lock_, -1); - - return this->rep_->addr_map_.rebind (addr, size); -} - -// Unbind a base from the repository. - -int -ACE_Based_Pointer_Repository::unbind (void *addr) -{ - ACE_TRACE ("ACE_Based_Pointer_Repository::unbind"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->rep_->lock_, -1); - ACE_Based_Pointer_Repository_Rep::MAP_ENTRY *ce = 0; - - // Search for service handlers that requested notification. - - for (ACE_Based_Pointer_Repository_Rep::MAP_ITERATOR iter (this->rep_->addr_map_); - iter.next (ce) != 0; - iter.advance ()) - { - // Check to see if is within any of the regions and if - // so, unbind the key from the map. - if (addr >= ce->ext_id_ - && addr < ((char *)ce->ext_id_ + ce->int_id_)) - // Unbind base address. - return this->rep_->addr_map_.unbind (ce->ext_id_); - } - - return 0; -} - -#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION) -template ACE_Singleton * - ACE_Singleton::singleton_; -#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Based_Pointer_Repository.h b/dep/acelite/ace/Based_Pointer_Repository.h deleted file mode 100644 index d549ce15326..00000000000 --- a/dep/acelite/ace/Based_Pointer_Repository.h +++ /dev/null @@ -1,94 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Based_Pointer_Repository.h - * - * $Id: Based_Pointer_Repository.h 84837 2009-03-16 13:01:15Z johnnyw $ - * - * @author Dietrich Quehl - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_BASED_POINTER_REPOSITORY_H -#define ACE_BASED_POINTER_REPOSITORY_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Singleton.h" -#include "ace/Synch_Traits.h" -#include "ace/os_include/os_stddef.h" - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward decl., using the "Cheshire Cat" technique. -class ACE_Based_Pointer_Repository_Rep; - -/** - * @class ACE_Based_Pointer_Repository - * - * @brief Maps pointers to the base address of the region to which each - * pointer belongs. - */ -class ACE_Export ACE_Based_Pointer_Repository -{ -public: - // = Use ACE_Null_Mutex to allow locking while iterating. - - // = Initialization and termination methods. - ACE_Based_Pointer_Repository (void); - ~ACE_Based_Pointer_Repository (void); - - // = Search structure methods. - /** - * Return the appropriate @a base_addr region that contains @a addr. - * Returns 1 on success and 0 if the @a addr isn't contained in any - * @a base_addr region. - */ - int find (void *addr, - void *&base_addr); - - /// Bind a new entry to the repository or update the size of an - /// existing entry. Returns 0 on success and -1 on failure. - int bind (void *addr, - size_t size); - - /// Unbind from the repository the that @a addr is - /// contained within. - int unbind (void *addr); - -private: - - /// Use the "Cheshire-Cat" technique to hide the implementation in - /// order to avoid circular #include dependencies. - ACE_Based_Pointer_Repository_Rep *rep_; - -private: - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Based_Pointer_Repository &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Based_Pointer_Repository (const ACE_Based_Pointer_Repository &)) -}; - -// ---------------------------------- - -/// Declare a process wide singleton -ACE_SINGLETON_DECLARE (ACE_Singleton, - ACE_Based_Pointer_Repository, - ACE_SYNCH_RW_MUTEX) - -/// Provide a Singleton access point to the based pointer repository. -typedef ACE_Singleton - ACE_BASED_POINTER_REPOSITORY; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_BASED_POINTER_REPOSITORY_H */ diff --git a/dep/acelite/ace/Based_Pointer_T.cpp b/dep/acelite/ace/Based_Pointer_T.cpp deleted file mode 100644 index b85774db48d..00000000000 --- a/dep/acelite/ace/Based_Pointer_T.cpp +++ /dev/null @@ -1,121 +0,0 @@ -// $Id: Based_Pointer_T.cpp 80826 2008-03-04 14:51:23Z wotte $ - -#ifndef ACE_BASED_POINTER_T_CPP -#define ACE_BASED_POINTER_T_CPP - -#include "ace/Based_Pointer_T.h" -#include "ace/Based_Pointer_Repository.h" -#include "ace/Log_Msg.h" - -# define ACE_TRACEX(X) ACE_Trace ____ (ACE_TEXT (X), __LINE__, ACE_TEXT (__FILE__)) - -#if !defined (__ACE_INLINE__) -#include "ace/Based_Pointer_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Based_Pointer::ACE_Based_Pointer (void) -{ - ACE_TRACE ("ACE_Based_Pointer::ACE_Based_Pointer"); -} - -template void -ACE_Based_Pointer_Basic::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Based_Pointer_Basic::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ntarget_ = %d\n"), this->target_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("base_offset_ = %d\n"), this->base_offset_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("computed pointer = %x\n"), - (CONCRETE *)(ACE_COMPUTE_BASED_POINTER (this)))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Based_Pointer::ACE_Based_Pointer (CONCRETE *initial) - : ACE_Based_Pointer_Basic (initial) -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic"); -} - -template -ACE_Based_Pointer::ACE_Based_Pointer (const void* base_addr, int) - : ACE_Based_Pointer_Basic (base_addr, 0) -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic"); -} - -template -ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic (void) - : target_ (0), - base_offset_ (0) -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic"); - void *base_addr = 0; - - // Find the base address associated with our pointer. Note - // that it's ok for to return 0, which simply indicates that - // the address is not in memory-mapped virtual address space. - ACE_BASED_POINTER_REPOSITORY::instance ()->find (this, - base_addr); - this->base_offset_ = (char *) this - (char *) base_addr; -} - -template -ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic (const void *base_addr, int) - : target_ (0), - base_offset_ (0) -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic"); - this->base_offset_ = (char *) this - (char *) base_addr; -} - -template -ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic (CONCRETE *rhs) - : target_ (0), - base_offset_ (0) -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic"); - - if (rhs == 0) - // Store a value of that indicate "NULL" pointer. - this->target_ = -1; - else - { - void *base_addr = 0; - - // Find the base address associated with the pointer. - // Note that it's ok for to return 0, which simply - // indicates that the address is not in memory-mapped virtual - // address space. - ACE_BASED_POINTER_REPOSITORY::instance ()->find (this, - base_addr); - this->base_offset_ = (char *) this - (char *) base_addr; - this->target_ = ((char *) rhs - (char *) base_addr); - } -} - -template -ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic (const ACE_Based_Pointer_Basic &) -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic"); - - ACE_ASSERT (0); // not implemented. -} - -template -ACE_Based_Pointer::ACE_Based_Pointer (const ACE_Based_Pointer &rhs) - : ACE_Based_Pointer_Basic (rhs) -{ - ACE_TRACE ("ACE_Based_Pointer::ACE_Based_Pointer"); - ACE_ASSERT (0); // not implemented. -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_BASED_POINTER_T_CPP */ diff --git a/dep/acelite/ace/Based_Pointer_T.h b/dep/acelite/ace/Based_Pointer_T.h deleted file mode 100644 index 802e73ca0d3..00000000000 --- a/dep/acelite/ace/Based_Pointer_T.h +++ /dev/null @@ -1,205 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Based_Pointer_T.h - * - * $Id: Based_Pointer_T.h 81705 2008-05-15 14:02:02Z johnnyw $ - * - * @author Dietrich Quehl - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_BASED_POINTER_T_H -#define ACE_BASED_POINTER_T_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" -#include "ace/Basic_Types.h" - -#if defined (_MSC_VER) -// Suppress warning e.g. "return type for -// 'ACE_Based_Pointer::operator ->' is 'long *' (i.e., not a UDT -// or reference to a UDT. Will produce errors if applied using infix -// notation)" -#pragma warning(disable: 4284) -#endif /* _MSC_VER */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Based_Pointer_Basic - * - * @brief A proxy that keeps track of the relative offset of a "pointer" - * from its base address. - * This class makes it possible to transparently use "pointers" in - * shared memory as easily as programming with pointers to local - * memory. In particular, we don't need to ensure that the base - * addresses of all the pointers are mapped into separate - * processes at the same absolute memory base address. - */ -template -class ACE_Based_Pointer_Basic -{ -public: - /** - * This constructor initializes the by asking the - * Singleton for the base address of - * the memory region within which it is instantiated. Two results - * are possible: - * - * 1. An has stored a base address/size pair and the - * new based-pointer instance is located between the base address and - * the base address + size - 1. In this case, the repository - * returns the base address. - * - * 2. No suitable address/size pair was found. The repository - * assumes an address in the regular (not mapped) virtual address - * space of the process and returns 0. In this case, the - * based-pointer uses its address as an offset to it's base - * address 0. - */ - ACE_Based_Pointer_Basic (void); - - /** - * Initialize this object using the @a initial pointer. This - * constructor initializes the by asking the - * Singleton for the base address of - * the memory region within which it is instantiated. Three results - * are possible: - * - * 1. An has stored a base address/size pair and the - * new based-pointer instance is located between the base address and - * the base address + size - 1. In this case, the repository - * returns the base address. - * - * 2. No suitable address/size pair was found. The repository - * assumes an address in the regular (not mapped) virtual address - * space of the process and returns 0. In this case, the - * based-pointer uses its address as an offset to its base - * address 0. - * - * 3. If @a initial is 0 then set the value of to -1, which - * indicates a "NULL" pointer. - */ - ACE_Based_Pointer_Basic (CONCRETE *initial); - - /// Copy constructor. - ACE_Based_Pointer_Basic (const ACE_Based_Pointer_Basic &); - - /// Constructor for know base address. @a o is only used to - /// resolve overload ambiguity. - ACE_Based_Pointer_Basic (const void *base_addr, int o); - - /// Pseudo-assignment operator. - void operator = (CONCRETE *from); - - /// Pseudo-assignment operator. - void operator = (const ACE_Based_Pointer_Basic &); - - /// Dereference operator. - CONCRETE operator * (void) const; - - /// Less than operator. - bool operator < (const ACE_Based_Pointer_Basic &) const; - - /// Less than or equal operator. - bool operator <= (const ACE_Based_Pointer_Basic &) const; - - /// Greater than operator. - bool operator > (const ACE_Based_Pointer_Basic &) const; - - /// Greater than or equal operator. - bool operator >= (const ACE_Based_Pointer_Basic &) const; - - /// Equality operator. - bool operator == (const ACE_Based_Pointer_Basic &) const; - - /// Inequality operator. - bool operator != (const ACE_Based_Pointer_Basic &) const; - - /// Subscript operator. - CONCRETE operator [](int index) const; - - /// Increment operator. - void operator+= (int index); - - /// Returns the underlying memory address of the smart pointer. - operator CONCRETE *() const; - - /// Returns the underlying memory address of the smart pointer. - CONCRETE *addr (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - /// Dump the state of the object. - void dump (void) const; - -protected: - ptrdiff_t target_; - - /// Keep track of our offset from the base pointer. - ptrdiff_t base_offset_; -}; - -/** - * @class ACE_Based_Pointer - * - * @brief A smart proxy that keeps track of the relative offset of a - * "pointer" from its base address. - * - * This class makes it possible to transparently use "pointers" in - * shared memory as easily as programming with pointers to local - * memory by overloading the C++ delegation operator ->(). - */ -template -class ACE_Based_Pointer : public ACE_Based_Pointer_Basic -{ -public: - // = Initialization method. - /// Constructor. See constructor for ACE_Based_Pointer_Basic for - /// details. - ACE_Based_Pointer (void); - - /// Initialize this object using the pointer. See - /// constructor for ACE_Based_Pointer_Basic for details. - ACE_Based_Pointer (CONCRETE *initial); - - /// Initialize this object with known @a base_addr. @a dummy is - /// a dummy value used to resolve overload ambiguity and it - /// otherwise ignored. - ACE_Based_Pointer (const void *base_addr, int dummy); - - /// Copy constructor (not implemented yet). - ACE_Based_Pointer (const ACE_Based_Pointer &); - - /// Assignment operator. - void operator = (const ACE_Based_Pointer &); - - /// Pseudo-assignment operator. - void operator = (CONCRETE *from); - - /// The C++ "delegation operator". - CONCRETE *operator-> (void); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Based_Pointer_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Based_Pointer_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Based_Pointer_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_BASED_POINTER_T_H */ diff --git a/dep/acelite/ace/Based_Pointer_T.inl b/dep/acelite/ace/Based_Pointer_T.inl deleted file mode 100644 index ba6a5aa511b..00000000000 --- a/dep/acelite/ace/Based_Pointer_T.inl +++ /dev/null @@ -1,139 +0,0 @@ -// -*- C++ -*- -// -// $Id: Based_Pointer_T.inl 81705 2008-05-15 14:02:02Z johnnyw $ - -#define ACE_COMPUTE_BASED_POINTER(P) (((char *) (P) - (P)->base_offset_) + (P)->target_) -#include "ace/Global_Macros.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE CONCRETE * -ACE_Based_Pointer::operator->(void) -{ - ACE_TRACE ("ACE_Based_Pointer::operator->"); - return reinterpret_cast (ACE_COMPUTE_BASED_POINTER (this)); -} - -template ACE_INLINE void -ACE_Based_Pointer_Basic::operator = (CONCRETE *rhs) -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::operator ="); - if (rhs == 0) - // Store a value of that indicate "NULL" pointer. - this->target_ = -1; - else - this->target_ = ((char *) rhs - - ((char *) this - this->base_offset_)); -} - -template ACE_INLINE void -ACE_Based_Pointer::operator = (CONCRETE *rhs) -{ - ACE_TRACE ("ACE_Based_Pointer::operator ="); - if (rhs == 0) - // Store a value of that indicate "NULL" pointer. - this->target_ = -1; - else - this->target_ = ((char *) rhs - - ((char *) this - this->base_offset_)); -} - -template ACE_INLINE CONCRETE -ACE_Based_Pointer_Basic::operator *(void) const -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::operator *"); - return *reinterpret_cast (ACE_COMPUTE_BASED_POINTER (this)); -} - -template ACE_INLINE CONCRETE * -ACE_Based_Pointer_Basic::addr (void) const -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::addr"); - - if (this->target_ == -1) - return 0; - else - return reinterpret_cast (ACE_COMPUTE_BASED_POINTER (this)); -} - -template ACE_INLINE -ACE_Based_Pointer_Basic::operator CONCRETE *() const -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::operator CONCRETE *()"); - - return this->addr (); -} - -template ACE_INLINE CONCRETE -ACE_Based_Pointer_Basic::operator [] (int index) const -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::operator []"); - CONCRETE *c = - reinterpret_cast (ACE_COMPUTE_BASED_POINTER (this)); - return c[index]; -} - -template ACE_INLINE void -ACE_Based_Pointer_Basic::operator += (int index) -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::operator +="); - this->base_offset_ += (index * sizeof (CONCRETE)); -} - -template ACE_INLINE bool -ACE_Based_Pointer_Basic::operator == (const ACE_Based_Pointer_Basic &rhs) const -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::operator =="); - return ACE_COMPUTE_BASED_POINTER (this) == ACE_COMPUTE_BASED_POINTER (&rhs); -} - -template ACE_INLINE bool -ACE_Based_Pointer_Basic::operator != (const ACE_Based_Pointer_Basic &rhs) const -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::operator !="); - return !(*this == rhs); -} - -template ACE_INLINE bool -ACE_Based_Pointer_Basic::operator < (const ACE_Based_Pointer_Basic &rhs) const -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::operator <"); - return ACE_COMPUTE_BASED_POINTER (this) < ACE_COMPUTE_BASED_POINTER (&rhs); -} - -template ACE_INLINE bool -ACE_Based_Pointer_Basic::operator <= (const ACE_Based_Pointer_Basic &rhs) const -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::operator <="); - return ACE_COMPUTE_BASED_POINTER (this) <= ACE_COMPUTE_BASED_POINTER (&rhs); -} - -template ACE_INLINE bool -ACE_Based_Pointer_Basic::operator > (const ACE_Based_Pointer_Basic &rhs) const -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::operator >"); - return ACE_COMPUTE_BASED_POINTER (this) > ACE_COMPUTE_BASED_POINTER (&rhs); -} - -template ACE_INLINE bool -ACE_Based_Pointer_Basic::operator >= (const ACE_Based_Pointer_Basic &rhs) const -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::operator >="); - return ACE_COMPUTE_BASED_POINTER (this) >= ACE_COMPUTE_BASED_POINTER (&rhs); -} - -template ACE_INLINE void -ACE_Based_Pointer_Basic::operator= (const ACE_Based_Pointer_Basic &rhs) -{ - ACE_TRACE ("ACE_Based_Pointer_Basic::operator="); - *this = rhs.addr (); -} - -template ACE_INLINE void -ACE_Based_Pointer::operator= (const ACE_Based_Pointer &rhs) -{ - ACE_TRACE ("ACE_Based_Pointer::operator="); - *this = rhs.addr (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Basic_Stats.cpp b/dep/acelite/ace/Basic_Stats.cpp deleted file mode 100644 index 93c4c0bdde8..00000000000 --- a/dep/acelite/ace/Basic_Stats.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// $Id: Basic_Stats.cpp 95743 2012-05-13 12:29:28Z johnnyw $ - -#include "ace/Basic_Stats.h" -#include "ace/Log_Msg.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Basic_Stats.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -void -ACE_Basic_Stats::accumulate (const ACE_Basic_Stats &rhs) -{ - if (rhs.samples_count_ == 0) - return; - - if (this->samples_count_ == 0) - { - this->min_ = rhs.min_; - this->min_at_ = rhs.min_at_; - - this->max_ = rhs.max_; - this->max_at_ = rhs.max_at_; - } - else - { - if (this->min_ > rhs.min_) - { - this->min_ = rhs.min_; - this->min_at_ = rhs.min_at_; - } - if (this->max_ < rhs.max_) - { - this->max_ = rhs.max_; - this->max_at_ = rhs.max_at_; - } - } - - this->samples_count_ += rhs.samples_count_; - this->sum_ += rhs.sum_; -} - -void -ACE_Basic_Stats::dump_results ( - const ACE_TCHAR *msg, - ACE_Basic_Stats::scale_factor_type sf) const -{ -#ifndef ACE_NLOGGING - if (this->samples_count () == 0u) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("%s : no data collected\n"), msg)); - return; - } - - ACE_UINT64 avg = this->sum_ / this->samples_count_; - - ACE_UINT64 l_min = this->min_ / sf; - ACE_UINT64 l_max = this->max_ / sf; - ACE_UINT64 l_avg = avg / sf; - - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("%s latency : %Q[%d]/%Q/%Q[%d] (min/avg/max)\n"), - msg, - l_min, this->min_at_, - l_avg, - l_max, this->max_at_)); - -#else - ACE_UNUSED_ARG (msg); - ACE_UNUSED_ARG (sf); -#endif /* ACE_NLOGGING */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Basic_Stats.h b/dep/acelite/ace/Basic_Stats.h deleted file mode 100644 index eb6c393b904..00000000000 --- a/dep/acelite/ace/Basic_Stats.h +++ /dev/null @@ -1,92 +0,0 @@ - -//============================================================================= -/** - * @file Basic_Stats.h - * - * $Id: Basic_Stats.h 95743 2012-05-13 12:29:28Z johnnyw $ - * - * @author Carlos O'Ryan - */ -//============================================================================= - -#ifndef ACE_BASIC_STATS_H -#define ACE_BASIC_STATS_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" -#include "ace/Basic_Types.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/// Collect basic stats about a series of samples -/** - * Compute the average and standard deviation (aka jitter) for an - * arbitrary number of samples, using constant space. - * Normally used for latency statistics. - */ -class ACE_Export ACE_Basic_Stats -{ -public: -#if !defined (ACE_WIN32) - typedef ACE_UINT32 scale_factor_type; -#else - typedef ACE_UINT64 scale_factor_type; -#endif - - /// Constructor - /** - * The number of samples is pre-allocated, and cannot changes once - * the class is initialized. - */ - ACE_Basic_Stats (void); - - /// The number of samples received so far - ACE_UINT32 samples_count (void) const; - - /// Record one sample. - void sample (ACE_UINT64 value); - - /// Update the values to reflect the stats in @a rhs. - void accumulate (const ACE_Basic_Stats &rhs); - - /// Dump all the samples - /** - * Prints out the results, using @a msg as a prefix for each message and - * scaling all the numbers by @a scale_factor. The latter is useful because - * high resolution timer samples are acquired in clock ticks, but often - * presented in microseconds. - */ - void dump_results (const ACE_TCHAR *msg, - scale_factor_type scale_factor) const; - - /// The number of samples - ACE_UINT32 samples_count_; - - /// The minimum value - ACE_UINT64 min_; - - /// The number of the sample that had the minimum value - ACE_UINT32 min_at_; - - /// The maximum value - ACE_UINT64 max_; - - /// The number of the sample that had the maximum value - ACE_UINT32 max_at_; - - /// The sum of all the values - ACE_UINT64 sum_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Basic_Stats.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_BASIC_STATS_H */ diff --git a/dep/acelite/ace/Basic_Stats.inl b/dep/acelite/ace/Basic_Stats.inl deleted file mode 100644 index e2f153884e3..00000000000 --- a/dep/acelite/ace/Basic_Stats.inl +++ /dev/null @@ -1,53 +0,0 @@ -// -*- C++ -*- -// -// $Id: Basic_Stats.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Basic_Stats::ACE_Basic_Stats (void) - : samples_count_ (0) - , min_ (0) - , min_at_ (0) - , max_ (0) - , max_at_ (0) - , sum_ (0) -{ -} - -ACE_INLINE ACE_UINT32 -ACE_Basic_Stats::samples_count (void) const -{ - return this->samples_count_; -} - -ACE_INLINE void -ACE_Basic_Stats::sample (ACE_UINT64 value) -{ - ++this->samples_count_; - - if (this->samples_count_ == 1u) - { - this->min_ = value; - this->min_at_ = this->samples_count_; - this->max_ = value; - this->max_at_ = this->samples_count_; - } - else - { - if (this->min_ > value) - { - this->min_ = value; - this->min_at_ = this->samples_count_; - } - if (this->max_ < value) - { - this->max_ = value; - this->max_at_ = this->samples_count_; - } - } - - this->sum_ += value; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Basic_Types.cpp b/dep/acelite/ace/Basic_Types.cpp deleted file mode 100644 index c915dabee17..00000000000 --- a/dep/acelite/ace/Basic_Types.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// $Id: Basic_Types.cpp 95763 2012-05-16 06:43:51Z johnnyw $ - -#include "ace/Basic_Types.h" diff --git a/dep/acelite/ace/Basic_Types.h b/dep/acelite/ace/Basic_Types.h deleted file mode 100644 index fc275ee314b..00000000000 --- a/dep/acelite/ace/Basic_Types.h +++ /dev/null @@ -1,683 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Basic_Types.h - * - * $Id: Basic_Types.h 96017 2012-08-08 22:18:09Z mitza $ - * - * @author David L. Levine - * - * #defines the list of preprocessor macros below. The config.h file can - * pre-define any of these to short-cut the definitions. This is usually - * only necessary if the preprocessor does all of its math using integers. - * - * Sizes of built-in types: - * - ACE_SIZEOF_CHAR - * - ACE_SIZEOF_WCHAR - * - ACE_SIZEOF_SHORT - * - ACE_SIZEOF_INT - * - ACE_SIZEOF_LONG - * - ACE_SIZEOF_LONG_LONG - * - ACE_SIZEOF_VOID_P - * - ACE_SIZEOF_FLOAT - * - ACE_SIZEOF_DOUBLE - * - ACE_SIZEOF_LONG_DOUBLE - * - * Wrappers for built-in types of specific sizes: - * - ACE_INT8 - * - ACE_UINT8 - * - ACE_INT16 - * - ACE_UINT16 - * - ACE_INT32 - * - ACE_UINT32 - * - ACE_UINT64 - * - ACE_INT64 - * - * Byte-order (endian-ness) determination: - * ACE_BYTE_ORDER, to either ACE_BIG_ENDIAN or ACE_LITTLE_ENDIAN - */ -//============================================================================= - -#include "ace/config-lite.h" - -#ifndef ACE_BASIC_TYPES_H -# define ACE_BASIC_TYPES_H - -# include /**/ "ace/pre.h" - -# if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -# endif /* ACE_LACKS_PRAGMA_ONCE */ - -// Pull in definitions -# include "ace/os_include/os_limits.h" // Integer limits -# include "ace/os_include/os_float.h" // Floating point limits -# include "ace/os_include/os_stdlib.h" // Other types -# include "ace/os_include/os_stddef.h" // Get ptrdiff_t - see further comments below - -# include "ace/os_include/sys/os_types.h" - -# if !defined (ACE_LACKS_SYS_PARAM_H) -# include /**/ -# endif /* ACE_LACKS_SYS_PARAM_H */ - -# include "ace/ACE_export.h" - -# if !defined (ACE_LACKS_STDINT_H) -# include -# endif -# if !defined (ACE_LACKS_INTTYPES_H) -# include -# endif - -#ifdef ACE_LACKS_INTPTR_T -# include "ace/If_Then_Else.h" - -// This intptr_t typedef is here instead of -// since it depends on the template -// metaprogramming in . - -// We could compare ACE_SIZEOF_VOID_P against ACE_SIZEOF_LONG, etc. -// However, that depends on the ACE preprocessor symbol definitions in -// the platform-specific configuration header being correct. -// The template meta-programming approach we take below, -// i.e. determining the type at compile-time rather than at -// preprocessing-time, will work for all platforms, and does not -// depend on ACE developer-defined configuration parameters. - -typedef ACE::If_Then_Else< - (sizeof (void*) == sizeof (signed int)), - signed int, - ACE::If_Then_Else< - (sizeof (void*) == sizeof (signed long)), - signed long, - ACE::If_Then_Else< - (sizeof (void*) == sizeof (signed long long)), - signed long long, - void /* Unknown. Force an invalid type */ - >::result_type - >::result_type - >::result_type intptr_t; - -typedef ACE::If_Then_Else< - (sizeof (void*) == sizeof (unsigned int)), - unsigned int, - ACE::If_Then_Else< - (sizeof (void*) == sizeof (unsigned long)), - unsigned long, - ACE::If_Then_Else< - (sizeof (void*) == sizeof (unsigned long long)), - unsigned long long, - void /* Unknown. Force an invalid type */ - >::result_type - >::result_type - >::result_type uintptr_t; - -#endif /* ACE_LACKS_INTPTR_T */ - -// A char always has 1 byte, by definition. -# define ACE_SIZEOF_CHAR 1 - -// Unfortunately, there isn't a portable way to determine the size of a wchar. -// So we just define them on a platform basis. If the platform doesn't -// define it and it's an XPG4 system, assume wchar_t is 4 bytes. Some code -// uses ACE_SIZEOF_WCHAR in preprocessor statements, so sizeof() isn't valid. -// If the platform config doesn't set this, and this guess is wrong, -// Basic_Types_Test should catch the inconsistency. -# if defined (ACE_HAS_WCHAR) -# if !defined (ACE_SIZEOF_WCHAR) -# if defined (ACE_HAS_XPG4_MULTIBYTE_CHAR) -# define ACE_SIZEOF_WCHAR 4 -# else -// 0 so the Basic_Types test will catch this. -# define ACE_SIZEOF_WCHAR 0 -# endif /* ACE_HAS_XPG4_MULTIBYTE_CHAR */ -# endif /* !ACE_SIZEOF_WCHAR */ -# endif /* ACE_HAS_WCHAR */ - -// The number of bytes in a short. -# if !defined (ACE_SIZEOF_SHORT) -# if (USHRT_MAX) == 255U -# define ACE_SIZEOF_SHORT 1 -# elif (USHRT_MAX) == 65535U -# define ACE_SIZEOF_SHORT 2 -# elif (USHRT_MAX) == 4294967295U -# define ACE_SIZEOF_SHORT 4 -# elif (USHRT_MAX) == 18446744073709551615U -# define ACE_SIZEOF_SHORT 8 -# else -# error: unsupported short size, must be updated for this platform! -# endif /* USHRT_MAX */ -# endif /* !defined (ACE_SIZEOF_SHORT) */ - -// The number of bytes in an int. -# if !defined (ACE_SIZEOF_INT) -# if (UINT_MAX) == 65535U -# define ACE_SIZEOF_INT 2 -# elif (UINT_MAX) == 4294967295U -# define ACE_SIZEOF_INT 4 -# elif (UINT_MAX) == 18446744073709551615U -# define ACE_SIZEOF_INT 8 -# else -# error: unsupported int size, must be updated for this platform! -# endif /* UINT_MAX */ -# endif /* !defined (ACE_SIZEOF_INT) */ - -// The number of bytes in a long. -# if !defined (ACE_SIZEOF_LONG) -# if (ULONG_MAX) == 65535UL -# define ACE_SIZEOF_LONG 2 -# elif ((ULONG_MAX) == 4294967295UL) -# define ACE_SIZEOF_LONG 4 -# elif ((ULONG_MAX) == 18446744073709551615UL) -# define ACE_SIZEOF_LONG 8 -# else -# error: unsupported long size, must be updated for this platform! -# endif /* ULONG_MAX */ -# endif /* !defined (ACE_SIZEOF_LONG) */ - -// The number of bytes in a long long. -# if !defined (ACE_SIZEOF_LONG_LONG) -# if defined (ULLONG_MAX) -# if ((ULLONG_MAX) == 4294967295ULL) -# define ACE_SIZEOF_LONG_LONG 4 -# elif ((ULLONG_MAX) == 18446744073709551615ULL) -# define ACE_SIZEOF_LONG_LONG 8 -# endif -# elif defined (ULONGLONG_MAX) -# if ((ULONGLONG_MAX) == 4294967295ULL) -# define ACE_SIZEOF_LONG_LONG 4 -# elif ((ULONGLONG_MAX) == 18446744073709551615ULL) -# define ACE_SIZEOF_LONG_LONG 8 -# endif -# endif -# // If we can't determine the size of long long, assume it is 8 -# // instead of erroring out. (Either ULLONG_MAX and ULONGLONG_MAX -# // may not be supported; or an extended C/C++ dialect may need to -# // be selected. If this assumption is wrong, it can be addressed -# // in the platform-specific config header. -# if !defined (ACE_SIZEOF_LONG_LONG) -# define ACE_SIZEOF_LONG_LONG 8 -# endif -# endif /* !defined (ACE_SIZEOF_LONG_LONG) */ - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// The sizes of the commonly implemented types are now known. Set up -// typedefs for whatever we can. Some of these are needed for certain -// cases of ACE_UINT64, so do them before the 64-bit stuff. - -#if defined (ACE_INT8_TYPE) - typedef ACE_INT8_TYPE ACE_INT8; -#elif defined (ACE_HAS_INT8_T) - typedef int8_t ACE_INT8; -#elif !defined (ACE_LACKS_SIGNED_CHAR) - typedef signed char ACE_INT8; -#else - typedef char ACE_INT8; -#endif /* defined (ACE_INT8_TYPE) */ - -#if defined (ACE_UINT8_TYPE) - typedef ACE_UINT8_TYPE ACE_UINT8; -#elif defined (ACE_HAS_UINT8_T) - typedef uint8_t ACE_UINT8; -#else - typedef unsigned char ACE_UINT8; -#endif /* defined (ACE_UINT8_TYPE) */ - -#if defined (ACE_INT16_TYPE) - typedef ACE_INT16_TYPE ACE_INT16; -#elif defined (ACE_HAS_INT16_T) - typedef int16_t ACE_INT16; -#elif ACE_SIZEOF_SHORT == 2 - typedef short ACE_INT16; -#elif ACE_SIZEOF_INT == 2 - typedef int ACE_INT16; -#else -# error Have to add to the ACE_INT16 type setting -#endif /* defined (ACE_INT16_TYPE) */ - -#if defined (ACE_UINT16_TYPE) - typedef ACE_UINT16_TYPE ACE_UINT16; -#elif defined (ACE_HAS_UINT16_T) - typedef uint16_t ACE_UINT16; -#elif ACE_SIZEOF_SHORT == 2 - typedef unsigned short ACE_UINT16; -#elif ACE_SIZEOF_INT == 2 - typedef unsigned int ACE_UINT16; -#else -# error Have to add to the ACE_UINT16 type setting -#endif /* defined (ACE_UINT16_TYPE) */ - -#if defined (ACE_INT32_TYPE) - typedef ACE_INT32_TYPE ACE_INT32; -#elif defined (ACE_HAS_INT32_T) - typedef int32_t ACE_INT32; -#elif ACE_SIZEOF_INT == 4 - typedef int ACE_INT32; -#elif ACE_SIZEOF_LONG == 4 - typedef long ACE_INT32; -#else -# error Have to add to the ACE_INT32 type setting -#endif /* defined (ACE_INT32_TYPE) */ - -#if defined (ACE_UINT32_TYPE) - typedef ACE_UINT32_TYPE ACE_UINT32; -#elif defined (ACE_HAS_UINT32_T) - typedef uint32_t ACE_UINT32; -#elif ACE_SIZEOF_INT == 4 - typedef unsigned int ACE_UINT32; -#elif ACE_SIZEOF_LONG == 4 - typedef unsigned long ACE_UINT32; -#else -# error Have to add to the ACE_UINT32 type setting -#endif /* defined (ACE_UINT32_TYPE) */ - -#if defined (ACE_INT64_TYPE) - typedef ACE_INT64_TYPE ACE_INT64; -#elif defined (ACE_HAS_INT64_T) - typedef int64_t ACE_INT64; -#elif ACE_SIZEOF_LONG == 8 - typedef long ACE_INT64; -#elif ACE_SIZEOF_LONG_LONG == 8 -# ifdef __GNUC__ - // Silence g++ "-pedantic" warnings regarding use of "long long" - // type. - __extension__ -# endif /* __GNUC__ */ - typedef long long ACE_INT64; -#endif /* defined (ACE_INT64_TYPE) */ - -#if defined (ACE_UINT64_TYPE) - typedef ACE_UINT64_TYPE ACE_UINT64; -#elif defined (ACE_HAS_UINT64_T) - typedef uint64_t ACE_UINT64; -#elif ACE_SIZEOF_LONG == 8 - typedef unsigned long ACE_UINT64; -#elif ACE_SIZEOF_LONG_LONG == 8 -# ifdef __GNUC__ - // Silence g++ "-pedantic" warnings regarding use of "long long" - // type. - __extension__ -# endif /* __GNUC__ */ - typedef unsigned long long ACE_UINT64; -#endif /* defined (ACE_UINT64_TYPE) */ - -/// Define a generic byte for use in codecs -typedef unsigned char ACE_Byte; - -// Define a pseudo wide character type when wchar is not supported so we -// can support basic wide character string operations. - -# if defined (ACE_HAS_WCHAR) || defined (ACE_HAS_XPG4_MULTIBYTE_CHAR) -# define ACE_WINT_T wint_t -# define ACE_WCHAR_T wchar_t -# else -# define ACE_WINT_T ACE_UINT16 -# define ACE_WCHAR_T ACE_UINT16 -# endif /* ACE_HAS_WCHAR */ - -// The number of bytes in a void *. -# ifndef ACE_SIZEOF_VOID_P -# define ACE_SIZEOF_VOID_P ACE_SIZEOF_LONG -# endif /* ACE_SIZEOF_VOID_P */ - -ACE_END_VERSIONED_NAMESPACE_DECL - -// Byte-order (endian-ness) determination. -# if defined (BYTE_ORDER) -# if (BYTE_ORDER == LITTLE_ENDIAN) -# define ACE_LITTLE_ENDIAN 0x0123 -# define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN -# elif (BYTE_ORDER == BIG_ENDIAN) -# define ACE_BIG_ENDIAN 0x3210 -# define ACE_BYTE_ORDER ACE_BIG_ENDIAN -# else -# error: unknown BYTE_ORDER! -# endif /* BYTE_ORDER */ -# elif defined (_BYTE_ORDER) -# if (_BYTE_ORDER == _LITTLE_ENDIAN) -# define ACE_LITTLE_ENDIAN 0x0123 -# define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN -# elif (_BYTE_ORDER == _BIG_ENDIAN) -# define ACE_BIG_ENDIAN 0x3210 -# define ACE_BYTE_ORDER ACE_BIG_ENDIAN -# else -# error: unknown _BYTE_ORDER! -# endif /* _BYTE_ORDER */ -# elif defined (__BYTE_ORDER) -# if (__BYTE_ORDER == __LITTLE_ENDIAN) -# define ACE_LITTLE_ENDIAN 0x0123 -# define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN -# elif (__BYTE_ORDER == __BIG_ENDIAN) -# define ACE_BIG_ENDIAN 0x3210 -# define ACE_BYTE_ORDER ACE_BIG_ENDIAN -# else -# error: unknown __BYTE_ORDER! -# endif /* __BYTE_ORDER */ -# else /* ! BYTE_ORDER && ! __BYTE_ORDER */ - // We weren't explicitly told, so we have to figure it out . . . - // Note that Itanium hardware (IA64) can run in either byte order. It's - // selected by the OS when loading; Windows runs little, HP-UX runs big. -# if defined (i386) || defined (__i386__) || defined (_M_IX86) || \ - defined (vax) || defined (__alpha) || defined (__LITTLE_ENDIAN__) || \ - defined (ARM) || defined (_M_IA64) || defined (_M_AMD64) || \ - defined (__amd64) || \ - ((defined (__ia64__) || defined (__ia64)) && !defined (__hpux)) - // We know these are little endian. -# define ACE_LITTLE_ENDIAN 0x0123 -# define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN -# else - // Otherwise, we assume big endian. -# define ACE_BIG_ENDIAN 0x3210 -# define ACE_BYTE_ORDER ACE_BIG_ENDIAN -# endif -# endif /* ! BYTE_ORDER && ! __BYTE_ORDER */ - -// Byte swapping macros to deal with differences between little endian -// and big endian machines. Note that "long" here refers to 32 bit -// quantities. -# define ACE_SWAP_LONG(L) ((ACE_SWAP_WORD ((L) & 0xFFFF) << 16) \ - | ACE_SWAP_WORD(((L) >> 16) & 0xFFFF)) -# define ACE_SWAP_WORD(L) ((((L) & 0x00FF) << 8) | (((L) & 0xFF00) >> 8)) - -# if defined (ACE_LITTLE_ENDIAN) -# define ACE_HTONL(X) ACE_SWAP_LONG (X) -# define ACE_NTOHL(X) ACE_SWAP_LONG (X) -# define ACE_IDL_NCTOHL(X) (X) -# define ACE_IDL_NSTOHL(X) (X) -# else -# define ACE_HTONL(X) X -# define ACE_NTOHL(X) X -# define ACE_IDL_NCTOHL(X) (X << 24) -# define ACE_IDL_NSTOHL(X) ((X) << 16) -# endif /* ACE_LITTLE_ENDIAN */ - -# if defined (ACE_LITTLE_ENDIAN) -# define ACE_HTONS(x) ACE_SWAP_WORD(x) -# define ACE_NTOHS(x) ACE_SWAP_WORD(x) -# else -# define ACE_HTONS(x) x -# define ACE_NTOHS(x) x -# endif /* ACE_LITTLE_ENDIAN */ - -# define ACE_LONGLONG_TO_PTR(PTR_TYPE, L) \ - reinterpret_cast (static_cast (L)) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -inline ACE_UINT32 -ACE_U64_TO_U32 (ACE_UINT64 n) -{ - return static_cast (n); -} - -inline ACE_UINT32 -ACE_CU64_TO_CU32 (ACE_UINT64 n) -{ - return static_cast (n); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_WIN32) -# if defined (__MINGW32__) -# define ACE_UINT64_LITERAL(n) n ## ull -# define ACE_INT64_LITERAL(n) n ## ll -# else -# define ACE_UINT64_LITERAL(n) n ## ui64 -# define ACE_INT64_LITERAL(n) n ## i64 -# endif /* defined (__MINGW32__) */ -#elif defined (__TANDEM) -# define ACE_UINT64_LITERAL(n) n ## LL -# define ACE_INT64_LITERAL(n) n ## LL -#else /* ! ACE_WIN32 */ -# define ACE_UINT64_LITERAL(n) n ## ull -# define ACE_INT64_LITERAL(n) n ## ll -#endif /* ! ACE_WIN32*/ - -#if !defined (ACE_INT8_FORMAT_SPECIFIER_ASCII) -# if defined (PRId8) -# define ACE_INT8_FORMAT_SPECIFIER_ASCII "%" PRId8 -# else -# define ACE_INT8_FORMAT_SPECIFIER_ASCII "%d" -# endif /* defined (PRId8) */ -#endif /* ACE_INT8_FORMAT_SPECIFIER_ASCII */ - -#if !defined (ACE_INT8_FORMAT_SPECIFIER) -# if defined (PRId8) -# define ACE_INT8_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId8) -# else -# define ACE_INT8_FORMAT_SPECIFIER ACE_TEXT (ACE_INT8_FORMAT_SPECIFIER_ASCII) -# endif /* defined (PRId8) */ -#endif /* ACE_INT8_FORMAT_SPECIFIER */ - -#if !defined (ACE_UINT8_FORMAT_SPECIFIER_ASCII) -# if defined (PRIu8) -# define ACE_UINT8_FORMAT_SPECIFIER_ASCII "%" PRIu8 -# else -# define ACE_UINT8_FORMAT_SPECIFIER_ASCII "%u" -# endif /* defined (PRIu8) */ -#endif /* ACE_UINT8_FORMAT_SPECIFIER */ - -#if !defined (ACE_UINT8_FORMAT_SPECIFIER) -# if defined (PRIu8) -# define ACE_UINT8_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu8) -# else -# define ACE_UINT8_FORMAT_SPECIFIER ACE_TEXT (ACE_UINT8_FORMAT_SPECIFIER_ASCII) -# endif /* defined (PRIu8) */ -#endif /* ACE_UINT8_FORMAT_SPECIFIER */ - -#if !defined (ACE_INT16_FORMAT_SPECIFIER_ASCII) -# if defined (PRId16) -# define ACE_INT16_FORMAT_SPECIFIER_ASCII "%" PRId16 -# else -# define ACE_INT16_FORMAT_SPECIFIER_ASCII "%d" -# endif /* defined (PRId16) */ -#endif /* ACE_INT16_FORMAT_SPECIFIER */ - -#if !defined (ACE_INT16_FORMAT_SPECIFIER) -# if defined (PRId16) -# define ACE_INT16_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId16) -# else -# define ACE_INT16_FORMAT_SPECIFIER ACE_TEXT (ACE_INT16_FORMAT_SPECIFIER_ASCII) -# endif /* defined (PRId16) */ -#endif /* ACE_INT16_FORMAT_SPECIFIER */ - -#if !defined (ACE_UINT16_FORMAT_SPECIFIER_ASCII) -# if defined (PRIu16) -# define ACE_UINT16_FORMAT_SPECIFIER_ASCII "%" PRIu16 -# else -# define ACE_UINT16_FORMAT_SPECIFIER_ASCII "%u" -# endif /* defined (PRIu16) */ -#endif /* ACE_UINT16_FORMAT_SPECIFIER */ - -#if !defined (ACE_UINT16_FORMAT_SPECIFIER) -# if defined (PRIu16) -# define ACE_UINT16_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu16) -# else -# define ACE_UINT16_FORMAT_SPECIFIER ACE_TEXT (ACE_UINT16_FORMAT_SPECIFIER_ASCII) -# endif /* defined (PRIu16) */ -#endif /* ACE_UINT16_FORMAT_SPECIFIER */ - -#if !defined (ACE_INT32_FORMAT_SPECIFIER_ASCII) -# if defined (PRId32) -# define ACE_INT32_FORMAT_SPECIFIER_ASCII "%" PRId32 -# elif ACE_SIZEOF_INT == 4 -# define ACE_INT32_FORMAT_SPECIFIER_ASCII "%d" -# else -# define ACE_INT32_FORMAT_SPECIFIER_ASCII "%ld" -# endif /* defined (PRId32) */ -#endif /* ACE_INT32_FORMAT_SPECIFIER */ - -#if !defined (ACE_INT32_FORMAT_SPECIFIER) -# if defined (PRId32) -# define ACE_INT32_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId32) -# else -# define ACE_INT32_FORMAT_SPECIFIER ACE_TEXT (ACE_INT32_FORMAT_SPECIFIER_ASCII) -# endif /* defined (PRId32) */ -#endif /* ACE_INT32_FORMAT_SPECIFIER */ - -#if !defined (ACE_UINT32_FORMAT_SPECIFIER_ASCII) -# if defined (PRIu32) -# define ACE_UINT32_FORMAT_SPECIFIER_ASCII "%" PRIu32 -# elif ACE_SIZEOF_INT == 4 -# define ACE_UINT32_FORMAT_SPECIFIER_ASCII "%u" -# else -# define ACE_UINT32_FORMAT_SPECIFIER_ASCII "%lu" -# endif /* defined (PRIu32) */ -#endif /* ACE_UINT32_FORMAT_SPECIFIER */ - -#if !defined (ACE_UINT32_FORMAT_SPECIFIER) -# if defined (PRIu32) -# define ACE_UINT32_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu32) -# else -# define ACE_UINT32_FORMAT_SPECIFIER ACE_TEXT (ACE_UINT32_FORMAT_SPECIFIER_ASCII) -# endif /* defined (PRIu32) */ -#endif /* ACE_UINT32_FORMAT_SPECIFIER */ - -#if !defined (ACE_INT64_FORMAT_SPECIFIER_ASCII) -# if defined (PRId64) -# define ACE_INT64_FORMAT_SPECIFIER_ASCII "%" PRId64 -# elif ACE_SIZEOF_LONG == 8 -# define ACE_INT64_FORMAT_SPECIFIER_ASCII "%ld" -# else -# define ACE_INT64_FORMAT_SPECIFIER_ASCII "%lld" -# endif /* defined (PRId64) */ -#endif /* ACE_INT64_FORMAT_SPECIFIER */ - -#if !defined (ACE_INT64_FORMAT_SPECIFIER) -# if defined (PRId64) -# define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId64) -# else -# define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT (ACE_INT64_FORMAT_SPECIFIER_ASCII) -# endif /* defined (PRId64) */ -#endif /* ACE_INT64_FORMAT_SPECIFIER */ - -#if !defined (ACE_UINT64_FORMAT_SPECIFIER_ASCII) -# if defined (PRIu64) -# define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%" PRIu64 -# elif ACE_SIZEOF_LONG == 8 -# define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%lu" -# else -# define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%llu" -# endif /* defined (PRIu64) */ -#endif /* ACE_UINT64_FORMAT_SPECIFIER_ASCII */ - -#if !defined (ACE_UINT64_FORMAT_SPECIFIER) -# if defined (PRIu64) -# define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu64) -# else -# define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT (ACE_UINT64_FORMAT_SPECIFIER_ASCII) -# endif /* defined (PRIu64) */ -#endif /* ACE_UINT64_FORMAT_SPECIFIER */ - -#if !defined (ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII) -# if defined (ACE_WIN64) -# define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%I64d" -# elif defined (_WRS_CONFIG_LP64) -# define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%ld" -# else -# define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%d" -# endif /* ACE_WIN64 */ -#endif /* ACE_SSIZE_T_FORMAT_SPECIFIER */ - -#if !defined (ACE_SSIZE_T_FORMAT_SPECIFIER) -#define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_TEXT (ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII) -#endif /* ACE_SSIZE_T_FORMAT_SPECIFIER */ - -#if !defined (ACE_SIZE_T_FORMAT_SPECIFIER_ASCII) -# if defined (ACE_WIN64) -# define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%I64u" -# elif defined (_WRS_CONFIG_LP64) -# define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%lu" -# else -# define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%u" -# endif /* ACE_WIN64 */ -#endif /* ACE_SIZE_T_FORMAT_SPECIFIER */ - -#if !defined (ACE_SIZE_T_FORMAT_SPECIFIER) -#define ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT (ACE_SIZE_T_FORMAT_SPECIFIER_ASCII) -#endif /* ACE_SIZE_T_FORMAT_SPECIFIER */ - -// Cast from UINT64 to a double requires an intermediate cast to INT64 -// on some platforms. -#if defined (ACE_WIN32) -# define ACE_UINT64_DBLCAST_ADAPTER(n) static_cast<__int64> (n) -#else /* ! ACE_WIN32 && */ -# define ACE_UINT64_DBLCAST_ADAPTER(n) (n) -#endif /* ! ACE_WIN32 && */ - - -// The number of bytes in a float. -# ifndef ACE_SIZEOF_FLOAT -# if FLT_MAX_EXP == 128 -# define ACE_SIZEOF_FLOAT 4 -# elif FLT_MAX_EXP == 1024 -# define ACE_SIZEOF_FLOAT 8 -# else -# error: unsupported float size, must be updated for this platform! -# endif /* FLT_MAX_EXP */ -# endif /* ACE_SIZEOF_FLOAT */ - -// The number of bytes in a double. -# ifndef ACE_SIZEOF_DOUBLE -# if DBL_MAX_EXP == 128 -# define ACE_SIZEOF_DOUBLE 4 -# elif DBL_MAX_EXP == 1024 -# define ACE_SIZEOF_DOUBLE 8 -# else -# error: unsupported double size, must be updated for this platform! -# endif /* DBL_MAX_EXP */ -# endif /* ACE_SIZEOF_DOUBLE */ - -// The number of bytes in a long double. -# ifndef ACE_SIZEOF_LONG_DOUBLE -# if LDBL_MAX_EXP == 128 -# define ACE_SIZEOF_LONG_DOUBLE 4 -# elif LDBL_MAX_EXP == 1024 -# if defined (__powerpc64__) -# define ACE_SIZEOF_LONG_DOUBLE 16 -# else -# define ACE_SIZEOF_LONG_DOUBLE 8 -# endif -# elif LDBL_MAX_EXP == 16384 -# if defined (LDBL_DIG) && LDBL_DIG == 18 -# if defined (__ia64) || defined (__x86_64) -# define ACE_SIZEOF_LONG_DOUBLE 16 -# else /* ! __ia64 || __x86_64 */ -# define ACE_SIZEOF_LONG_DOUBLE 12 -# endif /* __ia64 */ -# else /* ! LDBL_DIG || LDBL_DIG != 18 */ -# define ACE_SIZEOF_LONG_DOUBLE 16 -# endif /* ! LDBL_DIG || LDBL_DIG != 18 */ -# else -# error: unsupported double size, must be updated for this platform! -# endif /* LDBL_MAX_EXP */ -# endif /* ACE_SIZEOF_LONG_DOUBLE */ - -// Max and min sizes for the ACE integer types. -#define ACE_CHAR_MAX 0x7F -#define ACE_CHAR_MIN -(ACE_CHAR_MAX)-1 -#define ACE_OCTET_MAX 0xFF -#define ACE_INT16_MAX 0x7FFF -#define ACE_INT16_MIN -(ACE_INT16_MAX)-1 -#define ACE_UINT16_MAX 0xFFFF -#define ACE_WCHAR_MAX ACE_UINT16_MAX -#define ACE_INT32_MAX 0x7FFFFFFF -#define ACE_INT32_MIN -(ACE_INT32_MAX)-1 -#define ACE_UINT32_MAX 0xFFFFFFFF -#define ACE_INT64_MAX ACE_INT64_LITERAL(0x7FFFFFFFFFFFFFFF) -#define ACE_INT64_MIN -(ACE_INT64_MAX)-1 -#define ACE_UINT64_MAX ACE_UINT64_LITERAL (0xFFFFFFFFFFFFFFFF) - -// These use ANSI/IEEE format. -#define ACE_FLT_MAX 3.402823466e+38F -#define ACE_FLT_MIN 1.175494351e-38F -#define ACE_DBL_MAX 1.7976931348623158e+308 -#define ACE_DBL_MIN 2.2250738585072014e-308 - -# include /**/ "ace/post.h" -#endif /* ACE_BASIC_TYPES_H */ diff --git a/dep/acelite/ace/Bound_Ptr.h b/dep/acelite/ace/Bound_Ptr.h deleted file mode 100644 index 5176ff9514a..00000000000 --- a/dep/acelite/ace/Bound_Ptr.h +++ /dev/null @@ -1,388 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Bound_Ptr.h - * - * $Id: Bound_Ptr.h 82723 2008-09-16 09:35:44Z johnnyw $ - * - * @author Christopher Kohlhoff - * @author Boris Kolpackov - */ -//============================================================================= - -#ifndef ACE_BOUND_PTR_H -#define ACE_BOUND_PTR_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Auto_Ptr.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Bound_Ptr_Counter - * - * @brief An ACE_Bound_Ptr_Counter object encapsulates an - * object reference count. - * - * Do not use this class directly, use ACE_Strong_Bound_Ptr or - * ACE_Weak_Bound_Ptr instead. - */ -template -class ACE_Bound_Ptr_Counter -{ -public: - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - ACE_Bound_Ptr_Counter (long init_obj_ref_count = 0); - ~ACE_Bound_Ptr_Counter (void); - - /// Create a ACE_Bound_Ptr_Counter and initialize the - /// reference count to indicate ownership by a strong pointer. - static ACE_Bound_Ptr_Counter *create_strong (void); - - /// Increase both the object and counter reference counts and return - /// the new object reference count. A return value of -1 indicates - /// that the object has already been destroyed. - static long attach_strong (ACE_Bound_Ptr_Counter *counter); - - /// Decreases both the object and counter reference counts and - /// deletes whichever has no more references. Returns the new object - /// reference count. - static long detach_strong (ACE_Bound_Ptr_Counter *counter); - - /// Create a ACE_Bound_Ptr_Counter and initialize the - /// reference count to indicate no ownership. - static ACE_Bound_Ptr_Counter *create_weak (void); - - /// Increase the counter reference count and return argument. - static void attach_weak (ACE_Bound_Ptr_Counter *counter); - - /// Decreases the counter reference count and deletes the counter if - /// it has no more references. - static void detach_weak (ACE_Bound_Ptr_Counter *counter); - - /// Determine whether the object has been deleted. - static bool object_was_deleted (ACE_Bound_Ptr_Counter *counter); - -private: - - /// Allocate a new ACE_Bound_Ptr_Counter instance, - /// returning NULL if it cannot be created. - static ACE_Bound_Ptr_Counter *internal_create (long init_obj_ref_count); - -private: - - /// Reference count of underlying object. Is set to -1 once the - /// object has been destroyed to indicate to all weak pointers that - /// it is no longer valid. - long obj_ref_count_; - - /// Reference count of this counter. - long self_ref_count_; - - /// Mutex variable to synchronize access to the reference counts. - ACE_LOCK lock_; -}; - -// Forward decl. -template class ACE_Weak_Bound_Ptr; - -/** - * @class ACE_Strong_Bound_Ptr - * - * @brief This class implements support for a reference counted - * pointer. - * - * Assigning or copying instances of an ACE_Strong_Bound_Ptr will - * automatically increment the reference count of the underlying object. - * When the last instance of an ACE_Strong_Bound_Ptr that references a - * particular object is destroyed or overwritten, it will invoke delete - * on its underlying pointer. - */ -template -class ACE_Strong_Bound_Ptr -{ -public: - /// Constructor that initializes an ACE_Strong_Bound_Ptr to point to the - /// object \ immediately. - explicit ACE_Strong_Bound_Ptr (X *p = 0); - - /// Constructor that initializes an ACE_Strong_Bound_Ptr by stealing - /// ownership of an object from an auto_ptr. - explicit ACE_Strong_Bound_Ptr (auto_ptr p); - - /// Copy constructor binds @c this and @a r to the same object. - ACE_Strong_Bound_Ptr (const ACE_Strong_Bound_Ptr &r); - - /// Constructor binds @c this and @a r to the same object. - ACE_Strong_Bound_Ptr (const ACE_Weak_Bound_Ptr &r); - - /// Copy constructor binds @c this and @a r to the same object if - /// Y* can be implicitly converted to X*. - template - ACE_Strong_Bound_Ptr (const ACE_Strong_Bound_Ptr &r) - : counter_ (r.counter_), - ptr_ (dynamic_cast(r.ptr_)) - { - // This ctor is temporarily defined here to increase our chances - // of being accepted by broken compilers. - // - COUNTER::attach_strong (this->counter_); - } - - /// Destructor. - ~ACE_Strong_Bound_Ptr (void); - - /// Assignment operator that binds @c this and @a r to the same object. - void operator = (const ACE_Strong_Bound_Ptr &r); - - /// Assignment operator that binds @c this and @a r to the same object. - void operator = (const ACE_Weak_Bound_Ptr &r); - - /// Assignment operator that binds @c this and @a r to the same object - /// if Y* can be implicitly converted to X*. - template - ACE_Weak_Bound_Ptr& - operator= (const ACE_Strong_Bound_Ptr &r) - { - // This operator is temporarily defined here to increase our chances - // of being accepted by broken compilers. - // - - // This will work if &r == this, by first increasing the ref count - - COUNTER *new_counter = r.counter_; - X* new_ptr = dynamic_cast (r.ptr_); - COUNTER::attach_strong (new_counter); - if (COUNTER::detach_strong (this->counter_) == 0) - delete this->ptr_; - this->counter_ = new_counter; - this->ptr_ = new_ptr; - - return *this; - } - - /// Equality operator that returns @c true if both - /// ACE_Strong_Bound_Ptr instances point to the same underlying - /// object. - /** - * @note It also returns @c true if both objects have just been - * instantiated and not used yet. - */ - bool operator == (const ACE_Strong_Bound_Ptr &r) const; - - /// Equality operator that returns true if the ACE_Strong_Bound_Ptr - /// and ACE_Weak_Bound_Ptr objects point to the same underlying - /// object. - /** - * @note It also returns @c true if both objects have just been - * instantiated and not used yet. - */ - bool operator == (const ACE_Weak_Bound_Ptr &r) const; - - /// Equality operator that returns @c true if the - /// ACE_Strong_Bound_Ptr and the raw pointer point to the same - /// underlying object. - bool operator == (X *p) const; - - /// Inequality operator, which is the opposite of equality. - bool operator != (const ACE_Strong_Bound_Ptr &r) const; - - /// Inequality operator, which is the opposite of equality. - bool operator != (const ACE_Weak_Bound_Ptr &r) const; - - /// Inequality operator, which is the opposite of equality. - bool operator != (X *p) const; - - /// Redirection operator - X *operator-> (void) const; - - /// Dereference operator - X &operator * (void) const; - - /// Get the pointer value. - X *get (void) const; - - /// Resets the ACE_Strong_Bound_Ptr to refer to a different - /// underlying object. - void reset (X *p = 0); - - /// Resets the ACE_Strong_Bound_Ptr to refer to a different - /// underlying object, ownership of which is stolen from the - /// auto_ptr. - void reset (auto_ptr p); - - /// Allows us to check for NULL on all ACE_Strong_Bound_Ptr - /// objects. - bool null (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - typedef X X_t; // This indirection is for Borland C++. - - friend class ACE_Weak_Bound_Ptr; - - template - friend class ACE_Strong_Bound_Ptr; - - /// The ACE_Bound_Ptr_Counter type. - typedef ACE_Bound_Ptr_Counter COUNTER; - - /// The reference counter. - COUNTER *counter_; - - /// The underlying object. - X *ptr_; -}; - -/** - * @class ACE_Weak_Bound_Ptr - * - * @brief This class implements support for a weak pointer that complements - * ACE_Strong_Bound_Ptr. - * - * Unlike ACE_Strong_Bound_Ptr, assigning or copying instances of an - * ACE_Weak_Bound_Ptr will not automatically increment the reference - * count of the underlying object. What ACE_Weak_Bound_Ptr does is - * preserve the knowledge that the object is in fact reference - * counted, and thus provides an alternative to raw pointers where - * non-ownership associations must be maintained. When the last - * instance of an ACE_Strong_Bound_Ptr that references a particular - * object is destroyed or overwritten, the corresponding - * ACE_Weak_Bound_Ptr instances are set to NULL. - */ -template -class ACE_Weak_Bound_Ptr -{ -public: - /// Constructor that initializes an ACE_Weak_Bound_Ptr to point to - /// the object \ immediately. - explicit ACE_Weak_Bound_Ptr (X *p = 0); - - /// Copy constructor binds @c this and @a r to the same object. - ACE_Weak_Bound_Ptr (const ACE_Weak_Bound_Ptr &r); - - /// Constructor binds @c this and @a r to the same object. - ACE_Weak_Bound_Ptr (const ACE_Strong_Bound_Ptr &r); - - /// Destructor. - ~ACE_Weak_Bound_Ptr (void); - - /// Assignment operator that binds @c this and @a r to the same object. - void operator = (const ACE_Weak_Bound_Ptr &r); - - /// Assignment operator that binds @c this and @a r to the same object. - void operator = (const ACE_Strong_Bound_Ptr &r); - - /// Equality operator that returns @c true if both - /// ACE_Weak_Bound_Ptr objects point to the same underlying object. - /** - * @note It also returns @c true if both objects have just been - * instantiated and not used yet. - */ - bool operator == (const ACE_Weak_Bound_Ptr &r) const; - - /// Equality operator that returns @c true if the ACE_Weak_Bound_Ptr - /// and ACE_Strong_Bound_Ptr objects point to the same underlying - /// object. - /** - * @note It also returns @c true if both objects have just been - * instantiated and not used yet. - */ - bool operator == (const ACE_Strong_Bound_Ptr &r) const; - - /// Equality operator that returns @c true if the ACE_Weak_Bound_Ptr - /// and the raw pointer point to the same underlying object. - bool operator == (X *p) const; - - /// Inequality operator, which is the opposite of equality. - bool operator != (const ACE_Weak_Bound_Ptr &r) const; - - /// Inequality operator, which is the opposite of equality. - bool operator != (const ACE_Strong_Bound_Ptr &r) const; - - /// Inequality operator, which is the opposite of equality. - bool operator != (X *p) const; - - /// Redirection operator. - /** - * It returns a temporary strong pointer and makes use of the - * chaining properties of operator-> to ensure that the underlying - * object does not disappear while you are using it. If you are - * certain of the lifetimes of the object, and do not want to incur - * the locking overhead, then use the unsafe_get method instead. - */ - ACE_Strong_Bound_Ptr operator-> (void) const; - - /// Obtain a strong pointer corresponding to this weak pointer. This - /// function is useful to create a temporary strong pointer for - /// conversion to a reference. - ACE_Strong_Bound_Ptr strong (void) const; - - /// Get the pointer value. Warning: this does not affect the - /// reference count of the underlying object, so it may disappear on - /// you while you are using it if you are not careful. - X *unsafe_get (void) const; - - /// Resets the ACE_Weak_Bound_Ptr to refer to a different underlying - /// object. - void reset (X *p = 0); - - /// Increment the reference count on the underlying object. - /** - * Returns the new reference count on the object. This function may - * be used to integrate the bound pointers into an external - * reference counting mechanism such as those used by COM or CORBA - * servants. - */ - long add_ref (void); - - /// Decrement the reference count on the underlying object, which is deleted - /// if the count has reached zero. - /** - * Returns the new reference count on the object. This function may - * be used to integrate the bound pointers into an external - * reference counting mechanism such as those used by COM or CORBA - * servants. - */ - long remove_ref (void); - - /// Allows us to check for NULL on all ACE_Weak_Bound_Ptr objects. - bool null (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - typedef X X_t; // This indirection is for Borland C++. - - friend class ACE_Strong_Bound_Ptr; - - /// The ACE_Bound_Ptr_Counter type. - typedef ACE_Bound_Ptr_Counter COUNTER; - - /// The reference counter. - COUNTER *counter_; - - /// The underlying object. - X *ptr_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include "ace/Bound_Ptr.inl" - -#include /**/ "ace/post.h" - -#endif /* ACE_BOUND_PTR_H */ diff --git a/dep/acelite/ace/Bound_Ptr.inl b/dep/acelite/ace/Bound_Ptr.inl deleted file mode 100644 index 06f03abd8dd..00000000000 --- a/dep/acelite/ace/Bound_Ptr.inl +++ /dev/null @@ -1,494 +0,0 @@ -/* -*- C++ -*- */ -// $Id: Bound_Ptr.inl 91626 2010-09-07 10:59:20Z johnnyw $ - -// Bound_Ptr.i - -#include "ace/Guard_T.h" -#if !defined (ACE_NEW_THROWS_EXCEPTIONS) -# include "ace/Log_Msg.h" -#endif /* ACE_NEW_THROWS_EXCEPTIONS */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template inline ACE_Bound_Ptr_Counter * -ACE_Bound_Ptr_Counter::internal_create (long init_obj_ref_count) -{ - ACE_Bound_Ptr_Counter *temp = 0; - ACE_NEW_RETURN (temp, - ACE_Bound_Ptr_Counter (init_obj_ref_count), - 0); - return temp; -} - -template inline ACE_Bound_Ptr_Counter * -ACE_Bound_Ptr_Counter::create_strong (void) -{ - // Set initial object reference count to 1. - ACE_Bound_Ptr_Counter *temp = internal_create (1); -#if defined (ACE_NEW_THROWS_EXCEPTIONS) - if (temp == 0) - ACE_throw_bad_alloc; -#else - ACE_ASSERT (temp != 0); -#endif /* ACE_NEW_THROWS_EXCEPTIONS */ - return temp; -} - - - -template inline long -ACE_Bound_Ptr_Counter::attach_strong (ACE_Bound_Ptr_Counter* counter) -{ - ACE_GUARD_RETURN (ACE_LOCK, guard, counter->lock_, -1); - - // Can't attach a strong pointer to an object that has already been deleted. - if (counter->obj_ref_count_ == -1) - return -1; - - long new_obj_ref_count = ++counter->obj_ref_count_; - ++counter->self_ref_count_; - - return new_obj_ref_count; -} - -template inline long -ACE_Bound_Ptr_Counter::detach_strong (ACE_Bound_Ptr_Counter* counter) -{ - ACE_Bound_Ptr_Counter *counter_del = 0; - long new_obj_ref_count; - - { - ACE_GUARD_RETURN (ACE_LOCK, guard, counter->lock_, -1); - - if ((new_obj_ref_count = --counter->obj_ref_count_) == 0) - // Change the object reference count to -1 to indicate that the - // object has been deleted, as opposed to a weak pointer that - // simply hasn't had any strong pointers created from it yet. - counter->obj_ref_count_ = -1; - - if (--counter->self_ref_count_ == 0) - // Since counter contains the lock held by the guard, the - // guard needs to be released before freeing the memory holding - // the lock. So save the pointer to free, then release, then - // free. - counter_del = counter; - - } // Release the lock - - delete counter_del; - - return new_obj_ref_count; -} - -template inline ACE_Bound_Ptr_Counter * -ACE_Bound_Ptr_Counter::create_weak (void) -{ - // Set initial object reference count to 0. - - ACE_Bound_Ptr_Counter *temp = internal_create (0); -#if defined (ACE_NEW_THROWS_EXCEPTIONS) - if (temp == 0) - ACE_throw_bad_alloc; -#else - ACE_ASSERT (temp != 0); -#endif /* ACE_NEW_THROWS_EXCEPTIONS */ - return temp; -} - -template inline void -ACE_Bound_Ptr_Counter::attach_weak (ACE_Bound_Ptr_Counter* counter) -{ - ACE_GUARD (ACE_LOCK, guard, counter->lock_); - - ++counter->self_ref_count_; -} - -template inline void -ACE_Bound_Ptr_Counter::detach_weak (ACE_Bound_Ptr_Counter* counter) -{ - ACE_Bound_Ptr_Counter *counter_del = 0; - - { - ACE_GUARD (ACE_LOCK, guard, counter->lock_); - - if (--counter->self_ref_count_ == 0) - // Since counter contains the lock held by the guard, the - // guard needs to be released before freeing the memory holding - // the lock. So save the pointer to free, then release, then - // free. - counter_del = counter; - - } // Release the lock - - delete counter_del; -} - -template inline bool -ACE_Bound_Ptr_Counter::object_was_deleted (ACE_Bound_Ptr_Counter *counter) -{ - ACE_GUARD_RETURN (ACE_LOCK, guard, counter->lock_, 0); - - return counter->obj_ref_count_ == -1; -} - -template inline -ACE_Bound_Ptr_Counter::ACE_Bound_Ptr_Counter (long init_obj_ref_count) - : obj_ref_count_ (init_obj_ref_count), - self_ref_count_ (1) -{ -} - -template inline -ACE_Bound_Ptr_Counter::~ACE_Bound_Ptr_Counter (void) -{ -} - -template inline -ACE_Strong_Bound_Ptr::ACE_Strong_Bound_Ptr (X *p) - : counter_ (COUNTER::create_strong ()), - ptr_ (p) -{ -} - -template inline -ACE_Strong_Bound_Ptr::ACE_Strong_Bound_Ptr (auto_ptr p) - : counter_ (COUNTER::create_strong ()), - ptr_ (p.release()) -{ -} - -template inline -ACE_Strong_Bound_Ptr::ACE_Strong_Bound_Ptr (const ACE_Strong_Bound_Ptr &r) - : counter_ (r.counter_), - ptr_ (r.ptr_) -{ - COUNTER::attach_strong (this->counter_); -} - -template inline -ACE_Strong_Bound_Ptr::ACE_Strong_Bound_Ptr (const ACE_Weak_Bound_Ptr &r) - : counter_ (r.counter_), - ptr_ (r.ptr_) -{ - // When creating a strong pointer from a weak one we can't assume that the - // underlying object still exists. Therefore we must check for a return value - // of -1, which indicates that the object has been destroyed. - if (COUNTER::attach_strong (this->counter_) == -1) - { - // Underlying object has already been deleted, so set this pointer to null. - this->counter_ = COUNTER::create_strong (); - this->ptr_ = 0; - } -} - -template inline -ACE_Strong_Bound_Ptr::~ACE_Strong_Bound_Ptr (void) -{ - if (COUNTER::detach_strong (this->counter_) == 0) - delete this->ptr_; -} - -template inline void -ACE_Strong_Bound_Ptr::operator = (const ACE_Strong_Bound_Ptr &rhs) -{ - // This will work if &r == this, by first increasing the ref count, but - // why go through all that? - if (&rhs == this) - return; - - COUNTER *new_counter = rhs.counter_; - X_t *new_ptr = rhs.ptr_; - COUNTER::attach_strong (new_counter); - if (COUNTER::detach_strong (this->counter_) == 0) - delete this->ptr_; - this->counter_ = new_counter; - this->ptr_ = new_ptr; -} - -template inline void -ACE_Strong_Bound_Ptr::operator = (const ACE_Weak_Bound_Ptr &rhs) -{ - // This will work if &r == this, by first increasing the ref count, but - // why go through all that? - if (&rhs == this) - return; - - COUNTER *new_counter = rhs.counter_; - X_t *new_ptr = rhs.ptr_; - - // When creating a strong pointer from a weak one we can't assume that the - // underlying object still exists. Therefore we must check for a return value - // of -1, which indicates that the object has been destroyed. - if (COUNTER::attach_strong (new_counter) == -1) - { - // Underlying object has already been deleted, so set this pointer to null. - new_counter = COUNTER::create_strong (); - new_ptr = 0; - } - - if (COUNTER::detach_strong (this->counter_) == 0) - delete this->ptr_; - this->counter_ = new_counter; - this->ptr_ = new_ptr; -} - -template inline bool -ACE_Strong_Bound_Ptr::operator== (const ACE_Strong_Bound_Ptr &r) const -{ - return this->ptr_ == r.ptr_; -} - -template inline bool -ACE_Strong_Bound_Ptr::operator== (const ACE_Weak_Bound_Ptr &r) const -{ - // Use the weak pointer's operator== since it will check for null. - return r == *this; -} - -template inline bool -ACE_Strong_Bound_Ptr::operator== (X *p) const -{ - return this->ptr_ == p; -} - -template inline bool -ACE_Strong_Bound_Ptr::operator!= (const ACE_Strong_Bound_Ptr &r) const -{ - return this->ptr_ != r.ptr_; -} - -template inline bool -ACE_Strong_Bound_Ptr::operator!= (const ACE_Weak_Bound_Ptr &r) const -{ - // Use the weak pointer's operator!= since it will check for null. - return r != *this; -} - -template inline bool -ACE_Strong_Bound_Ptr::operator!= (X *p) const -{ - return this->ptr_ != p; -} - -template inline X * -ACE_Strong_Bound_Ptr::operator-> (void) const -{ - return this->ptr_; -} - -template inline X & -ACE_Strong_Bound_Ptr::operator *() const -{ - return *this->ptr_; -} - -template inline X* -ACE_Strong_Bound_Ptr::get (void) const -{ - return this->ptr_; -} - -template inline bool -ACE_Strong_Bound_Ptr::null (void) const -{ - return this->ptr_ == 0; -} - -template inline void -ACE_Strong_Bound_Ptr::reset (X *p) -{ - COUNTER *old_counter = this->counter_; - X_t *old_ptr = this->ptr_; - this->counter_ = COUNTER::create_strong (); - this->ptr_ = p; - if (COUNTER::detach_strong (old_counter) == 0) - delete old_ptr; -} - -template inline void -ACE_Strong_Bound_Ptr::reset (auto_ptr p) -{ - COUNTER *old_counter = this->counter_; - X_t *old_ptr = this->ptr_; - this->counter_ = COUNTER::create_strong (); - this->ptr_ = p.release (); - if (COUNTER::detach_strong (old_counter) == 0) - delete old_ptr; -} - -template inline -ACE_Weak_Bound_Ptr::ACE_Weak_Bound_Ptr (X *p) - : counter_ (COUNTER::create_weak ()), - ptr_ (p) -{ -} - -template inline -ACE_Weak_Bound_Ptr::ACE_Weak_Bound_Ptr (const ACE_Weak_Bound_Ptr &r) - : counter_ (r.counter_), - ptr_ (r.ptr_) -{ - COUNTER::attach_weak (this->counter_); -} - -template inline -ACE_Weak_Bound_Ptr::ACE_Weak_Bound_Ptr (const ACE_Strong_Bound_Ptr &r) - : counter_ (r.counter_), - ptr_ (r.ptr_) -{ - COUNTER::attach_weak (this->counter_); -} - -template inline -ACE_Weak_Bound_Ptr::~ACE_Weak_Bound_Ptr (void) -{ - COUNTER::detach_weak (this->counter_); -} - -template inline void -ACE_Weak_Bound_Ptr::operator = (const ACE_Weak_Bound_Ptr &rhs) -{ - // This will work if &rhs == this, by first increasing the ref count - COUNTER *new_counter = rhs.counter_; - COUNTER::attach_weak (new_counter); - COUNTER::detach_weak (this->counter_); - this->counter_ = new_counter; - this->ptr_ = rhs.ptr_; -} - -template inline void -ACE_Weak_Bound_Ptr::operator = (const ACE_Strong_Bound_Ptr &rhs) -{ - // This will work if &rhs == this, by first increasing the ref count - COUNTER *new_counter = rhs.counter_; - COUNTER::attach_weak (new_counter); - COUNTER::detach_weak (this->counter_); - this->counter_ = new_counter; - this->ptr_ = rhs.ptr_; -} - -template inline bool -ACE_Weak_Bound_Ptr::operator== (const ACE_Weak_Bound_Ptr &r) const -{ - // A weak pointer must behave as though it is automatically set to null - // if the underlying object has been deleted. - if (COUNTER::object_was_deleted (this->counter_)) - return r.ptr_ == 0; - - return this->ptr_ == r.ptr_; -} - -template inline bool -ACE_Weak_Bound_Ptr::operator== (const ACE_Strong_Bound_Ptr &r) const -{ - // A weak pointer must behave as though it is automatically set to null - // if the underlying object has been deleted. - if (COUNTER::object_was_deleted (this->counter_)) - return r.ptr_ == 0; - - return this->ptr_ == r.ptr_; -} - -template inline bool -ACE_Weak_Bound_Ptr::operator== (X *p) const -{ - // A weak pointer must behave as though it is automatically set to null - // if the underlying object has been deleted. - if (COUNTER::object_was_deleted (this->counter_)) - return p == 0; - - return this->ptr_ == p; -} - -template inline bool -ACE_Weak_Bound_Ptr::operator!= (const ACE_Weak_Bound_Ptr &r) const -{ - // A weak pointer must behave as though it is automatically set to null - // if the underlying object has been deleted. - if (COUNTER::object_was_deleted (this->counter_)) - return r.ptr_ != 0; - - return this->ptr_ != r.ptr_; -} - -template inline bool -ACE_Weak_Bound_Ptr::operator!= (const ACE_Strong_Bound_Ptr &r) const -{ - // A weak pointer must behave as though it is automatically set to null - // if the underlying object has been deleted. - if (COUNTER::object_was_deleted (this->counter_)) - return r.ptr_ != 0; - - return this->ptr_ != r.ptr_; -} - -template inline bool -ACE_Weak_Bound_Ptr::operator!= (X *p) const -{ - // A weak pointer must behave as though it is automatically set to null - // if the underlying object has been deleted. - if (COUNTER::object_was_deleted (this->counter_)) - return p != 0; - - return this->ptr_ != p; -} - -template inline ACE_Strong_Bound_Ptr -ACE_Weak_Bound_Ptr::operator-> (void) const -{ - return ACE_Strong_Bound_Ptr (*this); -} - -template inline ACE_Strong_Bound_Ptr -ACE_Weak_Bound_Ptr::strong (void) const -{ - return ACE_Strong_Bound_Ptr (*this); -} - -template inline X* -ACE_Weak_Bound_Ptr::unsafe_get (void) const -{ - // We do not check if the object has been deleted, since this operation - // is defined to be unsafe! - return this->ptr_; -} - -template inline bool -ACE_Weak_Bound_Ptr::null (void) const -{ - // A weak pointer must behave as though it is automatically set to null - // if the underlying object has been deleted. - if (COUNTER::object_was_deleted (this->counter_)) - return true; - - return this->ptr_ == 0; -} - -template inline void -ACE_Weak_Bound_Ptr::reset (X *p) -{ - COUNTER *old_counter = this->counter_; - this->counter_ = COUNTER::create_weak (); - this->ptr_ = p; - COUNTER::detach_weak (old_counter); -} - -template inline long -ACE_Weak_Bound_Ptr::add_ref () -{ - return COUNTER::attach_strong (counter_); -} - -template inline long -ACE_Weak_Bound_Ptr::remove_ref () -{ - long new_obj_ref_count = COUNTER::detach_strong (counter_); - if (new_obj_ref_count == 0) - { - delete this->ptr_; - this->ptr_ = 0; - } - return new_obj_ref_count; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/CDR_Base.cpp b/dep/acelite/ace/CDR_Base.cpp deleted file mode 100644 index 04e87f65c94..00000000000 --- a/dep/acelite/ace/CDR_Base.cpp +++ /dev/null @@ -1,777 +0,0 @@ -// $Id: CDR_Base.cpp 94251 2011-06-22 18:03:25Z parsons $ - -#include "ace/CDR_Base.h" - -#if !defined (__ACE_INLINE__) -# include "ace/CDR_Base.inl" -#endif /* ! __ACE_INLINE__ */ - -#include "ace/Message_Block.h" -#include "ace/OS_Memory.h" -#include "ace/OS_NS_string.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -#if defined (NONNATIVE_LONGDOUBLE) -static const ACE_INT16 max_eleven_bit = 0x3ff; -static const ACE_INT16 max_fifteen_bit = 0x3fff; -#endif /* NONNATIVE_LONGDOUBLE */ - -// -// See comments in CDR_Base.inl about optimization cases for swap_XX_array. -// - -void -ACE_CDR::swap_2_array (char const * orig, char* target, size_t n) -{ - // ACE_ASSERT(n > 0); The caller checks that n > 0 - - // We pretend that AMD64/GNU G++ systems have a Pentium CPU to - // take advantage of the inline assembly implementation. - - // Later, we try to read in 32 or 64 bit chunks, - // so make sure we don't do that for unaligned addresses. -#if ACE_SIZEOF_LONG == 8 && \ - !((defined(__amd64__) || defined (__x86_64__)) && defined(__GNUG__)) - char const * const o8 = ACE_ptr_align_binary (orig, 8); - while (orig < o8 && n > 0) - { - ACE_CDR::swap_2 (orig, target); - orig += 2; - target += 2; - --n; - } -#else - char const * const o4 = ACE_ptr_align_binary (orig, 4); - // this is an _if_, not a _while_. The mistmatch can only be by 2. - if (orig != o4) - { - ACE_CDR::swap_2 (orig, target); - orig += 2; - target += 2; - --n; - } -#endif - if (n == 0) - return; - - // - // Loop unrolling. Here be dragons. - // - - // (n & (~3)) is the greatest multiple of 4 not bigger than n. - // In the while loop ahead, orig will move over the array by 8 byte - // increments (4 elements of 2 bytes). - // end marks our barrier for not falling outside. - char const * const end = orig + 2 * (n & (~3)); - - // See if we're aligned for writting in 64 or 32 bit chunks... -#if ACE_SIZEOF_LONG == 8 && \ - !((defined(__amd64__) || defined (__x86_64__)) && defined(__GNUG__)) - if (target == ACE_ptr_align_binary (target, 8)) -#else - if (target == ACE_ptr_align_binary (target, 4)) -#endif - { - while (orig < end) - { -#if defined (ACE_HAS_INTEL_ASSEMBLY) - unsigned int a = - * reinterpret_cast (orig); - unsigned int b = - * reinterpret_cast (orig + 4); - asm ( "bswap %1" : "=r" (a) : "0" (a) ); - asm ( "bswap %1" : "=r" (b) : "0" (b) ); - asm ( "rol $16, %1" : "=r" (a) : "0" (a) ); - asm ( "rol $16, %1" : "=r" (b) : "0" (b) ); - * reinterpret_cast (target) = a; - * reinterpret_cast (target + 4) = b; -#elif defined(ACE_HAS_PENTIUM) \ - && (defined(_MSC_VER) || defined(__BORLANDC__)) \ - && !defined(ACE_LACKS_INLINE_ASSEMBLY) - __asm mov ecx, orig; - __asm mov edx, target; - __asm mov eax, [ecx]; - __asm mov ebx, 4[ecx]; - __asm bswap eax; - __asm bswap ebx; - __asm rol eax, 16; - __asm rol ebx, 16; - __asm mov [edx], eax; - __asm mov 4[edx], ebx; -#elif ACE_SIZEOF_LONG == 8 - // 64 bit architecture. - register unsigned long a = - * reinterpret_cast (orig); - - register unsigned long a1 = (a & 0x00ff00ff00ff00ffUL) << 8; - register unsigned long a2 = (a & 0xff00ff00ff00ff00UL) >> 8; - - a = (a1 | a2); - - * reinterpret_cast (target) = a; -#else - register ACE_UINT32 a = - * reinterpret_cast (orig); - register ACE_UINT32 b = - * reinterpret_cast (orig + 4); - - register ACE_UINT32 a1 = (a & 0x00ff00ffU) << 8; - register ACE_UINT32 b1 = (b & 0x00ff00ffU) << 8; - register ACE_UINT32 a2 = (a & 0xff00ff00U) >> 8; - register ACE_UINT32 b2 = (b & 0xff00ff00U) >> 8; - - a = (a1 | a2); - b = (b1 | b2); - - * reinterpret_cast (target) = a; - * reinterpret_cast (target + 4) = b; -#endif - orig += 8; - target += 8; - } - } - else - { - // We're out of luck. We have to write in 2 byte chunks. - while (orig < end) - { -#if defined (ACE_HAS_INTEL_ASSEMBLY) - unsigned int a = - * reinterpret_cast (orig); - unsigned int b = - * reinterpret_cast (orig + 4); - asm ( "bswap %1" : "=r" (a) : "0" (a) ); - asm ( "bswap %1" : "=r" (b) : "0" (b) ); - // We're little endian. - * reinterpret_cast (target + 2) - = (unsigned short) (a & 0xffff); - * reinterpret_cast (target + 6) - = (unsigned short) (b & 0xffff); - asm ( "shrl $16, %1" : "=r" (a) : "0" (a) ); - asm ( "shrl $16, %1" : "=r" (b) : "0" (b) ); - * reinterpret_cast (target + 0) - = (unsigned short) (a & 0xffff); - * reinterpret_cast (target + 4) - = (unsigned short) (b & 0xffff); -#elif defined (ACE_HAS_PENTIUM) \ - && (defined (_MSC_VER) || defined (__BORLANDC__)) \ - && !defined (ACE_LACKS_INLINE_ASSEMBLY) - __asm mov ecx, orig; - __asm mov edx, target; - __asm mov eax, [ecx]; - __asm mov ebx, 4[ecx]; - __asm bswap eax; - __asm bswap ebx; - // We're little endian. - __asm mov 2[edx], ax; - __asm mov 6[edx], bx; - __asm shr eax, 16; - __asm shr ebx, 16; - __asm mov 0[edx], ax; - __asm mov 4[edx], bx; -#elif ACE_SIZEOF_LONG == 8 - // 64 bit architecture. - register unsigned long a = - * reinterpret_cast (orig); - - register unsigned long a1 = (a & 0x00ff00ff00ff00ffUL) << 8; - register unsigned long a2 = (a & 0xff00ff00ff00ff00UL) >> 8; - - a = (a1 | a2); - - ACE_UINT16 b1 = static_cast (a >> 48); - ACE_UINT16 b2 = static_cast ((a >> 32) & 0xffff); - ACE_UINT16 b3 = static_cast ((a >> 16) & 0xffff); - ACE_UINT16 b4 = static_cast (a & 0xffff); - -#if defined(ACE_LITTLE_ENDIAN) - * reinterpret_cast (target) = b4; - * reinterpret_cast (target + 2) = b3; - * reinterpret_cast (target + 4) = b2; - * reinterpret_cast (target + 6) = b1; -#else - * reinterpret_cast (target) = b1; - * reinterpret_cast (target + 2) = b2; - * reinterpret_cast (target + 4) = b3; - * reinterpret_cast (target + 6) = b4; -#endif -#else - register ACE_UINT32 a = - * reinterpret_cast (orig); - register ACE_UINT32 b = - * reinterpret_cast (orig + 4); - - register ACE_UINT32 a1 = (a & 0x00ff00ff) << 8; - register ACE_UINT32 b1 = (b & 0x00ff00ff) << 8; - register ACE_UINT32 a2 = (a & 0xff00ff00) >> 8; - register ACE_UINT32 b2 = (b & 0xff00ff00) >> 8; - - a = (a1 | a2); - b = (b1 | b2); - - ACE_UINT32 c1 = static_cast (a >> 16); - ACE_UINT32 c2 = static_cast (a & 0xffff); - ACE_UINT32 c3 = static_cast (b >> 16); - ACE_UINT32 c4 = static_cast (b & 0xffff); - -#if defined(ACE_LITTLE_ENDIAN) - * reinterpret_cast (target) = c2; - * reinterpret_cast (target + 2) = c1; - * reinterpret_cast (target + 4) = c4; - * reinterpret_cast (target + 6) = c3; -#else - * reinterpret_cast (target) = c1; - * reinterpret_cast (target + 2) = c2; - * reinterpret_cast (target + 4) = c3; - * reinterpret_cast (target + 6) = c4; -#endif -#endif - - orig += 8; - target += 8; - } - } - - // (n & 3) == (n % 4). - switch (n&3) { - case 3: - ACE_CDR::swap_2 (orig, target); - orig += 2; - target += 2; - case 2: - ACE_CDR::swap_2 (orig, target); - orig += 2; - target += 2; - case 1: - ACE_CDR::swap_2 (orig, target); - } -} - -void -ACE_CDR::swap_4_array (char const * orig, char* target, size_t n) -{ - // ACE_ASSERT (n > 0); The caller checks that n > 0 - -#if ACE_SIZEOF_LONG == 8 - // Later, we read from *orig in 64 bit chunks, - // so make sure we don't generate unaligned readings. - char const * const o8 = ACE_ptr_align_binary (orig, 8); - // The mismatch can only be by 4. - if (orig != o8) - { - ACE_CDR::swap_4 (orig, target); - orig += 4; - target += 4; - --n; - } -#endif /* ACE_SIZEOF_LONG == 8 */ - - if (n == 0) - return; - - // - // Loop unrolling. Here be dragons. - // - - // (n & (~3)) is the greatest multiple of 4 not bigger than n. - // In the while loop, orig will move over the array by 16 byte - // increments (4 elements of 4 bytes). - // ends marks our barrier for not falling outside. - char const * const end = orig + 4 * (n & (~3)); - -#if ACE_SIZEOF_LONG == 8 - // 64 bits architecture. - // See if we can write in 8 byte chunks. - if (target == ACE_ptr_align_binary (target, 8)) - { - while (orig < end) - { - register unsigned long a = - * reinterpret_cast (orig); - register unsigned long b = - * reinterpret_cast (orig + 8); - -#if defined(ACE_HAS_INTEL_ASSEMBLY) - asm ("bswapq %1" : "=r" (a) : "0" (a)); - asm ("bswapq %1" : "=r" (b) : "0" (b)); - asm ("rol $32, %1" : "=r" (a) : "0" (a)); - asm ("rol $32, %1" : "=r" (b) : "0" (b)); -#else - register unsigned long a84 = (a & 0x000000ff000000ffL) << 24; - register unsigned long b84 = (b & 0x000000ff000000ffL) << 24; - register unsigned long a73 = (a & 0x0000ff000000ff00L) << 8; - register unsigned long b73 = (b & 0x0000ff000000ff00L) << 8; - register unsigned long a62 = (a & 0x00ff000000ff0000L) >> 8; - register unsigned long b62 = (b & 0x00ff000000ff0000L) >> 8; - register unsigned long a51 = (a & 0xff000000ff000000L) >> 24; - register unsigned long b51 = (b & 0xff000000ff000000L) >> 24; - - a = (a84 | a73 | a62 | a51); - b = (b84 | b73 | b62 | b51); -#endif - - * reinterpret_cast (target) = a; - * reinterpret_cast (target + 8) = b; - - orig += 16; - target += 16; - } - } - else - { - // We are out of luck, we have to write in 4 byte chunks. - while (orig < end) - { - register unsigned long a = - * reinterpret_cast (orig); - register unsigned long b = - * reinterpret_cast (orig + 8); - -#if defined(ACE_HAS_INTEL_ASSEMBLY) - asm ("bswapq %1" : "=r" (a) : "0" (a)); - asm ("bswapq %1" : "=r" (b) : "0" (b)); - asm ("rol $32, %1" : "=r" (a) : "0" (a)); - asm ("rol $32, %1" : "=r" (b) : "0" (b)); -#else - register unsigned long a84 = (a & 0x000000ff000000ffL) << 24; - register unsigned long b84 = (b & 0x000000ff000000ffL) << 24; - register unsigned long a73 = (a & 0x0000ff000000ff00L) << 8; - register unsigned long b73 = (b & 0x0000ff000000ff00L) << 8; - register unsigned long a62 = (a & 0x00ff000000ff0000L) >> 8; - register unsigned long b62 = (b & 0x00ff000000ff0000L) >> 8; - register unsigned long a51 = (a & 0xff000000ff000000L) >> 24; - register unsigned long b51 = (b & 0xff000000ff000000L) >> 24; - - a = (a84 | a73 | a62 | a51); - b = (b84 | b73 | b62 | b51); -#endif - - ACE_UINT32 c1 = static_cast (a >> 32); - ACE_UINT32 c2 = static_cast (a & 0xffffffff); - ACE_UINT32 c3 = static_cast (b >> 32); - ACE_UINT32 c4 = static_cast (b & 0xffffffff); - -#if defined (ACE_LITTLE_ENDIAN) - * reinterpret_cast (target + 0) = c2; - * reinterpret_cast (target + 4) = c1; - * reinterpret_cast (target + 8) = c4; - * reinterpret_cast (target + 12) = c3; -#else - * reinterpret_cast (target + 0) = c1; - * reinterpret_cast (target + 4) = c2; - * reinterpret_cast (target + 8) = c3; - * reinterpret_cast (target + 12) = c4; -#endif - orig += 16; - target += 16; - } - } - -#else /* ACE_SIZEOF_LONG != 8 */ - - while (orig < end) - { -#if defined (ACE_HAS_PENTIUM) && defined (__GNUG__) - register unsigned int a = - *reinterpret_cast (orig); - register unsigned int b = - *reinterpret_cast (orig + 4); - register unsigned int c = - *reinterpret_cast (orig + 8); - register unsigned int d = - *reinterpret_cast (orig + 12); - - asm ("bswap %1" : "=r" (a) : "0" (a)); - asm ("bswap %1" : "=r" (b) : "0" (b)); - asm ("bswap %1" : "=r" (c) : "0" (c)); - asm ("bswap %1" : "=r" (d) : "0" (d)); - - *reinterpret_cast (target) = a; - *reinterpret_cast (target + 4) = b; - *reinterpret_cast (target + 8) = c; - *reinterpret_cast (target + 12) = d; -#elif defined (ACE_HAS_PENTIUM) \ - && (defined (_MSC_VER) || defined (__BORLANDC__)) \ - && !defined (ACE_LACKS_INLINE_ASSEMBLY) - __asm mov eax, orig - __asm mov esi, target - __asm mov edx, [eax] - __asm mov ecx, 4[eax] - __asm mov ebx, 8[eax] - __asm mov eax, 12[eax] - __asm bswap edx - __asm bswap ecx - __asm bswap ebx - __asm bswap eax - __asm mov [esi], edx - __asm mov 4[esi], ecx - __asm mov 8[esi], ebx - __asm mov 12[esi], eax -#else - register ACE_UINT32 a = - * reinterpret_cast (orig); - register ACE_UINT32 b = - * reinterpret_cast (orig + 4); - register ACE_UINT32 c = - * reinterpret_cast (orig + 8); - register ACE_UINT32 d = - * reinterpret_cast (orig + 12); - - // Expect the optimizer reordering this A LOT. - // We leave it this way for clarity. - a = (a << 24) | ((a & 0xff00) << 8) | ((a & 0xff0000) >> 8) | (a >> 24); - b = (b << 24) | ((b & 0xff00) << 8) | ((b & 0xff0000) >> 8) | (b >> 24); - c = (c << 24) | ((c & 0xff00) << 8) | ((c & 0xff0000) >> 8) | (c >> 24); - d = (d << 24) | ((d & 0xff00) << 8) | ((d & 0xff0000) >> 8) | (d >> 24); - - * reinterpret_cast (target) = a; - * reinterpret_cast (target + 4) = b; - * reinterpret_cast (target + 8) = c; - * reinterpret_cast (target + 12) = d; -#endif - - orig += 16; - target += 16; - } - -#endif /* ACE_SIZEOF_LONG == 8 */ - - // (n & 3) == (n % 4). - switch (n & 3) { - case 3: - ACE_CDR::swap_4 (orig, target); - orig += 4; - target += 4; - case 2: - ACE_CDR::swap_4 (orig, target); - orig += 4; - target += 4; - case 1: - ACE_CDR::swap_4 (orig, target); - } -} - -// -// We don't benefit from unrolling in swap_8_array and swap_16_array -// (swap_8 and swap_16 are big enough). -// -void -ACE_CDR::swap_8_array (char const * orig, char* target, size_t n) -{ - // ACE_ASSERT(n > 0); The caller checks that n > 0 - - char const * const end = orig + 8*n; - while (orig < end) - { - swap_8 (orig, target); - orig += 8; - target += 8; - } -} - -void -ACE_CDR::swap_16_array (char const * orig, char* target, size_t n) -{ - // ACE_ASSERT(n > 0); The caller checks that n > 0 - - char const * const end = orig + 16*n; - while (orig < end) - { - swap_16 (orig, target); - orig += 16; - target += 16; - } -} - -void -ACE_CDR::mb_align (ACE_Message_Block *mb) -{ -#if !defined (ACE_CDR_IGNORE_ALIGNMENT) - char * const start = ACE_ptr_align_binary (mb->base (), - ACE_CDR::MAX_ALIGNMENT); -#else - char * const start = mb->base (); -#endif /* ACE_CDR_IGNORE_ALIGNMENT */ - mb->rd_ptr (start); - mb->wr_ptr (start); -} - -int -ACE_CDR::grow (ACE_Message_Block *mb, size_t minsize) -{ - size_t newsize = - ACE_CDR::first_size (minsize + ACE_CDR::MAX_ALIGNMENT); - - if (newsize <= mb->size ()) - return 0; - - ACE_Data_Block *db = - mb->data_block ()->clone_nocopy (0, newsize); - - if (db == 0) - return -1; - - // Do the equivalent of ACE_CDR::mb_align() here to avoid having - // to allocate an ACE_Message_Block on the stack thereby avoiding - // the manipulation of the data blocks reference count - size_t mb_len = mb->length (); - char *start = ACE_ptr_align_binary (db->base (), - ACE_CDR::MAX_ALIGNMENT); - - ACE_OS::memcpy (start, mb->rd_ptr (), mb_len); - mb->data_block (db); - - // Setting the data block on the mb resets the read and write - // pointers back to the beginning. We must set the rd_ptr to the - // aligned start and adjust the write pointer to the end - mb->rd_ptr (start); - mb->wr_ptr (start + mb_len); - - // Remove the DONT_DELETE flags from mb - mb->clr_self_flags (ACE_Message_Block::DONT_DELETE); - - return 0; -} - -size_t -ACE_CDR::total_length (const ACE_Message_Block* begin, - const ACE_Message_Block* end) -{ - size_t l = 0; - // Compute the total size. - for (const ACE_Message_Block *i = begin; - i != end; - i = i->cont ()) - l += i->length (); - return l; -} - -int -ACE_CDR::consolidate (ACE_Message_Block *dst, - const ACE_Message_Block *src) -{ - if (src == 0) - return 0; - - size_t const newsize = - ACE_CDR::first_size (ACE_CDR::total_length (src, 0) - + ACE_CDR::MAX_ALIGNMENT); - - if (dst->size (newsize) == -1) - return -1; - -#if !defined (ACE_CDR_IGNORE_ALIGNMENT) - // We must copy the contents of src into the new buffer, but - // respecting the alignment. - ptrdiff_t srcalign = - ptrdiff_t(src->rd_ptr ()) % ACE_CDR::MAX_ALIGNMENT; - ptrdiff_t dstalign = - ptrdiff_t(dst->rd_ptr ()) % ACE_CDR::MAX_ALIGNMENT; - ptrdiff_t offset = srcalign - dstalign; - if (offset < 0) - offset += ACE_CDR::MAX_ALIGNMENT; - dst->rd_ptr (static_cast (offset)); - dst->wr_ptr (dst->rd_ptr ()); -#endif /* ACE_CDR_IGNORE_ALIGNMENT */ - - for (const ACE_Message_Block* i = src; - i != 0; - i = i->cont ()) - { - // If the destination and source are the same, do not - // attempt to copy the data. Just update the write pointer. - if (dst->wr_ptr () != i->rd_ptr ()) - dst->copy (i->rd_ptr (), i->length ()); - else - dst->wr_ptr (i->length ()); - } - return 0; -} - -#if defined (NONNATIVE_LONGLONG) -bool -ACE_CDR::LongLong::operator== (const ACE_CDR::LongLong &rhs) const -{ - return this->h == rhs.h && this->l == rhs.l; -} - -bool -ACE_CDR::LongLong::operator!= (const ACE_CDR::LongLong &rhs) const -{ - return this->l != rhs.l || this->h != rhs.h; -} - -#endif /* NONNATIVE_LONGLONG */ - -#if defined (NONNATIVE_LONGDOUBLE) -ACE_CDR::LongDouble& -ACE_CDR::LongDouble::assign (const ACE_CDR::LongDouble::NativeImpl& rhs) -{ - ACE_OS::memset (this->ld, 0, sizeof (this->ld)); - - if (sizeof (rhs) == 8) - { -#if defined (ACE_LITTLE_ENDIAN) - static const size_t byte_zero = 1; - static const size_t byte_one = 0; - char rhs_ptr[16]; - ACE_CDR::swap_8 (reinterpret_cast (&rhs), rhs_ptr); -#else - static const size_t byte_zero = 0; - static const size_t byte_one = 1; - const char* rhs_ptr = reinterpret_cast (&rhs); -#endif - ACE_INT16 sign = static_cast ( - static_cast (rhs_ptr[0])) & 0x8000; - ACE_INT16 exponent = ((rhs_ptr[0] & 0x7f) << 4) | - ((rhs_ptr[1] >> 4) & 0xf); - const char* exp_ptr = reinterpret_cast (&exponent); - - // Infinity and NaN have an exponent of 0x7ff in 64-bit IEEE - if (exponent == 0x7ff) - { - exponent = 0x7fff; - } - else - { - exponent = (exponent - max_eleven_bit) + max_fifteen_bit; - } - exponent |= sign; - - // Store the sign bit and exponent - this->ld[0] = exp_ptr[byte_zero]; - this->ld[1] = exp_ptr[byte_one]; - - // Store the mantissa. In an 8 byte double, it is split by - // 4 bits (because of the 12 bits for sign and exponent), so - // we have to shift and or the rhs to get the right bytes. - size_t li = 2; - bool direction = true; - for (size_t ri = 1; ri < sizeof (rhs);) - { - if (direction) - { - this->ld[li] |= ((rhs_ptr[ri] << 4) & 0xf0); - direction = false; - ++ri; - } - else - { - this->ld[li] |= ((rhs_ptr[ri] >> 4) & 0xf); - direction = true; - ++li; - } - } -#if defined (ACE_LITTLE_ENDIAN) - ACE_OS::memcpy (rhs_ptr, this->ld, sizeof (this->ld)); - ACE_CDR::swap_16 (rhs_ptr, this->ld); -#endif - } - else - { - ACE_OS::memcpy(this->ld, - reinterpret_cast (&rhs), sizeof (rhs)); - } - return *this; -} - -ACE_CDR::LongDouble& -ACE_CDR::LongDouble::assign (const ACE_CDR::LongDouble& rhs) -{ - if (this != &rhs) - *this = rhs; - return *this; -} - -bool -ACE_CDR::LongDouble::operator== (const ACE_CDR::LongDouble &rhs) const -{ - return ACE_OS::memcmp (this->ld, rhs.ld, 16) == 0; -} - -bool -ACE_CDR::LongDouble::operator!= (const ACE_CDR::LongDouble &rhs) const -{ - return ACE_OS::memcmp (this->ld, rhs.ld, 16) != 0; -} - -ACE_CDR::LongDouble::operator ACE_CDR::LongDouble::NativeImpl () const -{ - ACE_CDR::LongDouble::NativeImpl ret = 0.0; - char* lhs_ptr = reinterpret_cast (&ret); - - if (sizeof (ret) == 8) - { -#if defined (ACE_LITTLE_ENDIAN) - static const size_t byte_zero = 1; - static const size_t byte_one = 0; - char copy[16]; - ACE_CDR::swap_16 (this->ld, copy); -#else - static const size_t byte_zero = 0; - static const size_t byte_one = 1; - const char* copy = this->ld; -#endif - ACE_INT16 exponent = 0; - char* exp_ptr = reinterpret_cast (&exponent); - exp_ptr[byte_zero] = copy[0]; - exp_ptr[byte_one] = copy[1]; - - ACE_INT16 sign = (exponent & 0x8000); - exponent &= 0x7fff; - - // Infinity and NaN have an exponent of 0x7fff in 128-bit IEEE - if (exponent == 0x7fff) - { - exponent = 0x7ff; - } - else - { - exponent = (exponent - max_fifteen_bit) + max_eleven_bit; - } - exponent = (exponent << 4) | sign; - - // Store the sign and exponent - lhs_ptr[0] = exp_ptr[byte_zero]; - lhs_ptr[1] = exp_ptr[byte_one]; - - // Store the mantissa. In an 8 byte double, it is split by - // 4 bits (because of the 12 bits for sign and exponent), so - // we have to shift and or the rhs to get the right bytes. - size_t li = 1; - bool direction = true; - for (size_t ri = 2; li < sizeof (ret);) { - if (direction) - { - lhs_ptr[li] |= ((copy[ri] >> 4) & 0xf); - direction = false; - ++li; - } - else - { - lhs_ptr[li] |= ((copy[ri] & 0xf) << 4); - direction = true; - ++ri; - } - } - -#if defined (ACE_LITTLE_ENDIAN) - ACE_CDR::swap_8 (lhs_ptr, lhs_ptr); -#endif - } - else - { - ACE_OS::memcpy(lhs_ptr, this->ld, sizeof (ret)); - } - - // This bit of code is unnecessary. However, this code is - // necessary to work around a bug in the gcc 4.1.1 optimizer. - ACE_CDR::LongDouble tmp; - tmp.assign (ret); - - return ret; -} -#endif /* NONNATIVE_LONGDOUBLE */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/CDR_Base.h b/dep/acelite/ace/CDR_Base.h deleted file mode 100644 index f324152253f..00000000000 --- a/dep/acelite/ace/CDR_Base.h +++ /dev/null @@ -1,376 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file CDR_Base.h - * - * $Id: CDR_Base.h 95761 2012-05-15 18:23:04Z johnnyw $ - * - * ACE Common Data Representation (CDR) basic types. - * - * The current implementation assumes that the host has 1-byte, - * 2-byte and 4-byte integral types, and that it has single - * precision and double precision IEEE floats. - * Those assumptions are pretty good these days, with Crays being - * the only known exception. - * - * - * @author TAO version by - * @author Aniruddha Gokhale - * @author Carlos O'Ryan - * @author ACE version by - * @author Jeff Parsons - * @author Istvan Buki - */ -//============================================================================= - - -#ifndef ACE_CDR_BASE_H -#define ACE_CDR_BASE_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Basic_Types.h" -#include "ace/Default_Constants.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Stuff used by the ACE CDR classes. Watch these values... they're also used -// in the ACE_CDR Byte_Order enum below. -#if defined ACE_LITTLE_ENDIAN -# define ACE_CDR_BYTE_ORDER 1 -// little endian encapsulation byte order has value = 1 -#else /* ! ACE_LITTLE_ENDIAN */ -# define ACE_CDR_BYTE_ORDER 0 -// big endian encapsulation byte order has value = 0 -#endif /* ! ACE_LITTLE_ENDIAN */ - -class ACE_Message_Block; - -/** - * @class ACE_CDR - * - * @brief Keep constants and some routines common to both Output and - * Input CDR streams. - */ -class ACE_Export ACE_CDR -{ -public: - // = Constants defined by the CDR protocol. - // By defining as many of these constants as possible as enums we - // ensure they get inlined and avoid pointless static memory - // allocations. - - enum - { - // Note that some of these get reused as part of the standard - // binary format: unsigned is the same size as its signed cousin, - // float is LONG_SIZE, and double is LONGLONG_SIZE. - - OCTET_SIZE = 1, - SHORT_SIZE = 2, - LONG_SIZE = 4, - LONGLONG_SIZE = 8, - LONGDOUBLE_SIZE = 16, - - OCTET_ALIGN = 1, - SHORT_ALIGN = 2, - LONG_ALIGN = 4, - LONGLONG_ALIGN = 8, - /// @note the CORBA LongDouble alignment requirements do not - /// match its size... - LONGDOUBLE_ALIGN = 8, - - /// Maximal CDR 1.1 alignment: "quad precision" FP (i.e. "CDR::Long - /// double", size as above). - MAX_ALIGNMENT = 8, - - /// The default buffer size. - /** - * @todo We want to add options to control this - * default value, so this constant should be read as the default - * default value ;-) - */ - DEFAULT_BUFSIZE = ACE_DEFAULT_CDR_BUFSIZE, - - /// The buffer size grows exponentially until it reaches this size; - /// afterwards it grows linearly using the next constant - EXP_GROWTH_MAX = ACE_DEFAULT_CDR_EXP_GROWTH_MAX, - - /// Once exponential growth is ruled out the buffer size increases - /// in chunks of this size, note that this constants have the same - /// value right now, but it does not need to be so. - LINEAR_GROWTH_CHUNK = ACE_DEFAULT_CDR_LINEAR_GROWTH_CHUNK - }; - - /** - * @enum Byte_Order - * - * Defines values for the byte_order argument to ACE_OutputCDR and - * ACE_InputCDR. - */ - enum Byte_Order - { - /// Use big-endian order (also known as network byte order). - BYTE_ORDER_BIG_ENDIAN = 0, - /// Use little-endian order. - BYTE_ORDER_LITTLE_ENDIAN = 1, - /// Use whichever byte order is native to this machine. - BYTE_ORDER_NATIVE = ACE_CDR_BYTE_ORDER - }; - - /** - * Do byte swapping for each basic IDL type size. There exist only - * routines to put byte, halfword (2 bytes), word (4 bytes), - * doubleword (8 bytes) and quadword (16 byte); because those are - * the IDL basic type sizes. - */ - static void swap_2 (char const *orig, char *target); - static void swap_4 (char const *orig, char *target); - static void swap_8 (char const *orig, char *target); - static void swap_16 (char const *orig, char *target); - static void swap_2_array (char const *orig, - char *target, - size_t length); - static void swap_4_array (char const *orig, - char *target, - size_t length); - static void swap_8_array (char const *orig, - char *target, - size_t length); - static void swap_16_array (char const *orig, - char *target, - size_t length); - - /// Align the message block to ACE_CDR::MAX_ALIGNMENT, - /// set by the CORBA spec at 8 bytes. - static void mb_align (ACE_Message_Block *mb); - - /** - * Compute the size of the smallest buffer that can contain at least - * @a minsize bytes. - * To understand how a "best fit" is computed look at the - * algorithm in the code. - * Basically the buffers grow exponentially, up to a certain point, - * then the buffer size grows linearly. - * The advantage of this algorithm is that is rapidly grows to a - * large value, but does not explode at the end. - */ - static size_t first_size (size_t minsize); - - /// Compute not the smallest, but the second smallest buffer that - /// will fir @a minsize bytes. - static size_t next_size (size_t minsize); - - /** - * Increase the capacity of mb to contain at least @a minsize bytes. - * If @a minsize is zero the size is increased by an amount at least - * large enough to contain any of the basic IDL types. - * @retval -1 Failure - * @retval 0 Success. - */ - static int grow (ACE_Message_Block *mb, size_t minsize); - - /** - * Copy a message block chain into a single message block, - * preserving the alignment of the first message block of the - * original stream, not the following message blocks. - * @retval -1 Failure - * @retval 0 Success. - */ - static int consolidate (ACE_Message_Block *dst, - const ACE_Message_Block *src); - - static size_t total_length (const ACE_Message_Block *begin, - const ACE_Message_Block *end); - - /** - * @name Basic OMG IDL Types - * - * These types are for use in the CDR classes. The cleanest way to - * avoid complaints from all compilers is to define them all. - */ - //@{ - typedef bool Boolean; - typedef unsigned char Octet; - typedef char Char; - typedef ACE_WCHAR_T WChar; - typedef ACE_INT16 Short; - typedef ACE_UINT16 UShort; - typedef ACE_INT32 Long; - typedef ACE_UINT32 ULong; - typedef ACE_UINT64 ULongLong; - -# if (defined (_MSC_VER)) || (defined (__BORLANDC__)) - typedef __int64 LongLong; -# elif ACE_SIZEOF_LONG == 8 - typedef long LongLong; -# elif defined(__TANDEM) - typedef long long LongLong; -# elif ACE_SIZEOF_LONG_LONG == 8 -# if defined (sun) && !defined (ACE_LACKS_U_LONGLONG_T) - // sun #defines u_longlong_t, maybe other platforms do also. - // Use it, at least with g++, so that its -pedantic doesn't - // complain about no ANSI C++ long long. - typedef longlong_t LongLong; -# else - typedef long long LongLong; -# endif /* sun */ -# else /* no native 64 bit integer type */ -# define NONNATIVE_LONGLONG - struct ACE_Export LongLong - { -# if defined (ACE_BIG_ENDIAN) - ACE_CDR::Long h; - ACE_CDR::Long l; -# else - ACE_CDR::Long l; - ACE_CDR::Long h; -# endif /* ! ACE_BIG_ENDIAN */ - - /** - * @name Overloaded Relation Operators. - * - * The canonical comparison operators. - */ - //@{ - bool operator== (const LongLong &rhs) const; - bool operator!= (const LongLong &rhs) const; - //@} - }; -# endif /* no native 64 bit integer type */ - -# if defined (NONNATIVE_LONGLONG) -# define ACE_CDR_LONGLONG_INITIALIZER {0,0} -# else -# define ACE_CDR_LONGLONG_INITIALIZER 0 -# endif /* NONNATIVE_LONGLONG */ - -# if ACE_SIZEOF_FLOAT == 4 - typedef float Float; -# else /* ACE_SIZEOF_FLOAT != 4 */ - struct Float - { -# if ACE_SIZEOF_INT == 4 - // Use unsigned int to get word alignment. - unsigned int f; -# else /* ACE_SIZEOF_INT != 4 */ - // Applications will probably have trouble with this. - char f[4]; -# endif /* ACE_SIZEOF_INT != 4 */ - }; -# endif /* ACE_SIZEOF_FLOAT != 4 */ - -# if ACE_SIZEOF_DOUBLE == 8 - typedef double Double; -# else /* ACE_SIZEOF_DOUBLE != 8 */ - struct Double - { -# if ACE_SIZEOF_LONG == 8 - // Use u long to get word alignment. - unsigned long f; -# else /* ACE_SIZEOF_INT != 8 */ - // Applications will probably have trouble with this. - char f[8]; -# endif /* ACE_SIZEOF_INT != 8 */ - }; -# endif /* ACE_SIZEOF_DOUBLE != 8 */ - - // 94-9-32 Appendix A defines a 128 bit floating point "long - // double" data type, with greatly extended precision and four - // more bits of exponent (compared to "double"). This is an IDL - // extension, not yet standard. - -# if ACE_SIZEOF_LONG_DOUBLE == 16 - typedef long double LongDouble; -# define ACE_CDR_LONG_DOUBLE_INITIALIZER 0 -# define ACE_CDR_LONG_DOUBLE_ASSIGNMENT(LHS, RHS) LHS = RHS -# else -# define NONNATIVE_LONGDOUBLE -# define ACE_CDR_LONG_DOUBLE_INITIALIZER {{0}} -# define ACE_CDR_LONG_DOUBLE_ASSIGNMENT(LHS, RHS) LHS.assign (RHS) - struct ACE_Export LongDouble - { - // VxWorks' compiler (gcc 2.96) gets confused by the operator long - // double, so we avoid using long double as the NativeImpl. - // Linux's x86 long double format (12 or 16 bytes) is incompatible - // with Windows, Solaris, AIX, MacOS X and HP-UX (and probably others) - // long double format (8 or 16 bytes). If you need 32-bit Linux to - // inter-operate with 64-bit Linux you will want to define this - // macro to 0 so that "long double" is used. Otherwise, do not define - // this macro. -# if defined (ACE_CDR_IMPLEMENT_WITH_NATIVE_DOUBLE) && \ - (ACE_CDR_IMPLEMENT_WITH_NATIVE_DOUBLE == 1) - typedef double NativeImpl; -# else - typedef long double NativeImpl; -# endif /* ACE_CDR_IMPLEMENT_WITH_NATIVE_DOUBLE==1 */ - - char ld[16]; - - LongDouble& assign (const NativeImpl& rhs); - LongDouble& assign (const LongDouble& rhs); - - bool operator== (const LongDouble &rhs) const; - bool operator!= (const LongDouble &rhs) const; - - LongDouble& operator*= (const NativeImpl rhs) { - return this->assign (static_cast (*this) * rhs); - } - LongDouble& operator/= (const NativeImpl rhs) { - return this->assign (static_cast (*this) / rhs); - } - LongDouble& operator+= (const NativeImpl rhs) { - return this->assign (static_cast (*this) + rhs); - } - LongDouble& operator-= (const NativeImpl rhs) { - return this->assign (static_cast (*this) - rhs); - } - LongDouble& operator++ () { - return this->assign (static_cast (*this) + 1); - } - LongDouble& operator-- () { - return this->assign (static_cast (*this) - 1); - } - LongDouble operator++ (int) { - LongDouble ldv = *this; - this->assign (static_cast (*this) + 1); - return ldv; - } - LongDouble operator-- (int) { - LongDouble ldv = *this; - this->assign (static_cast (*this) - 1); - return ldv; - } - - operator NativeImpl () const; - }; -# endif /* ACE_SIZEOF_LONG_DOUBLE != 16 */ - - //@} - -#if !defined (ACE_CDR_GIOP_MAJOR_VERSION) -# define ACE_CDR_GIOP_MAJOR_VERSION 1 -#endif /*ACE_CDR_GIOP_MAJOR_VERSION */ - -#if !defined (ACE_CDR_GIOP_MINOR_VERSION) -# define ACE_CDR_GIOP_MINOR_VERSION 2 -#endif /* ACE_CDR_GIOP_MINOR_VERSION */ -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -# include "ace/CDR_Base.inl" -#endif /* __ACE_INLINE__ */ - - -#include /**/ "ace/post.h" - -#endif /* ACE_CDR_BASE_H */ diff --git a/dep/acelite/ace/CDR_Base.inl b/dep/acelite/ace/CDR_Base.inl deleted file mode 100644 index 85373170af7..00000000000 --- a/dep/acelite/ace/CDR_Base.inl +++ /dev/null @@ -1,255 +0,0 @@ -// -*- C++ -*- -// -// $Id: CDR_Base.inl 80826 2008-03-04 14:51:23Z wotte $ - -#if defined (ACE_HAS_INTRINSIC_BYTESWAP) -// Take advantage of MSVC++ byte swapping compiler intrinsics (found -// in ). -# pragma intrinsic (_byteswap_ushort, _byteswap_ulong, _byteswap_uint64) -#endif /* ACE_HAS_INTRINSIC_BYTESWAP */ - -#if defined (ACE_HAS_BSWAP_16) || defined (ACE_HAS_BSWAP_32) || defined (ACE_HAS_BSWAP_64) -# include "ace/os_include/os_byteswap.h" -#endif - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// -// The ACE_CDR::swap_X and ACE_CDR::swap_X_array routines are broken -// in 5 cases for optimization: -// -// * MSVC++ 7.1 or better -// => Compiler intrinsics -// -// * AMD64 CPU + gnu g++ -// => gcc amd64 inline assembly. -// -// * x86 Pentium CPU + gnu g++ -// (ACE_HAS_PENTIUM && __GNUG__) -// => gcc x86 inline assembly. -// -// * x86 Pentium CPU and (_MSC_VER) or BORLAND C++) -// (ACE_HAS_PENTIUM && ( _MSC_VER || __BORLANDC__ ) -// => MSC x86 inline assembly. -// -// * 64 bit architecture -// (ACE_SIZEOF_LONG == 8) -// => shift/masks using 64bit words. -// -// * default -// (none of the above) -// => shift/masks using 32bit words. -// -// -// Some things you could find useful to know if you intend to mess -// with this optimizations for swaps: -// -// * MSVC++ don't assume register values are conserved between -// statements. So you can clobber any register you want, -// whenever you want (well not *anyone* really, see manual). -// The MSVC++ optimizer will try to pick different registers -// for the C++ statements sorrounding your asm block, and if -// it's not possible will use the stack. -// -// * If you clobber registers with asm statements in gcc, you -// better do it in an asm-only function, or save/restore them -// before/after in the stack. If not, sorrounding C statements -// could end using the same registers and big-badda-bum (been -// there, done that...). The big-badda-bum could happen *even -// if you specify the clobbered register in your asm's*. -// Even better, use gcc asm syntax for detecting the register -// asigned to a certain variable so you don't have to clobber any -// register directly. -// - -ACE_INLINE void -ACE_CDR::swap_2 (const char *orig, char* target) -{ -#if defined (ACE_HAS_INTRINSIC_BYTESWAP) - // Take advantage of MSVC++ compiler intrinsic byte swapping - // function. - *reinterpret_cast (target) = - _byteswap_ushort (*reinterpret_cast (orig)); -#elif defined (ACE_HAS_BSWAP16) - *reinterpret_cast (target) = - bswap16 (*reinterpret_cast (orig)); -#elif defined (ACE_HAS_BSWAP_16) - *reinterpret_cast (target) = - bswap_16 (*reinterpret_cast (orig)); -#elif defined(ACE_HAS_INTEL_ASSEMBLY) - unsigned short a = - *reinterpret_cast (orig); - asm( "rolw $8, %0" : "=r" (a) : "0" (a) ); - *reinterpret_cast (target) = a; -#elif defined (ACE_HAS_PENTIUM) \ - && (defined(_MSC_VER) || defined(__BORLANDC__)) \ - && !defined(ACE_LACKS_INLINE_ASSEMBLY) - __asm mov ebx, orig; - __asm mov ecx, target; - __asm mov ax, [ebx]; - __asm rol ax, 8; - __asm mov [ecx], ax; -#else - register ACE_UINT16 usrc = * reinterpret_cast (orig); - register ACE_UINT16* udst = reinterpret_cast (target); - *udst = (usrc << 8) | (usrc >> 8); -#endif /* ACE_HAS_PENTIUM */ -} - -ACE_INLINE void -ACE_CDR::swap_4 (const char* orig, char* target) -{ -#if defined (ACE_HAS_INTRINSIC_BYTESWAP) - // Take advantage of MSVC++ compiler intrinsic byte swapping - // function. - *reinterpret_cast (target) = - _byteswap_ulong (*reinterpret_cast (orig)); -#elif defined (ACE_HAS_BSWAP32) - *reinterpret_cast (target) = - bswap32 (*reinterpret_cast (orig)); -#elif defined (ACE_HAS_BSWAP_32) - *reinterpret_cast (target) = - bswap_32 (*reinterpret_cast (orig)); -#elif defined(ACE_HAS_INTEL_ASSEMBLY) - // We have ACE_HAS_PENTIUM, so we know the sizeof's. - register unsigned int j = - *reinterpret_cast (orig); - asm ("bswap %1" : "=r" (j) : "0" (j)); - *reinterpret_cast (target) = j; -#elif defined(ACE_HAS_PENTIUM) \ - && (defined(_MSC_VER) || defined(__BORLANDC__)) \ - && !defined(ACE_LACKS_INLINE_ASSEMBLY) - __asm mov ebx, orig; - __asm mov ecx, target; - __asm mov eax, [ebx]; - __asm bswap eax; - __asm mov [ecx], eax; -#else - register ACE_UINT32 x = * reinterpret_cast (orig); - x = (x << 24) | ((x & 0xff00) << 8) | ((x & 0xff0000) >> 8) | (x >> 24); - * reinterpret_cast (target) = x; -#endif /* ACE_HAS_INTRINSIC_BYTESWAP */ -} - -ACE_INLINE void -ACE_CDR::swap_8 (const char* orig, char* target) -{ -#if defined (ACE_HAS_INTRINSIC_BYTESWAP) - // Take advantage of MSVC++ compiler intrinsic byte swapping - // function. - *reinterpret_cast (target) = - _byteswap_uint64 (*reinterpret_cast (orig)); -#elif defined (ACE_HAS_BSWAP64) - *reinterpret_cast (target) = - bswap64 (*reinterpret_cast (orig)); -#elif defined (ACE_HAS_BSWAP_64) - *reinterpret_cast (target) = - bswap_64 (*reinterpret_cast (orig)); -#elif (defined (__amd64__) || defined (__x86_64__)) && defined(__GNUG__) - register unsigned long x = - * reinterpret_cast (orig); - asm ("bswapq %1" : "=r" (x) : "0" (x)); - *reinterpret_cast (target) = x; -#elif defined(ACE_HAS_PENTIUM) && defined(__GNUG__) - register unsigned int i = - *reinterpret_cast (orig); - register unsigned int j = - *reinterpret_cast (orig + 4); - asm ("bswap %1" : "=r" (i) : "0" (i)); - asm ("bswap %1" : "=r" (j) : "0" (j)); - *reinterpret_cast (target + 4) = i; - *reinterpret_cast (target) = j; -#elif defined(ACE_HAS_PENTIUM) \ - && (defined(_MSC_VER) || defined(__BORLANDC__)) \ - && !defined(ACE_LACKS_INLINE_ASSEMBLY) - __asm mov ecx, orig; - __asm mov edx, target; - __asm mov eax, [ecx]; - __asm mov ebx, 4[ecx]; - __asm bswap eax; - __asm bswap ebx; - __asm mov 4[edx], eax; - __asm mov [edx], ebx; -#elif ACE_SIZEOF_LONG == 8 - // 64 bit architecture. - register unsigned long x = - * reinterpret_cast (orig); - register unsigned long x84 = (x & 0x000000ff000000ffUL) << 24; - register unsigned long x73 = (x & 0x0000ff000000ff00UL) << 8; - register unsigned long x62 = (x & 0x00ff000000ff0000UL) >> 8; - register unsigned long x51 = (x & 0xff000000ff000000UL) >> 24; - x = (x84 | x73 | x62 | x51); - x = (x << 32) | (x >> 32); - *reinterpret_cast (target) = x; -#else - register ACE_UINT32 x = - * reinterpret_cast (orig); - register ACE_UINT32 y = - * reinterpret_cast (orig + 4); - x = (x << 24) | ((x & 0xff00) << 8) | ((x & 0xff0000) >> 8) | (x >> 24); - y = (y << 24) | ((y & 0xff00) << 8) | ((y & 0xff0000) >> 8) | (y >> 24); - * reinterpret_cast (target) = y; - * reinterpret_cast (target + 4) = x; -#endif /* ACE_HAS_INTRINSIC_BYTESWAP */ -} - -ACE_INLINE void -ACE_CDR::swap_16 (const char* orig, char* target) -{ - swap_8 (orig + 8, target); - swap_8 (orig, target + 8); -} - -ACE_INLINE size_t -ACE_CDR::first_size (size_t minsize) -{ - if (minsize == 0) - return ACE_CDR::DEFAULT_BUFSIZE; - - size_t newsize = ACE_CDR::DEFAULT_BUFSIZE; - while (newsize < minsize) - { - if (newsize < ACE_CDR::EXP_GROWTH_MAX) - { - // We grow exponentially at the beginning, this is fast and - // reduces the number of allocations. - - // Quickly multiply by two using a bit shift. This is - // guaranteed to work since the variable is an unsigned - // integer. - newsize <<= 1; - } - else - { - // but continuing with exponential growth can result in over - // allocations and easily yield an allocation failure. - // So we grow linearly when the buffer is too big. - newsize += ACE_CDR::LINEAR_GROWTH_CHUNK; - } - } - return newsize; -} - -ACE_INLINE size_t -ACE_CDR::next_size (size_t minsize) -{ - size_t newsize = ACE_CDR::first_size (minsize); - - if (newsize == minsize) - { - // If necessary increment the size - if (newsize < ACE_CDR::EXP_GROWTH_MAX) - // Quickly multiply by two using a bit shift. This is - // guaranteed to work since the variable is an unsigned - // integer. - newsize <<= 1; - else - newsize += ACE_CDR::LINEAR_GROWTH_CHUNK; - } - - return newsize; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -// **************************************************************** diff --git a/dep/acelite/ace/CDR_Size.cpp b/dep/acelite/ace/CDR_Size.cpp deleted file mode 100644 index 40ea9d35b73..00000000000 --- a/dep/acelite/ace/CDR_Size.cpp +++ /dev/null @@ -1,260 +0,0 @@ -// $Id: CDR_Size.cpp 91813 2010-09-17 07:52:52Z johnnyw $ - -#include "ace/CDR_Size.h" -#include "ace/SString.h" -#include "ace/OS_Memory.h" -#include "ace/Truncate.h" - -#if !defined (__ACE_INLINE__) -# include "ace/CDR_Size.inl" -#endif /* ! __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_CDR::Boolean -ACE_SizeCDR::write_wchar (ACE_CDR::WChar x) -{ - // Note: translator framework is not supported. - // - if (ACE_OutputCDR::wchar_maxbytes () == 0) - { - errno = EACCES; - return (this->good_bit_ = false); - } - - if (static_cast (major_version_) == 1 - && static_cast (minor_version_) == 2) - { - ACE_CDR::Octet len = - static_cast (ACE_OutputCDR::wchar_maxbytes ()); - - if (this->write_1 (&len)) - { - if (ACE_OutputCDR::wchar_maxbytes () == sizeof(ACE_CDR::WChar)) - { - return - this->write_octet_array ( - reinterpret_cast (&x), - static_cast (len)); - } - else - { - if (ACE_OutputCDR::wchar_maxbytes () == 2) - { - ACE_CDR::Short sx = static_cast (x); - return - this->write_octet_array ( - reinterpret_cast (&sx), - static_cast (len)); - } - else - { - ACE_CDR::Octet ox = static_cast (x); - return - this->write_octet_array ( - reinterpret_cast (&ox), - static_cast (len)); - } - } - } - } - else if (static_cast (minor_version_) == 0) - { // wchar is not allowed with GIOP 1.0. - errno = EINVAL; - return (this->good_bit_ = false); - } - - if (ACE_OutputCDR::wchar_maxbytes () == sizeof (ACE_CDR::WChar)) - { - const void *temp = &x; - return this->write_4 (reinterpret_cast (temp)); - } - else if (ACE_OutputCDR::wchar_maxbytes () == 2) - { - ACE_CDR::Short sx = static_cast (x); - return this->write_2 (reinterpret_cast (&sx)); - } - - ACE_CDR::Octet ox = static_cast (x); - return this->write_1 (reinterpret_cast (&ox)); -} - -ACE_CDR::Boolean -ACE_SizeCDR::write_string (ACE_CDR::ULong len, - const ACE_CDR::Char *x) -{ - // Note: translator framework is not supported. - // - if (len != 0) - { - if (this->write_ulong (len + 1)) - return this->write_char_array (x, len + 1); - } - else - { - // Be nice to programmers: treat nulls as empty strings not - // errors. (OMG-IDL supports languages that don't use the C/C++ - // notion of null v. empty strings; nulls aren't part of the OMG-IDL - // string model.) - if (this->write_ulong (1)) - return this->write_char (0); - } - - return (this->good_bit_ = false); -} - -ACE_CDR::Boolean -ACE_SizeCDR::write_string (const ACE_CString &x) -{ - // @@ Leave this method in here, not the `.i' file so that we don't - // have to unnecessarily pull in the `ace/SString.h' header. - return this->write_string (static_cast (x.length ()), - x.c_str()); -} - -ACE_CDR::Boolean -ACE_SizeCDR::write_wstring (ACE_CDR::ULong len, - const ACE_CDR::WChar *x) -{ - // Note: translator framework is not supported. - // - if (ACE_OutputCDR::wchar_maxbytes () == 0) - { - errno = EACCES; - return (this->good_bit_ = false); - } - - if (static_cast (this->major_version_) == 1 - && static_cast (this->minor_version_) == 2) - { - if (x != 0) - { - //In GIOP 1.2 the length field contains the number of bytes - //the wstring occupies rather than number of wchars - //Taking sizeof might not be a good way! This is a temporary fix. - ACE_CDR::Boolean good_ulong = - this->write_ulong ( - ACE_Utils::truncate_cast ( - ACE_OutputCDR::wchar_maxbytes () * len)); - - if (good_ulong) - { - return this->write_wchar_array (x, len); - } - } - else - { - //In GIOP 1.2 zero length wstrings are legal - return this->write_ulong (0); - } - } - - else - if (x != 0) - { - if (this->write_ulong (len + 1)) - return this->write_wchar_array (x, len + 1); - } - else if (this->write_ulong (1)) - return this->write_wchar (0); - return (this->good_bit_ = false); -} - -ACE_CDR::Boolean -ACE_SizeCDR::write_1 (const ACE_CDR::Octet *) -{ - this->adjust (1); - return true; -} - -ACE_CDR::Boolean -ACE_SizeCDR::write_2 (const ACE_CDR::UShort *) -{ - this->adjust (ACE_CDR::SHORT_SIZE); - return true; -} - -ACE_CDR::Boolean -ACE_SizeCDR::write_4 (const ACE_CDR::ULong *) -{ - this->adjust (ACE_CDR::LONG_SIZE); - return true; -} - -ACE_CDR::Boolean -ACE_SizeCDR::write_8 (const ACE_CDR::ULongLong *) -{ - this->adjust (ACE_CDR::LONGLONG_SIZE); - return true; -} - -ACE_CDR::Boolean -ACE_SizeCDR::write_16 (const ACE_CDR::LongDouble *) -{ - this->adjust (ACE_CDR::LONGDOUBLE_SIZE, - ACE_CDR::LONGDOUBLE_ALIGN); - return true; -} - -ACE_CDR::Boolean -ACE_SizeCDR::write_wchar_array_i (const ACE_CDR::WChar *, - ACE_CDR::ULong length) -{ - if (length == 0) - return true; - - size_t const align = (ACE_OutputCDR::wchar_maxbytes () == 2) ? - ACE_CDR::SHORT_ALIGN : - ACE_CDR::OCTET_ALIGN; - - this->adjust (ACE_OutputCDR::wchar_maxbytes () * length, align); - return true; -} - - -ACE_CDR::Boolean -ACE_SizeCDR::write_array (const void *, - size_t size, - size_t align, - ACE_CDR::ULong length) -{ - if (length == 0) - return true; - - this->adjust (size * length, align); - return true; -} - -ACE_CDR::Boolean -ACE_SizeCDR::write_boolean_array (const ACE_CDR::Boolean*, - ACE_CDR::ULong length) -{ - this->adjust (length, 1); - return true; -} - -void -ACE_SizeCDR::adjust (size_t size) -{ - adjust (size, size); -} - -void -ACE_SizeCDR::adjust (size_t size, - size_t align) -{ -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - const size_t offset = ACE_align_binary (size_, align) - size_; - size_ += offset; -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - size_ += size; -} - -ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, const ACE_CString &x) -{ - ss.write_string (x); - return ss.good_bit (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/CDR_Size.h b/dep/acelite/ace/CDR_Size.h deleted file mode 100644 index ccf45324929..00000000000 --- a/dep/acelite/ace/CDR_Size.h +++ /dev/null @@ -1,241 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file CDR_Size.h - * - * $Id: CDR_Size.h 93359 2011-02-11 11:33:12Z mcorino $ - * - * - * ACE Common Data Representation (CDR) size-calculating stream. - * - * - * The current implementation assumes that the host has 1-byte, - * 2-byte and 4-byte integral types, and that it has single - * precision and double precision IEEE floats. - * Those assumptions are pretty good these days, with Crays being - * the only known exception. - * - * - * @author Boris Kolpackov - * - */ -//============================================================================= - -#ifndef ACE_CDR_SIZE_H -#define ACE_CDR_SIZE_H - -#include /**/ "ace/pre.h" - -#include "ace/CDR_Base.h" -#include "ace/CDR_Stream.h" // for ACE_OutputCDR::from_* - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/SStringfwd.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SizeCDR - * - * @brief A CDR stream for calculating size of the representation. - * - */ -class ACE_Export ACE_SizeCDR -{ -public: - /// Default constructor. - ACE_SizeCDR (ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION); - - /// Returns @c false if an error has ocurred. - bool good_bit (void) const; - - - /// Reset current size. - void reset (void); - - - /// Return current size. - size_t total_length (void) const; - - - // Return 0 on failure and 1 on success. - //@{ @name Size-calculating pseudo-write operations - ACE_CDR::Boolean write_boolean (ACE_CDR::Boolean x); - ACE_CDR::Boolean write_char (ACE_CDR::Char x); - ACE_CDR::Boolean write_wchar (ACE_CDR::WChar x); - ACE_CDR::Boolean write_octet (ACE_CDR::Octet x); - ACE_CDR::Boolean write_short (ACE_CDR::Short x); - ACE_CDR::Boolean write_ushort (ACE_CDR::UShort x); - ACE_CDR::Boolean write_long (ACE_CDR::Long x); - ACE_CDR::Boolean write_ulong (ACE_CDR::ULong x); - ACE_CDR::Boolean write_longlong (const ACE_CDR::LongLong &x); - ACE_CDR::Boolean write_ulonglong (const ACE_CDR::ULongLong &x); - ACE_CDR::Boolean write_float (ACE_CDR::Float x); - ACE_CDR::Boolean write_double (const ACE_CDR::Double &x); - ACE_CDR::Boolean write_longdouble (const ACE_CDR::LongDouble &x); - - /// For string we offer methods that accept a precomputed length. - ACE_CDR::Boolean write_string (const ACE_CDR::Char *x); - ACE_CDR::Boolean write_string (ACE_CDR::ULong len, - const ACE_CDR::Char *x); - ACE_CDR::Boolean write_string (const ACE_CString &x); - ACE_CDR::Boolean write_wstring (const ACE_CDR::WChar *x); - ACE_CDR::Boolean write_wstring (ACE_CDR::ULong length, - const ACE_CDR::WChar *x); - //@} - - /// @note the portion written starts at and ends - /// at . - /// The length is *NOT* stored into the CDR stream. - //@{ @name Array write operations - ACE_CDR::Boolean write_boolean_array (const ACE_CDR::Boolean *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_char_array (const ACE_CDR::Char *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_wchar_array (const ACE_CDR::WChar* x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_octet_array (const ACE_CDR::Octet* x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_short_array (const ACE_CDR::Short *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_ushort_array (const ACE_CDR::UShort *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_long_array (const ACE_CDR::Long *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_ulong_array (const ACE_CDR::ULong *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_longlong_array (const ACE_CDR::LongLong* x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_ulonglong_array (const ACE_CDR::ULongLong *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_float_array (const ACE_CDR::Float *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_double_array (const ACE_CDR::Double *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_longdouble_array (const ACE_CDR::LongDouble* x, - ACE_CDR::ULong length); - - /// - /// Adjust to @a size and count octets. - void adjust (size_t size); - - /// As above, but now the size and alignment requirements may be - /// different. - void adjust (size_t size, - size_t align); - -private: - /// disallow copying... - ACE_SizeCDR (const ACE_SizeCDR& rhs); - ACE_SizeCDR& operator= (const ACE_SizeCDR& rhs); - - ACE_CDR::Boolean write_1 (const ACE_CDR::Octet *x); - ACE_CDR::Boolean write_2 (const ACE_CDR::UShort *x); - ACE_CDR::Boolean write_4 (const ACE_CDR::ULong *x); - ACE_CDR::Boolean write_8 (const ACE_CDR::ULongLong *x); - ACE_CDR::Boolean write_16 (const ACE_CDR::LongDouble *x); - - /** - * write an array of @a length elements, each of @a size bytes and the - * start aligned at a multiple of . The elements are assumed - * to be packed with the right alignment restrictions. It is mostly - * designed for buffers of the basic types. - * - * This operation uses ; as explained above it is expected - * that using assignment is faster that for one element, - * but for several elements should be more efficient, it - * could be interesting to find the break even point and optimize - * for that case, but that would be too platform dependent. - */ - ACE_CDR::Boolean write_array (const void *x, - size_t size, - size_t align, - ACE_CDR::ULong length); - - - ACE_CDR::Boolean write_wchar_array_i (const ACE_CDR::WChar* x, - ACE_CDR::ULong length); - -private: - /// Set to false when an error ocurrs. - bool good_bit_; - - /// Current size. - size_t size_; - -protected: - /// GIOP version information - ACE_CDR::Octet major_version_; - ACE_CDR::Octet minor_version_; -}; - -// @@ This operator should not be inlined since they force SString.h -// to be included in this header. -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - const ACE_CString &x); - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -# include "ace/CDR_Size.inl" -#else /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Not used by CORBA or TAO -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_CDR::Char x); - -// CDR size-calculating output operators for primitive types - -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_CDR::Short x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_CDR::UShort x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_CDR::Long x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_CDR::ULong x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_CDR::LongLong x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_CDR::ULongLong x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR& ss, - ACE_CDR::LongDouble x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_CDR::Float x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_CDR::Double x); - -// CDR size-calculating output operator from helper classes - -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_OutputCDR::from_boolean x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_OutputCDR::from_char x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_OutputCDR::from_wchar x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_OutputCDR::from_octet x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_OutputCDR::from_string x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - ACE_OutputCDR::from_wstring x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - const ACE_CDR::Char* x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, - const ACE_CDR::WChar* x); - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* __ACE_INLINE__ */ - - -#include /**/ "ace/post.h" - -#endif /* ACE_CDR_SIZE_H */ diff --git a/dep/acelite/ace/CDR_Size.inl b/dep/acelite/ace/CDR_Size.inl deleted file mode 100644 index 4ea81523faf..00000000000 --- a/dep/acelite/ace/CDR_Size.inl +++ /dev/null @@ -1,424 +0,0 @@ -// -*- C++ -*- -// -// $Id: CDR_Size.inl 80826 2008-03-04 14:51:23Z wotte $ - -#include "ace/OS_NS_string.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_SizeCDR::ACE_SizeCDR (ACE_CDR::Octet major_version, - ACE_CDR::Octet minor_version) - : good_bit_ (true), - size_ (0), - major_version_ (major_version), - minor_version_ (minor_version) -{ -} - -ACE_INLINE bool -ACE_SizeCDR::good_bit (void) const -{ - return this->good_bit_; -} - -ACE_INLINE void -ACE_SizeCDR::reset (void) -{ - this->size_ = 0; -} - -ACE_INLINE size_t -ACE_SizeCDR::total_length (void) const -{ - return this->size_; -} - - -// Encode the CDR stream. - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_octet (ACE_CDR::Octet x) -{ - return this->write_1 (reinterpret_cast (&x)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_boolean (ACE_CDR::Boolean x) -{ - return (ACE_CDR::Boolean) this->write_octet (x ? (ACE_CDR::Octet) 1 : (ACE_CDR::Octet) 0); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_char (ACE_CDR::Char x) -{ - // Note: translator framework is not supported. - // - return this->write_1 (reinterpret_cast (&x)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_short (ACE_CDR::Short x) -{ - return this->write_2 (reinterpret_cast (&x)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_ushort (ACE_CDR::UShort x) -{ - return this->write_2 (reinterpret_cast (&x)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_long (ACE_CDR::Long x) -{ - return this->write_4 (reinterpret_cast (&x)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_ulong (ACE_CDR::ULong x) -{ - return this->write_4 (reinterpret_cast (&x)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_longlong (const ACE_CDR::LongLong &x) -{ - return this->write_8 (reinterpret_cast (&x)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_ulonglong (const ACE_CDR::ULongLong &x) -{ - const void *temp = &x; - return this->write_8 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_float (ACE_CDR::Float x) -{ - const void *temp = &x; - return this->write_4 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_double (const ACE_CDR::Double &x) -{ - const void *temp = &x; - return this->write_8 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_longdouble (const ACE_CDR::LongDouble &x) -{ - const void *temp = &x; - return this->write_16 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_string (const ACE_CDR::Char *x) -{ - if (x != 0) - { - const ACE_CDR::ULong len = - static_cast (ACE_OS::strlen (x)); - return this->write_string (len, x); - } - return this->write_string (0, 0); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_wstring (const ACE_CDR::WChar *x) -{ - if (x != 0) - { - ACE_CDR::ULong len = - static_cast (ACE_OS::strlen (x)); - return this->write_wstring (len, x); - } - return this->write_wstring (0, 0); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_char_array (const ACE_CDR::Char *x, - ACE_CDR::ULong length) -{ - // Note: translator framework is not supported. - // - return this->write_array (x, - ACE_CDR::OCTET_SIZE, - ACE_CDR::OCTET_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_wchar_array (const ACE_CDR::WChar* x, - ACE_CDR::ULong length) -{ - // Note: translator framework is not supported. - // - if (ACE_OutputCDR::wchar_maxbytes () == 0) - { - errno = EACCES; - return (ACE_CDR::Boolean) (this->good_bit_ = false); - } - if (ACE_OutputCDR::wchar_maxbytes () == sizeof (ACE_CDR::WChar)) - return this->write_array (x, - sizeof (ACE_CDR::WChar), - sizeof (ACE_CDR::WChar) == 2 - ? ACE_CDR::SHORT_ALIGN - : ACE_CDR::LONG_ALIGN, - length); - return this->write_wchar_array_i (x,length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_octet_array (const ACE_CDR::Octet* x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::OCTET_SIZE, - ACE_CDR::OCTET_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_short_array (const ACE_CDR::Short *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::SHORT_SIZE, - ACE_CDR::SHORT_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_ushort_array (const ACE_CDR::UShort *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::SHORT_SIZE, - ACE_CDR::SHORT_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_long_array (const ACE_CDR::Long *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONG_SIZE, - ACE_CDR::LONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_ulong_array (const ACE_CDR::ULong *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONG_SIZE, - ACE_CDR::LONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_longlong_array (const ACE_CDR::LongLong *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONGLONG_SIZE, - ACE_CDR::LONGLONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_ulonglong_array (const ACE_CDR::ULongLong *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONGLONG_SIZE, - ACE_CDR::LONGLONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_float_array (const ACE_CDR::Float *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONG_SIZE, - ACE_CDR::LONG_ALIGN, - length); -} - - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_double_array (const ACE_CDR::Double *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONGLONG_SIZE, - ACE_CDR::LONGLONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_SizeCDR::write_longdouble_array (const ACE_CDR::LongDouble* x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONGDOUBLE_SIZE, - ACE_CDR::LONGDOUBLE_ALIGN, - length); -} - - -// **************************************************************** - - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_CDR::Char x) -{ - ss.write_char (x); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_CDR::Short x) -{ - ss.write_short (x); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_CDR::UShort x) -{ - ss.write_ushort (x); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_CDR::Long x) -{ - ss.write_long (x); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_CDR::ULong x) -{ - ss.write_ulong (x); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_CDR::LongLong x) -{ - ss.write_longlong (x); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_CDR::ULongLong x) -{ - ss.write_ulonglong (x); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_CDR::LongDouble x) -{ - ss.write_longdouble (x); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_CDR::Float x) -{ - ss.write_float (x); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_CDR::Double x) -{ - ss.write_double (x); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, const ACE_CDR::Char *x) -{ - ss.write_string (x); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, const ACE_CDR::WChar *x) -{ - ss.write_wstring (x); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -// The following use the helper classes -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_boolean x) -{ - ss.write_boolean (x.val_); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_char x) -{ - ss.write_char (x.val_); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_wchar x) -{ - ss.write_wchar (x.val_); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_octet x) -{ - ss.write_octet (x.val_); - return (ACE_CDR::Boolean) ss.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_string x) -{ - ACE_CDR::ULong len = 0; - - if (x.val_ != 0) - { - len = static_cast (ACE_OS::strlen (x.val_)); - } - - ss.write_string (len, x.val_); - return - (ACE_CDR::Boolean) (ss.good_bit () && (!x.bound_ || len <= x.bound_)); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_wstring x) -{ - ACE_CDR::ULong len = 0; - - if (x.val_ != 0) - { - len = static_cast (ACE_OS::strlen (x.val_)); - } - - ss.write_wstring (len, x.val_); - return - (ACE_CDR::Boolean) (ss.good_bit () && (!x.bound_ || len <= x.bound_)); -} - - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/CDR_Stream.cpp b/dep/acelite/ace/CDR_Stream.cpp deleted file mode 100644 index 0d674324f68..00000000000 --- a/dep/acelite/ace/CDR_Stream.cpp +++ /dev/null @@ -1,2300 +0,0 @@ -// $Id: CDR_Stream.cpp 95896 2012-06-18 20:42:07Z hillj $ - -#include "ace/CDR_Stream.h" -#include "ace/SString.h" -#include "ace/Auto_Ptr.h" -#include "ace/Truncate.h" - -#if !defined (__ACE_INLINE__) -# include "ace/CDR_Stream.inl" -#endif /* ! __ACE_INLINE__ */ - -// **************************************************************** - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -size_t ACE_OutputCDR::wchar_maxbytes_ = sizeof (ACE_CDR::WChar); - -ACE_OutputCDR::ACE_OutputCDR (size_t size, - int byte_order, - ACE_Allocator *buffer_allocator, - ACE_Allocator *data_block_allocator, - ACE_Allocator *message_block_allocator, - size_t memcpy_tradeoff, - ACE_CDR::Octet major_version, - ACE_CDR::Octet minor_version) - : start_ ((size ? size : (size_t) ACE_CDR::DEFAULT_BUFSIZE) + ACE_CDR::MAX_ALIGNMENT, - ACE_Message_Block::MB_DATA, - 0, - 0, - buffer_allocator, - 0, - 0, - ACE_Time_Value::zero, - ACE_Time_Value::max_time, - data_block_allocator, - message_block_allocator), -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - current_alignment_ (0), -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - current_is_writable_ (true), - do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), - good_bit_ (true), - memcpy_tradeoff_ (memcpy_tradeoff), - major_version_ (major_version), - minor_version_ (minor_version), - char_translator_ (0), - wchar_translator_ (0) - -{ - ACE_CDR::mb_align (&this->start_); - this->current_ = &this->start_; - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - ACE_NEW (this->monitor_, - ACE::Monitor_Control::Size_Monitor); - this->monitor_->receive (this->total_length ()); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ -} - -ACE_OutputCDR::ACE_OutputCDR (char *data, - size_t size, - int byte_order, - ACE_Allocator *buffer_allocator, - ACE_Allocator *data_block_allocator, - ACE_Allocator *message_block_allocator, - size_t memcpy_tradeoff, - ACE_CDR::Octet major_version, - ACE_CDR::Octet minor_version) - : start_ (size, - ACE_Message_Block::MB_DATA, - 0, - data, - buffer_allocator, - 0, - 0, - ACE_Time_Value::zero, - ACE_Time_Value::max_time, - data_block_allocator, - message_block_allocator), -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - current_alignment_ (0), -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - current_is_writable_ (true), - do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), - good_bit_ (true), - memcpy_tradeoff_ (memcpy_tradeoff), - major_version_ (major_version), - minor_version_ (minor_version), - char_translator_ (0), - wchar_translator_ (0) -{ - // We cannot trust the buffer to be properly aligned - ACE_CDR::mb_align (&this->start_); - this->current_ = &this->start_; - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - ACE_NEW (this->monitor_, - ACE::Monitor_Control::Size_Monitor); - this->monitor_->receive (this->total_length ()); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ -} - -ACE_OutputCDR::ACE_OutputCDR (ACE_Data_Block *data_block, - int byte_order, - ACE_Allocator *message_block_allocator, - size_t memcpy_tradeoff, - ACE_CDR::Octet major_version, - ACE_CDR::Octet minor_version) - : start_ (data_block, - ACE_Message_Block::DONT_DELETE, - message_block_allocator), -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - current_alignment_ (0), -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - current_is_writable_ (true), - do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), - good_bit_ (true), - memcpy_tradeoff_ (memcpy_tradeoff), - major_version_ (major_version), - minor_version_ (minor_version), - char_translator_ (0), - wchar_translator_ (0) -{ - // We cannot trust the buffer to be properly aligned - ACE_CDR::mb_align (&this->start_); - this->current_ = &this->start_; - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - ACE_NEW (this->monitor_, - ACE::Monitor_Control::Size_Monitor); - this->monitor_->receive (this->total_length ()); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ -} - -ACE_OutputCDR::ACE_OutputCDR (ACE_Message_Block *data, - int byte_order, - size_t memcpy_tradeoff, - ACE_CDR::Octet major_version, - ACE_CDR::Octet minor_version) - : start_ (data->data_block ()->duplicate ()), -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - current_alignment_ (0), -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - current_is_writable_ (true), - do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), - good_bit_ (true), - memcpy_tradeoff_ (memcpy_tradeoff), - major_version_ (major_version), - minor_version_ (minor_version), - char_translator_ (0), - wchar_translator_ (0) -{ - // We cannot trust the buffer to be properly aligned - ACE_CDR::mb_align (&this->start_); - this->current_ = &this->start_; - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - ACE_NEW (this->monitor_, - ACE::Monitor_Control::Size_Monitor); - this->monitor_->receive (this->total_length ()); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ -} - -/*static*/ void -ACE_OutputCDR::wchar_maxbytes (size_t maxbytes) -{ - ACE_OutputCDR::wchar_maxbytes_ = maxbytes; -} - -/*static*/ size_t -ACE_OutputCDR::wchar_maxbytes () -{ - return ACE_OutputCDR::wchar_maxbytes_; -} - -int -ACE_OutputCDR::grow_and_adjust (size_t size, - size_t align, - char*& buf) -{ - if (!this->current_is_writable_ - || this->current_->cont () == 0 - || this->current_->cont ()->size () < size + ACE_CDR::MAX_ALIGNMENT) - { - // Calculate the new buffer's length; if growing for encode, we - // don't grow in "small" chunks because of the cost. - size_t cursize = this->current_->size (); - if (this->current_->cont () != 0) - cursize = this->current_->cont ()->size (); - size_t minsize = size; - -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - minsize += ACE_CDR::MAX_ALIGNMENT; -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - - // Make sure that there is enough room for bytes, but - // also make it bigger than whatever our current size is. - if (minsize < cursize) - minsize = cursize; - - size_t const newsize = ACE_CDR::next_size (minsize); - - this->good_bit_ = false; - ACE_Message_Block* tmp = 0; - ACE_NEW_RETURN (tmp, - ACE_Message_Block (newsize, - ACE_Message_Block::MB_DATA, - 0, - 0, - this->current_->data_block ()->allocator_strategy (), - 0, - 0, - ACE_Time_Value::zero, - ACE_Time_Value::max_time, - this->current_->data_block ()->data_block_allocator ()), - -1); - - // Message block initialization may fail while the construction - // succeds. Since as a matter of policy, ACE may throw no - // exceptions, we have to do a separate check like this. - if (tmp != 0 && tmp->size () < newsize) - { - delete tmp; - errno = ENOMEM; - return -1; - } - - this->good_bit_ = true; - -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - // The new block must start with the same alignment as the - // previous block finished. - ptrdiff_t const tmpalign = - reinterpret_cast (tmp->rd_ptr ()) % ACE_CDR::MAX_ALIGNMENT; - ptrdiff_t const curalign = - static_cast (this->current_alignment_) % ACE_CDR::MAX_ALIGNMENT; - ptrdiff_t offset = curalign - tmpalign; - if (offset < 0) - offset += ACE_CDR::MAX_ALIGNMENT; - tmp->rd_ptr (static_cast (offset)); - tmp->wr_ptr (tmp->rd_ptr ()); -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - - // grow the chain and set the current block. - tmp->cont (this->current_->cont ()); - this->current_->cont (tmp); - } - this->current_ = this->current_->cont (); - this->current_is_writable_ = true; - - return this->adjust (size, align, buf); -} - -ACE_CDR::Boolean -ACE_OutputCDR::write_wchar (ACE_CDR::WChar x) -{ - if (this->wchar_translator_ != 0) - return (this->good_bit_ = this->wchar_translator_->write_wchar (*this, x)); - if (ACE_OutputCDR::wchar_maxbytes_ == 0) - { - errno = EACCES; - return (this->good_bit_ = false); - } - if (static_cast (major_version_) == 1 - && static_cast (minor_version_) == 2) - { - ACE_CDR::Octet len = - static_cast (ACE_OutputCDR::wchar_maxbytes_); - if (this->write_1 (&len)) - { - if (ACE_OutputCDR::wchar_maxbytes_ == sizeof(ACE_CDR::WChar)) - return - this->write_octet_array ( - reinterpret_cast (&x), - static_cast (len)); - else - if (ACE_OutputCDR::wchar_maxbytes_ == 2) - { - ACE_CDR::Short sx = static_cast (x); - return - this->write_octet_array ( - reinterpret_cast (&sx), - static_cast (len)); - } - else - { - ACE_CDR::Octet ox = static_cast (x); - return - this->write_octet_array ( - reinterpret_cast (&ox), - static_cast (len)); - } - } - } - else if (static_cast (minor_version_) == 0) - { // wchar is not allowed with GIOP 1.0. - errno = EINVAL; - return (this->good_bit_ = false); - } - if (ACE_OutputCDR::wchar_maxbytes_ == sizeof (ACE_CDR::WChar)) - { - void const * const temp = &x; - return - this->write_4 (reinterpret_cast (temp)); - } - else if (ACE_OutputCDR::wchar_maxbytes_ == 2) - { - ACE_CDR::Short sx = static_cast (x); - return this->write_2 (reinterpret_cast (&sx)); - } - ACE_CDR::Octet ox = static_cast (x); - return this->write_1 (reinterpret_cast (&ox)); -} - -ACE_CDR::Boolean -ACE_OutputCDR::write_string (ACE_CDR::ULong len, - const ACE_CDR::Char *x) -{ - // @@ This is a slight violation of "Optimize for the common case", - // i.e. normally the translator will be 0, but OTOH the code is - // smaller and should be better for the cache ;-) ;-) - if (this->char_translator_ != 0) - return this->char_translator_->write_string (*this, len, x); - - if (len != 0) - { - if (this->write_ulong (len + 1)) - return this->write_char_array (x, len + 1); - } - else - { - // Be nice to programmers: treat nulls as empty strings not - // errors. (OMG-IDL supports languages that don't use the C/C++ - // notion of null v. empty strings; nulls aren't part of the OMG-IDL - // string model.) - if (this->write_ulong (1)) - return this->write_char (0); - } - - return (this->good_bit_ = false); -} - -ACE_CDR::Boolean -ACE_OutputCDR::write_string (const ACE_CString &x) -{ - // @@ Leave this method in here, not the `.i' file so that we don't - // have to unnecessarily pull in the `ace/SString.h' header. - return this->write_string (static_cast (x.length ()), - x.c_str()); -} - -ACE_CDR::Boolean -ACE_OutputCDR::write_wstring (ACE_CDR::ULong len, - const ACE_CDR::WChar *x) -{ - // @@ This is a slight violation of "Optimize for the common case", - // i.e. normally the translator will be 0, but OTOH the code is - // smaller and should be better for the cache ;-) ;-) - // What do we do for GIOP 1.2??? - if (this->wchar_translator_ != 0) - return this->wchar_translator_->write_wstring (*this, len, x); - if (ACE_OutputCDR::wchar_maxbytes_ == 0) - { - errno = EACCES; - return (this->good_bit_ = false); - } - - if (static_cast (this->major_version_) == 1 - && static_cast (this->minor_version_) == 2) - { - if (x != 0) - { - //In GIOP 1.2 the length field contains the number of bytes - //the wstring occupies rather than number of wchars - //Taking sizeof might not be a good way! This is a temporary fix. - ACE_CDR::Boolean good_ulong = - this->write_ulong ( - ACE_Utils::truncate_cast ( - ACE_OutputCDR::wchar_maxbytes_ * len)); - - if (good_ulong) - { - return this->write_wchar_array (x, len); - } - } - else - { - //In GIOP 1.2 zero length wstrings are legal - return this->write_ulong (0); - } - } - - else - if (x != 0) - { - if (this->write_ulong (len + 1)) - return this->write_wchar_array (x, len + 1); - } - else if (this->write_ulong (1)) - return this->write_wchar (0); - return (this->good_bit_ = false); -} - -ACE_CDR::Boolean -ACE_OutputCDR::write_octet_array_mb (const ACE_Message_Block* mb) -{ - // If the buffer is small and it fits in the current message - // block it is be cheaper just to copy the buffer. - for (const ACE_Message_Block* i = mb; - i != 0; - i = i->cont ()) - { - size_t const length = i->length (); - - // If the mb does not own its data we are forced to make a copy. - if (ACE_BIT_ENABLED (i->flags (), - ACE_Message_Block::DONT_DELETE)) - { - if (! this->write_array (i->rd_ptr (), - ACE_CDR::OCTET_SIZE, - ACE_CDR::OCTET_ALIGN, - static_cast (length))) - return (this->good_bit_ = false); - continue; - } - - if (length < this->memcpy_tradeoff_ - && this->current_->wr_ptr () + length < this->current_->end ()) - { - if (! this->write_array (i->rd_ptr (), - ACE_CDR::OCTET_SIZE, - ACE_CDR::OCTET_ALIGN, - static_cast (length))) - return (this->good_bit_ = false); - continue; - } - - ACE_Message_Block* cont = 0; - this->good_bit_ = false; - ACE_NEW_RETURN (cont, - ACE_Message_Block (i->data_block ()->duplicate ()), - false); - this->good_bit_ = true; - - if (this->current_->cont () != 0) - ACE_Message_Block::release (this->current_->cont ()); - cont->rd_ptr (i->rd_ptr ()); - cont->wr_ptr (i->wr_ptr ()); - - this->current_->cont (cont); - this->current_ = cont; - this->current_is_writable_ = false; -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - this->current_alignment_ = - (this->current_alignment_ + cont->length ()) % ACE_CDR::MAX_ALIGNMENT; -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - } - - return true; -} - -ACE_CDR::Boolean -ACE_OutputCDR::write_1 (const ACE_CDR::Octet *x) -{ - char *buf = 0; - if (this->adjust (1, buf) == 0) - { - *reinterpret_cast (buf) = *x; - return true; - } - - return false; -} - -ACE_CDR::Boolean -ACE_OutputCDR::write_2 (const ACE_CDR::UShort *x) -{ - char *buf = 0; - if (this->adjust (ACE_CDR::SHORT_SIZE, buf) == 0) - { -#if !defined (ACE_ENABLE_SWAP_ON_WRITE) - *reinterpret_cast (buf) = *x; - return true; -#else - if (!this->do_byte_swap_) - { - *reinterpret_cast (buf) = *x; - return true; - } - else - { - ACE_CDR::swap_2 (reinterpret_cast (x), buf); - return true; - } -#endif /* ACE_ENABLE_SWAP_ON_WRITE */ - } - - return false; -} - -ACE_CDR::Boolean -ACE_OutputCDR::write_4 (const ACE_CDR::ULong *x) -{ - char *buf = 0; - if (this->adjust (ACE_CDR::LONG_SIZE, buf) == 0) - { -#if !defined (ACE_ENABLE_SWAP_ON_WRITE) - *reinterpret_cast (buf) = *x; - return true; -#else - if (!this->do_byte_swap_) - { - *reinterpret_cast (buf) = *x; - return true; - } - else - { - ACE_CDR::swap_4 (reinterpret_cast (x), buf); - return true; - } -#endif /* ACE_ENABLE_SWAP_ON_WRITE */ - } - - return false; -} - -ACE_CDR::Boolean -ACE_OutputCDR::write_8 (const ACE_CDR::ULongLong *x) -{ - char *buf = 0; - - if (this->adjust (ACE_CDR::LONGLONG_SIZE, buf) == 0) - { -#if defined (__arm__) && !defined (ACE_HAS_IPHONE) - // Convert to Intel format (12345678 => 56781234) - const char *orig = reinterpret_cast (x); - char *target = buf; - register ACE_UINT32 x = - *reinterpret_cast (orig); - register ACE_UINT32 y = - *reinterpret_cast (orig + 4); - *reinterpret_cast (target) = y; - *reinterpret_cast (target + 4) = x; - return true; -#else -# if !defined (ACE_ENABLE_SWAP_ON_WRITE) - *reinterpret_cast (buf) = *x; - return true; -# else - if (!this->do_byte_swap_) - { - *reinterpret_cast (buf) = *x; - return true; - } - else - { - ACE_CDR::swap_8 (reinterpret_cast (x), buf); - return true; - } -# endif /* ACE_ENABLE_SWAP_ON_WRITE */ -#endif /* !__arm__ */ - } - - return false; -} - -ACE_CDR::Boolean -ACE_OutputCDR::write_16 (const ACE_CDR::LongDouble *x) -{ - char* buf = 0; - if (this->adjust (ACE_CDR::LONGDOUBLE_SIZE, - ACE_CDR::LONGDOUBLE_ALIGN, - buf) == 0) - { -#if !defined (ACE_ENABLE_SWAP_ON_WRITE) - *reinterpret_cast (buf) = *x; - return 1; -#else - if (!this->do_byte_swap_) - { - *reinterpret_cast (buf) = *x; - return true; - } - else - { - ACE_CDR::swap_16 (reinterpret_cast (x), buf); - return true; - } -#endif /* ACE_ENABLE_SWAP_ON_WRITE */ - } - - return false; -} - -ACE_CDR::Boolean -ACE_OutputCDR::write_wchar_array_i (const ACE_CDR::WChar *x, - ACE_CDR::ULong length) -{ - if (length == 0) - return true; - char* buf = 0; - size_t const align = (ACE_OutputCDR::wchar_maxbytes_ == 2) ? - ACE_CDR::SHORT_ALIGN : - ACE_CDR::OCTET_ALIGN; - - if (this->adjust (ACE_OutputCDR::wchar_maxbytes_ * length, align, buf) == 0) - { - if (ACE_OutputCDR::wchar_maxbytes_ == 2) - { - ACE_CDR::UShort *sb = reinterpret_cast (buf); - for (size_t i = 0; i < length; ++i) -#if !defined (ACE_ENABLE_SWAP_ON_WRITE) - sb[i] = static_cast (x[i]); -#else - if (!this->do_byte_swap_) - sb[i] = static_cast (x[i]); - else - { - ACE_CDR::UShort sx = static_cast (x[i]); - ACE_CDR::swap_2 (reinterpret_cast (&sx), &buf[i * 2]); - } -#endif /* ACE_ENABLE_SWAP_ON_WRITE */ - } - else - { - for (size_t i = 0; i < length; ++i) - buf[i] = static_cast (x[i]); - } - return this->good_bit_; - } - return false; -} - - -ACE_CDR::Boolean -ACE_OutputCDR::write_array (const void *x, - size_t size, - size_t align, - ACE_CDR::ULong length) -{ - if (length == 0) - return true; - char *buf = 0; - if (this->adjust (size * length, align, buf) == 0) - { -#if !defined (ACE_ENABLE_SWAP_ON_WRITE) - ACE_OS::memcpy (buf, x, size*length); - return true; -#else - if (!this->do_byte_swap_ || size == 1) - { - ACE_OS::memcpy (buf, x, size*length); - return true; - } - else - { - const char *source = reinterpret_cast (x); - switch (size) - { - case 2: - ACE_CDR::swap_2_array (source, buf, length); - return true; - case 4: - ACE_CDR::swap_4_array (source, buf, length); - return true; - case 8: - ACE_CDR::swap_8_array (source, buf, length); - return true; - case 16: - ACE_CDR::swap_16_array (source, buf, length); - return true; - default: - // TODO: print something? - this->good_bit_ = false; - return false; - } - } -#endif /* ACE_ENABLE_SWAP_ON_WRITE */ - } - this->good_bit_ = false; - return false; -} - - -ACE_CDR::Boolean -ACE_OutputCDR::write_boolean_array (const ACE_CDR::Boolean* x, - ACE_CDR::ULong length) -{ - // It is hard to optimize this, the spec requires that on the wire - // booleans be represented as a byte with value 0 or 1, but in - // memory it is possible (though very unlikely) that a boolean has - // a non-zero value (different from 1). - // We resort to a simple loop. - ACE_CDR::Boolean const * const end = x + length; - - for (ACE_CDR::Boolean const * i = x; - i != end && this->good_bit (); - ++i) - (void) this->write_boolean (*i); - - return this->good_bit (); -} - -char * -ACE_OutputCDR::write_long_placeholder (void) -{ - char *buf = 0; - if (this->adjust (ACE_CDR::LONG_SIZE, buf) == 0) - *reinterpret_cast (buf) = 0; - else - buf = 0; - return buf; -} - -char * -ACE_OutputCDR::write_short_placeholder (void) -{ - char *buf = 0; - if (this->adjust (ACE_CDR::SHORT_SIZE, buf) == 0) - *reinterpret_cast (buf) = 0; - else - buf = 0; - return buf; -} - -char * -ACE_OutputCDR::write_boolean_placeholder (void) -{ - char *buf = 0; - if (this->adjust (ACE_CDR::OCTET_SIZE, buf) == 0) - *reinterpret_cast (buf) = 0; - else - buf = 0; - return buf; -} - -char * -ACE_OutputCDR::write_char_placeholder (void) -{ - char *buf = 0; - if (this->adjust (ACE_CDR::OCTET_SIZE, buf) == 0) - *reinterpret_cast (buf) = 0; - else - buf = 0; - return buf; -} - -char * -ACE_OutputCDR::write_octet_placeholder (void) -{ - char *buf = 0; - if (this->adjust (ACE_CDR::OCTET_SIZE, buf) == 0) - *reinterpret_cast (buf) = 0; - else - buf = 0; - return buf; -} - -char * -ACE_OutputCDR::write_longlong_placeholder (void) -{ - char *buf = 0; - if (this->adjust (ACE_CDR::LONGLONG_SIZE, buf) == 0) - *reinterpret_cast (buf) = 0; - else - buf = 0; - return buf; -} - -char * -ACE_OutputCDR::write_float_placeholder (void) -{ - char *buf = 0; - if (this->adjust (ACE_CDR::LONG_SIZE, buf) == 0) - *reinterpret_cast (buf) = 0; - else - buf = 0; - return buf; -} - -char * -ACE_OutputCDR::write_double_placeholder (void) -{ - char *buf = 0; - if (this->adjust (ACE_CDR::LONGLONG_SIZE, buf) == 0) - *reinterpret_cast (buf) = 0; - else - buf = 0; - return buf; -} - -ACE_CDR::Boolean -ACE_OutputCDR::replace (ACE_CDR::Long x, char* loc) -{ - if (this->find (loc) == 0) - return false; - -#if !defined (ACE_ENABLE_SWAP_ON_WRITE) - *reinterpret_cast (loc) = x; -#else - if (!this->do_byte_swap_) - { - *reinterpret_cast (loc) = x; - } - else - { - ACE_CDR::swap_4 (reinterpret_cast (&x), loc); - } -#endif /* ACE_ENABLE_SWAP_ON_WRITE */ - - return true; -} - -ACE_CDR::Boolean -ACE_OutputCDR::replace (ACE_CDR::ULong x, char* loc) -{ - if (this->find (loc) == 0) - return false; - -#if !defined (ACE_ENABLE_SWAP_ON_WRITE) - *reinterpret_cast (loc) = x; -#else - if (!this->do_byte_swap_) - { - *reinterpret_cast (loc) = x; - } - else - { - ACE_CDR::swap_4 (reinterpret_cast (&x), loc); - } -#endif /* ACE_ENABLE_SWAP_ON_WRITE */ - - return true; -} - -ACE_CDR::Boolean -ACE_OutputCDR::replace (ACE_CDR::Short x, char* loc) -{ - if (this->find (loc) == 0) - return false; - -#if !defined (ACE_ENABLE_SWAP_ON_WRITE) - *reinterpret_cast (loc) = x; -#else - if (!this->do_byte_swap_) - { - *reinterpret_cast (loc) = x; - } - else - { - ACE_CDR::swap_2 (reinterpret_cast (&x), loc); - } -#endif /* ACE_ENABLE_SWAP_ON_WRITE */ - - return true; -} - -ACE_CDR::Boolean -ACE_OutputCDR::replace (ACE_CDR::UShort x, char* loc) -{ - if (this->find (loc) == 0) - return false; - -#if !defined (ACE_ENABLE_SWAP_ON_WRITE) - *reinterpret_cast (loc) = x; -#else - if (!this->do_byte_swap_) - { - *reinterpret_cast (loc) = x; - } - else - { - ACE_CDR::swap_2 (reinterpret_cast (&x), loc); - } -#endif /* ACE_ENABLE_SWAP_ON_WRITE */ - - return true; -} - -ACE_CDR::Boolean -ACE_OutputCDR::replace (ACE_CDR::Boolean x, char* loc) -{ - if (this->find (loc) == 0) - return false; - - *reinterpret_cast (loc) = x; - - return true; -} - -ACE_CDR::Boolean -ACE_OutputCDR::replace (ACE_CDR::Char x, char* loc) -{ - if (this->find (loc) == 0) - return false; - - *reinterpret_cast (loc) = x; - - return true; -} - -ACE_CDR::Boolean -ACE_OutputCDR::replace (ACE_CDR::Octet x, char* loc) -{ - if (this->find (loc) == 0) - return false; - - *reinterpret_cast (loc) = x; - - return true; -} - -ACE_CDR::Boolean -ACE_OutputCDR::replace (ACE_CDR::LongLong x, char* loc) -{ - if (this->find (loc) == 0) - return false; - -#if !defined (ACE_ENABLE_SWAP_ON_WRITE) - *reinterpret_cast (loc) = x; -#else - if (!this->do_byte_swap_) - { - *reinterpret_cast (loc) = x; - } - else - { - ACE_CDR::swap_8 (reinterpret_cast (&x), loc); - } -#endif /* ACE_ENABLE_SWAP_ON_WRITE */ - - return true; -} - -ACE_CDR::Boolean -ACE_OutputCDR::replace (ACE_CDR::ULongLong x, char* loc) -{ - if (this->find (loc) == 0) - return false; - -#if !defined (ACE_ENABLE_SWAP_ON_WRITE) - *reinterpret_cast (loc) = x; -#else - if (!this->do_byte_swap_) - { - *reinterpret_cast (loc) = x; - } - else - { - ACE_CDR::swap_8 (reinterpret_cast (&x), loc); - } -#endif /* ACE_ENABLE_SWAP_ON_WRITE */ - - return true; -} - -ACE_CDR::Boolean -ACE_OutputCDR::replace (ACE_CDR::Float x, char* loc) -{ - if (this->find (loc) == 0) - return false; - -#if !defined (ACE_ENABLE_SWAP_ON_WRITE) - *reinterpret_cast (loc) = x; -#else - if (!this->do_byte_swap_) - { - *reinterpret_cast (loc) = x; - } - else - { - ACE_CDR::swap_4 (reinterpret_cast (&x), loc); - } -#endif /* ACE_ENABLE_SWAP_ON_WRITE */ - - return true; -} - -ACE_CDR::Boolean -ACE_OutputCDR::replace (ACE_CDR::Double x, char* loc) -{ - if (this->find (loc) == 0) - return false; - -#if !defined (ACE_ENABLE_SWAP_ON_WRITE) - *reinterpret_cast (loc) = x; -#else - if (!this->do_byte_swap_) - { - *reinterpret_cast (loc) = x; - } - else - { - ACE_CDR::swap_8 (reinterpret_cast (&x), loc); - } -#endif /* ACE_ENABLE_SWAP_ON_WRITE */ - - return true; -} - -int -ACE_OutputCDR::consolidate (void) -{ - // Optimize by only doing something if we need to - if (this->current_ != &this->start_) - { - // Set the number of bytes in the top-level block, reallocating - // if necessary. The rd_ptr and wr_ptr remain at the original offsets - // into the buffer, even if it is reallocated. - // Return an error if the allocation failed. - size_t const newsize = - ACE_CDR::first_size (this->total_length () - + ACE_CDR::MAX_ALIGNMENT); - if (this->start_.size (newsize) < 0) - { - return -1; - } - - // Consolidate the chain into the first block. NOTE that - // ACE_CDR::consolidate can not be used since we don't want to - // overwrite what is already in the first block. We just append it since - // the read and write pointers weren't affected by the resizing above. - // We also don't have to worry about alignment since the start block is - // already aligned. - // NOTE also we know there is a continuation since we checked for it - // above. There is therefore no reason to check for a 0 continuation - // field here. - ACE_Message_Block *cont = this->start_.cont (); - for (const ACE_Message_Block* i = cont; i != 0; i = i->cont ()) - { - this->start_.copy (i->rd_ptr (), i->length ()); - } - - // Release the old blocks that were consolidated and reset the - // current_ and current_is_writable_ to reflect the single used block. - ACE_Message_Block::release (cont); - this->start_.cont (0); - this->current_ = &this->start_; - this->current_is_writable_ = true; - } - - return 0; -} - - -ACE_Message_Block* -ACE_OutputCDR::find (char* loc) -{ - ACE_Message_Block* mb = 0; - for (mb = &this->start_; mb != 0; mb = mb->cont ()) - { - if (loc <= mb->wr_ptr () && loc >= mb->rd_ptr ()) - { - break; - } - } - - return mb; -} - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - -void -ACE_OutputCDR::register_monitor (const char *id) -{ - this->monitor_->name (id); - this->monitor_->add_to_registry (); -} - -void -ACE_OutputCDR::unregister_monitor (void) -{ - this->monitor_->remove_from_registry (); -} - -#endif /* ACE_HAS_MONITOR_POINTS==1 */ - -// **************************************************************** - -ACE_InputCDR::ACE_InputCDR (const char *buf, - size_t bufsiz, - int byte_order, - ACE_CDR::Octet major_version, - ACE_CDR::Octet minor_version) - : start_ (buf, bufsiz), - do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), - good_bit_ (true), - major_version_ (major_version), - minor_version_ (minor_version), - char_translator_ (0), - wchar_translator_ (0) -{ - this->start_.wr_ptr (bufsiz); - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - ACE_NEW (this->monitor_, - ACE::Monitor_Control::Size_Monitor); - this->monitor_->receive (bufsiz); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ -} - -ACE_InputCDR::ACE_InputCDR (size_t bufsiz, - int byte_order, - ACE_CDR::Octet major_version, - ACE_CDR::Octet minor_version) - : start_ (bufsiz), - do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), - good_bit_ (true), - major_version_ (major_version), - minor_version_ (minor_version), - char_translator_ (0), - wchar_translator_ (0) -{ -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - ACE_NEW (this->monitor_, - ACE::Monitor_Control::Size_Monitor); - this->monitor_->receive (bufsiz); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ -} - -ACE_InputCDR::ACE_InputCDR (const ACE_Message_Block *data, - int byte_order, - ACE_CDR::Octet major_version, - ACE_CDR::Octet minor_version, - ACE_Lock* lock) - : start_ (0, ACE_Message_Block::MB_DATA, 0, 0, 0, lock), - good_bit_ (true), - major_version_ (major_version), - minor_version_ (minor_version), - char_translator_ (0), - wchar_translator_ (0) -{ -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - ACE_NEW (this->monitor_, - ACE::Monitor_Control::Size_Monitor); - this->monitor_->receive (this->start_.total_size ()); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ - - this->reset (data, byte_order); -} - -ACE_InputCDR::ACE_InputCDR (ACE_Data_Block *data, - ACE_Message_Block::Message_Flags flag, - int byte_order, - ACE_CDR::Octet major_version, - ACE_CDR::Octet minor_version) - : start_ (data, flag), - do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), - good_bit_ (true), - major_version_ (major_version), - minor_version_ (minor_version), - char_translator_ (0), - wchar_translator_ (0) -{ -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - ACE_NEW (this->monitor_, - ACE::Monitor_Control::Size_Monitor); - this->monitor_->receive (data->size ()); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ -} - -ACE_InputCDR::ACE_InputCDR (ACE_Data_Block *data, - ACE_Message_Block::Message_Flags flag, - size_t rd_pos, - size_t wr_pos, - int byte_order, - ACE_CDR::Octet major_version, - ACE_CDR::Octet minor_version) - : start_ (data, flag), - do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), - good_bit_ (true), - major_version_ (major_version), - minor_version_ (minor_version), - char_translator_ (0), - wchar_translator_ (0) -{ - // Set the read pointer - this->start_.rd_ptr (rd_pos); - - // Set the write pointer after doing a sanity check. - char* wrpos = this->start_.base () + wr_pos; - - if (this->start_.end () >= wrpos) - { - this->start_.wr_ptr (wr_pos); - } - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - ACE_NEW (this->monitor_, - ACE::Monitor_Control::Size_Monitor); - this->monitor_->receive (data->size ()); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ -} - -ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs, - size_t size, - ACE_CDR::Long offset) - : start_ (rhs.start_, - ACE_CDR::MAX_ALIGNMENT), - do_byte_swap_ (rhs.do_byte_swap_), - good_bit_ (true), - major_version_ (rhs.major_version_), - minor_version_ (rhs.minor_version_), - char_translator_ (rhs.char_translator_), - wchar_translator_ (rhs.wchar_translator_) -{ -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - // Align the base pointer assuming that the incoming stream is also - // aligned the way we are aligned - char *incoming_start = ACE_ptr_align_binary (rhs.start_.base (), - ACE_CDR::MAX_ALIGNMENT); -#else - char *incoming_start = rhs.start_.base (); -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - - const size_t newpos = - (rhs.start_.rd_ptr() - incoming_start) + offset; - - if (newpos <= this->start_.space () - && newpos + size <= this->start_.space ()) - { - this->start_.rd_ptr (newpos); - this->start_.wr_ptr (newpos + size); - } - else - { - this->good_bit_ = false; - } - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - ACE_NEW (this->monitor_, - ACE::Monitor_Control::Size_Monitor); - this->monitor_->receive (this->start_.total_size ()); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ -} - -ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs, - size_t size) - : start_ (rhs.start_, - ACE_CDR::MAX_ALIGNMENT), - do_byte_swap_ (rhs.do_byte_swap_), - good_bit_ (true), - major_version_ (rhs.major_version_), - minor_version_ (rhs.minor_version_), - char_translator_ (rhs.char_translator_), - wchar_translator_ (rhs.wchar_translator_) -{ -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - // Align the base pointer assuming that the incoming stream is also - // aligned the way we are aligned - char *incoming_start = ACE_ptr_align_binary (rhs.start_.base (), - ACE_CDR::MAX_ALIGNMENT); -#else - char *incoming_start = rhs.start_.base (); -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - - const size_t newpos = - rhs.start_.rd_ptr() - incoming_start; - - if (newpos <= this->start_.space () - && newpos + size <= this->start_.space ()) - { - // Notice that ACE_Message_Block::duplicate may leave the - // wr_ptr() with a higher value than what we actually want. - this->start_.rd_ptr (newpos); - this->start_.wr_ptr (newpos + size); - - ACE_CDR::Octet byte_order = 0; - (void) this->read_octet (byte_order); - this->do_byte_swap_ = (byte_order != ACE_CDR_BYTE_ORDER); - } - else - { - this->good_bit_ = false; - } - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - ACE_NEW (this->monitor_, - ACE::Monitor_Control::Size_Monitor); - this->monitor_->receive (this->start_.total_size ()); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ -} - -ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs) - : start_ (rhs.start_, - ACE_CDR::MAX_ALIGNMENT), - do_byte_swap_ (rhs.do_byte_swap_), - good_bit_ (true), - major_version_ (rhs.major_version_), - minor_version_ (rhs.minor_version_), - char_translator_ (rhs.char_translator_), - wchar_translator_ (rhs.wchar_translator_) -{ -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - char *buf = ACE_ptr_align_binary (rhs.start_.base (), - ACE_CDR::MAX_ALIGNMENT); -#else - char *buf = rhs.start_.base (); -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - - size_t rd_offset = rhs.start_.rd_ptr () - buf; - size_t wr_offset = rhs.start_.wr_ptr () - buf; - this->start_.rd_ptr (rd_offset); - this->start_.wr_ptr (wr_offset); - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - ACE_NEW (this->monitor_, - ACE::Monitor_Control::Size_Monitor); - this->monitor_->receive (this->start_.total_size ()); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ -} - -ACE_InputCDR::ACE_InputCDR (ACE_InputCDR::Transfer_Contents x) - : start_ (x.rhs_.start_.data_block ()), - do_byte_swap_ (x.rhs_.do_byte_swap_), - good_bit_ (true), - major_version_ (x.rhs_.major_version_), - minor_version_ (x.rhs_.minor_version_), - char_translator_ (x.rhs_.char_translator_), - wchar_translator_ (x.rhs_.wchar_translator_) -{ - this->start_.rd_ptr (x.rhs_.start_.rd_ptr ()); - this->start_.wr_ptr (x.rhs_.start_.wr_ptr ()); - - ACE_Data_Block* db = this->start_.data_block ()->clone_nocopy (); - (void) x.rhs_.start_.replace_data_block (db); - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - ACE_NEW (this->monitor_, - ACE::Monitor_Control::Size_Monitor); - this->monitor_->receive (this->start_.total_size ()); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ -} - -ACE_InputCDR& -ACE_InputCDR::operator= (const ACE_InputCDR& rhs) -{ - if (this != &rhs) - { - this->start_.data_block (rhs.start_.data_block ()->duplicate ()); - this->start_.rd_ptr (rhs.start_.rd_ptr ()); - this->start_.wr_ptr (rhs.start_.wr_ptr ()); - this->do_byte_swap_ = rhs.do_byte_swap_; - this->good_bit_ = true; - this->char_translator_ = rhs.char_translator_; - this->major_version_ = rhs.major_version_; - this->minor_version_ = rhs.minor_version_; - } - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - this->monitor_->receive (this->start_.total_size ()); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ - - return *this; -} - -ACE_InputCDR::ACE_InputCDR (const ACE_OutputCDR& rhs, - ACE_Allocator* buffer_allocator, - ACE_Allocator* data_block_allocator, - ACE_Allocator* message_block_allocator) - : start_ (rhs.total_length () + ACE_CDR::MAX_ALIGNMENT, - ACE_Message_Block::MB_DATA, - 0, - 0, - buffer_allocator, - 0, - 0, - ACE_Time_Value::zero, - ACE_Time_Value::max_time, - data_block_allocator, - message_block_allocator), - do_byte_swap_ (rhs.do_byte_swap_), - good_bit_ (true), - major_version_ (rhs.major_version_), - minor_version_ (rhs.minor_version_), - char_translator_ (rhs.char_translator_), - wchar_translator_ (rhs.wchar_translator_) -{ - ACE_CDR::mb_align (&this->start_); - for (const ACE_Message_Block *i = rhs.begin (); - i != rhs.end (); - i = i->cont ()) - { - this->start_.copy (i->rd_ptr (), i->length ()); - } - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - ACE_NEW (this->monitor_, - ACE::Monitor_Control::Size_Monitor); - this->monitor_->receive (this->start_.total_size ()); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ -} - -ACE_CDR::Boolean -ACE_InputCDR::skip_wchar (void) -{ - if (static_cast (major_version_) == 1 - && static_cast (minor_version_) == 2) - { - ACE_CDR::Octet len; - if (this->read_1 (&len)) - return this->skip_bytes (static_cast (len)); - } - else - { - ACE_CDR::WChar x; - void * const temp = &x; - if (ACE_OutputCDR::wchar_maxbytes_ == 2) - return this->read_2 (reinterpret_cast (temp)); - else - return this->read_4 (reinterpret_cast (temp)); - } - - return (this->good_bit_ = false); -} - -ACE_CDR::Boolean -ACE_InputCDR::read_wchar (ACE_CDR::WChar& x) -{ - if (this->wchar_translator_ != 0) - { - this->good_bit_ = this->wchar_translator_->read_wchar (*this,x); - return this->good_bit_; - } - if (ACE_OutputCDR::wchar_maxbytes_ == 0) - { - errno = EACCES; - return (this->good_bit_ = false); - } - - if (ACE_OutputCDR::wchar_maxbytes_ == sizeof (ACE_CDR::WChar)) - { - if (static_cast (major_version_) == 1 - && static_cast (minor_version_) == 2) - { - ACE_CDR::Octet len; - - if (this->read_1 (&len)) - return this->read_array - (reinterpret_cast (&x), - static_cast (len), - ACE_CDR::OCTET_ALIGN, - 1); - - else - return (this->good_bit_ = false); - } - - void * const temp = &x; - if (sizeof (ACE_CDR::WChar) == 2) - return this->read_2 (reinterpret_cast (temp)); - else - return this->read_4 (reinterpret_cast (temp)); - } - - if (static_cast (major_version_) == 1 - && static_cast (minor_version_) == 2) - { - ACE_CDR::Octet len; - - if (this->read_1 (&len)) - { - if (len == 2) - { - ACE_CDR::Short sx; - if (this->read_array - (reinterpret_cast (&sx), - static_cast (len), - ACE_CDR::OCTET_ALIGN, - 1)) - { - x = static_cast (sx); - return true; - } - } - else - { - ACE_CDR::Octet ox; - if (this->read_array - (reinterpret_cast (&ox), - static_cast (len), - ACE_CDR::OCTET_ALIGN, - 1)) - { - x = static_cast (ox); - return true; - } - } - } - } - else - { - if (ACE_OutputCDR::wchar_maxbytes_ == 2) - { - ACE_CDR::UShort sx; - if (this->read_2 (reinterpret_cast (&sx))) - { - x = static_cast (sx); - return true; - } - } - else - { - ACE_CDR::Octet ox; - if (this->read_1 (&ox)) - { - x = static_cast (ox); - return true; - } - - } - } - return (this->good_bit_ = false); -} - -ACE_CDR::Boolean -ACE_InputCDR::read_string (ACE_CDR::Char *&x) -{ - // @@ This is a slight violation of "Optimize for the common case", - // i.e. normally the translator will be 0, but OTOH the code is - // smaller and should be better for the cache ;-) ;-) - if (this->char_translator_ != 0) - { - this->good_bit_ = this->char_translator_->read_string (*this, x); - return this->good_bit_; - } - - ACE_CDR::ULong len = 0; - - if (!this->read_ulong (len)) - return false; - - // A check for the length being too great is done later in the - // call to read_char_array but we want to have it done before - // the memory is allocated. - if (len > 0 && len <= this->length()) - { - ACE_NEW_RETURN (x, - ACE_CDR::Char[len], - 0); - - ACE_Auto_Basic_Array_Ptr safe_data (x); - - if (this->read_char_array (x, len)) - { - (void) safe_data.release (); - return true; - } - } - else if (len == 0) - { - // Convert any null strings to empty strings since empty - // strings can cause crashes. (See bug 58.) - ACE_NEW_RETURN (x, - ACE_CDR::Char[1], - 0); - ACE_OS::strcpy (const_cast (x), ""); - return true; - } - - x = 0; - return (this->good_bit_ = false); -} - -ACE_CDR::Boolean -ACE_InputCDR::read_string (ACE_CString &x) -{ - ACE_CDR::Char * data = 0; - if (this->read_string (data)) - { - ACE_Auto_Basic_Array_Ptr safe_data (data); - x = data; - return true; - } - - x = ""; - return (this->good_bit_ = false); -} - -ACE_CDR::Boolean -ACE_InputCDR::read_wstring (ACE_CDR::WChar*& x) -{ - // @@ This is a slight violation of "Optimize for the common case", - // i.e. normally the translator will be 0, but OTOH the code is - // smaller and should be better for the cache ;-) ;-) - if (this->wchar_translator_ != 0) - { - this->good_bit_ = this->wchar_translator_->read_wstring (*this, x); - return this->good_bit_; - } - if (ACE_OutputCDR::wchar_maxbytes_ == 0) - { - errno = EACCES; - return (this->good_bit_ = false); - } - - ACE_CDR::ULong len = 0; - - if (!this->read_ulong (len)) - { - return false; - } - - // A check for the length being too great is done later in the - // call to read_char_array but we want to have it done before - // the memory is allocated. - if (len > 0 && len <= this->length ()) - { - ACE_Auto_Basic_Array_Ptr safe_data; - - if (static_cast (this->major_version_) == 1 - && static_cast (this->minor_version_) == 2) - { - len /= - ACE_Utils::truncate_cast ( - ACE_OutputCDR::wchar_maxbytes_); - - //allocating one extra for the null character needed by applications - ACE_NEW_RETURN (x, - ACE_CDR::WChar [len + 1], - false); - - ACE_auto_ptr_reset (safe_data, x); - - if (this->read_wchar_array (x, len)) - { - - //Null character used by applications to find the end of - //the wstring - //Is this okay with the GIOP 1.2 spec?? - x[len] = '\x00'; - - (void) safe_data.release (); - - return true; - } - } - else - { - ACE_NEW_RETURN (x, - ACE_CDR::WChar [len], - false); - - ACE_auto_ptr_reset (safe_data, x); - - if (this->read_wchar_array (x, len)) - { - (void) safe_data.release (); - - return true; - } - } - } - else if (len == 0) - { - // Convert any null strings to empty strings since empty - // strings can cause crashes. (See bug 58.) - ACE_NEW_RETURN (x, - ACE_CDR::WChar[1], - false); - x[0] = '\x00'; - return true; - } - - this->good_bit_ = false; - x = 0; - return false; -} - -ACE_CDR::Boolean -ACE_InputCDR::read_array (void* x, - size_t size, - size_t align, - ACE_CDR::ULong length) -{ - if (length == 0) - return true; - char* buf = 0; - - if (this->adjust (size * length, align, buf) == 0) - { -#if defined (ACE_DISABLE_SWAP_ON_READ) - ACE_OS::memcpy (x, buf, size*length); -#else - if (!this->do_byte_swap_ || size == 1) - ACE_OS::memcpy (x, buf, size*length); - else - { - char *target = reinterpret_cast (x); - switch (size) - { - case 2: - ACE_CDR::swap_2_array (buf, target, length); - break; - case 4: - ACE_CDR::swap_4_array (buf, target, length); - break; - case 8: - ACE_CDR::swap_8_array (buf, target, length); - break; - case 16: - ACE_CDR::swap_16_array (buf, target, length); - break; - default: - // TODO: print something? - this->good_bit_ = false; - return false; - } - } -#endif /* ACE_DISABLE_SWAP_ON_READ */ - return this->good_bit_; - } - return false; -} - -ACE_CDR::Boolean -ACE_InputCDR::read_wchar_array_i (ACE_CDR::WChar* x, - ACE_CDR::ULong length) -{ - if (length == 0) - return true; - char* buf = 0; - size_t const align = (ACE_OutputCDR::wchar_maxbytes_ == 2) ? - ACE_CDR::SHORT_ALIGN : - ACE_CDR::OCTET_ALIGN; - - if (this->adjust (ACE_OutputCDR::wchar_maxbytes_ * length, align, buf) == 0) - { - if (ACE_OutputCDR::wchar_maxbytes_ == 2) - { - ACE_CDR::UShort *sb = reinterpret_cast (buf); - for (size_t i = 0; i < length; ++i) -#if defined (ACE_DISABLE_SWAP_ON_READ) - x[i] = static_cast (sb[i]); -#else - if (!this->do_byte_swap_) - x[i] = static_cast (sb[i]); - else - { - ACE_CDR::UShort sx; - ACE_CDR::swap_2 (&buf[i * 2], reinterpret_cast (&sx)); - x[i] = static_cast (sx); - } -#endif /* ACE_DISABLE_SWAP_ON_READ */ - } - else - { - for (size_t i = 0; i < length; ++i) - x[i] = static_cast (buf[i]); - } - return this->good_bit_; - } - return false; -} - - -ACE_CDR::Boolean -ACE_InputCDR::read_boolean_array (ACE_CDR::Boolean *x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length > this->length ()) - { - this->good_bit_ = false; - return false; - } - - // It is hard to optimize this, the spec requires that on the wire - // booleans be represented as a byte with value 0 or 1, but in - // memory it is possible (though very unlikely) that a boolean has - // a non-zero value (different from 1). - // We resort to a simple loop. - for (ACE_CDR::ULong i = 0; i != length && this->good_bit_; ++i) - (void) this->read_boolean (x[i]); - - return this->good_bit_; -} - -ACE_CDR::Boolean -ACE_InputCDR::read_1 (ACE_CDR::Octet *x) -{ - if (this->rd_ptr () < this->wr_ptr ()) - { - *x = *reinterpret_cast (this->rd_ptr ()); - this->start_.rd_ptr (1); - return true; - } - - this->good_bit_ = false; - return false; -} - -ACE_CDR::Boolean -ACE_InputCDR::read_2 (ACE_CDR::UShort *x) -{ - char *buf = 0; - if (this->adjust (ACE_CDR::SHORT_SIZE, buf) == 0) - { -#if !defined (ACE_DISABLE_SWAP_ON_READ) - if (!this->do_byte_swap_) - *x = *reinterpret_cast (buf); - else - ACE_CDR::swap_2 (buf, reinterpret_cast (x)); -#else - *x = *reinterpret_cast (buf); -#endif /* ACE_DISABLE_SWAP_ON_READ */ - return true; - } - this->good_bit_ = false; - return false; -} - -ACE_CDR::Boolean -ACE_InputCDR::read_4 (ACE_CDR::ULong *x) -{ - char *buf = 0; - if (this->adjust (ACE_CDR::LONG_SIZE, buf) == 0) - { -#if !defined (ACE_DISABLE_SWAP_ON_READ) - if (!this->do_byte_swap_) - *x = *reinterpret_cast (buf); - else - ACE_CDR::swap_4 (buf, reinterpret_cast (x)); -#else - *x = *reinterpret_cast (buf); -#endif /* ACE_DISABLE_SWAP_ON_READ */ - return true; - } - this->good_bit_ = false; - return false; -} - -ACE_CDR::Boolean -ACE_InputCDR::read_8 (ACE_CDR::ULongLong *x) -{ - char *buf = 0; - - if (this->adjust (ACE_CDR::LONGLONG_SIZE, buf) == 0) - { -#if !defined (ACE_DISABLE_SWAP_ON_READ) -# if defined (__arm__) && !defined (ACE_HAS_IPHONE) - if (!this->do_byte_swap_) - { - // Convert from Intel format (12345678 => 56781234) - const char *orig = buf; - char *target = reinterpret_cast (x); - register ACE_UINT32 x = - *reinterpret_cast (orig); - register ACE_UINT32 y = - *reinterpret_cast (orig + 4); - *reinterpret_cast (target) = y; - *reinterpret_cast (target + 4) = x; - } - else - { - // Convert from Sparc format (12345678 => 43218765) - const char *orig = buf; - char *target = reinterpret_cast (x); - register ACE_UINT32 x = - *reinterpret_cast (orig); - register ACE_UINT32 y = - *reinterpret_cast (orig + 4); - x = (x << 24) | ((x & 0xff00) << 8) | ((x & 0xff0000) >> 8) | (x >> 24); - y = (y << 24) | ((y & 0xff00) << 8) | ((y & 0xff0000) >> 8) | (y >> 24); - *reinterpret_cast (target) = x; - *reinterpret_cast (target + 4) = y; - } -# else - if (!this->do_byte_swap_) - *x = *reinterpret_cast (buf); - else - ACE_CDR::swap_8 (buf, reinterpret_cast (x)); -# endif /* !__arm__ */ -#else - *x = *reinterpret_cast (buf); -#endif /* ACE_DISABLE_SWAP_ON_READ */ - return true; - } - - this->good_bit_ = false; - return false; -} - -ACE_CDR::Boolean -ACE_InputCDR::read_16 (ACE_CDR::LongDouble *x) -{ - char *buf = 0; - if (this->adjust (ACE_CDR::LONGDOUBLE_SIZE, - ACE_CDR::LONGDOUBLE_ALIGN, - buf) == 0) - { -#if !defined (ACE_DISABLE_SWAP_ON_READ) - if (!this->do_byte_swap_) - *x = *reinterpret_cast (buf); - else - ACE_CDR::swap_16 (buf, reinterpret_cast (x)); -#else - *x = *reinterpret_cast (buf); -#endif /* ACE_DISABLE_SWAP_ON_READ */ - return true; - } - - this->good_bit_ = false; - return false; -} - -ACE_CDR::Boolean -ACE_InputCDR::skip_string (void) -{ - ACE_CDR::ULong len = 0; - if (this->read_ulong (len)) - { - if (static_cast (~0u) == len) - { - // Indirection, next Long in stream is signed offset to actual - // string location (backwards in same stream from here). - ACE_CDR::Long offset = 0; - if (this->read_long (offset)) - { - return true; - } - } - else if (this->rd_ptr () + len <= this->wr_ptr ()) - { - this->rd_ptr (len); - return true; - } - this->good_bit_ = false; - } - return false; -} - -ACE_CDR::Boolean -ACE_InputCDR::skip_wstring (void) -{ - ACE_CDR::ULong len = 0; - ACE_CDR::Boolean continue_skipping = read_ulong (len); - - if (continue_skipping && len != 0) - { - if (static_cast (this->major_version_) == 1 - && static_cast (this->minor_version_) == 2) - continue_skipping = this->skip_bytes ((size_t)len); - else - while (continue_skipping && len--) - continue_skipping = this->skip_wchar (); - } - return continue_skipping; -} - -ACE_CDR::Boolean -ACE_InputCDR::skip_bytes (size_t len) -{ - if (this->rd_ptr () + len <= this->wr_ptr ()) - { - this->rd_ptr (len); - return true; - } - this->good_bit_ = false; - return false; -} - -int -ACE_InputCDR::grow (size_t newsize) -{ - if (ACE_CDR::grow (&this->start_, newsize) == -1) - return -1; - - ACE_CDR::mb_align (&this->start_); - this->start_.wr_ptr (newsize); - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - if (newsize > this->start_.total_size ()) - { - this->monitor_->receive (newsize); - } -#endif /* ACE_HAS_MONITOR_POINTS==1 */ - - return 0; -} - -void -ACE_InputCDR::reset (const ACE_Message_Block* data, - int byte_order) -{ - this->reset_byte_order (byte_order); - ACE_CDR::consolidate (&this->start_, data); - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - this->monitor_->receive (this->start_.total_size ()); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ -} - -void -ACE_InputCDR::steal_from (ACE_InputCDR &cdr) -{ - this->do_byte_swap_ = cdr.do_byte_swap_; - this->start_.data_block (cdr.start_.data_block ()->duplicate ()); - - // If the message block had a DONT_DELETE flags, just clear it off.. - this->start_.clr_self_flags (ACE_Message_Block::DONT_DELETE); - this->start_.rd_ptr (cdr.start_.rd_ptr ()); - - this->start_.wr_ptr (cdr.start_.wr_ptr ()); - this->major_version_ = cdr.major_version_; - this->minor_version_ = cdr.minor_version_; - cdr.reset_contents (); - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - this->monitor_->receive (this->start_.total_size ()); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ -} - -void -ACE_InputCDR::exchange_data_blocks (ACE_InputCDR &cdr) -{ - // Exchange byte orders - int const byte_order = cdr.do_byte_swap_; - cdr.do_byte_swap_ = this->do_byte_swap_; - this->do_byte_swap_ = byte_order; - - // Get the destination read and write pointers - size_t const drd_pos = - cdr.start_.rd_ptr () - cdr.start_.base (); - size_t const dwr_pos = - cdr.start_.wr_ptr () - cdr.start_.base (); - - // Get the source read & write pointers - size_t const srd_pos = - this->start_.rd_ptr () - this->start_.base (); - size_t const swr_pos = - this->start_.wr_ptr () - this->start_.base (); - - // Exchange data_blocks. Dont release any of the data blocks. - ACE_Data_Block *dnb = - this->start_.replace_data_block (cdr.start_.data_block ()); - cdr.start_.replace_data_block (dnb); - - // Exchange the flags information.. - ACE_Message_Block::Message_Flags df = cdr.start_.self_flags (); - ACE_Message_Block::Message_Flags sf = this->start_.self_flags (); - - cdr.start_.clr_self_flags (df); - this->start_.clr_self_flags (sf); - - cdr.start_.set_self_flags (sf); - this->start_.set_self_flags (df); - - // Reset the pointers to zero before it is set again. - cdr.start_.reset (); - this->start_.reset (); - - // Set the read and write pointers. - if (cdr.start_.size () >= srd_pos) - { - cdr.start_.rd_ptr (srd_pos); - } - - if (cdr.start_.size () >= swr_pos) - { - cdr.start_.wr_ptr (swr_pos); - } - - if (this->start_.size () >= drd_pos) - { - this->start_.rd_ptr (drd_pos); - } - - if (this->start_.size () >= dwr_pos) - { - this->start_.wr_ptr (dwr_pos); - } - - ACE_CDR::Octet const dmajor = cdr.major_version_; - ACE_CDR::Octet const dminor = cdr.minor_version_; - - // Exchange the GIOP version info - cdr.major_version_ = this->major_version_; - cdr.minor_version_ = this->minor_version_; - - this->major_version_ = dmajor; - this->minor_version_ = dminor; - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - this->monitor_->receive (this->start_.total_size ()); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ -} - -ACE_Data_Block * -ACE_InputCDR::clone_from (ACE_InputCDR &cdr) -{ - this->do_byte_swap_ = cdr.do_byte_swap_; - - // Get the read & write pointer positions in the incoming CDR - // streams - char *rd_ptr = cdr.start_.rd_ptr (); - char *wr_ptr = cdr.start_.wr_ptr (); - - // Now reset the incoming CDR stream - cdr.start_.reset (); - - // As we have reset the stream, try to align the underlying message - // block in the incoming stream - ACE_CDR::mb_align (&cdr.start_); - - // Get the read & write pointer positions again - char *nrd_ptr = cdr.start_.rd_ptr (); - char *nwr_ptr = cdr.start_.wr_ptr (); - - // Actual length of the stream is.. - // @todo: This will look idiotic, but we dont seem to have much of a - // choice. How do we calculate the length of the incoming stream? - // Calling the method before calling reset () would give us the - // wrong length of the stream that needs copying. So we do the - // calulation like this - // (1) We get the and positions of the incoming - // stream. - // (2) Then we reset the stream and then align it. - // (3) We get the and positions again. (Points #1 - // thru #3 has been done already) - // (4) The difference in the and positions gives - // us the following, the actual bytes traversed by the and - // . - // (5) The bytes traversed by the is the actual length of - // the stream. - - // Actual bytes traversed - size_t rd_bytes = rd_ptr - nrd_ptr; - size_t wr_bytes = wr_ptr - nwr_ptr; - - ACE_CDR::mb_align (&this->start_); - - ACE_Data_Block *db = this->start_.data_block (); - - // If the size of the data that needs to be copied are higher than - // what is available, then do a reallocation. - if (wr_bytes > (this->start_.size () - ACE_CDR::MAX_ALIGNMENT)) - { - // @@NOTE: We need to probably add another method to the message - // block interface to simplify this - db = cdr.start_.data_block ()->clone_nocopy (); - - if (db == 0 || db->size ((wr_bytes) + - ACE_CDR::MAX_ALIGNMENT) == -1) - return 0; - - // Replace our data block by using the incoming CDR stream. - db = this->start_.replace_data_block (db); - - // Align the start_ message block. - ACE_CDR::mb_align (&this->start_); - - // Clear the DONT_DELETE flag if it has been set - this->start_.clr_self_flags (ACE_Message_Block::DONT_DELETE); - } - - // Now do the copy - (void) ACE_OS::memcpy (this->start_.wr_ptr (), - cdr.start_.rd_ptr (), - wr_bytes); - - // Set the read pointer position to the same point as that was in - // cdr. - this->start_.rd_ptr (rd_bytes); - this->start_.wr_ptr (wr_bytes); - - // We have changed the read & write pointers for the incoming - // stream. Set them back to the positions that they were before.. - cdr.start_.rd_ptr (rd_bytes); - cdr.start_.wr_ptr (wr_bytes); - - this->major_version_ = cdr.major_version_; - this->minor_version_ = cdr.minor_version_; - - // Copy the char/wchar translators - this->char_translator_ = cdr.char_translator_; - this->wchar_translator_ = cdr.wchar_translator_; - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - this->monitor_->receive (this->start_.total_size ()); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ - - return db; -} - -ACE_Message_Block* -ACE_InputCDR::steal_contents (void) -{ - ACE_Message_Block* block = this->start_.clone (); - this->start_.data_block (block->data_block ()->clone ()); - - // If at all our message had a DONT_DELETE flag set, just clear it - // off. - this->start_.clr_self_flags (ACE_Message_Block::DONT_DELETE); - - ACE_CDR::mb_align (&this->start_); - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - this->monitor_->receive (this->start_.total_size ()); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ - - return block; -} - -void -ACE_InputCDR::reset_contents (void) -{ - this->start_.data_block (this->start_.data_block ()->clone_nocopy ()); - - // Reset the flags... - this->start_.clr_self_flags (ACE_Message_Block::DONT_DELETE); - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - this->monitor_->receive (this->start_.total_size ()); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ -} - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - -void -ACE_InputCDR::register_monitor (const char *id) -{ - this->monitor_->name (id); - this->monitor_->add_to_registry (); -} - -void -ACE_InputCDR::unregister_monitor (void) -{ - this->monitor_->remove_from_registry (); -} - -#endif /* ACE_HAS_MONITOR_POINTS==1 */ - -// -------------------------------------------------------------- - -ACE_Char_Codeset_Translator::~ACE_Char_Codeset_Translator (void) -{ -} - -// -------------------------------------------------------------- - -ACE_WChar_Codeset_Translator::~ACE_WChar_Codeset_Translator (void) -{ -} - -// -------------------------------------------------------------- - -ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, const ACE_CString &x) -{ - os.write_string (x); - return os.good_bit (); -} - -ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_CString &x) -{ - is.read_string (x); - return is.good_bit (); -} - -#if defined (GEN_OSTREAM_OPS) - -std::ostream& -operator<< (std::ostream &os, ACE_OutputCDR::from_boolean x) -{ - return (x.val_ ? os << "true" : os << "false"); -} - -std::ostream& -operator<< (std::ostream &os, ACE_OutputCDR::from_char x) -{ - return os << '\'' << x.val_ << '\''; -} - -std::ostream& -operator<< (std::ostream &os, ACE_OutputCDR::from_wchar x) -{ - os.setf (ios_base::showbase); - os.setf (ios_base::hex, ios_base::basefield); - os << x.val_; - os.unsetf (ios_base::showbase); - os.setf (ios_base::dec, ios_base::basefield); - return os; -} - -std::ostream& -operator<< (std::ostream &os, ACE_OutputCDR::from_octet x) -{ - // Same format (hex) and no risk of overflow. - ACE_CDR::WChar w = static_cast (x.val_); - ACE_OutputCDR::from_wchar tmp (w); - return os << tmp; -} - -#endif /* GEN_OSTREAM_OPS */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/CDR_Stream.h b/dep/acelite/ace/CDR_Stream.h deleted file mode 100644 index 256560dea7e..00000000000 --- a/dep/acelite/ace/CDR_Stream.h +++ /dev/null @@ -1,1417 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file CDR_Stream.h - * - * $Id: CDR_Stream.h 95896 2012-06-18 20:42:07Z hillj $ - * - * ACE Common Data Representation (CDR) marshaling and demarshaling - * classes. - * - * This implementation was inspired in the CDR class in SunSoft's - * IIOP engine, but has a completely different implementation and a - * different interface too. - * - * The current implementation assumes that the host has 1-byte, - * 2-byte and 4-byte integral types, and that it has single - * precision and double precision IEEE floats. - * Those assumptions are pretty good these days, with Crays being - * the only known exception. - * - * Optimizations - * ------------- - * ACE_LACKS_CDR_ALIGNMENT - * @author Arvind S. Krishna - * - * CDR stream ignores alignment when marshaling data. Use this option - * only when ACE_DISABLE_SWAP_ON_READ can be enabled. This option requires - * ACE CDR engine to do both marshaling and demarshaling. - * - * - * @author TAO version by Aniruddha Gokhale - * @author Carlos O'Ryan - * @author ACE version by Jeff Parsons - * @author Istvan Buki - * @author Codeset translation by Jim Rogers - */ -//============================================================================= - -#ifndef ACE_CDR_STREAM_H -#define ACE_CDR_STREAM_H - -#include /**/ "ace/pre.h" - -#include "ace/CDR_Base.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/SStringfwd.h" -#include "ace/Message_Block.h" - -#if defined (GEN_OSTREAM_OPS) -#include "ace/streams.h" -#endif /* GEN_OSTREAM_OPS */ - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) -#include "Monitor_Size.h" -#endif /* ACE_HAS_MONITOR_POINTS==1 */ - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Char_Codeset_Translator; -class ACE_WChar_Codeset_Translator; - -class ACE_InputCDR; - -/** - * @class ACE_OutputCDR - * - * @brief A CDR stream for marshalling data, most often for transmission to - * another system which may or may not have the same byte order. - * - * This class is based on the the CORBA spec for Java (98-02-29), - * java class omg.org.CORBA.portable.OutputStream. It diverts in - * a few ways: - * @li Operations taking arrays don't have offsets, because in C++ - * it is easier to describe an array starting from x+offset. - * @li Operations return an error status, because exceptions are - * not widely available in C++ (yet). - */ -class ACE_Export ACE_OutputCDR -{ -public: - /** - * The Codeset translators need access to some private members to - * efficiently marshal arrays - * For reading from an output CDR stream. - */ - friend class ACE_Char_Codeset_Translator; - friend class ACE_WChar_Codeset_Translator; - friend class ACE_InputCDR; - - /** - * Default constructor; allows one to set byte ordering, allocators, and - * tuning information. - * - * @param size Causes constructor to preallocate @a size bytes; if - * @a size is 0 it allocates the default size. - * - * @param byte_order The byte order that data will have within this - * object. Unless otherwise specified, the byte order - * will be the order native to the hardware this is - * executed on. To force the marshalled data to have - * a specific order, specify one of the values defined - * in ACE_CDR::Byte_Order. - * @note The @c ACE_ENABLE_SWAP_ON_WRITE config macro - * must be set for any local byte swapping to occur - * as data is inserted into an ACE_OutputCDR object. - */ - ACE_OutputCDR (size_t size = 0, - int byte_order = ACE_CDR::BYTE_ORDER_NATIVE, - ACE_Allocator* buffer_allocator = 0, - ACE_Allocator* data_block_allocator = 0, - ACE_Allocator* message_block_allocator = 0, - size_t memcpy_tradeoff = ACE_DEFAULT_CDR_MEMCPY_TRADEOFF, - ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION); - - /// Build a CDR stream with an initial buffer, it will *not* remove - /// @a data, since it did not allocated it. It's important to be careful - /// with the alignment of @a data. - /** - * Create an output stream from an arbitrary buffer, care must be - * exercised with alignment, because this contructor will align if - * needed. In this case @a data will not point to the start of the - * output stream. @c begin()->rd_ptr() points to the start of the - * output stream. See @c ACE_ptr_align_binary() to properly align a - * pointer and use ACE_CDR::MAX_ALIGNMENT for the correct alignment. - */ - ACE_OutputCDR (char *data, - size_t size, - int byte_order = ACE_CDR::BYTE_ORDER_NATIVE, - ACE_Allocator* buffer_allocator = 0, - ACE_Allocator* data_block_allocator = 0, - ACE_Allocator* message_block_allocator = 0, - size_t memcpy_tradeoff = ACE_DEFAULT_CDR_MEMCPY_TRADEOFF, - ACE_CDR::Octet giop_major_version = ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet giop_minor_version = ACE_CDR_GIOP_MINOR_VERSION); - - /// Build a CDR stream with an initial data block, it will *not* remove - /// , since it did not allocated it. It's important to be - // careful with the alignment of . - /** - * Create an output stream from an arbitrary data block, care must be - * exercised with alignment, because this contructor will align if - * needed. In this case @a data_block will not point to the - * start of the output stream. begin()->rd_ptr() points to the start - * off the output stream. See ACE_ptr_align_binary() to properly align a - * pointer and use ACE_CDR::MAX_ALIGNMENT for the correct alignment. - */ - ACE_OutputCDR (ACE_Data_Block *data_block, - int byte_order = ACE_CDR::BYTE_ORDER_NATIVE, - ACE_Allocator* message_block_allocator = 0, - size_t memcpy_tradeoff = ACE_DEFAULT_CDR_MEMCPY_TRADEOFF, - ACE_CDR::Octet giop_major_version = ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet giop_minor_version = ACE_CDR_GIOP_MINOR_VERSION); - - /// Build a CDR stream with an initial Message_Block chain, it will - /// *not* remove @a data, since it did not allocate it. - ACE_OutputCDR (ACE_Message_Block *data, - int byte_order = ACE_CDR::BYTE_ORDER_NATIVE, - size_t memcpy_tradeoff = ACE_DEFAULT_CDR_MEMCPY_TRADEOFF, - ACE_CDR::Octet giop_major_version = ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet giop_minor_version = ACE_CDR_GIOP_MINOR_VERSION); - - /// destructor - ~ACE_OutputCDR (void); - - /** - * Disambiguate overload when inserting booleans, octets, chars, and - * bounded strings. - */ - //@{ @name Helper classes - - struct ACE_Export from_boolean - { - explicit from_boolean (ACE_CDR::Boolean b); - ACE_CDR::Boolean val_; - }; - - struct ACE_Export from_octet - { - explicit from_octet (ACE_CDR::Octet o); - ACE_CDR::Octet val_; - }; - - struct ACE_Export from_char - { - explicit from_char (ACE_CDR::Char c); - ACE_CDR::Char val_; - }; - - struct ACE_Export from_wchar - { - explicit from_wchar (ACE_CDR::WChar wc); - ACE_CDR::WChar val_; - }; - - struct ACE_Export from_string - { - from_string (ACE_CDR::Char* s, - ACE_CDR::ULong b, - ACE_CDR::Boolean nocopy = 0); - from_string (const ACE_CDR::Char* s, - ACE_CDR::ULong b, - ACE_CDR::Boolean nocopy = 0); - ACE_CDR::Char *val_; - ACE_CDR::ULong bound_; - ACE_CDR::Boolean nocopy_; - }; - - struct ACE_Export from_wstring - { - from_wstring (ACE_CDR::WChar* ws, - ACE_CDR::ULong b, - ACE_CDR::Boolean nocopy = 0); - from_wstring (const ACE_CDR::WChar* ws, - ACE_CDR::ULong b, - ACE_CDR::Boolean nocopy = 0); - ACE_CDR::WChar *val_; - ACE_CDR::ULong bound_; - ACE_CDR::Boolean nocopy_; - }; - //@} - - /** - * @{ @name Write operations - * Return 0 on failure and 1 on success. - */ - ACE_CDR::Boolean write_boolean (ACE_CDR::Boolean x); - ACE_CDR::Boolean write_char (ACE_CDR::Char x); - ACE_CDR::Boolean write_wchar (ACE_CDR::WChar x); - ACE_CDR::Boolean write_octet (ACE_CDR::Octet x); - ACE_CDR::Boolean write_short (ACE_CDR::Short x); - ACE_CDR::Boolean write_ushort (ACE_CDR::UShort x); - ACE_CDR::Boolean write_long (ACE_CDR::Long x); - ACE_CDR::Boolean write_ulong (ACE_CDR::ULong x); - ACE_CDR::Boolean write_longlong (const ACE_CDR::LongLong &x); - ACE_CDR::Boolean write_ulonglong (const ACE_CDR::ULongLong &x); - ACE_CDR::Boolean write_float (ACE_CDR::Float x); - ACE_CDR::Boolean write_double (const ACE_CDR::Double &x); - ACE_CDR::Boolean write_longdouble (const ACE_CDR::LongDouble &x); - - /// For string we offer methods that accept a precomputed length. - ACE_CDR::Boolean write_string (const ACE_CDR::Char *x); - ACE_CDR::Boolean write_string (ACE_CDR::ULong len, - const ACE_CDR::Char *x); - ACE_CDR::Boolean write_string (const ACE_CString &x); - ACE_CDR::Boolean write_wstring (const ACE_CDR::WChar *x); - ACE_CDR::Boolean write_wstring (ACE_CDR::ULong length, - const ACE_CDR::WChar *x); - //@} - - /// @note the portion written starts at @a x and ends - /// at @a x + @a length. - /// The length is *NOT* stored into the CDR stream. - //@{ @name Array write operations - ACE_CDR::Boolean write_boolean_array (const ACE_CDR::Boolean *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_char_array (const ACE_CDR::Char *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_wchar_array (const ACE_CDR::WChar* x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_octet_array (const ACE_CDR::Octet* x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_short_array (const ACE_CDR::Short *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_ushort_array (const ACE_CDR::UShort *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_long_array (const ACE_CDR::Long *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_ulong_array (const ACE_CDR::ULong *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_longlong_array (const ACE_CDR::LongLong* x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_ulonglong_array (const ACE_CDR::ULongLong *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_float_array (const ACE_CDR::Float *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_double_array (const ACE_CDR::Double *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean write_longdouble_array (const ACE_CDR::LongDouble* x, - ACE_CDR::ULong length); - - /// Write an octet array contained inside a MB, this can be optimized - /// to minimize copies. - ACE_CDR::Boolean write_octet_array_mb (const ACE_Message_Block* mb); - //@} - - /** - * @{ @name Placeholder/replace operations - * Facilitates writing a placeholder into a CDR stream to be replaced - * later with a different value. - * - * @note An example use for this facility is: - * @code - ACE_OutputCDR strm; - ... // insert values... - char *pos = strm.write_long_placeholder (); - ... // insert more values - ACE_CDR::Long real_val; // Somehow assign the "correct" value - strm.replace (real_val, pos); // Replace earlier placeholder - @endcode - */ - - /** - * Write a placeholder into the stream. The placeholder's pointer - * is returned so it may later be passed as the @a loc argument to - * replace (). - * These methods align the stream's write pointer properly prior to - * writing the placeholder. - * - * @retval Pointer to the placeholder; 0 if there is not enough space - * in the stream and memory could not be allocated. - */ - char* write_long_placeholder (void); - char* write_short_placeholder (void); - char* write_boolean_placeholder (void); - char* write_char_placeholder (void); - char* write_longlong_placeholder (void); - char* write_octet_placeholder (void); - char* write_float_placeholder (void); - char* write_double_placeholder (void); - - /** - * Writes a new value into a specific location. This is commonly - * used to update a prior "placeholder" location in the stream. - * The specified location is assumed to have proper CDR alignment for the - * type to insert. This requirement is satisfied by using one of the - * placeholder-writing methods to align the stream for the anticipated - * value and obtain the correct location. - * Treatment of @a x with repect to byte swapping is the same as for when - * any value is inserted. - * - * @param x The value to insert into the specified location. - * @param loc The location at which to insert @a x. @a loc must be a valid - * position within the stream's current set of message blocks. - * - * @sa write_long_placeholder(), write_short_placeholder () - */ - ACE_CDR::Boolean replace (ACE_CDR::Long x, char* loc); - ACE_CDR::Boolean replace (ACE_CDR::ULong x, char* loc); - ACE_CDR::Boolean replace (ACE_CDR::Short x, char* loc); - ACE_CDR::Boolean replace (ACE_CDR::UShort x, char* loc); - ACE_CDR::Boolean replace (ACE_CDR::Boolean x, char* loc); - ACE_CDR::Boolean replace (ACE_CDR::Char x, char* loc); - ACE_CDR::Boolean replace (ACE_CDR::LongLong x, char* loc); - ACE_CDR::Boolean replace (ACE_CDR::ULongLong x, char* loc); - ACE_CDR::Boolean replace (ACE_CDR::Octet x, char* loc); - ACE_CDR::Boolean replace (ACE_CDR::Float x, char* loc); - ACE_CDR::Boolean replace (ACE_CDR::Double x, char* loc); - //@} - - /** - * Return 0 on failure and 1 on success. - */ - //@{ @name Append contents of own CDR stream to another - ACE_CDR::Boolean append_boolean (ACE_InputCDR &); - ACE_CDR::Boolean append_char (ACE_InputCDR &); - ACE_CDR::Boolean append_wchar (ACE_InputCDR &); - ACE_CDR::Boolean append_octet (ACE_InputCDR &); - ACE_CDR::Boolean append_short (ACE_InputCDR &); - ACE_CDR::Boolean append_ushort (ACE_InputCDR &); - ACE_CDR::Boolean append_long (ACE_InputCDR &); - ACE_CDR::Boolean append_ulong (ACE_InputCDR &); - ACE_CDR::Boolean append_longlong (ACE_InputCDR &); - ACE_CDR::Boolean append_ulonglong (ACE_InputCDR &); - ACE_CDR::Boolean append_float (ACE_InputCDR &); - ACE_CDR::Boolean append_double (ACE_InputCDR &); - ACE_CDR::Boolean append_longdouble (ACE_InputCDR &); - - ACE_CDR::Boolean append_wstring (ACE_InputCDR &); - ACE_CDR::Boolean append_string (ACE_InputCDR &); - //@} - - /// Returns @c false if an error has ocurred. - /** - * @note The only expected error is to run out of memory. - */ - bool good_bit (void) const; - - /// Reuse the CDR stream to write on the old buffer. - void reset (void); - - /// Add the length of each message block in the chain. - size_t total_length (void) const; - - /** - * Return the start of the message block chain for this CDR stream. - * @note The complete CDR stream is represented by a chain of - * message blocks. - */ - const ACE_Message_Block *begin (void) const; - - /// Return the last message in the chain that is is use. - const ACE_Message_Block *end (void) const; - - /// Return the message block in chain. - const ACE_Message_Block *current (void) const; - - /// Replace the message block chain with a single message block. - /** - * Upon successful completion, there will be a single message block - * containing the data from the complete message block chain. - * - * @note The only expected error is to run out of memory. - */ - int consolidate (void); - - /** - * Access the underlying buffer (read only). @note This - * method only returns a pointer to the first block in the - * chain. - */ - const char *buffer (void) const; - - /** - * Return the size of first message block in the block chain. @note This - * method only returns information about the first block in the - * chain. - */ - size_t length (void) const; - - /** - * Utility function to allow the user more flexibility. - * Pads the stream up to the nearest -byte boundary. - * Argument MUST be a power of 2. - * Returns 0 on success and -1 on failure. - */ - int align_write_ptr (size_t alignment); - - /// Access the codeset translators. They can be null! - ACE_Char_Codeset_Translator *char_translator (void) const; - ACE_WChar_Codeset_Translator *wchar_translator (void) const; - - /// Set the char codeset translator. - void char_translator (ACE_Char_Codeset_Translator *); - /// Set the wchar codeset translator. - void wchar_translator (ACE_WChar_Codeset_Translator *); - - /// set the global size of serialized wchars. This may be different - /// than the size of a wchar_t. - static void wchar_maxbytes (size_t max_bytes); - - /// access the serialized size of wchars. - static size_t wchar_maxbytes (void); - - /** - * Return alignment of the wr_ptr(), with respect to the start of - * the CDR stream. This is not the same as the alignment of - * current->wr_ptr()! - */ - size_t current_alignment (void) const; - - void current_alignment (size_t current_alignment); - - /** - * Returns (in @a buf) the next position in the buffer aligned to - * @a size, it advances the Message_Block wr_ptr past the data - * (i.e., @a buf + @a size). If necessary it grows the Message_Block - * buffer. Sets the good_bit to false and returns a -1 on failure. - */ - int adjust (size_t size, - char *&buf); - - /// As above, but now the size and alignment requirements may be - /// different. - int adjust (size_t size, - size_t align, - char *&buf); - - /// Returns true if this stream is writing in non-native byte order - /// and false otherwise. For example, it would be true if either - /// ACE_ENABLE_SWAP_ON_WRITE is defined or a specific byte order was - /// specified for this stream. - bool do_byte_swap (void) const; - - /// Returns the byte order this stream is marshaling data in. Will be one - /// of the values in ACE_CDR::Byte_Order. - int byte_order (void) const; - - /// For use by a gateway, which creates the output stream for the - /// reply to the client in its native byte order, but which must - /// send the reply in the byte order of the target's reply to the - /// gateway. - void reset_byte_order (int byte_order); - - /// set GIOP version info - void set_version (ACE_CDR::Octet major, ACE_CDR::Octet minor); - - /// Set the underlying GIOP version.. - void get_version (ACE_CDR::Octet &major, ACE_CDR::Octet &minor); - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - /// Register and unregister our buffer size monitor. - void register_monitor (const char* id); - void unregister_monitor (void); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ - -private: - - // Find the message block in the chain of message blocks - // that the provide location locates. - ACE_Message_Block* find (char* loc); - - /// disallow copying... - ACE_OutputCDR (const ACE_OutputCDR& rhs); - ACE_OutputCDR& operator= (const ACE_OutputCDR& rhs); - - ACE_CDR::Boolean write_1 (const ACE_CDR::Octet *x); - ACE_CDR::Boolean write_2 (const ACE_CDR::UShort *x); - ACE_CDR::Boolean write_4 (const ACE_CDR::ULong *x); - ACE_CDR::Boolean write_8 (const ACE_CDR::ULongLong *x); - ACE_CDR::Boolean write_16 (const ACE_CDR::LongDouble *x); - - /** - * write an array of @a length elements, each of @a size bytes and the - * start aligned at a multiple of . The elements are assumed - * to be packed with the right alignment restrictions. It is mostly - * designed for buffers of the basic types. - * - * This operation uses ; as explained above it is expected - * that using assignment is faster that for one element, - * but for several elements should be more efficient, it - * could be interesting to find the break even point and optimize - * for that case, but that would be too platform dependent. - */ - ACE_CDR::Boolean write_array (const void *x, - size_t size, - size_t align, - ACE_CDR::ULong length); - - - ACE_CDR::Boolean write_wchar_array_i (const ACE_CDR::WChar* x, - ACE_CDR::ULong length); - - - /** - * Grow the CDR stream. When it returns @a buf contains a pointer to - * memory in the CDR stream, with at least @a size bytes ahead of it - * and aligned to an boundary. It moved the to . - */ - int grow_and_adjust (size_t size, - size_t align, - char *&buf); - -private: - /// The start of the chain of message blocks. - ACE_Message_Block start_; - - /// The current block in the chain where we are writing. - ACE_Message_Block *current_; - -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - /** - * The current alignment as measured from the start of the buffer. - * Usually this coincides with the alignment of the buffer in - * memory, but, when we chain another buffer this "quasi invariant" - * is broken. - * The current_alignment is used to readjust the buffer following - * the stolen message block. - */ - size_t current_alignment_; -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - - /** - * Is the current block writable. When we steal a buffer from the - * user and just chain it into the message block we are not supposed - * to write on it, even if it is past the start and end of the - * buffer. - */ - bool current_is_writable_; - - /** - * If not zero swap bytes at writing so the created CDR stream byte - * order does *not* match the machine byte order. The motivation - * for such a beast is that in some setting a few (fast) machines - * can be serving hundreds of slow machines with the opposite byte - * order, so it makes sense (as a load balancing device) to put the - * responsibility in the writers. THIS IS NOT A STANDARD IN CORBA, - * USE AT YOUR OWN RISK - */ - bool do_byte_swap_; - - /// Set to false when an error ocurrs. - bool good_bit_; - - /// Break-even point for copying. - size_t const memcpy_tradeoff_; - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - ACE::Monitor_Control::Size_Monitor *monitor_; -#endif /* ACE_HAS_MONITOR_POINTS==1 */ - -protected: - /// GIOP version information - ACE_CDR::Octet major_version_; - ACE_CDR::Octet minor_version_; - - /// If not nil, invoke for translation of character and string data. - ACE_Char_Codeset_Translator *char_translator_; - ACE_WChar_Codeset_Translator *wchar_translator_; - - /** - * Some wide char codesets may be defined with a maximum number - * of bytes that is smaller than the size of a wchar_t. This means - * that the CDR cannot simply memcpy a block of wchars to and from - * the stream, but must instead realign the bytes appropriately. - * In cases when wchar i/o is not allowed, such as with GIOP 1.0, - * or not having a native wchar codeset defined, the maxbytes is - * set to zero, indicating no wchar data is allowed. - */ - static size_t wchar_maxbytes_; -}; - - -// **************************************************************** - -/** - * @class ACE_InputCDR - * - * @brief A CDR stream for demarshalling CDR-encoded data. - * - * This class is based on the the CORBA spec for Java (98-02-29), - * java class omg.org.CORBA.portable.InputStream. It diverts in a - * few ways: - * @li Operations to retrieve basic types take parameters by - * reference. - * @li Operations taking arrays don't have offsets, because in C++ - * it is easier to describe an array starting from x+offset. - * @li Operations return an error status, because exceptions are - * not widely available in C++ (yet). - */ -class ACE_Export ACE_InputCDR -{ -public: - // The translators need privileged access to efficiently demarshal - // arrays and such. - friend class ACE_Char_Codeset_Translator; - friend class ACE_WChar_Codeset_Translator; - - /** - * Create an input stream from an arbitrary buffer. The buffer must - * be properly aligned because this contructor will *not* work if - * the buffer is aligned unproperly.See ACE_ptr_align_binary() for - * instructions on how to align a pointer properly and use - * ACE_CDR::MAX_ALIGNMENT for the correct alignment. - */ - ACE_InputCDR (const char *buf, - size_t bufsiz, - int byte_order = ACE_CDR::BYTE_ORDER_NATIVE, - ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION); - - /// Create an empty input stream. The caller is responsible for - /// putting the right data and providing the right alignment. - ACE_InputCDR (size_t bufsiz, - int byte_order = ACE_CDR::BYTE_ORDER_NATIVE, - ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION); - - /// Create an input stream from an ACE_Message_Block - /** - * The alignment of the @a data block is carried into the new - * ACE_InputCDR object. This constructor either increments the - * @a data reference count, or copies the data (if it's a compound - * message block) so the caller can release the block immediately - * upon return. - */ - ACE_InputCDR (const ACE_Message_Block *data, - int byte_order = ACE_CDR::BYTE_ORDER_NATIVE, - ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION, - ACE_Lock* lock = 0); - - /// Create an input stream from an ACE_Data_Block. The - /// indicates whether the @a data can be deleted by the CDR stream - /// or not - ACE_InputCDR (ACE_Data_Block *data, - ACE_Message_Block::Message_Flags flag = 0, - int byte_order = ACE_CDR::BYTE_ORDER_NATIVE, - ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION); - - /// Create an input stream from an ACE_Data_Block. It also sets the - /// read and write pointers at the desired positions. This would be - /// helpful if the applications desires to create a new CDR stream - /// from a semi-processed datablock. - ACE_InputCDR (ACE_Data_Block *data, - ACE_Message_Block::Message_Flags flag, - size_t read_pointer_position, - size_t write_pointer_position, - int byte_order = ACE_CDR::BYTE_ORDER_NATIVE, - ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION); - - /** - * These make a copy of the current stream state, but do not copy - * the internal buffer, so the same stream can be read multiple - * times efficiently. - */ - ACE_InputCDR (const ACE_InputCDR& rhs); - - ACE_InputCDR& operator= (const ACE_InputCDR& rhs); - - /// When interpreting indirected TypeCodes it is useful to make a - /// "copy" of the stream starting in the new position. - ACE_InputCDR (const ACE_InputCDR& rhs, - size_t size, - ACE_CDR::Long offset); - - /// This creates an encapsulated stream, the first byte must be (per - /// the spec) the byte order of the encapsulation. - ACE_InputCDR (const ACE_InputCDR& rhs, - size_t size); - - /// Create an input CDR from an output CDR. - ACE_InputCDR (const ACE_OutputCDR& rhs, - ACE_Allocator* buffer_allocator = 0, - ACE_Allocator* data_block_allocator = 0, - ACE_Allocator* message_block_allocator = 0); - - /// Helper class to transfer the contents from one input CDR to - /// another without requiring any extra memory allocations, data - /// copies or too many temporaries. - struct ACE_Export Transfer_Contents - { - Transfer_Contents (ACE_InputCDR &rhs); - - ACE_InputCDR &rhs_; - }; - /// Transfer the contents from to a new CDR - ACE_InputCDR (Transfer_Contents rhs); - - /// Destructor - ~ACE_InputCDR (void); - - /// Disambiguate overloading when extracting octets, chars, - /// booleans, and bounded strings - //@{ @name Helper classes - - struct ACE_Export to_boolean - { - explicit to_boolean (ACE_CDR::Boolean &b); - ACE_CDR::Boolean &ref_; - }; - - struct ACE_Export to_char - { - explicit to_char (ACE_CDR::Char &c); - ACE_CDR::Char &ref_; - }; - - struct ACE_Export to_wchar - { - explicit to_wchar (ACE_CDR::WChar &wc); - ACE_CDR::WChar &ref_; - }; - - struct ACE_Export to_octet - { - explicit to_octet (ACE_CDR::Octet &o); - ACE_CDR::Octet &ref_; - }; - - struct ACE_Export to_string - { - /** - * @deprecated The constructor taking a non-const string is now - * deprecated (C++ mapping 00-01-02), but we keep it - * around for backward compatibility. - */ - to_string (ACE_CDR::Char *&s, - ACE_CDR::ULong b); - to_string (const ACE_CDR::Char *&s, - ACE_CDR::ULong b); - const ACE_CDR::Char *&val_; - ACE_CDR::ULong bound_; - }; - - struct ACE_Export to_wstring - { - /// The constructor taking a non-const wstring is - /// now deprecated (C++ mapping 00-01-02), but we - /// keep it around for backward compatibility. - to_wstring (ACE_CDR::WChar *&ws, - ACE_CDR::ULong b); - to_wstring (const ACE_CDR::WChar *&ws, - ACE_CDR::ULong b); - const ACE_CDR::WChar *&val_; - ACE_CDR::ULong bound_; - }; - //@} - - /** - * Return @c false on failure and @c true on success. - */ - //@{ @name Read basic IDL types - ACE_CDR::Boolean read_boolean (ACE_CDR::Boolean& x); - ACE_CDR::Boolean read_char (ACE_CDR::Char &x); - ACE_CDR::Boolean read_wchar (ACE_CDR::WChar& x); - ACE_CDR::Boolean read_octet (ACE_CDR::Octet& x); - ACE_CDR::Boolean read_short (ACE_CDR::Short &x); - ACE_CDR::Boolean read_ushort (ACE_CDR::UShort &x); - ACE_CDR::Boolean read_long (ACE_CDR::Long &x); - ACE_CDR::Boolean read_ulong (ACE_CDR::ULong &x); - ACE_CDR::Boolean read_longlong (ACE_CDR::LongLong& x); - ACE_CDR::Boolean read_ulonglong (ACE_CDR::ULongLong& x); - ACE_CDR::Boolean read_float (ACE_CDR::Float &x); - ACE_CDR::Boolean read_double (ACE_CDR::Double &x); - ACE_CDR::Boolean read_longdouble (ACE_CDR::LongDouble &x); - - ACE_CDR::Boolean read_string (ACE_CDR::Char *&x); - ACE_CDR::Boolean read_string (ACE_CString &x); - ACE_CDR::Boolean read_wstring (ACE_CDR::WChar*& x); - //@} - - /** - * The buffer @a x must be large enough to contain @a length - * elements. - * Return @c false on failure and @c true on success. - */ - //@{ @name Read basic IDL types arrays - ACE_CDR::Boolean read_boolean_array (ACE_CDR::Boolean* x, - ACE_CDR::ULong length); - ACE_CDR::Boolean read_char_array (ACE_CDR::Char *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean read_wchar_array (ACE_CDR::WChar* x, - ACE_CDR::ULong length); - ACE_CDR::Boolean read_octet_array (ACE_CDR::Octet* x, - ACE_CDR::ULong length); - ACE_CDR::Boolean read_short_array (ACE_CDR::Short *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean read_ushort_array (ACE_CDR::UShort *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean read_long_array (ACE_CDR::Long *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean read_ulong_array (ACE_CDR::ULong *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean read_longlong_array (ACE_CDR::LongLong* x, - ACE_CDR::ULong length); - ACE_CDR::Boolean read_ulonglong_array (ACE_CDR::ULongLong* x, - ACE_CDR::ULong length); - ACE_CDR::Boolean read_float_array (ACE_CDR::Float *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean read_double_array (ACE_CDR::Double *x, - ACE_CDR::ULong length); - ACE_CDR::Boolean read_longdouble_array (ACE_CDR::LongDouble* x, - ACE_CDR::ULong length); - //@} - - /** - * Return @c false on failure and @c true on success. - */ - //@{ @name Skip elements - ACE_CDR::Boolean skip_boolean (void); - ACE_CDR::Boolean skip_char (void); - ACE_CDR::Boolean skip_wchar (void); - ACE_CDR::Boolean skip_octet (void); - ACE_CDR::Boolean skip_short (void); - ACE_CDR::Boolean skip_ushort (void); - ACE_CDR::Boolean skip_long (void); - ACE_CDR::Boolean skip_ulong (void); - ACE_CDR::Boolean skip_longlong (void); - ACE_CDR::Boolean skip_ulonglong (void); - ACE_CDR::Boolean skip_float (void); - ACE_CDR::Boolean skip_double (void); - ACE_CDR::Boolean skip_longdouble (void); - //@} - - /** - * The next field must be a string, this method skips it. It is - * useful in parsing a TypeCode. - * @return @c false on failure and @c true on success. - */ - ACE_CDR::Boolean skip_wstring (void); - ACE_CDR::Boolean skip_string (void); - - /// Skip @a n bytes in the CDR stream. - /** - * @return @c false on failure and @c true on success. - */ - ACE_CDR::Boolean skip_bytes (size_t n); - - /// returns @c false if a problem has been detected. - bool good_bit (void) const; - - /** - * @return The start of the message block chain for this CDR - * stream. - * - * @note In the current implementation the chain has length 1, but - * we are planning to change that. - */ - const ACE_Message_Block* start (void) const; - - // = The following functions are useful to read the contents of the - // CDR stream from a socket or file. - - /** - * Grow the internal buffer, reset @c rd_ptr to the first byte in - * the new buffer that is properly aligned, and set @c wr_ptr to @c - * rd_ptr @c + @c newsize - */ - int grow (size_t newsize); - - /** - * After reading and partially parsing the contents the user can - * detect a change in the byte order, this method will let him/her - * change it. - */ - void reset_byte_order (int byte_order); - - /// Re-initialize the CDR stream, copying the contents of the chain - /// of message_blocks starting from @a data. - void reset (const ACE_Message_Block *data, - int byte_order); - - /// Steal the contents from the current CDR. - ACE_Message_Block *steal_contents (void); - - /// Steal the contents of @a cdr and make a shallow copy into this - /// stream. - void steal_from (ACE_InputCDR &cdr); - - /// Exchange data blocks with the caller of this method. The read - /// and write pointers are also exchanged. - /** - * @note We now do only with the start_ message block. - */ - void exchange_data_blocks (ACE_InputCDR &cdr); - - /// Copy the data portion from the @a cdr to this cdr and return the - /// data content (ie. the ACE_Data_Block) from this CDR to the - /// caller. - /** - * @note The caller is responsible for managing the memory of the - * returned ACE_Data_Block. - */ - ACE_Data_Block* clone_from (ACE_InputCDR &cdr); - - /// Re-initialize the CDR stream, forgetting about the old contents - /// of the stream and allocating a new buffer (from the allocators). - void reset_contents (void); - - /// Returns the current position for the @c rd_ptr. - char* rd_ptr (void); - - /// Returns the current position for the @c wr_ptr. - char* wr_ptr (void); - - /// Return how many bytes are left in the stream. - size_t length (void) const; - - /** - * Utility function to allow the user more flexibility. - * Skips up to the nearest @a alignment-byte boundary. - * Argument MUST be a power of 2. - * - * @return 0 on success and -1 on failure. - */ - int align_read_ptr (size_t alignment); - - /// If @c true then this stream is writing in non-native byte order. - /// This is only meaningful if ACE_ENABLE_SWAP_ON_WRITE is defined. - bool do_byte_swap (void) const; - - /// If @c do_byte_swap() returns @c false, this returns - /// ACE_CDR_BYTE_ORDER else it returns !ACE_CDR_BYTE_ORDER. - int byte_order (void) const; - - /// Access the codeset translators. They can be nil! - ACE_Char_Codeset_Translator *char_translator (void) const; - ACE_WChar_Codeset_Translator *wchar_translator (void) const; - - /// Set the codeset translators. - void char_translator (ACE_Char_Codeset_Translator *); - void wchar_translator (ACE_WChar_Codeset_Translator *); - - /** - * Returns (in @a buf) the next position in the buffer aligned to - * @a size. It advances the Message_Block @c rd_ptr past the data - * (i.e., @c buf @c + @c size). Sets the good_bit to @c false and - * returns a -1 on failure. - */ - int adjust (size_t size, - char *&buf); - - /// As above, but now the size and alignment requirements may be - /// different. - int adjust (size_t size, - size_t align, - char *&buf); - - /// Set the underlying GIOP version.. - void set_version (ACE_CDR::Octet major, ACE_CDR::Octet minor); - - /// Set the underlying GIOP version.. - void get_version (ACE_CDR::Octet &major, ACE_CDR::Octet &minor); - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - /// Register and unregister our buffer size monitor. - void register_monitor (const char* id); - void unregister_monitor (void); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ - -protected: - - /// The start of the chain of message blocks, even though in the - /// current version the chain always has length 1. - ACE_Message_Block start_; - - /// The CDR stream byte order does not match the one on the machine, - /// swapping is needed while reading. - bool do_byte_swap_; - - /// set to @c false when an error occurs. - bool good_bit_; - - /// The GIOP versions for this stream - ACE_CDR::Octet major_version_; - ACE_CDR::Octet minor_version_; - - /// If not nil, invoke for translation of character and string data. - ACE_Char_Codeset_Translator *char_translator_; - ACE_WChar_Codeset_Translator *wchar_translator_; - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - ACE::Monitor_Control::Size_Monitor *monitor_; -#endif /* ACE_HAS_MONITOR_POINTS==1 */ - -private: - - ACE_CDR::Boolean read_1 (ACE_CDR::Octet *x); - ACE_CDR::Boolean read_2 (ACE_CDR::UShort *x); - ACE_CDR::Boolean read_4 (ACE_CDR::ULong *x); - ACE_CDR::Boolean read_8 (ACE_CDR::ULongLong *x); - ACE_CDR::Boolean read_16 (ACE_CDR::LongDouble *x); - - // Several types can be read using the same routines, since TAO - // tries to use native types with known size for each CORBA type. - // We could use void* or char* to make the interface more - // consistent, but using native types let us exploit the strict - // alignment requirements of CDR streams and implement the - // operations using asignment. - - /** - * Read an array of @a length elements, each of @a size bytes and the - * start aligned at a multiple of . The elements are assumed - * to be packed with the right alignment restrictions. It is mostly - * designed for buffers of the basic types. - * - * This operation uses ; as explained above it is expected - * that using assignment is faster that for one element, - * but for several elements should be more efficient, it - * could be interesting to find the break even point and optimize - * for that case, but that would be too platform dependent. - */ - ACE_CDR::Boolean read_array (void* x, - size_t size, - size_t align, - ACE_CDR::ULong length); - - /** - * On those occasions when the native codeset for wchar is smaller than - * the size of a wchar_t, such as using UTF-16 with a 4-byte wchar_t, a - * special form of reading the array is needed. Actually, this should be - * a default translator. - */ - ACE_CDR::Boolean read_wchar_array_i (ACE_CDR::WChar * x, - ACE_CDR::ULong length); - - /// Move the rd_ptr ahead by @a offset bytes. - void rd_ptr (size_t offset); - - /// Points to the continuation field of the current message block. - char* end (void); -}; - -// **************************************************************** - -/** - * @class ACE_Char_Codeset_Translator - * - * @brief Codeset translation routines common to both Output and Input - * CDR streams. - * - * This class is a base class for defining codeset translation - * routines to handle the character set translations required by - * both CDR Input streams and CDR Output streams. - * - * Translators are reference counted. This allows for stateful as well - * as stateless translators. Stateless translators will be allocated - * once whereas CDR Streams own their own copy of a stateful translator. - */ -class ACE_Export ACE_Char_Codeset_Translator -{ -public: - virtual ~ACE_Char_Codeset_Translator (); - - /// Read a single character from the stream, converting from the - /// stream codeset to the native codeset - virtual ACE_CDR::Boolean read_char (ACE_InputCDR&, - ACE_CDR::Char&) = 0; - - /// Read a string from the stream, including the length, converting - /// the characters from the stream codeset to the native codeset - virtual ACE_CDR::Boolean read_string (ACE_InputCDR&, - ACE_CDR::Char *&) = 0; - - /// Read an array of characters from the stream, converting the - /// characters from the stream codeset to the native codeset. - virtual ACE_CDR::Boolean read_char_array (ACE_InputCDR&, - ACE_CDR::Char*, - ACE_CDR::ULong) = 0; - - /// Write a single character to the stream, converting from the - /// native codeset to the stream codeset - virtual ACE_CDR::Boolean write_char (ACE_OutputCDR&, - ACE_CDR::Char) = 0; - - /// Write a string to the stream, including the length, converting - /// from the native codeset to the stream codeset - virtual ACE_CDR::Boolean write_string (ACE_OutputCDR&, - ACE_CDR::ULong, - const ACE_CDR::Char*) = 0; - - /// Write an array of characters to the stream, converting from the - /// native codeset to the stream codeset - virtual ACE_CDR::Boolean write_char_array (ACE_OutputCDR&, - const ACE_CDR::Char*, - ACE_CDR::ULong) = 0; - - virtual ACE_CDR::ULong ncs () = 0; - virtual ACE_CDR::ULong tcs () = 0; -protected: - /// Children have access to low-level routines because they cannot - /// use read_char or something similar (it would recurse). - ACE_CDR::Boolean read_1 (ACE_InputCDR& input, - ACE_CDR::Octet *x); - ACE_CDR::Boolean write_1 (ACE_OutputCDR& output, - const ACE_CDR::Octet *x); - - /// Efficiently read @a length elements of size @a size each from - /// into ; the data must be aligned to . - ACE_CDR::Boolean read_array (ACE_InputCDR& input, - void* x, - size_t size, - size_t align, - ACE_CDR::ULong length); - - /** - * Efficiently write @a length elements of size @a size from into - * . Before inserting the elements enough padding is added - * to ensure that the elements will be aligned to in the - * stream. - */ - ACE_CDR::Boolean write_array (ACE_OutputCDR& output, - const void *x, - size_t size, - size_t align, - ACE_CDR::ULong length); - - /** - * Exposes the stream implementation of , this is useful in - * many cases to minimize memory allocations during marshaling. - * On success @a buf will contain a contiguous area in the CDR stream - * that can hold @a size bytes aligned to . - * Results - */ - int adjust (ACE_OutputCDR& out, - size_t size, - size_t align, - char *&buf); - - /// Used by derived classes to set errors in the CDR stream. - void good_bit (ACE_OutputCDR& out, bool bit); - - /// Obtain the CDR Stream's major & minor version values. - ACE_CDR::Octet major_version (ACE_InputCDR& input); - ACE_CDR::Octet minor_version (ACE_InputCDR& input); - ACE_CDR::Octet major_version (ACE_OutputCDR& output); - ACE_CDR::Octet minor_version (ACE_OutputCDR& output); -}; - -// **************************************************************** - -/** - * @class ACE_WChar_Codeset_Translator - * - * @brief Codeset translation routines common to both Output and Input - * CDR streams. - * - * This class is a base class for defining codeset translation - * routines to handle the character set translations required by - * both CDR Input streams and CDR Output streams. - */ -class ACE_Export ACE_WChar_Codeset_Translator -{ -public: - virtual ~ACE_WChar_Codeset_Translator (); - - virtual ACE_CDR::Boolean read_wchar (ACE_InputCDR&, - ACE_CDR::WChar&) = 0; - virtual ACE_CDR::Boolean read_wstring (ACE_InputCDR&, - ACE_CDR::WChar *&) = 0; - virtual ACE_CDR::Boolean read_wchar_array (ACE_InputCDR&, - ACE_CDR::WChar*, - ACE_CDR::ULong) = 0; - virtual ACE_CDR::Boolean write_wchar (ACE_OutputCDR&, - ACE_CDR::WChar) = 0; - virtual ACE_CDR::Boolean write_wstring (ACE_OutputCDR&, - ACE_CDR::ULong, - const ACE_CDR::WChar*) = 0; - virtual ACE_CDR::Boolean write_wchar_array (ACE_OutputCDR&, - const ACE_CDR::WChar*, - ACE_CDR::ULong) = 0; - - virtual ACE_CDR::ULong ncs () = 0; - virtual ACE_CDR::ULong tcs () = 0; -protected: - /// Children have access to low-level routines because they cannot - /// use read_char or something similar (it would recurse). - ACE_CDR::Boolean read_1 (ACE_InputCDR& input, - ACE_CDR::Octet *x); - ACE_CDR::Boolean read_2 (ACE_InputCDR& input, - ACE_CDR::UShort *x); - ACE_CDR::Boolean read_4 (ACE_InputCDR& input, - ACE_CDR::ULong *x); - ACE_CDR::Boolean write_1 (ACE_OutputCDR& output, - const ACE_CDR::Octet *x); - ACE_CDR::Boolean write_2 (ACE_OutputCDR& output, - const ACE_CDR::UShort *x); - ACE_CDR::Boolean write_4 (ACE_OutputCDR& output, - const ACE_CDR::ULong *x); - - /// Efficiently read @a length elements of size @a size each from - /// @a input into @a x; the data must be aligned to @a align. - ACE_CDR::Boolean read_array (ACE_InputCDR& input, - void* x, - size_t size, - size_t align, - ACE_CDR::ULong length); - - /** - * Efficiently write @a length elements of size @a size from @a x into - * @a output. Before inserting the elements enough padding is added - * to ensure that the elements will be aligned to @a align in the - * stream. - */ - ACE_CDR::Boolean write_array (ACE_OutputCDR& output, - const void *x, - size_t size, - size_t align, - ACE_CDR::ULong length); - - /** - * Exposes the stream implementation of @a adjust, this is useful in - * many cases to minimize memory allocations during marshaling. - * On success @a buf will contain a contiguous area in the CDR stream - * that can hold @a size bytes aligned to @a align. - * Results - */ - int adjust (ACE_OutputCDR& out, - size_t size, - size_t align, - char *&buf); - - /// Used by derived classes to set errors in the CDR stream. - void good_bit (ACE_OutputCDR& out, bool bit); - - /// Obtain the CDR Stream's major & minor version values. - ACE_CDR::Octet major_version (ACE_InputCDR& input); - ACE_CDR::Octet minor_version (ACE_InputCDR& input); - ACE_CDR::Octet major_version (ACE_OutputCDR& output); - ACE_CDR::Octet minor_version (ACE_OutputCDR& output); - -}; - -// @@ These operators should not be inlined since they force SString.h -// to be included in this header. -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - const ACE_CString &x); - -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CString &x); - - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -# include "ace/CDR_Stream.inl" -#else /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Not used by CORBA or TAO -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::Char x); -// CDR output operators for primitive types - -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::Short x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::UShort x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::Long x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::ULong x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::LongLong x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::ULongLong x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR& os, - ACE_CDR::LongDouble x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::Float x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::Double x); - -// CDR output operator from helper classes - -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_OutputCDR::from_boolean x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_OutputCDR::from_char x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_OutputCDR::from_wchar x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_OutputCDR::from_octet x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_OutputCDR::from_string x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_OutputCDR::from_wstring x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - const ACE_CDR::Char* x); -extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - const ACE_CDR::WChar* x); - -// Not used by CORBA or TAO -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::Char &x); -// CDR input operators for primitive types - -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::Short &x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::UShort &x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::Long &x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::ULong &x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::LongLong &x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::ULongLong &x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::LongDouble &x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::Float &x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::Double &x); - -// CDR input operator from helper classes - -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_InputCDR::to_boolean x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_InputCDR::to_char x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_InputCDR::to_wchar x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_InputCDR::to_octet x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_InputCDR::to_string x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_InputCDR::to_wstring x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::Char*& x); -extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::WChar*& x); - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* __ACE_INLINE__ */ - -#if defined (GEN_OSTREAM_OPS) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// ostream insertion operators for debugging code generated from IDL. All -// but these below are either in generated code itself or are unambiguous -// primitive types. - -ACE_Export std::ostream& operator<< (std::ostream &os, - ACE_OutputCDR::from_boolean x); - -ACE_Export std::ostream& operator<< (std::ostream &os, - ACE_OutputCDR::from_char x); - -ACE_Export std::ostream& operator<< (std::ostream &os, - ACE_OutputCDR::from_wchar x); - -ACE_Export std::ostream& operator<< (std::ostream &os, - ACE_OutputCDR::from_octet x); - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* GEN_OSTREAM_OPS */ - -#include /**/ "ace/post.h" - -#endif /* ACE_CDR_STREAM_H */ diff --git a/dep/acelite/ace/CDR_Stream.inl b/dep/acelite/ace/CDR_Stream.inl deleted file mode 100644 index 2be60c154dd..00000000000 --- a/dep/acelite/ace/CDR_Stream.inl +++ /dev/null @@ -1,1727 +0,0 @@ -// -*- C++ -*- -// -// $Id: CDR_Stream.inl 84206 2009-01-21 02:49:26Z schmidt $ - -#include "ace/OS_NS_string.h" -#include "ace/OS_Memory.h" - -// **************************************************************** - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// implementing the special types -ACE_INLINE -ACE_OutputCDR::from_boolean::from_boolean (ACE_CDR::Boolean b) - : val_ (b) -{ -} - -ACE_INLINE -ACE_InputCDR::to_boolean::to_boolean (ACE_CDR::Boolean &b) - : ref_ (b) -{ -} - -ACE_INLINE -ACE_OutputCDR::from_octet::from_octet (ACE_CDR::Octet o) - : val_ (o) -{ -} - -ACE_INLINE -ACE_InputCDR::to_octet::to_octet (ACE_CDR::Octet &o) - : ref_ (o) -{ -} - -ACE_INLINE -ACE_OutputCDR::from_char::from_char (ACE_CDR::Char c) - : val_ (c) -{ -} - -ACE_INLINE -ACE_InputCDR::to_char::to_char (ACE_CDR::Char &c) - : ref_ (c) -{ -} - -ACE_INLINE -ACE_OutputCDR::from_wchar::from_wchar (ACE_CDR::WChar wc) - : val_ (wc) -{ -} - -ACE_INLINE -ACE_InputCDR::to_wchar::to_wchar (ACE_CDR::WChar &wc) - : ref_ (wc) -{ -} - -ACE_INLINE -ACE_OutputCDR::from_string::from_string (ACE_CDR::Char *s, - ACE_CDR::ULong b, - ACE_CDR::Boolean nocopy) - : val_ (s), - bound_ (b), - nocopy_ (nocopy) -{ -} - -ACE_INLINE -ACE_OutputCDR::from_string::from_string (const ACE_CDR::Char *s, - ACE_CDR::ULong b, - ACE_CDR::Boolean nocopy) - : val_ (const_cast (s)), - bound_ (b), - nocopy_ (nocopy) -{ -} - -ACE_INLINE -ACE_InputCDR::to_string::to_string (ACE_CDR::Char *&s, - ACE_CDR::ULong b) - : val_ (const_cast (s)), - bound_ (b) -{ -} - -ACE_INLINE -ACE_InputCDR::to_string::to_string (const ACE_CDR::Char *&s, - ACE_CDR::ULong b) - : val_ (s), - bound_ (b) -{ -} - -ACE_INLINE -ACE_OutputCDR::from_wstring::from_wstring (ACE_CDR::WChar *ws, - ACE_CDR::ULong b, - ACE_CDR::Boolean nocopy) - : val_ (ws), - bound_ (b), - nocopy_ (nocopy) -{ -} - -ACE_INLINE -ACE_OutputCDR::from_wstring::from_wstring (const ACE_CDR::WChar *ws, - ACE_CDR::ULong b, - ACE_CDR::Boolean nocopy) - : val_ (const_cast (ws)), - bound_ (b), - nocopy_ (nocopy) -{ -} - -ACE_INLINE -ACE_InputCDR::to_wstring::to_wstring (ACE_CDR::WChar *&ws, - ACE_CDR::ULong b) - : val_ (const_cast (ws)), - bound_ (b) -{ -} - -ACE_INLINE -ACE_InputCDR::to_wstring::to_wstring (const ACE_CDR::WChar *&ws, - ACE_CDR::ULong b) - : val_ (ws), - bound_ (b) -{ -} - -ACE_INLINE -ACE_InputCDR::Transfer_Contents::Transfer_Contents (ACE_InputCDR &rhs) - : rhs_ (rhs) -{ -} - -// **************************************************************** - -ACE_INLINE -ACE_OutputCDR::~ACE_OutputCDR (void) -{ - if (this->start_.cont () != 0) - { - ACE_Message_Block::release (this->start_.cont ()); - this->start_.cont (0); - } - - this->current_ = 0; - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - this->monitor_->remove_ref (); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ -} - -ACE_INLINE void -ACE_OutputCDR::reset (void) -{ - this->current_ = &this->start_; - this->current_is_writable_ = true; - ACE_CDR::mb_align (&this->start_); - -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - this->current_alignment_ = 0; -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - - // It is tempting not to remove the memory, but we need to do so to - // release any potential user buffers chained in the continuation - // field. - - ACE_Message_Block * const cont = this->start_.cont (); - if (cont) - { - ACE_Message_Block::release (cont); - this->start_.cont (0); - } - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - this->monitor_->receive (this->start_.total_size ()); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ -} - -// Encode the CDR stream. - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_octet (ACE_CDR::Octet x) -{ - return this->write_1 (&x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_boolean (ACE_CDR::Boolean x) -{ - return - static_cast ( - this->write_octet ( - x - ? static_cast (1) - : static_cast (0))); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_char (ACE_CDR::Char x) -{ - if (this->char_translator_ == 0) - { - ACE_CDR::Octet temp = static_cast (x); - return this->write_1 (&temp); - } - return this->char_translator_->write_char (*this, x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_short (ACE_CDR::Short x) -{ - ACE_CDR::UShort temp = static_cast (x); - return this->write_2 (&temp); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_ushort (ACE_CDR::UShort x) -{ - return this->write_2 (&x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_long (ACE_CDR::Long x) -{ - ACE_CDR::ULong temp = static_cast (x); - return this->write_4 (&temp); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_ulong (ACE_CDR::ULong x) -{ - return this->write_4 (&x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_longlong (const ACE_CDR::LongLong &x) -{ - void const * const temp = &x; - return this->write_8 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_ulonglong (const ACE_CDR::ULongLong &x) -{ - return this->write_8 (&x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_float (ACE_CDR::Float x) -{ - void const * const temp = &x; - return this->write_4 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_double (const ACE_CDR::Double &x) -{ - void const * const temp = &x; - return this->write_8 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_longdouble (const ACE_CDR::LongDouble &x) -{ - return this->write_16 (&x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_string (const ACE_CDR::Char *x) -{ - if (x) - { - ACE_CDR::ULong const len = - static_cast (ACE_OS::strlen (x)); - return this->write_string (len, x); - } - - return this->write_string (0, 0); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_wstring (const ACE_CDR::WChar *x) -{ - if (x) - { - ACE_CDR::ULong const len = - static_cast (ACE_OS::strlen (x)); - return this->write_wstring (len, x); - } - - return this->write_wstring (0, 0); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_char_array (const ACE_CDR::Char *x, - ACE_CDR::ULong length) -{ - if (this->char_translator_ == 0) - return this->write_array (x, - ACE_CDR::OCTET_SIZE, - ACE_CDR::OCTET_ALIGN, - length); - return this->char_translator_->write_char_array (*this, x, length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_wchar_array (const ACE_CDR::WChar* x, - ACE_CDR::ULong length) -{ - if (this->wchar_translator_) - return this->wchar_translator_->write_wchar_array (*this, x, length); - - if (ACE_OutputCDR::wchar_maxbytes_ == 0) - { - errno = EACCES; - return (ACE_CDR::Boolean) (this->good_bit_ = false); - } - - if (ACE_OutputCDR::wchar_maxbytes_ == sizeof (ACE_CDR::WChar)) - return this->write_array (x, - sizeof (ACE_CDR::WChar), - sizeof (ACE_CDR::WChar) == 2 - ? ACE_CDR::SHORT_ALIGN - : ACE_CDR::LONG_ALIGN, - length); - return this->write_wchar_array_i (x,length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_octet_array (const ACE_CDR::Octet* x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::OCTET_SIZE, - ACE_CDR::OCTET_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_short_array (const ACE_CDR::Short *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::SHORT_SIZE, - ACE_CDR::SHORT_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_ushort_array (const ACE_CDR::UShort *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::SHORT_SIZE, - ACE_CDR::SHORT_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_long_array (const ACE_CDR::Long *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONG_SIZE, - ACE_CDR::LONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_ulong_array (const ACE_CDR::ULong *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONG_SIZE, - ACE_CDR::LONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_longlong_array (const ACE_CDR::LongLong *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONGLONG_SIZE, - ACE_CDR::LONGLONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_ulonglong_array (const ACE_CDR::ULongLong *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONGLONG_SIZE, - ACE_CDR::LONGLONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_float_array (const ACE_CDR::Float *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONG_SIZE, - ACE_CDR::LONG_ALIGN, - length); -} - - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_double_array (const ACE_CDR::Double *x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONGLONG_SIZE, - ACE_CDR::LONGLONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::write_longdouble_array (const ACE_CDR::LongDouble* x, - ACE_CDR::ULong length) -{ - return this->write_array (x, - ACE_CDR::LONGDOUBLE_SIZE, - ACE_CDR::LONGDOUBLE_ALIGN, - length); -} - -ACE_INLINE bool -ACE_OutputCDR::good_bit (void) const -{ - return this->good_bit_; -} - -ACE_INLINE int -ACE_OutputCDR::adjust (size_t size, - size_t align, - char*& buf) -{ - if (!this->current_is_writable_) - return this->grow_and_adjust (size, align, buf); - -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - size_t const offset = - ACE_align_binary (this->current_alignment_, align) - - this->current_alignment_; - - buf = this->current_->wr_ptr () + offset; -#else - buf = this->current_->wr_ptr (); -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - - char * const end = buf + size; - - if (end <= this->current_->end () && - end >= buf) - { -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - this->current_alignment_ += offset + size; -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - this->current_->wr_ptr (end); - -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - this->monitor_->receive (this->total_length ()); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ - - return 0; - } - - return this->grow_and_adjust (size, align, buf); -} - -ACE_INLINE int -ACE_OutputCDR::adjust (size_t size, char*& buf) -{ - return this->adjust (size, size, buf); -} - -ACE_INLINE void -ACE_OutputCDR::set_version (ACE_CDR::Octet major, ACE_CDR::Octet minor) -{ - this->major_version_ = major; - this->minor_version_ = minor; -} - -ACE_INLINE void -ACE_OutputCDR::get_version (ACE_CDR::Octet &major, ACE_CDR::Octet &minor) -{ - major = this->major_version_; - minor = this->minor_version_; -} - - -ACE_INLINE const ACE_Message_Block* -ACE_OutputCDR::begin (void) const -{ - return &this->start_; -} - -ACE_INLINE const ACE_Message_Block* -ACE_OutputCDR::end (void) const -{ - return this->current_->cont (); -} - -ACE_INLINE const ACE_Message_Block* -ACE_OutputCDR::current (void) const -{ - return this->current_; -} - -ACE_INLINE size_t -ACE_OutputCDR::total_length (void) const -{ - return ACE_CDR::total_length (this->begin (), this->end ()); -} - -ACE_INLINE const char* -ACE_OutputCDR::buffer (void) const -{ - return this->start_.rd_ptr (); -} - -ACE_INLINE size_t -ACE_OutputCDR::length (void) const -{ - return this->start_.length (); -} - -ACE_INLINE bool -ACE_OutputCDR::do_byte_swap (void) const -{ - return this->do_byte_swap_; -} - -ACE_INLINE int -ACE_OutputCDR::byte_order (void) const -{ - if (this->do_byte_swap ()) - return !ACE_CDR_BYTE_ORDER; - else - return ACE_CDR_BYTE_ORDER; -} - -ACE_INLINE void -ACE_OutputCDR::reset_byte_order (int byte_order) -{ - this->do_byte_swap_ = (byte_order != ACE_CDR_BYTE_ORDER); -} - -ACE_INLINE size_t -ACE_OutputCDR::current_alignment (void) const -{ -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - return this->current_alignment_; -#else - // Default value set to 0 - return 0; -#endif /* ACE_LACKS_CDR_ALIGNMENT */ -} - -ACE_INLINE void -ACE_OutputCDR::current_alignment (size_t current_alignment) -{ -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - this->current_alignment_ = current_alignment; -#else - ACE_UNUSED_ARG (current_alignment); -#endif /* ACE_LACKS_CDR_ALIGNMENT */ -} - -ACE_INLINE int -ACE_OutputCDR::align_write_ptr (size_t alignment) -{ -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - char *dummy; - return this->adjust (0, alignment, dummy); -#else - ACE_UNUSED_ARG (alignment); - // A return value of -1 from this function is used - // to indicate failure, returning 0 - return 0; -#endif /* ACE_LACKS_CDR_ALIGNMENT */ -} - -ACE_INLINE ACE_Char_Codeset_Translator * -ACE_OutputCDR::char_translator (void) const -{ - return this->char_translator_; -} - -ACE_INLINE ACE_WChar_Codeset_Translator * -ACE_OutputCDR::wchar_translator (void) const -{ - return this->wchar_translator_; -} - -ACE_INLINE void -ACE_OutputCDR::char_translator (ACE_Char_Codeset_Translator * ctran) -{ - this->char_translator_ = ctran; -} - -ACE_INLINE void -ACE_OutputCDR::wchar_translator (ACE_WChar_Codeset_Translator * wctran) -{ - this->wchar_translator_ = wctran; -} - -// **************************************************************** - -ACE_INLINE -ACE_InputCDR::~ACE_InputCDR (void) -{ -#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) - this->monitor_->remove_ref (); -#endif /* ACE_HAS_MONITOR_POINTS==1 */ -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_octet (ACE_CDR::Octet& x) -{ - return this->read_1 (&x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_boolean (ACE_CDR::Boolean& x) -{ - ACE_CDR::Octet tmp = 0; - (void) this->read_octet (tmp); - x = tmp ? true : false; - return (ACE_CDR::Boolean) this->good_bit_; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_char (ACE_CDR::Char &x) -{ - if (this->char_translator_ == 0) - { - void *temp = &x; - return this->read_1 (reinterpret_cast (temp)); - } - return this->char_translator_->read_char (*this, x); -} - - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_short (ACE_CDR::Short &x) -{ - void *temp = &x; - return this->read_2 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_ushort (ACE_CDR::UShort &x) -{ - return this->read_2 (&x); -} - - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_long (ACE_CDR::Long &x) -{ - void *temp = &x; - return this->read_4 (reinterpret_cast (temp)); -} - - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_ulong (ACE_CDR::ULong &x) -{ - return this->read_4 (&x); -} - - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_longlong (ACE_CDR::LongLong &x) -{ - void *temp = &x; - return this->read_8 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_ulonglong (ACE_CDR::ULongLong &x) -{ - return this->read_8 (&x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_float (ACE_CDR::Float &x) -{ - void *temp = &x; - return this->read_4 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_double (ACE_CDR::Double &x) -{ - void *temp = &x; - return this->read_8 (reinterpret_cast (temp)); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_longdouble (ACE_CDR::LongDouble &x) -{ - return this->read_16 (&x); -} - -ACE_INLINE size_t -ACE_InputCDR::length (void) const -{ - return this->start_.length (); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_char_array (ACE_CDR::Char* x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length > this->length ()) - { - this->good_bit_ = false; - return false; - } - - if (this->char_translator_ == 0) - return this->read_array (x, - ACE_CDR::OCTET_SIZE, - ACE_CDR::OCTET_ALIGN, - length); - return this->char_translator_->read_char_array (*this, x, length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_wchar_array (ACE_CDR::WChar* x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length * ACE_OutputCDR::wchar_maxbytes_ > this->length ()) - { - this->good_bit_ = false; - return false; - } - - if (this->wchar_translator_ != 0) - return this->wchar_translator_->read_wchar_array (*this, x, length); - if (ACE_OutputCDR::wchar_maxbytes_ != sizeof (ACE_CDR::WChar)) - return this->read_wchar_array_i (x, length); - return this->read_array (x, - sizeof (ACE_CDR::WChar), - sizeof (ACE_CDR::WChar) == 2 - ? ACE_CDR::SHORT_ALIGN - : ACE_CDR::LONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_octet_array (ACE_CDR::Octet* x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length * ACE_CDR::OCTET_SIZE > this->length ()) - { - this->good_bit_ = false; - return false; - } - - return this->read_array (x, - ACE_CDR::OCTET_SIZE, - ACE_CDR::OCTET_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_short_array (ACE_CDR::Short *x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length * ACE_CDR::SHORT_SIZE > this->length ()) - { - this->good_bit_ = false; - return false; - } - - return this->read_array (x, - ACE_CDR::SHORT_SIZE, - ACE_CDR::SHORT_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_ushort_array (ACE_CDR::UShort *x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length * ACE_CDR::SHORT_SIZE > this->length ()) - { - this->good_bit_ = false; - return false; - } - - return this->read_array (x, - ACE_CDR::SHORT_SIZE, - ACE_CDR::SHORT_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_long_array (ACE_CDR::Long *x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length * ACE_CDR::LONG_SIZE > this->length ()) - { - this->good_bit_ = false; - return false; - } - - return this->read_array (x, - ACE_CDR::LONG_SIZE, - ACE_CDR::LONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_ulong_array (ACE_CDR::ULong *x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length * ACE_CDR::LONG_SIZE > this->length ()) - { - this->good_bit_ = false; - return false; - } - - return this->read_array (x, - ACE_CDR::LONG_SIZE, - ACE_CDR::LONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_longlong_array (ACE_CDR::LongLong *x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length * ACE_CDR::LONGLONG_SIZE > this->length ()) - { - this->good_bit_ = false; - return false; - } - - return this->read_array (x, - ACE_CDR::LONGLONG_SIZE, - ACE_CDR::LONGLONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_ulonglong_array (ACE_CDR::ULongLong *x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length * ACE_CDR::LONGLONG_SIZE > this->length ()) - { - this->good_bit_ = false; - return false; - } - - return this->read_array (x, - ACE_CDR::LONGLONG_SIZE, - ACE_CDR::LONGLONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_float_array (ACE_CDR::Float *x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length * ACE_CDR::LONG_SIZE > this->length ()) - { - this->good_bit_ = false; - return false; - } - - return this->read_array (x, - ACE_CDR::LONG_SIZE, - ACE_CDR::LONG_ALIGN, - length); -} - - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_double_array (ACE_CDR::Double *x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length * ACE_CDR::LONGLONG_SIZE > this->length ()) - { - this->good_bit_ = false; - return false; - } - - return this->read_array (x, - ACE_CDR::LONGLONG_SIZE, - ACE_CDR::LONGLONG_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::read_longdouble_array (ACE_CDR::LongDouble* x, - ACE_CDR::ULong length) -{ - // Make sure the length of the array isn't greater than the length of - // the stream. - if (length * ACE_CDR::LONGDOUBLE_SIZE > this->length ()) - { - this->good_bit_ = false; - return false; - } - return this->read_array (x, - ACE_CDR::LONGDOUBLE_SIZE, - ACE_CDR::LONGDOUBLE_ALIGN, - length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::skip_octet (void) -{ - ACE_CDR::Octet x; - return this->read_1 (&x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::skip_char (void) -{ - return this->skip_octet (); // sizeof (Char) == sizeof (Octet) -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::skip_boolean (void) -{ - return this->skip_octet () && this->good_bit_; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::skip_ushort (void) -{ - ACE_CDR::UShort x; - return this->read_2 (&x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::skip_short (void) -{ - return this->skip_ushort (); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::skip_ulong (void) -{ - ACE_CDR::ULong x; - return this->read_4 (&x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::skip_long (void) -{ - return this->skip_ulong (); // sizeof (Long) == sizeof (ULong) -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::skip_ulonglong (void) -{ - ACE_CDR::ULongLong x; - return this->read_8 (&x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::skip_longlong (void) -{ - return this->skip_ulonglong (); // sizeof (LongLong) == sizeof (ULongLong) -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::skip_float (void) -{ - return this->skip_ulong (); // sizeof(Float) == sizeof (ULong) -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::skip_double (void) -{ - return this->skip_ulonglong (); // sizeof(Double) == sizeof (ULongLong) -} - -ACE_INLINE ACE_CDR::Boolean -ACE_InputCDR::skip_longdouble (void) -{ - ACE_CDR::LongDouble x; - return this->read_16 (&x); -} - -ACE_INLINE char* -ACE_InputCDR::end (void) -{ - return this->start_.end (); -} - -ACE_INLINE void -ACE_InputCDR::rd_ptr (size_t offset) -{ - this->start_.rd_ptr (offset); -} - -ACE_INLINE char* -ACE_InputCDR::rd_ptr (void) -{ - return this->start_.rd_ptr (); -} - -ACE_INLINE char* -ACE_InputCDR::wr_ptr (void) -{ - return this->start_.wr_ptr (); -} - -ACE_INLINE int -ACE_InputCDR::adjust (size_t size, - size_t align, - char*& buf) -{ -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - buf = ACE_ptr_align_binary (this->rd_ptr (), align); -#else - buf = this->rd_ptr (); -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - - char * const end = buf + size; - if (end <= this->wr_ptr ()) - { - this->start_.rd_ptr (end); - return 0; - } - - this->good_bit_ = false; - return -1; -#if defined (ACE_LACKS_CDR_ALIGNMENT) - ACE_UNUSED_ARG (align); -#endif /* ACE_LACKS_CDR_ALIGNMENT */ -} - -ACE_INLINE int -ACE_InputCDR::adjust (size_t size, - char*& buf) -{ - return this->adjust (size, size, buf); -} - -ACE_INLINE const ACE_Message_Block* -ACE_InputCDR::start (void) const -{ - return &this->start_; -} - -ACE_INLINE bool -ACE_InputCDR::good_bit (void) const -{ - return this->good_bit_; -} - -// **************************************************************** - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_CDR::Char x) -{ - os.write_char (x); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_CDR::Short x) -{ - os.write_short (x); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_CDR::UShort x) -{ - os.write_ushort (x); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_CDR::Long x) -{ - os.write_long (x); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_CDR::ULong x) -{ - os.write_ulong (x); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_CDR::LongLong x) -{ - os.write_longlong (x); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_CDR::ULongLong x) -{ - os.write_ulonglong (x); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_CDR::LongDouble x) -{ - os.write_longdouble (x); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_CDR::Float x) -{ - os.write_float (x); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_CDR::Double x) -{ - os.write_double (x); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, const ACE_CDR::Char *x) -{ - os.write_string (x); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, const ACE_CDR::WChar *x) -{ - os.write_wstring (x); - return (ACE_CDR::Boolean) os.good_bit (); -} - -// The following use the helper classes -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_boolean x) -{ - (void) os.write_boolean (x.val_); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_char x) -{ - os.write_char (x.val_); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_wchar x) -{ - os.write_wchar (x.val_); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_octet x) -{ - os.write_octet (x.val_); - return (ACE_CDR::Boolean) os.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_string x) -{ - ACE_CDR::ULong len = 0; - - if (x.val_ != 0) - { - len = static_cast (ACE_OS::strlen (x.val_)); - } - - os.write_string (len, x.val_); - return - (ACE_CDR::Boolean) (os.good_bit () && (!x.bound_ || len <= x.bound_)); -} - -ACE_INLINE ACE_CDR::Boolean -operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_wstring x) -{ - ACE_CDR::ULong len = 0; - - if (x.val_ != 0) - { - len = static_cast (ACE_OS::strlen (x.val_)); - } - - os.write_wstring (len, x.val_); - return - (ACE_CDR::Boolean) (os.good_bit () && (!x.bound_ || len <= x.bound_)); -} - -// **************************************************************** - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_CDR::Char &x) -{ - return is.read_char (x) && is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_CDR::Short &x) -{ - return is.read_short (x) && is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_CDR::UShort &x) -{ - return is.read_ushort (x) && is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>>(ACE_InputCDR &is, ACE_CDR::Long &x) -{ - return is.read_long (x) && is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_CDR::ULong &x) -{ - return is.read_ulong (x) && is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR& is, ACE_CDR::LongLong &x) -{ - return is.read_longlong (x) && is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR& is, ACE_CDR::ULongLong &x) -{ - return is.read_ulonglong (x) && is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR& is, ACE_CDR::LongDouble &x) -{ - return is.read_longdouble (x) && is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_CDR::Float &x) -{ - return is.read_float (x) && is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_CDR::Double &x) -{ - return is.read_double (x) && is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_CDR::Char *&x) -{ - return is.read_string (x) && is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_CDR::WChar *&x) -{ - return is.read_wstring (x) && is.good_bit (); -} - -// The following use the helper classes -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_InputCDR::to_boolean x) -{ - return is.read_boolean (x.ref_); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_InputCDR::to_char x) -{ - return is.read_char (x.ref_) && is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_InputCDR::to_wchar x) -{ - return is.read_wchar (x.ref_) && is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_InputCDR::to_octet x) -{ - return is.read_octet (x.ref_) && is.good_bit (); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_InputCDR::to_string x) -{ - // check if the bounds are satisfied - return - (is.read_string (const_cast (x.val_)) - && is.good_bit () - && (!x.bound_ - || ACE_OS::strlen (x.val_) <= x.bound_)); -} - -ACE_INLINE ACE_CDR::Boolean -operator>> (ACE_InputCDR &is, ACE_InputCDR::to_wstring x) -{ - // check if the bounds are satisfied - return - (is.read_wstring (const_cast (x.val_)) - && is.good_bit () - && (!x.bound_ - || ACE_OS::strlen (x.val_) <= x.bound_)); -} - -// *************************************************************************** -// We must define these methods here because they use the "read_*" inlined -// methods of the ACE_InputCDR class -// *************************************************************************** - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_boolean (ACE_InputCDR &stream) -{ - ACE_CDR::Boolean x; - return stream.read_boolean (x) ? this->write_boolean (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_char (ACE_InputCDR &stream) -{ - ACE_CDR::Char x; - return stream.read_char (x) ? this->write_char (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_wchar (ACE_InputCDR &stream) -{ - ACE_CDR::WChar x; - return stream.read_wchar (x) ? this->write_wchar (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_octet (ACE_InputCDR &stream) -{ - ACE_CDR::Octet x; - return stream.read_octet (x) ? this->write_octet (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_short (ACE_InputCDR &stream) -{ - ACE_CDR::Short x; - return stream.read_short (x) ? this->write_short (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_ushort (ACE_InputCDR &stream) -{ - ACE_CDR::UShort x; - return stream.read_ushort (x) ? this->write_ushort (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_long (ACE_InputCDR &stream) -{ - ACE_CDR::Long x; - return stream.read_long (x) ? this->write_long (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_ulong (ACE_InputCDR &stream) -{ - ACE_CDR::ULong x; - return stream.read_ulong (x) ? this->write_ulong (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_longlong (ACE_InputCDR &stream) -{ - ACE_CDR::LongLong x; - return stream.read_longlong (x) ? this->write_longlong (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_ulonglong (ACE_InputCDR &stream) -{ - ACE_CDR::ULongLong x; - return stream.read_ulonglong (x) ? this->write_ulonglong (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_float (ACE_InputCDR &stream) -{ - ACE_CDR::Float x; - return stream.read_float (x) ? this->write_float (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_double (ACE_InputCDR &stream) -{ - ACE_CDR::Double x; - return stream.read_double (x) ? this->write_double (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_longdouble (ACE_InputCDR &stream) -{ - ACE_CDR::LongDouble x; - return stream.read_longdouble (x) ? this->write_longdouble (x) : false; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_string (ACE_InputCDR &stream) -{ - ACE_CDR::Char *x = 0; - ACE_CDR::Boolean const flag = - (stream.read_string (x) ? this->write_string (x) : false); - delete [] x; - return flag; -} - -ACE_INLINE ACE_CDR::Boolean -ACE_OutputCDR::append_wstring (ACE_InputCDR &stream) -{ - ACE_CDR::WChar *x = 0; - ACE_CDR::Boolean const flag = - (stream.read_wstring (x) ? this->write_wstring (x) : false); - delete [] x; - return flag; -} - -ACE_INLINE void -ACE_InputCDR::reset_byte_order (int byte_order) -{ - this->do_byte_swap_ = (byte_order != ACE_CDR_BYTE_ORDER); -} - -ACE_INLINE bool -ACE_InputCDR::do_byte_swap (void) const -{ - return this->do_byte_swap_; -} - -ACE_INLINE int -ACE_InputCDR::byte_order (void) const -{ - return this->do_byte_swap () ? !ACE_CDR_BYTE_ORDER : ACE_CDR_BYTE_ORDER; -} - -ACE_INLINE int -ACE_InputCDR::align_read_ptr (size_t alignment) -{ -#if !defined (ACE_LACKS_CDR_ALIGNMENT) - char *buf = ACE_ptr_align_binary (this->rd_ptr (), - alignment); -#else - char *buf = this->rd_ptr (); -#endif /* ACE_LACKS_CDR_ALIGNMENT */ - - if (buf <= this->wr_ptr ()) - { - this->start_.rd_ptr (buf); - return 0; - } - - this->good_bit_ = false; - return -1; -} - -ACE_INLINE void -ACE_InputCDR::set_version (ACE_CDR::Octet major, ACE_CDR::Octet minor) -{ - this->major_version_ = major; - this->minor_version_ = minor; -} - -ACE_INLINE void -ACE_InputCDR::get_version (ACE_CDR::Octet &major, ACE_CDR::Octet &minor) -{ - major = this->major_version_; - minor = this->minor_version_; -} - -ACE_INLINE ACE_Char_Codeset_Translator * -ACE_InputCDR::char_translator (void) const -{ - return this->char_translator_; -} - -ACE_INLINE ACE_WChar_Codeset_Translator * -ACE_InputCDR::wchar_translator (void) const -{ - return this->wchar_translator_; -} - - -ACE_INLINE void -ACE_InputCDR::char_translator (ACE_Char_Codeset_Translator * ctran) -{ - this->char_translator_ = ctran; -} - -ACE_INLINE void -ACE_InputCDR::wchar_translator (ACE_WChar_Codeset_Translator * wctran) -{ - this->wchar_translator_ = wctran; -} - -// **************************************************************** - -ACE_INLINE ACE_CDR::Boolean -ACE_Char_Codeset_Translator::read_1 (ACE_InputCDR& input, - ACE_CDR::Octet *x) -{ - return input.read_1 (x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_Char_Codeset_Translator::write_1 (ACE_OutputCDR& output, - const ACE_CDR::Octet *x) -{ - return output.write_1 (x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_Char_Codeset_Translator::read_array (ACE_InputCDR& in, - void* x, - size_t size, - size_t align, - ACE_CDR::ULong length) -{ - return in.read_array (x, size, align, length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_Char_Codeset_Translator::write_array (ACE_OutputCDR& out, - const void *x, - size_t size, - size_t align, - ACE_CDR::ULong length) -{ - return out.write_array(x, size, align, length); -} - -ACE_INLINE int -ACE_Char_Codeset_Translator::adjust (ACE_OutputCDR& out, - size_t size, - size_t align, - char *&buf) -{ - return out.adjust(size, align, buf); -} - -ACE_INLINE void -ACE_Char_Codeset_Translator::good_bit (ACE_OutputCDR& out, bool bit) -{ - out.good_bit_ = bit; -} - -ACE_INLINE ACE_CDR::Octet -ACE_Char_Codeset_Translator::major_version (ACE_InputCDR& input) -{ - return input.major_version_; -} - -ACE_INLINE ACE_CDR::Octet -ACE_Char_Codeset_Translator::minor_version (ACE_InputCDR& input) -{ - return input.minor_version_; -} - -ACE_INLINE ACE_CDR::Octet -ACE_Char_Codeset_Translator::major_version (ACE_OutputCDR& output) -{ - return output.major_version_; -} - -ACE_INLINE ACE_CDR::Octet -ACE_Char_Codeset_Translator::minor_version (ACE_OutputCDR& output) -{ - return output.minor_version_; -} - -// **************************************************************** - -ACE_INLINE ACE_CDR::Boolean -ACE_WChar_Codeset_Translator::read_1 (ACE_InputCDR& input, - ACE_CDR::Octet *x) -{ - return input.read_1 (x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_WChar_Codeset_Translator::read_2 (ACE_InputCDR& input, - ACE_CDR::UShort *x) -{ - return input.read_2 (x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_WChar_Codeset_Translator::read_4 (ACE_InputCDR& input, - ACE_CDR::ULong *x) -{ - return input.read_4 (x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_WChar_Codeset_Translator::write_1 (ACE_OutputCDR& output, - const ACE_CDR::Octet *x) -{ - return output.write_1 (x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_WChar_Codeset_Translator::write_2 (ACE_OutputCDR& output, - const ACE_CDR::UShort *x) -{ - return output.write_2 (x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_WChar_Codeset_Translator::write_4 (ACE_OutputCDR& output, - const ACE_CDR::ULong *x) -{ - return output.write_4 (x); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_WChar_Codeset_Translator::read_array (ACE_InputCDR& in, - void* x, - size_t size, - size_t align, - ACE_CDR::ULong length) -{ - return in.read_array (x, size, align, length); -} - -ACE_INLINE ACE_CDR::Boolean -ACE_WChar_Codeset_Translator::write_array (ACE_OutputCDR& out, - const void *x, - size_t size, - size_t align, - ACE_CDR::ULong length) -{ - return out.write_array(x, size, align, length); -} - -ACE_INLINE int -ACE_WChar_Codeset_Translator::adjust (ACE_OutputCDR& out, - size_t size, - size_t align, - char *&buf) -{ - return out.adjust(size, align, buf); -} - -ACE_INLINE void -ACE_WChar_Codeset_Translator::good_bit (ACE_OutputCDR& out, bool bit) -{ - out.good_bit_ = bit; -} - -ACE_INLINE ACE_CDR::Octet -ACE_WChar_Codeset_Translator::major_version (ACE_InputCDR& input) -{ - return input.major_version_; -} - -ACE_INLINE ACE_CDR::Octet -ACE_WChar_Codeset_Translator::minor_version (ACE_InputCDR& input) -{ - return input.minor_version_; -} - -ACE_INLINE ACE_CDR::Octet -ACE_WChar_Codeset_Translator::major_version (ACE_OutputCDR& output) -{ - return output.major_version_; -} - -ACE_INLINE ACE_CDR::Octet -ACE_WChar_Codeset_Translator::minor_version (ACE_OutputCDR& output) -{ - return output.minor_version_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/CE_Screen_Output.cpp b/dep/acelite/ace/CE_Screen_Output.cpp deleted file mode 100644 index dfd3d717a1f..00000000000 --- a/dep/acelite/ace/CE_Screen_Output.cpp +++ /dev/null @@ -1,158 +0,0 @@ -// $Id: CE_Screen_Output.cpp 80826 2008-03-04 14:51:23Z wotte $ - -#include "ace/CE_Screen_Output.h" -#if defined (ACE_HAS_WINCE) - -#include "ace/Log_Msg.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_CE_Screen_Output::ACE_CE_Screen_Output(HWND hEdit) -: handler_(hEdit) -, pFile_(0) -{ -} - -ACE_CE_Screen_Output::ACE_CE_Screen_Output() -: handler_(0) -, pFile_(0) -{ -} - -ACE_CE_Screen_Output::~ACE_CE_Screen_Output() -{ - if (pFile_ != 0) { - fclose(pFile_); - } -} - -void ACE_CE_Screen_Output::log(ACE_Log_Record &log_record) -{ - ACE_TCHAR verbose_msg[ACE_Log_Record::MAXVERBOSELOGMSGLEN]; - int result = log_record.format_msg (ACE_TEXT("WindozeCE"), // host name - 0, // verbose flag - verbose_msg); - - if (result == 0) - { - verbose_msg[ ACE_OS::strlen(verbose_msg) - 1 ] = 0; // CE does not like '\n' by itself. - *this << verbose_msg << endl; - } -} - -void ACE_CE_Screen_Output::SetOutputWindow(HWND hEdit) -{ - handler_ = hEdit; -} - -void ACE_CE_Screen_Output::clear() -{ - SetWindowText(handler_, 0); -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (ACE_TCHAR* output) -{ - int length = GetWindowTextLength(handler_); - SendMessage(handler_, EM_SETSEL, length, length); - SendMessage(handler_, EM_REPLACESEL, 0, (LPARAM)output); - - if (pFile_ != 0) - { - fwprintf(pFile_, L"%s", output); - } - - return *this; -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (const ACE_TCHAR* output) -{ - ACE_TCHAR* buffer = ACE_OS::strdup(output); - if (buffer != 0) - { - *this << buffer; - delete buffer; - } - return *this; -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (ACE_ANTI_TCHAR* output) -{ - *this << ACE_TEXT_CHAR_TO_TCHAR(output); - return *this; -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (const ACE_ANTI_TCHAR* output) -{ - *this << ACE_TEXT_CHAR_TO_TCHAR(output); - return *this; -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (char output) -{ - *this << (int)output; - return *this; -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (unsigned char output) -{ - *this << (int)output; - return *this; -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (unsigned short output) -{ - ACE_TCHAR buffer[20]; - wsprintf(buffer, ACE_TEXT("%u"), output); - *this << buffer; - return *this; -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (int output) -{ - ACE_TCHAR buffer[20]; - wsprintf(buffer, ACE_TEXT("%d"), output); - *this << buffer; - return *this; -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (unsigned int output) -{ - ACE_TCHAR buffer[20]; - wsprintf(buffer, ACE_TEXT("%du"), output); - *this << buffer; - return *this; -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (float output) -{ - ACE_TCHAR buffer[20]; - swprintf(buffer, ACE_TEXT("%f"), output); - *this << buffer; - return *this; -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (long output) -{ - ACE_TCHAR buffer[20]; - wsprintf(buffer, ACE_TEXT("%l"), output); - *this << buffer; - return *this; -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (unsigned long output) -{ - ACE_TCHAR buffer[20]; - wsprintf(buffer, ACE_TEXT("%lu"), output); - *this << buffer; - return *this; -} - -ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (FILE* pFile) -{ - pFile_ = pFile; - return *this; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif // ACE_HAS_WINCE diff --git a/dep/acelite/ace/CE_Screen_Output.h b/dep/acelite/ace/CE_Screen_Output.h deleted file mode 100644 index 62d4deaa042..00000000000 --- a/dep/acelite/ace/CE_Screen_Output.h +++ /dev/null @@ -1,109 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file CE_Screen_Output.h - * - * $Id: CE_Screen_Output.h 94271 2011-06-23 14:52:31Z johnnyw $ - * - * @author Si Mong Park - */ -//============================================================================= - -#ifndef ACE_CE_SCREEN_OUTPUT_H -#define ACE_CE_SCREEN_OUTPUT_H - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_WINCE) - -#include "ace/Log_Msg_Callback.h" -#include "ace/Log_Record.h" - -namespace -{ - const ACE_TCHAR endl[] = ACE_TEXT("\r\n"); - const ACE_TCHAR tab[] = ACE_TEXT("\t"); -} - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_CE_Screen_Output - * - * @brief Replacement of text output for Windows CE. - * - * This class allows standard text output to be displayed on - * text window for Windows CE. Generally, all ACE output will - * go through under CE if and only if user uses Windows CE - * implementation by using main_ce instead of main. - * Also, for the easier debugging purpose, object pointer of - * this class can be gotten from ACE_Log_Msg::msg_callback() - * and then can be used directly by user just like cout stream. - */ -class ACE_Export ACE_CE_Screen_Output : public ACE_Log_Msg_Callback -{ -public: - - ACE_CE_Screen_Output (HWND hEdit); - - ACE_CE_Screen_Output (void); - - virtual ~ACE_CE_Screen_Output(); - - /// Implementation of pure virtual function from ACE_Log_Msg_Callback. - virtual void log (ACE_Log_Record &log_record); - - /// Interface to specify active window handle. - void SetOutputWindow (HWND hWnd); - - void clear (void); - - /// Stream insertion operator that performs actual print out. - /** - * @note This is the only one operator that performs output. All - * other perators convert the type and use this operator - * underneath. - */ - ACE_CE_Screen_Output& operator << (ACE_TCHAR*); - ACE_CE_Screen_Output& operator << (const ACE_TCHAR*); - - ACE_CE_Screen_Output& operator << (ACE_ANTI_TCHAR* output); - ACE_CE_Screen_Output& operator << (const ACE_ANTI_TCHAR* output); - - ACE_CE_Screen_Output& operator << (char output); - ACE_CE_Screen_Output& operator << (unsigned char output); - - ACE_CE_Screen_Output& operator << (unsigned short output); - - ACE_CE_Screen_Output& operator << (int output); - ACE_CE_Screen_Output& operator << (unsigned int output); - - ACE_CE_Screen_Output& operator << (float output); - - ACE_CE_Screen_Output& operator << (long output); - ACE_CE_Screen_Output& operator << (unsigned long output); - - ACE_CE_Screen_Output& operator << (FILE* pFile); - -private: - - ACE_CE_Screen_Output (ACE_CE_Screen_Output&); - -private: - - HWND handler_; - - /// FILE pointer that used to save output to file. This class does - /// not own the file handler pointer. - FILE* pFile_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif // ACE_HAS_WINCE -#endif // ACE_CE_SCREEN_OUTPUT_H diff --git a/dep/acelite/ace/CMakeLists.txt b/dep/acelite/ace/CMakeLists.txt deleted file mode 100644 index 3de9f797938..00000000000 --- a/dep/acelite/ace/CMakeLists.txt +++ /dev/null @@ -1,352 +0,0 @@ -# Copyright (C) 2008-2014 TrinityCore -# -# This file is free software; as a special exception the author gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -# NOTE: Do not use glob here, it would include files we don't want -set(ace_STAT_SRCS - ACE.cpp - ACE_crc32.cpp - ACE_crc_ccitt.cpp - ace_wchar.cpp - Activation_Queue.cpp - Active_Map_Manager.cpp - Addr.cpp - Argv_Type_Converter.cpp - Assert.cpp - Asynch_IO.cpp - Asynch_IO_Impl.cpp - Asynch_Pseudo_Task.cpp - ATM_Acceptor.cpp - ATM_Addr.cpp - ATM_Connector.cpp - ATM_Params.cpp - ATM_QoS.cpp - ATM_Stream.cpp - Atomic_Op.cpp - Atomic_Op_Sparc.c - Auto_Event.cpp - Barrier.cpp - Base_Thread_Adapter.cpp - Based_Pointer_Repository.cpp - Basic_Stats.cpp - Basic_Types.cpp - Capabilities.cpp - CDR_Base.cpp - CDR_Size.cpp - CDR_Stream.cpp - Cleanup.cpp - Codecs.cpp - Codeset_IBM1047.cpp - Codeset_Registry.cpp - Codeset_Registry_db.cpp - Condition_Attributes.cpp - Condition_Recursive_Thread_Mutex.cpp - Condition_Thread_Mutex.cpp - Configuration.cpp - Configuration_Import_Export.cpp - Connection_Recycling_Strategy.cpp - Containers.cpp - Copy_Disabled.cpp - Date_Time.cpp - DEV.cpp - DEV_Addr.cpp - DEV_Connector.cpp - DEV_IO.cpp - Dev_Poll_Reactor.cpp - Dirent.cpp - Dirent_Selector.cpp - DLL.cpp - DLL_Manager.cpp - Dump.cpp - Dynamic.cpp - Dynamic_Message_Strategy.cpp - Dynamic_Service_Base.cpp - Dynamic_Service_Dependency.cpp - Encoding_Converter.cpp - Encoding_Converter_Factory.cpp - Event.cpp - Event_Handler.cpp - Event_Handler_Handle_Timeout_Upcall.cpp - FIFO.cpp - FIFO_Recv.cpp - FIFO_Recv_Msg.cpp - FIFO_Send.cpp - FIFO_Send_Msg.cpp - FILE.cpp - FILE_Addr.cpp - FILE_Connector.cpp - FILE_IO.cpp - File_Lock.cpp - Filecache.cpp - Flag_Manip.cpp - Framework_Component.cpp - Functor.cpp - Functor_String.cpp - Get_Opt.cpp - Handle_Ops.cpp - Handle_Set.cpp - Hashable.cpp - High_Res_Timer.cpp - ICMP_Socket.cpp - INET_Addr.cpp - Init_ACE.cpp - IO_Cntl_Msg.cpp - IO_SAP.cpp - IOStream.cpp - IPC_SAP.cpp - Lib_Find.cpp - Local_Memory_Pool.cpp - Local_Name_Space.cpp - Local_Tokens.cpp - Lock.cpp - Log_Msg.cpp - Log_Msg_Backend.cpp - Log_Msg_Callback.cpp - Log_Msg_IPC.cpp - Log_Msg_NT_Event_Log.cpp - Log_Msg_UNIX_Syslog.cpp - Log_Record.cpp - Logging_Strategy.cpp - LSOCK.cpp - LSOCK_Acceptor.cpp - LSOCK_CODgram.cpp - LSOCK_Connector.cpp - LSOCK_Dgram.cpp - LSOCK_Stream.cpp - Malloc.cpp - Malloc_Allocator.cpp - Manual_Event.cpp - MEM_Acceptor.cpp - MEM_Addr.cpp - MEM_Connector.cpp - MEM_IO.cpp - Mem_Map.cpp - MEM_SAP.cpp - MEM_Stream.cpp - Message_Block.cpp - Message_Queue.cpp - Message_Queue_NT.cpp - Message_Queue_Vx.cpp - Method_Request.cpp - MMAP_Memory_Pool.cpp - Monitor_Admin.cpp - Monitor_Admin_Manager.cpp - Monitor_Base.cpp - Monitor_Control_Action.cpp - Monitor_Control_Types.cpp - Monitor_Point_Registry.cpp - Monitor_Size.cpp - Msg_WFMO_Reactor.cpp - Multihomed_INET_Addr.cpp - Mutex.cpp - Name_Proxy.cpp - Name_Request_Reply.cpp - Name_Space.cpp - Naming_Context.cpp - Netlink_Addr.cpp - Notification_Queue.cpp - Notification_Strategy.cpp - NT_Service.cpp - Obchunk.cpp - Object_Manager.cpp - Object_Manager_Base.cpp - OS_Errno.cpp - OS_Log_Msg_Attributes.cpp - OS_main.cpp - OS_NS_arpa_inet.cpp - OS_NS_ctype.cpp - OS_NS_dirent.cpp - OS_NS_dlfcn.cpp - OS_NS_errno.cpp - OS_NS_fcntl.cpp - OS_NS_math.cpp - OS_NS_netdb.cpp - OS_NS_poll.cpp - OS_NS_pwd.cpp - OS_NS_regex.cpp - OS_NS_signal.cpp - OS_NS_stdio.cpp - OS_NS_stdlib.cpp - OS_NS_string.cpp - OS_NS_strings.cpp - OS_NS_stropts.cpp - OS_NS_sys_mman.cpp - OS_NS_sys_msg.cpp - OS_NS_sys_resource.cpp - OS_NS_sys_select.cpp - OS_NS_sys_sendfile.cpp - OS_NS_sys_shm.cpp - OS_NS_sys_socket.cpp - OS_NS_sys_stat.cpp - OS_NS_sys_time.cpp - OS_NS_sys_uio.cpp - OS_NS_sys_utsname.cpp - OS_NS_sys_wait.cpp - OS_NS_Thread.cpp - OS_NS_time.cpp - OS_NS_unistd.cpp - OS_NS_wchar.cpp - OS_QoS.cpp - OS_Thread_Adapter.cpp - OS_TLI.cpp - Pagefile_Memory_Pool.cpp - Parse_Node.cpp - PI_Malloc.cpp - Ping_Socket.cpp - Pipe.cpp - POSIX_Asynch_IO.cpp - POSIX_CB_Proactor.cpp - POSIX_Proactor.cpp - Priority_Reactor.cpp - Proactor.cpp - Proactor_Impl.cpp - Process.cpp - Process_Manager.cpp - Process_Mutex.cpp - Process_Semaphore.cpp - Profile_Timer.cpp - Reactor.cpp - Reactor_Impl.cpp - Reactor_Notification_Strategy.cpp - Reactor_Timer_Interface.cpp - Read_Buffer.cpp - Recursive_Thread_Mutex.cpp - Recyclable.cpp - Registry.cpp - Registry_Name_Space.cpp - Remote_Name_Space.cpp - Remote_Tokens.cpp - Rtems_init.c - RW_Mutex.cpp - RW_Process_Mutex.cpp - RW_Thread_Mutex.cpp - Sample_History.cpp - Sbrk_Memory_Pool.cpp - Sched_Params.cpp - Select_Reactor_Base.cpp - Semaphore.cpp - Service_Config.cpp - Service_Gestalt.cpp - Service_Manager.cpp - Service_Object.cpp - Service_Repository.cpp - Service_Types.cpp - Shared_Memory.cpp - Shared_Memory_MM.cpp - Shared_Memory_Pool.cpp - Shared_Memory_SV.cpp - Shared_Object.cpp - Sig_Adapter.cpp - Sig_Handler.cpp - Signal.cpp - SOCK.cpp - SOCK_Acceptor.cpp - SOCK_CODgram.cpp - Sock_Connect.cpp - SOCK_Connector.cpp - SOCK_Dgram.cpp - SOCK_Dgram_Bcast.cpp - SOCK_Dgram_Mcast.cpp - SOCK_IO.cpp - SOCK_Netlink.cpp - SOCK_SEQPACK_Acceptor.cpp - SOCK_SEQPACK_Association.cpp - SOCK_SEQPACK_Connector.cpp - SOCK_Stream.cpp - SPIPE.cpp - SPIPE_Acceptor.cpp - SPIPE_Addr.cpp - SPIPE_Connector.cpp - SPIPE_Stream.cpp - SString.cpp - Stack_Trace.cpp - Stats.cpp - String_Base_Const.cpp - SUN_Proactor.cpp - SV_Message.cpp - SV_Message_Queue.cpp - SV_Semaphore_Complex.cpp - SV_Semaphore_Simple.cpp - SV_Shared_Memory.cpp - Svc_Conf_Lexer.cpp - Svc_Conf_y.cpp - Synch_Options.cpp - System_Time.cpp - Task.cpp - Thread.cpp - Thread_Adapter.cpp - Thread_Control.cpp - Thread_Exit.cpp - Thread_Hook.cpp - Thread_Manager.cpp - Thread_Mutex.cpp - Thread_Semaphore.cpp - Throughput_Stats.cpp - Time_Policy.cpp - Time_Value.cpp - Timeprobe.cpp - TLI.cpp - TLI_Acceptor.cpp - TLI_Connector.cpp - TLI_Stream.cpp - Token.cpp - Token_Collection.cpp - Token_Invariants.cpp - Token_Manager.cpp - Token_Request_Reply.cpp - TP_Reactor.cpp - Trace.cpp - TSS_Adapter.cpp - TTY_IO.cpp - UNIX_Addr.cpp - UPIPE_Acceptor.cpp - UPIPE_Connector.cpp - UPIPE_Stream.cpp - UTF16_Encoding_Converter.cpp - UTF32_Encoding_Converter.cpp - UTF8_Encoding_Converter.cpp - UUID.cpp - WFMO_Reactor.cpp - WIN32_Asynch_IO.cpp - WIN32_Proactor.cpp - XML_Svc_Conf.cpp - XTI_ATM_Mcast.cpp -) - -if (USE_COREPCH) - set(ace_PCH_HDR PrecompiledHeaders/WinAcePCH.h) - set(ace_PCH_SRC PrecompiledHeaders/WinAcePCH.cpp) -endif() - -include_directories( - ${CMAKE_SOURCE_DIR}/dep/acelite - ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders - ${CMAKE_SOURCE_DIR}/dep/zlib -) - -# Needed for PCH support -set_source_files_properties(Atomic_Op_Sparc.c Rtems_init.c PROPERTIES LANGUAGE CXX) - -add_definitions(-DACE_BUILD_DLL) - -add_library(ace SHARED - ${ace_STAT_SRCS} - ${ace_PCH_SRC} -) - -if (MINGW) # GCC ignores "#prama comment" - target_link_libraries(ace ws2_32 iphlpapi netapi32 mswsock) -endif() - -# Generate precompiled header -if( USE_COREPCH ) - add_cxx_pch(ace ${ace_PCH_HDR} ${ace_PCH_SRC}) -endif() - -install(TARGETS ace RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}") diff --git a/dep/acelite/ace/CORBA_macros.h b/dep/acelite/ace/CORBA_macros.h deleted file mode 100644 index 8233b63cda9..00000000000 --- a/dep/acelite/ace/CORBA_macros.h +++ /dev/null @@ -1,90 +0,0 @@ -// -*- C++ -*- - -// ============================================================================ -/** - * @file CORBA_macros.h - * - * $Id: CORBA_macros.h 91626 2010-09-07 10:59:20Z johnnyw $ - * - * Writing code that is portable between platforms with or without - * native C++ exceptions is hard. The following macros offer some - * help on this task, mostly oriented to making the ORB code and the - * IDL generated code portable. - * - * @author Nanbor Wang - * @author Aniruddha Gokhale - * @author Carlos O'Ryan , et al. - */ -// ============================================================================ - -// Macros for handling CORBA exceptions. - -#ifndef ACE_CORBA_MACROS_H -#define ACE_CORBA_MACROS_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -# if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -# endif /* ACE_LACKS_PRAGMA_ONCE */ - -// The Windows MFC exception mechanism requires that a caught CException -// (including the CMemoryException in use here) be freed using its Delete() -// method. Thus, when MFC is in use and we're catching exceptions as a result -// of new(), the exception's Delete() method has to be called. No other -// platform imposes this sort of restriction/requirement. The Windows -// config stuff (at least for MSVC/MFC) defines a ACE_del_bad_alloc macro -// that works with its ACE_bad_alloc macro to implement this cleanup -// requirement. Since no other platform requires this, define it as -// empty here. -#if !defined (ACE_del_bad_alloc) -# define ACE_del_bad_alloc -#endif - -// ACE_HAS_EXCEPTIONS is not the same as ACE_NEW_THROWS_EXCEPTIONS. -#if defined(ACE_NEW_THROWS_EXCEPTIONS) - -# if defined (ACE_HAS_NEW_NOTHROW) - -# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \ - do { POINTER = new (ACE_nothrow) CONSTRUCTOR; \ - if (POINTER == 0) { throw EXCEPTION; } \ - } while (0) - -# else - -# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \ - do { try { POINTER = new CONSTRUCTOR; } \ - catch (ACE_bad_alloc) { ACE_del_bad_alloc throw EXCEPTION; } \ - } while (0) - -# endif /* ACE_HAS_NEW_NOTHROW */ - -#else /* ! ACE_NEW_THROWS_EXCEPTIONS */ - -# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \ - do { POINTER = new CONSTRUCTOR; \ - if (POINTER == 0) { throw EXCEPTION; } \ - } while (0) - -#endif /* ACE_NEW_THROWS_EXCEPTIONS */ - -// FUZZ: disable check_for_ACE_Guard -# define ACE_GUARD_THROW_EX(MUTEX,OBJ,LOCK,EXCEPTION) \ - ACE_Guard< MUTEX > OBJ (LOCK); \ - if (OBJ.locked () == 0) throw EXCEPTION; - -# define ACE_READ_GUARD_THROW_EX(MUTEX,OBJ,LOCK,EXCEPTION) \ - ACE_Read_Guard< MUTEX > OBJ (LOCK); \ - if (OBJ.locked () == 0) throw EXCEPTION; - -# define ACE_WRITE_GUARD_THROW_EX(MUTEX,OBJ,LOCK,EXCEPTION) \ - ACE_Write_Guard< MUTEX > OBJ (LOCK); \ - if (OBJ.locked () == 0) throw EXCEPTION; -// FUZZ: enable check_for_ACE_Guard - -#include /**/ "ace/post.h" - -#endif /* ACE_CORBA_MACROS_H */ diff --git a/dep/acelite/ace/Cache_Map_Manager_T.cpp b/dep/acelite/ace/Cache_Map_Manager_T.cpp deleted file mode 100644 index 1527bce646b..00000000000 --- a/dep/acelite/ace/Cache_Map_Manager_T.cpp +++ /dev/null @@ -1,414 +0,0 @@ -// $Id: Cache_Map_Manager_T.cpp 95790 2012-05-24 15:06:21Z shuston $ - -#ifndef ACE_CACHE_MAP_MANAGER_T_CPP -#define ACE_CACHE_MAP_MANAGER_T_CPP - -#include "ace/Cache_Map_Manager_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Log_Msg.h" -#include "ace/Malloc_Base.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Cache_Map_Manager_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Cache_Map_Manager) - -ACE_ALLOC_HOOK_DEFINE(ACE_Cache_Map_Iterator) - -ACE_ALLOC_HOOK_DEFINE(ACE_Cache_Map_Reverse_Iterator) - -template -ACE_Cache_Map_Manager::ACE_Cache_Map_Manager (CACHING_STRATEGY &caching_s, - size_t size, - ACE_Allocator *alloc) - : caching_strategy_ (caching_s) -{ - if (this->open (size, alloc) == -1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Cache_Map_Manager::ACE_Cache_Map_Manager"))); - -} - -template -ACE_Cache_Map_Manager::~ACE_Cache_Map_Manager (void) -{ - this->close (); -} - -template int -ACE_Cache_Map_Manager::open (size_t length, - ACE_Allocator *alloc) -{ - return this->map_.open (length, - alloc); -} - -template int -ACE_Cache_Map_Manager::close (void) -{ - return this->map_.close (); -} - -template int -ACE_Cache_Map_Manager::bind (const KEY &key, - const VALUE &value) -{ - // Insert an entry which has the and the which - // is the combination of the and the attributes of the - // caching strategy. - CACHE_VALUE cache_value (value, - this->caching_strategy_.attributes ()); - - int bind_result = this->map_.bind (key, - cache_value); - - if (bind_result != -1) - { - - int result = this->caching_strategy_.notify_bind (bind_result, - cache_value.second); - - if (result == -1) - { - - this->map_.unbind (key); - - // Unless the notification goes thru the bind operation is - // not complete. - bind_result = -1; - - } - - } - - return bind_result; -} - - -template int -ACE_Cache_Map_Manager::rebind (const KEY &key, - const VALUE &value) -{ - CACHE_VALUE cache_value (value, - this->caching_strategy_.attributes ()); - - int rebind_result = this->map_.rebind (key, - cache_value); - - if (rebind_result != -1) - { - - int result = this->caching_strategy_.notify_rebind (rebind_result, - cache_value.second ()); - - if (result == -1) - { - - // Make sure the unbind operation is done only when the - // notification fails after a bind which is denoted by - // rebind_result = 0 - if (rebind_result == 0) - this->map_.unbind (key); - - // Unless the notification goes thru the rebind operation is - // not complete. - rebind_result = -1; - - } - - } - - return rebind_result; -} - - -template int -ACE_Cache_Map_Manager::rebind (const KEY &key, - const VALUE &value, - VALUE &old_value) -{ - CACHE_VALUE cache_value (value, - this->caching_strategy_.attributes ()); - - CACHE_VALUE old_cache_value (old_value, - this->caching_strategy_.attributes ()); - - int rebind_result = this->map_.rebind (key, - cache_value, - old_cache_value); - - if (rebind_result != -1) - { - - int result = this->caching_strategy_.notify_rebind (rebind_result, - cache_value.second ()); - - if (result == -1) - { - - // Make sure the unbind operation is done only when the - // notification fails after a bind which is denoted by - // rebind_result = 0 - if (rebind_result == 0) - this->map_.unbind (key); - - // Unless the notification goes thru the rebind operation is - // not complete. - rebind_result = -1; - - } - else - { - - old_value = old_cache_value.first (); - - } - - } - - return rebind_result; -} - -template int -ACE_Cache_Map_Manager::rebind (const KEY &key, - const VALUE &value, - KEY &old_key, - VALUE &old_value) -{ - CACHE_VALUE cache_value (value, - this->caching_strategy_.attributes ()); - - CACHE_VALUE old_cache_value (old_value, - this->caching_strategy_.attributes ()); - - int rebind_result = this->map_.rebind (key, - cache_value, - old_key, - old_cache_value); - - if (rebind_result != -1) - { - - int result = this->caching_strategy_.notify_rebind (rebind_result, - cache_value.second ()); - - if (result == -1) - { - - // Make sure the unbind operation is done only when the - // notification fails after a bind which is denoted by - // rebind_result = 0 - if (rebind_result == 0) - this->map_.unbind (key); - - // Unless the notification goes thru the rebind operation is - // not complete. - rebind_result = -1; - - } - else - { - - old_value = old_cache_value.first (); - - } - - } - - return rebind_result; -} - -template int -ACE_Cache_Map_Manager::trybind (const KEY &key, - VALUE &value) -{ - CACHE_VALUE cache_value (value, - this->caching_strategy_.attributes ()); - - int trybind_result = this->map_.trybind (key, - cache_value); - - if (trybind_result != -1) - { - - int result = this->caching_strategy_.notify_trybind (trybind_result, - cache_value.second ()); - - if (result == -1) - { - - // If the entry has got inserted into the map, it is removed - // due to failure. - if (trybind_result == 0) - this->map_.unbind (key); - - trybind_result = -1; - - } - else - { - - // If an attempt is made to bind an existing entry the value - // is overwritten with the value from the map. - if (trybind_result == 1) - value = cache_value.first (); - - } - - } - - return trybind_result; -} - -template int -ACE_Cache_Map_Manager::find (const KEY &key, - VALUE &value) -{ - // Lookup the key and populate the . - CACHE_VALUE cache_value; - - int find_result = this->map_.find (key, - cache_value); - - if (find_result != -1) - { - - int result = this->caching_strategy_.notify_find (find_result, - cache_value.second); - - // Unless the find and notification operations go thru, this - // method is not successful. - if (result == -1) - find_result = -1; - else - { - - // Since the has now changed after the - // notification, we need to bind to the map again. - int rebind_result = this->map_.rebind (key, - cache_value); - if (rebind_result == -1) - find_result = -1; - else - value = cache_value.first; - - } - - } - - return find_result; -} - -template int -ACE_Cache_Map_Manager::find (const KEY &key) -{ - // Lookup the key and populate the . - CACHE_VALUE cache_value; - - int find_result = this->map_.find (key, - cache_value); - - if (find_result != -1) - { - - int result = this->caching_strategy_.notify_find (find_result, - cache_value.second); - - // Unless the find and notification operations go thru, this - // method is not successful. - if (result == -1) - find_result = -1; - else - { - - // Since the has now changed after the - // notification, we need to bind to the map again. - int rebind_result = this->map_.rebind (key, - cache_value); - - if (rebind_result == -1) - find_result = -1; - - } - - } - - return find_result; -} - - -template int -ACE_Cache_Map_Manager::unbind (const KEY &key) -{ - // Remove the entry from the cache. - CACHE_VALUE cache_value; - - int unbind_result = this->map_.unbind (key, - cache_value); - - if (unbind_result != -1) - { - - int result = this->caching_strategy_.notify_unbind (unbind_result, - cache_value.second); - - if (result == -1) - unbind_result = -1; - - } - - return unbind_result; -} - -template int -ACE_Cache_Map_Manager::unbind (const KEY &key, - VALUE &value) -{ - // Remove the entry from the cache. - CACHE_VALUE cache_value; - - int unbind_result = this->map_.unbind (key, - cache_value); - - if (unbind_result != -1) - { - - int result = this->caching_strategy_.notify_unbind (unbind_result, - cache_value.second ()); - - if (result == -1) - unbind_result = -1; - else - value = cache_value.first (); - - } - - return unbind_result; -} - -template void -ACE_Cache_Map_Manager::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - this->map_.dump (); - - this->caching_strategy_.dump (); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Cache_Map_Iterator::~ACE_Cache_Map_Iterator (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_CACHE_MAP_MANAGER_T_CPP */ diff --git a/dep/acelite/ace/Cache_Map_Manager_T.h b/dep/acelite/ace/Cache_Map_Manager_T.h deleted file mode 100644 index 3f11d92fdc1..00000000000 --- a/dep/acelite/ace/Cache_Map_Manager_T.h +++ /dev/null @@ -1,405 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Cache_Map_Manager_T.h - * - * $Id: Cache_Map_Manager_T.h 92097 2010-09-30 05:41:49Z msmit $ - * - * @author Kirthika Parameswaran - */ -//============================================================================= - -#ifndef ACE_CACHE_MAP_MANAGER_T_H -#define ACE_CACHE_MAP_MANAGER_T_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Default_Constants.h" -#include "ace/Global_Macros.h" -#include "ace/Pair_T.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declaration. -class ACE_Allocator; - -#define ACE_Cache_Map_Iterator ACMI -#define ACE_Cache_Map_Reverse_Iterator ACMRI - -template -class ACE_Cache_Map_Iterator; - -template -class ACE_Cache_Map_Reverse_Iterator; - -// For linkers that cant grok long names. -#define ACE_Cache_Map_Manager ACMM - -/** - * @class ACE_Cache_Map_Manager - * - * @brief Defines a abstraction that will purge entries from a map. - * - * The will manage the map it contains - * and provide purging on demand from the map. The strategy for - * caching is decided by the user and provided to the Cache - * Manager. The Cache Manager acts as a agent and communicates - * between the Map and the Strategy for purging entries from the - * map. - * No locking mechanism provided since locking at this level - * isn't efficient. Locking has to be provided by the - * application. - */ -template -class ACE_Cache_Map_Manager -{ -public: - - // = Traits. - typedef KEY key_type; - typedef VALUE mapped_type; - typedef CMAP_TYPE map_type; - typedef CACHING_STRATEGY caching_strategy_type; - - typedef ITERATOR_IMPL ITERATOR_IMPLEMENTATION; - typedef REVERSE_ITERATOR_IMPL REVERSE_ITERATOR_IMPLEMENTATION; - - friend class ACE_Cache_Map_Iterator; - friend class ACE_Cache_Map_Reverse_Iterator; - - // = ACE-style iterator typedefs. - typedef ACE_Cache_Map_Iterator - ITERATOR; - typedef ACE_Cache_Map_Reverse_Iterator - REVERSE_ITERATOR; - - // = STL-style iterator typedefs. - typedef ITERATOR - iterator; - typedef REVERSE_ITERATOR - reverse_iterator; - - /** - * The actual value mapped to the key in the map. The - * are used by the strategy and is transparent to the user of this - * class. - */ - typedef std::pair CACHE_VALUE; - - // = Initialization and termination methods. - - /// Initialize a with and - /// @a size entries. - ACE_Cache_Map_Manager (CACHING_STRATEGY &caching_strategy, - size_t size = ACE_DEFAULT_MAP_SIZE, - ACE_Allocator *alloc = 0); - - /// Close down a and release dynamically allocated - /// resources. - virtual ~ACE_Cache_Map_Manager (void); - - /// Initialize a cache with size @a length. - int open (size_t length = ACE_DEFAULT_MAP_SIZE, - ACE_Allocator *alloc = 0); - - /// Close down a cache and release dynamically allocated resources. - int close (void); - - /** - * Associate @a key with @a value. If @a key is already in the CMAP_TYPE - * then the ENTRY is not changed. Returns 0 if a new entry is bound - * successfully, returns 1 if an attempt is made to bind an existing - * entry, and returns -1 if failures occur. - */ - int bind (const KEY &key, - const VALUE &value); - - /** - * Lookup entry in the cache. If it is not found, returns -1. - * If the @a key is located in the CMAP_TYPE object, the CACHING_STRATEGY is - * notified of it via notify_find (int result, ATTRIBUTES &attribute). - * If notify_find also returns 0 (success), then this function returns - * 0 (success) and sets the cached value in @a value. - */ - int find (const KEY &key, - VALUE &value); - - /** - * Lookup entry in the cache. If it is not found, returns -1. - * If the @a key is located in the CMAP_TYPE object, the CACHING_STRATEGY is - * notified of it via notify_find (int result, ATTRIBUTES &attribute). - * If notify_find also returns 0 (success), then this function returns - * 0 (success). - */ - int find (const KEY &key); - - /** - * Reassociate the @a key with @a value. If the @a key already exists - * in the cache then returns 1, on a new bind returns 0 and returns - * -1 in case of any failures. - */ - int rebind (const KEY &key, - const VALUE &value); - - /** - * Reassociate @a key with @a value, storing the old value into the - * "out" parameter @a old_value. The function fails if @a key is not - * in the cache for caches that do not allow user specified keys. - * However, for caches that allow user specified keys, if the key is - * not in the cache, a new @a key / @a value association is created. - */ - int rebind (const KEY &key, - const VALUE &value, - VALUE &old_value); - - /** - * Reassociate @a key with @a value, storing the old key and value - * into the "out" parameters @a old_key and @a old_value. The - * function fails if @a key is not in the cache for caches that do - * not allow user specified keys. However, for caches that allow - * user specified keys, if the key is not in the cache, a new - * @a key / @a value association is created. - */ - int rebind (const KEY &key, - const VALUE &value, - KEY &old_key, - VALUE &old_value); - - /** - * Associate @a key with @a value if and only if @a key is not in the - * cache. If @a key is already in the cache, then the @a value - * parameter is overwritten with the existing value in the - * cache. Returns 0 if a new @a key / @a value association is created. - * Returns 1 if an attempt is made to bind an existing entry. This - * function fails for maps that do not allow user specified keys. - */ - int trybind (const KEY &key, - VALUE &value); - - /// Remove @a key from the cache. - int unbind (const KEY &key); - - /// Remove @a key from the cache, and return the @a value associated with - /// @a key. - int unbind (const KEY &key, - VALUE &value); - - /// Remove entries from the cache depending upon the strategy. - int purge (void); - - /// Return the current size of the cache. - size_t current_size (void) const; - - /// Return the total size of the cache. - size_t total_size (void) const; - - /// Dumps the state of the object. - void dump (void) const; - - // = STL styled iterator factory functions. - - /// Return forward iterator. - ITERATOR begin (void); - ITERATOR end (void); - - /// Return reverse iterator. - REVERSE_ITERATOR rbegin (void); - REVERSE_ITERATOR rend (void); - - /// The map managed by the Cache_Map_Manager. - CMAP_TYPE &map (void); - - /// The caching strategy used on the cache. - CACHING_STRATEGY &caching_strategy (void); - -protected: - - /// The underlying map which needs to be cached. - CMAP_TYPE map_; - - /// The strategy to be followed for caching entries in the map. - CACHING_STRATEGY &caching_strategy_; - -private: - - // = Disallow these operations. - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Cache_Map_Manager &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Cache_Map_Manager (const ACE_Cache_Map_Manager &)) - -}; - -/** - * @class ACE_Cache_Map_Iterator - * - * @brief Defines a iterator for the Cache_Map_Manager. - * - * Implementation to be provided by the iterator of the map - * managed by the ACE_Cache_Map_Manager. - */ -template -class ACE_Cache_Map_Iterator -{ - -public: - - // = Traits. - /// The actual value mapped to the key in the cache. The - /// are used by the strategy and is transparent to the cache user. - typedef ACE_Reference_Pair - value_type; - typedef std::pair - CACHE_VALUE; - - // = Initialisation and termination methods. - - ACE_Cache_Map_Iterator (const IMPLEMENTATION &iterator_impl); - - /// Copy constructor. - ACE_Cache_Map_Iterator (const ACE_Cache_Map_Iterator &rhs); - - virtual ~ACE_Cache_Map_Iterator (void); - - // = Iteration methods. - - /// assignment operator. - ACE_Cache_Map_Iterator &operator= - (const ACE_Cache_Map_Iterator &rhs); - - /// Comparison operators. - bool operator== (const ACE_Cache_Map_Iterator &rhs) const; - bool operator!= (const ACE_Cache_Map_Iterator &rhs) const; - - /// Returns a reference to the internal element @c this is pointing - /// to. - ACE_Reference_Pair operator* (void) const; - - // = STL styled iteration, compare, and reference functions. - - /// Prefix advance - ACE_Cache_Map_Iterator &operator++ (void); - - /// Postfix advance. - ACE_Cache_Map_Iterator operator++ (int); - - /// Prefix reverse. - ACE_Cache_Map_Iterator &operator-- (void); - - /// Postfix reverse. - ACE_Cache_Map_Iterator operator-- (int); - - /// Returns the iterator of the internal map in the custody of the - /// Cache_Map_Manager. - IMPLEMENTATION &iterator_implementation (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// The actual iterator which iterates internally on the map - /// belonging to the Cache_Map_Manager. - IMPLEMENTATION iterator_implementation_; -}; - -/** - * @class ACE_Cache_Map_Reverse_Iterator - * - * @brief Defines a reverse iterator for the Cache_Map_Manager. - * - * Implementation to be provided by the reverse iterator of the map - * managed by thr Cache_Map_manager. - */ -template -class ACE_Cache_Map_Reverse_Iterator -{ -public: - - // = Traits. - /// The actual value mapped to the key in the cache. The - /// are used by the strategy and is transparent to the cache user. - typedef ACE_Reference_Pair value_type; - typedef std::pair CACHE_VALUE; - - // = Initialisation and termination methods. - - ACE_Cache_Map_Reverse_Iterator (const REVERSE_IMPLEMENTATION &iterator_impl); - - /// Copy constructor. - ACE_Cache_Map_Reverse_Iterator (const ACE_Cache_Map_Reverse_Iterator &rhs); - - ~ACE_Cache_Map_Reverse_Iterator (void); - - // = Iteration methods. - - /// Assignment operator. - ACE_Cache_Map_Reverse_Iterator &operator= - (const ACE_Cache_Map_Reverse_Iterator &rhs); - - /// Comparison operators. - bool operator== (const ACE_Cache_Map_Reverse_Iterator &rhs) const; - bool operator!= (const ACE_Cache_Map_Reverse_Iterator &rhs) const; - - /// Returns a reference to the internal element @c this is pointing - /// to. - ACE_Reference_Pair operator* (void) const; - - // = STL styled iteration, compare, and reference functions. - - /// Prefix advance - ACE_Cache_Map_Reverse_Iterator &operator++ (void); - - /// Postfix advance. - ACE_Cache_Map_Reverse_Iterator operator++ (int); - - /// Prefix reverse. - ACE_Cache_Map_Reverse_Iterator &operator-- (void); - - /// Postfix reverse. - ACE_Cache_Map_Reverse_Iterator operator-- (int); - - /// Returns the iterator of the internal map in the custody of the - /// Cache_Map_Manager. - REVERSE_IMPLEMENTATION &iterator_implementation (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// The actual iterator which iterates internally on the map - /// belonging to the Cache_Map_Manager. - REVERSE_IMPLEMENTATION reverse_iterator_implementation_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Cache_Map_Manager_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Cache_Map_Manager_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Cache_Map_Manager_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_CACHE_MAP_MANAGER_T_H */ diff --git a/dep/acelite/ace/Cache_Map_Manager_T.inl b/dep/acelite/ace/Cache_Map_Manager_T.inl deleted file mode 100644 index 06378de046c..00000000000 --- a/dep/acelite/ace/Cache_Map_Manager_T.inl +++ /dev/null @@ -1,245 +0,0 @@ -// -*- C++ -*- -// -//$Id: Cache_Map_Manager_T.inl 92097 2010-09-30 05:41:49Z msmit $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE int -ACE_Cache_Map_Manager::purge (void) -{ - return this->caching_strategy ().caching_utility ().clear_cache (this->map_, - this->caching_strategy ().purge_percent ()); -} - -template ACE_INLINE size_t -ACE_Cache_Map_Manager::current_size (void) const -{ - return this->map_.current_size (); -} - -template ACE_INLINE size_t -ACE_Cache_Map_Manager::total_size (void) const -{ - return this->map_.total_size (); -} - -template ACE_INLINE CMAP_TYPE & -ACE_Cache_Map_Manager::map (void) -{ - return this->map_; -} - -template ACE_INLINE CACHING_STRATEGY & -ACE_Cache_Map_Manager::caching_strategy (void) -{ - return this->caching_strategy_; -} - -template ACE_INLINE ACE_Cache_Map_Iterator -ACE_Cache_Map_Manager::begin (void) -{ - return ITERATOR (this->map_.begin ()); -} - -template ACE_INLINE ACE_Cache_Map_Iterator -ACE_Cache_Map_Manager::end (void) -{ - return ITERATOR (this->map_.end ()); -} - -template ACE_INLINE ACE_Cache_Map_Reverse_Iterator -ACE_Cache_Map_Manager::rbegin (void) -{ - return REVERSE_ITERATOR (this->map_.rbegin ()); -} -template ACE_INLINE ACE_Cache_Map_Reverse_Iterator -ACE_Cache_Map_Manager::rend (void) -{ - return REVERSE_ITERATOR (this->map_.rend ()); -} - -//////////////////////////////////////////////////////////////////////////////// - -template ACE_INLINE -ACE_Cache_Map_Iterator::ACE_Cache_Map_Iterator (const ACE_Cache_Map_Iterator &rhs) - : iterator_implementation_ (rhs.iterator_implementation_) -{ -} - -template ACE_INLINE ACE_Cache_Map_Iterator & -ACE_Cache_Map_Iterator::operator= (const ACE_Cache_Map_Iterator &rhs) -{ - this->iterator_implementation_ = rhs.iterator_implementation_; - return *this; -} - -template ACE_INLINE bool -ACE_Cache_Map_Iterator::operator== (const ACE_Cache_Map_Iterator &rhs) const -{ - return this->iterator_implementation_ == rhs.iterator_implementation_; -} - -template ACE_INLINE bool -ACE_Cache_Map_Iterator::operator!= (const ACE_Cache_Map_Iterator &rhs) const -{ - return this->iterator_implementation_ != rhs.iterator_implementation_; -} - -template ACE_INLINE ACE_Reference_Pair -ACE_Cache_Map_Iterator::operator* (void) const -{ - value_type retn ((*this->iterator_implementation_).ext_id_, - (*this->iterator_implementation_).int_id_.first); - return retn; -} - -template ACE_INLINE -ACE_Cache_Map_Iterator & -ACE_Cache_Map_Iterator::operator++ (void) -{ - ++this->iterator_implementation_; - return *this; -} - -template ACE_INLINE -ACE_Cache_Map_Iterator -ACE_Cache_Map_Iterator::operator++ (int) -{ - ACE_Cache_Map_Iterator retn = *this; - ++this->iterator_implementation_; - return retn; -} - -template ACE_INLINE -ACE_Cache_Map_Iterator & -ACE_Cache_Map_Iterator::operator-- (void) -{ - --this->iterator_implementation_; - return *this; -} - -template ACE_INLINE -ACE_Cache_Map_Iterator -ACE_Cache_Map_Iterator::operator-- (int) -{ - ACE_Cache_Map_Iterator retn = *this; - --this->iterator_implementation_; - return retn; -} - -template ACE_INLINE void -ACE_Cache_Map_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - this->iterator_implementation_.dump (); -#endif /* ACE_HAS_DUMP */ -} - -template ACE_INLINE -ACE_Cache_Map_Iterator::ACE_Cache_Map_Iterator (const IMPLEMENTATION &iterator_impl) - : iterator_implementation_ (iterator_impl) -{ -} - -template ACE_INLINE IMPLEMENTATION & -ACE_Cache_Map_Iterator::iterator_implementation (void) -{ - return this->iterator_implementation_; -} - -//////////////////////////////////////////////////////////////////////////////// - -template ACE_INLINE -ACE_Cache_Map_Reverse_Iterator::ACE_Cache_Map_Reverse_Iterator (const ACE_Cache_Map_Reverse_Iterator &rhs) - : reverse_iterator_implementation_ (rhs.reverse_iterator_implementation_) -{ -} - -template ACE_INLINE -ACE_Cache_Map_Reverse_Iterator::~ACE_Cache_Map_Reverse_Iterator (void) -{ -} - -template ACE_INLINE ACE_Cache_Map_Reverse_Iterator & -ACE_Cache_Map_Reverse_Iterator::operator= (const ACE_Cache_Map_Reverse_Iterator &rhs) -{ - this->reverse_iterator_implementation_ = rhs.reverse_iterator_implementation_; - return *this; -} - -template ACE_INLINE bool -ACE_Cache_Map_Reverse_Iterator::operator== (const ACE_Cache_Map_Reverse_Iterator &rhs) const -{ - return this->reverse_iterator_implementation_ == rhs.reverse_iterator_implementation_; -} - -template ACE_INLINE bool -ACE_Cache_Map_Reverse_Iterator::operator!= (const ACE_Cache_Map_Reverse_Iterator &rhs) const -{ - return this->reverse_iterator_implementation_ != rhs.reverse_iterator_implementation_; -} - -template ACE_INLINE ACE_Reference_Pair -ACE_Cache_Map_Reverse_Iterator::operator* (void) const -{ - value_type retv ((*this->reverse_iterator_implementation_).ext_id_, - (*this->reverse_iterator_implementation_).int_id_.first); - return retv; -} - -template ACE_INLINE -ACE_Cache_Map_Reverse_Iterator & -ACE_Cache_Map_Reverse_Iterator::operator++ (void) -{ - ++this->reverse_iterator_implementation_; - return *this; -} - -template ACE_INLINE -ACE_Cache_Map_Reverse_Iterator -ACE_Cache_Map_Reverse_Iterator::operator++ (int) -{ - ACE_Cache_Map_Reverse_Iterator retn = *this; - ++this->reverse_iterator_implementation_; - return retn; -} - -template ACE_INLINE -ACE_Cache_Map_Reverse_Iterator & -ACE_Cache_Map_Reverse_Iterator::operator-- (void) -{ - --this->reverse_iterator_implementation_; - return *this; -} - -template ACE_INLINE -ACE_Cache_Map_Reverse_Iterator -ACE_Cache_Map_Reverse_Iterator::operator-- (int) -{ - ACE_Cache_Map_Reverse_Iterator retn = *this; - --this->reverse_iterator_implementation_; - return retn; -} - - -template ACE_INLINE void -ACE_Cache_Map_Reverse_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - this->reverse_iterator_implementation_.dump (); -#endif /* ACE_HAS_DUMP */ -} - -template ACE_INLINE -ACE_Cache_Map_Reverse_Iterator::ACE_Cache_Map_Reverse_Iterator (const REVERSE_IMPLEMENTATION &iterator_impl) - : reverse_iterator_implementation_(iterator_impl) -{ -} - -template ACE_INLINE REVERSE_IMPLEMENTATION & -ACE_Cache_Map_Reverse_Iterator::iterator_implementation (void) -{ - return this->reverse_iterator_implementation_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Cached_Connect_Strategy_T.cpp b/dep/acelite/ace/Cached_Connect_Strategy_T.cpp deleted file mode 100644 index a6f8acc77a0..00000000000 --- a/dep/acelite/ace/Cached_Connect_Strategy_T.cpp +++ /dev/null @@ -1,730 +0,0 @@ -//$Id: Cached_Connect_Strategy_T.cpp 95630 2012-03-22 13:04:47Z johnnyw $ - -#ifndef ACE_CACHED_CONNECT_STRATEGY_T_CPP -#define ACE_CACHED_CONNECT_STRATEGY_T_CPP - -#include "ace/Cached_Connect_Strategy_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/ACE.h" -#include "ace/Service_Repository.h" -#include "ace/Service_Types.h" -#include "ace/Thread_Manager.h" -#include "ace/WFMO_Reactor.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Cached_Connect_Strategy_Ex::ACE_Cached_Connect_Strategy_Ex -(CACHING_STRATEGY &caching_s, - ACE_Creation_Strategy *cre_s, - ACE_Concurrency_Strategy *con_s, - ACE_Recycling_Strategy *rec_s, - MUTEX *lock, - int delete_lock) - : CCSBASE (cre_s, con_s, rec_s, lock, delete_lock), - connection_cache_ (caching_s) -{ - if (this->open (cre_s, con_s, rec_s) == -1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Cached_Connect_Strategy_Ex\n"))); -} - -template -ACE_Cached_Connect_Strategy_Ex::~ACE_Cached_Connect_Strategy_Ex (void) -{ - cleanup (); -} - - -template int -ACE_Cached_Connect_Strategy_Ex::check_hint_i -(SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - bool reuse_addr, - int flags, - int perms, - ACE_Hash_Map_Entry, std::pair > *&entry, - int &found) -{ - ACE_UNUSED_ARG (remote_addr); - ACE_UNUSED_ARG (timeout); - ACE_UNUSED_ARG (local_addr); - ACE_UNUSED_ARG (reuse_addr); - ACE_UNUSED_ARG (flags); - ACE_UNUSED_ARG (perms); - - found = 0; - - // Get the recycling act for the svc_handler - CONNECTION_CACHE_ENTRY *possible_entry = - (CONNECTION_CACHE_ENTRY *) sh->recycling_act (); - - // Check to see if the hint svc_handler has been closed down - if (possible_entry->ext_id_.recycle_state () == ACE_RECYCLABLE_CLOSED) - { - // If close, decrement refcount - if (possible_entry->ext_id_.decrement () == 0) - { - // If refcount goes to zero, close down the svc_handler - possible_entry->int_id_.first->recycler (0, 0); - possible_entry->int_id_.first->close (); - this->purge_i (possible_entry); - } - - // Hint not successful - found = 0; - - // Reset hint - sh = 0; - } - - // If hint is not closed, see if it is connected to the correct - // address and is recyclable - else if ((possible_entry->ext_id_.recycle_state () == ACE_RECYCLABLE_IDLE_AND_PURGABLE || - possible_entry->ext_id_.recycle_state () == ACE_RECYCLABLE_IDLE_BUT_NOT_PURGABLE) && - possible_entry->ext_id_.subject () == remote_addr) - { - // Hint successful - found = 1; - - // Tell the that it should prepare itself for - // being recycled. - this->prepare_for_recycling (sh); - - // - // Update the caching attributes directly since we don't do a - // find() on the cache map. - // - - // Indicates successful find. - int find_result = 0; - - int result = this->caching_strategy ().notify_find (find_result, - possible_entry->int_id_.second); - - if (result == -1) - return result; - } - else - { - // This hint will not be used. - possible_entry->ext_id_.decrement (); - - // Hint not successful - found = 0; - - // If is not connected to the correct address or is busy, - // we will not use it. - sh = 0; - } - - if (found) - entry = possible_entry; - - return 0; -} - -template int -ACE_Cached_Connect_Strategy_Ex::find_or_create_svc_handler_i -(SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - bool reuse_addr, - int flags, - int perms, - ACE_Hash_Map_Entry, std::pair > *&entry, - int &found) -{ - REFCOUNTED_HASH_RECYCLABLE_ADDRESS search_addr (remote_addr); - - // Try to find the address in the cache. Only if we don't find it - // do we create a new and connect it with the server. - while (this->find (search_addr, entry) != -1) - { - // We found a cached svc_handler. - // Get the cached - sh = entry->int_id_.first; - - // Is the connection clean? - int state_result = - ACE::handle_ready (sh->peer ().get_handle (), - &ACE_Time_Value::zero, - 1, // read ready - 0, // write ready - 1);// exception ready - - if (state_result == 1) - { - - if (sh->close () == -1) - return -1; - - sh = 0; - - // Cycle it once again.. - } - else if ((state_result == -1) && (errno == ETIME)) - { - // Found!!! - // Set the flag - found = 1; - - // Tell the that it should prepare itself for - // being recycled. - if (this->prepare_for_recycling (sh) == -1) - return -1; - - return 0; - } - else - { - return -1; - } - } - - // Not found... - - // Set the flag - found = 0; - - // We need to use a temporary variable here since we are not - // allowed to change because other threads may use this - // when we let go of the lock during the OS level connect. - // - // Note that making a new svc_handler, connecting remotely, - // binding to the map, and assigning of the hint and recycler - // should be atomic to the outside world. - SVC_HANDLER *potential_handler = 0; - - // Create a new svc_handler - if (this->make_svc_handler (potential_handler) == -1) - return -1; - - // Connect using the svc_handler. - if (this->cached_connect (potential_handler, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms) == -1) - { - // Close the svc handler. - potential_handler->close (0); - - return -1; - } - else - { - // Insert the new SVC_HANDLER instance into the cache. - if (this->connection_cache_.bind (search_addr, - potential_handler, - entry) == -1) - { - // Close the svc handler and reset . - potential_handler->close (0); - - return -1; - } - - // Everything succeeded as planned. Assign to - // . - sh = potential_handler; - - // Set the recycler and the recycling act - - this->assign_recycler (sh, this, entry); - } - - return 0; -} - -template int -ACE_Cached_Connect_Strategy_Ex::cached_connect (SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - bool reuse_addr, - int flags, - int perms) -{ - // Actively establish the connection. This is a timed blocking - // connect. - if (this->new_connection (sh, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms) == -1) - { - // If connect() failed because of timeouts, we have to reject - // the connection entirely. This is necessary since currently - // there is no way for the non-blocking connects to complete and - // for the to notify the cache of the completion of - // connect(). - - if (errno == EWOULDBLOCK || errno == ETIMEDOUT) - errno = ENOTSUP; - else if (ACE::out_of_handles (errno) || errno == EADDRINUSE) - { - // If the connect failed due to the process running out of - // file descriptors then, auto_purging of some connections - // are done from the CONNECTION_CACHE. This frees the - // descriptors which get used in the connect process and - // hence the same method is called again! - if (this->purge_connections () == -1) - return -1; - - // Try connecting again. - if (this->new_connection (sh, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms) == -1) - { - if (errno == EWOULDBLOCK || errno == ETIMEDOUT) - errno = ENOTSUP; - return -1; - } - } - else - { - return -1; - } - } - - return 0; - -} - - -template int -ACE_Cached_Connect_Strategy_Ex::connect_svc_handler_i -(SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - bool reuse_addr, - int flags, - int perms, - int& found) -{ - CONNECTION_CACHE_ENTRY *entry = 0; - - // Check if the user passed a hint svc_handler - if (sh != 0) - { - int result = this->check_hint_i (sh, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms, - entry, - found); - if (result != 0) - return result; - } - - // If not found - if (!found) - { - int result = this->find_or_create_svc_handler_i (sh, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms, - entry, - found); - - if (result != 0) - return result; - - // Increment the refcount - entry->ext_id_.increment (); - } - - if (entry) - { - // For all successful cases: mark the in the cache - // as being . Therefore recyclable is BUSY. - entry->ext_id_.recycle_state (ACE_RECYCLABLE_BUSY); - } - - return 0; -} - - -template int -ACE_Cached_Connect_Strategy_Ex::cache_i (const void *recycling_act) -{ - // The wonders and perils of ACT - CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; - - // Mark the in the cache as not being . - // Therefore recyclable is IDLE. - entry->ext_id_.recycle_state (ACE_RECYCLABLE_IDLE_AND_PURGABLE); - - return 0; -} - -template int -ACE_Cached_Connect_Strategy_Ex::recycle_state_i (const void *recycling_act, - ACE_Recyclable_State new_state) -{ - // The wonders and perils of ACT - CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; - - // Mark the in the cache as not being . - // Therefore recyclable is IDLE. - entry->ext_id_.recycle_state (new_state); - - return 0; -} - -template ACE_Recyclable_State -ACE_Cached_Connect_Strategy_Ex::recycle_state_i (const void *recycling_act) const -{ - // The wonders and perils of ACT - CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; - - // Mark the in the cache as not being . - // Therefore recyclable is IDLE. - return entry->ext_id_.recycle_state (); -} - -template int -ACE_Cached_Connect_Strategy_Ex::purge_i (const void *recycling_act) -{ - // The wonders and perils of ACT - CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; - - return this->connection_cache_.unbind (entry); -} - - -template int -ACE_Cached_Connect_Strategy_Ex::mark_as_closed_i (const void *recycling_act) -{ - // The wonders and perils of ACT - CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; - - // Mark the in the cache as CLOSED. - entry->ext_id_.recycle_state (ACE_RECYCLABLE_CLOSED); - - return 0; -} - -template int -ACE_Cached_Connect_Strategy_Ex::cleanup_hint_i (const void *recycling_act, - void **act_holder) -{ - // Reset the <*act_holder> in the confines and protection of the - // lock. - if (act_holder) - *act_holder = 0; - - // The wonders and perils of ACT - CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; - - // Decrement the refcount on the . - int refcount = entry->ext_id_.decrement (); - - // If the svc_handler state is closed and the refcount == 0, call - // close() on svc_handler. - if (entry->ext_id_.recycle_state () == ACE_RECYCLABLE_CLOSED && - refcount == 0) - { - entry->int_id_.first->recycler (0, 0); - entry->int_id_.first->close (); - this->purge_i (entry); - } - - return 0; -} - -template int -ACE_Cached_Connect_Strategy_Ex::purge_connections (void) -{ - return this->connection_cache_.purge (); -} - -template CACHING_STRATEGY & -ACE_Cached_Connect_Strategy_Ex::caching_strategy (void) -{ - return this->connection_cache_.caching_strategy (); -} - -template int -ACE_Cached_Connect_Strategy_Ex::find (ACE_Refcounted_Hash_Recyclable &search_addr, - ACE_Hash_Map_Entry, std::pair > *&entry) -{ - typedef ACE_Hash_Map_Bucket_Iterator, - ACE_Hash, - ACE_Equal_To, - ACE_Null_Mutex> - CONNECTION_CACHE_BUCKET_ITERATOR; - - CONNECTION_CACHE_BUCKET_ITERATOR iterator (this->connection_cache_.map (), - search_addr); - - CONNECTION_CACHE_BUCKET_ITERATOR end (this->connection_cache_.map (), - search_addr, - 1); - - for (; - iterator != end; - ++iterator) - { - REFCOUNTED_HASH_RECYCLABLE_ADDRESS &addr = (*iterator).ext_id_; - - if (addr.recycle_state () != ACE_RECYCLABLE_IDLE_AND_PURGABLE && - addr.recycle_state () != ACE_RECYCLABLE_IDLE_BUT_NOT_PURGABLE) - continue; - - if (addr.subject () != search_addr.subject ()) - continue; - - entry = &(*iterator); - - // - // Update the caching attributes directly since we don't do a - // find() on the cache map. - // - - // Indicates successful find. - int find_result = 0; - - int result = this->caching_strategy ().notify_find (find_result, - entry->int_id_.second); - - if (result == -1) - return result; - - return 0; - } - - return -1; -} - -template void -ACE_Cached_Connect_Strategy_Ex::cleanup (void) -{ - // Excluded other threads from changing the cache while we cleanup - ACE_GUARD (MUTEX, ace_mon, *this->lock_); - - // Close down all cached service handlers. - typename CONNECTION_CACHE::ITERATOR iter = this->connection_cache_.begin (); - while (iter != this->connection_cache_.end ()) - { - if ((*iter).second () != 0) - { - // save entry for future use - CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) - (*iter).second ()->recycling_act (); - - // close handler - (*iter).second ()->recycler (0, 0); - (*iter).second ()->close (); - - // remember next iter - typename CONNECTION_CACHE::ITERATOR next_iter = iter; - ++next_iter; - - // purge the item from the hash - this->purge_i (entry); - - // assign next iter - iter = next_iter; - } - else - ++iter; - } -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Cached_Connect_Strategy_Ex) -///////////////////////////////////////////////////////////////////////// - -template -ACE_Bounded_Cached_Connect_Strategy::ACE_Bounded_Cached_Connect_Strategy -(size_t max_size, - CACHING_STRATEGY &caching_s, - ACE_Creation_Strategy *cre_s, - ACE_Concurrency_Strategy *con_s, - ACE_Recycling_Strategy *rec_s, - MUTEX *lock, - int delete_lock) - : CCSEBASE (caching_s, cre_s, con_s, rec_s, lock, delete_lock), - max_size_ (max_size) -{ -} - -template -ACE_Bounded_Cached_Connect_Strategy::~ACE_Bounded_Cached_Connect_Strategy(void) -{ -} - -template -int -ACE_Bounded_Cached_Connect_Strategy::find_or_create_svc_handler_i -(SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - bool reuse_addr, - int flags, - int perms, - ACE_Hash_Map_Entry, - std::pair > *&entry, - int &found) -{ - - REFCOUNTED_HASH_RECYCLABLE_ADDRESS search_addr (remote_addr); - - // Try to find the address in the cache. Only if we don't find it - // do we create a new and connect it with the server. - while (this->find (search_addr, entry) != -1) - { - // We found a cached svc_handler. - // Get the cached - sh = entry->int_id_.first (); - - // Is the connection clean? - int state_result= ACE::handle_ready (sh->peer ().get_handle (), - &ACE_Time_Value::zero, - 1, // read ready - 0, // write ready - 1);// exception ready - - if (state_result == 1) - { - // The connection was disconnected during idle. - // close the svc_handler down. - if (sh->close () == -1) - { - ACE_ASSERT (0); - return -1; - } - sh = 0; - // and rotate once more... - } - else if ((state_result == -1) && (errno == ETIME)) - { - // Found!!! - // Set the flag - found = 1; - - // Tell the that it should prepare itself for - // being recycled. - if (this->prepare_for_recycling (sh) == -1) - { - ACE_ASSERT (0); - return -1; - } - - return 0; - } - else // some other return value or error... - { - ACE_ASSERT (0); // just to see it coming - - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%t)ACE_Bounded_Cached_Connect_Strategy<>::") - ACE_TEXT ("find_or_create_svc_handler_i - ") - ACE_TEXT ("error polling server socket state.\n"))); - - return -1; - } - } - - // Not found... - - // Set the flag - found = 0; - - // Check the limit of handlers... - if ((this->max_size_ > 0) && - (this->connection_cache_.current_size () >= this->max_size_)) - { - // Try to purge idle connections - if (this->purge_connections () == -1) - return -1; - - // Check limit again. - if (this->connection_cache_.current_size () >= this->max_size_) - // still too much! - return -1; - - // OK, we have room now... - } - - // We need to use a temporary variable here since we are not - // allowed to change because other threads may use this - // when we let go of the lock during the OS level connect. - // - // Note that making a new svc_handler, connecting remotely, - // binding to the map, and assigning of the hint and recycler - // should be atomic to the outside world. - SVC_HANDLER *potential_handler = 0; - - // Create a new svc_handler - if (this->make_svc_handler (potential_handler) == -1) - return -1; - - // Connect using the svc_handler. - if (this->cached_connect (potential_handler, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms) == -1) - { - // Close the svc handler. - potential_handler->close (0); - return -1; - } - else - { - // Insert the new SVC_HANDLER instance into the cache. - if (this->connection_cache_.bind (search_addr, - potential_handler, - entry) == -1) - { - // Close the svc handler and reset . - potential_handler->close (0); - - return -1; - } - - // Everything succeeded as planned. Assign to - // . - sh = potential_handler; - - // Set the recycler and the recycling act - this->assign_recycler (sh, this, entry); - } - - return 0; -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Bounded_Cached_Connect_Strategy) - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_CACHED_CONNECT_STRATEGY_T_CPP */ diff --git a/dep/acelite/ace/Cached_Connect_Strategy_T.h b/dep/acelite/ace/Cached_Connect_Strategy_T.h deleted file mode 100644 index 12c5485cebe..00000000000 --- a/dep/acelite/ace/Cached_Connect_Strategy_T.h +++ /dev/null @@ -1,263 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Cached_Connect_Strategy_T.h - * - * $Id: Cached_Connect_Strategy_T.h 92097 2010-09-30 05:41:49Z msmit $ - * - * @author Kirthika Parameswaran - */ -//============================================================================= - -#ifndef CACHED_CONNECT_STRATEGY_T_H -#define CACHED_CONNECT_STRATEGY_T_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Strategies_T.h" -#include "ace/Hash_Cache_Map_Manager_T.h" -#include "ace/Caching_Strategies_T.h" -#include "ace/Functor_T.h" -#include "ace/Pair_T.h" - -// For linkers which cant grok long names... -#define ACE_Cached_Connect_Strategy_Ex ACCSE - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Cached_Connect_Strategy_Ex - * - * @brief A connection strategy which caches connections to peers - * (represented by SVC_HANDLER instances), thereby allowing - * subsequent re-use of unused, but available, connections. - * - * is intended to be used as a - * plug-in connection strategy for ACE_Strategy_Connector. - * It's added value is re-use of established connections and - * tweaking the role of the cache as per the caching strategy. - */ -template -class ACE_Cached_Connect_Strategy_Ex - : public ACE_Cached_Connect_Strategy -{ -public: - /// Constructor - ACE_Cached_Connect_Strategy_Ex ( - CACHING_STRATEGY &caching_s, - ACE_Creation_Strategy *cre_s = 0, - ACE_Concurrency_Strategy *con_s = 0, - ACE_Recycling_Strategy *rec_s = 0, - MUTEX *lock = 0, - int delete_lock = 0); - - /// Destructor - virtual ~ACE_Cached_Connect_Strategy_Ex (void); - - /// Explicit purging of connection entries from the connection cache. - virtual int purge_connections (void); - - /// Mark as closed (non-locking version). This is used during the cleanup of the - /// connections purged. - virtual int mark_as_closed_i (const void *recycling_act); - - /** - * Since g++ version < 2.8 arent happy with templates, this special - * method had to be devised to avoid memory leaks and perform - * cleanup of the . - */ - void cleanup (void); - - // = Typedefs for managing the map - typedef ACE_Refcounted_Hash_Recyclable - REFCOUNTED_HASH_RECYCLABLE_ADDRESS; - typedef ACE_Hash_Cache_Map_Manager, - ACE_Equal_To, - CACHING_STRATEGY, - ATTRIBUTES> - CONNECTION_CACHE; - typedef typename CONNECTION_CACHE::CACHE_ENTRY CONNECTION_CACHE_ENTRY; - typedef typename CONNECTION_CACHE::key_type KEY; - typedef typename CONNECTION_CACHE::mapped_type VALUE; - - typedef ACE_Recyclable_Handler_Cleanup_Strategy, - ACE_Hash_Map_Manager_Ex, - ACE_Hash, - ACE_Equal_To, - MUTEX> > - CLEANUP_STRATEGY; - - typedef ACE_Cached_Connect_Strategy - CCSBASE; - - // = Accessor. - CACHING_STRATEGY &caching_strategy (void); - -protected: - - /// Find an idle handle. - int find (ACE_Refcounted_Hash_Recyclable &search_addr, - ACE_Hash_Map_Entry, std::pair > *&entry); - - /// Remove from cache (non-locking version). - virtual int purge_i (const void *recycling_act); - - /// Add to cache (non-locking version). - virtual int cache_i (const void *recycling_act); - - /// Get/Set recycle_state (non-locking version). - virtual int recycle_state_i (const void *recycling_act, - ACE_Recyclable_State new_state); - virtual ACE_Recyclable_State recycle_state_i (const void *recycling_act) const; - - /// Cleanup hint and reset @c *act_holder to zero if @a act_holder != 0. - virtual int cleanup_hint_i (const void *recycling_act, - void **act_holder); - - // = Helpers - int check_hint_i (SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - bool reuse_addr, - int flags, - int perms, - ACE_Hash_Map_Entry, std::pair > *&entry, - int &found); - - virtual int find_or_create_svc_handler_i (SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - bool reuse_addr, - int flags, - int perms, - ACE_Hash_Map_Entry, std::pair > *&entry, - int &found); - - virtual int connect_svc_handler_i (SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - bool reuse_addr, - int flags, - int perms, - int &found); - - /** - * Connection of the svc_handler with the remote host. This method - * also encapsulates the connection done with auto_purging under the - * hood. If the connect failed due to the process running out of - * file descriptors then, auto_purging of some connections are done - * from the CONNECTION_CACHE. This frees the descriptors which get - * used in the connect process and hence the connect operation can - * succeed. - */ - virtual int cached_connect (SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - bool reuse_addr, - int flags, - int perms); - - /// Table that maintains the cache of connected SVC_HANDLERs. - CONNECTION_CACHE connection_cache_; -}; - -///////////////////////////////////////////////////////////////////////////// - -// For linkers which cant grok long names... -#define ACE_Bounded_Cached_Connect_Strategy ABCCS - -/** - * @class ACE_Bounded_Cached_Connect_Strategy - * - * @brief - * A connection strategy which caches connections to peers - * (represented by SVC_HANDLER instances), thereby allowing - * subsequent re-use of unused, but available, connections. - * This strategy should be used when the cache is bounded by - * maximum size. - * - * Bounded_Cached_Connect_Strategy is intended to be used as a - * plug-in connection strategy for ACE_Strategy_Connector. - * It's added value is re-use of established connections and - * tweaking the role of the cache as per the caching strategy. - * Thanks to Edan Ayal for contributing this - * class and Susan Liebeskind for - * brainstorming about it. - */ -template -class ACE_Bounded_Cached_Connect_Strategy - : public ACE_Cached_Connect_Strategy_Ex -{ - - typedef ACE_Cached_Connect_Strategy_Ex - CCSEBASE; - - // = Typedefs for managing the map - typedef ACE_Refcounted_Hash_Recyclable - REFCOUNTED_HASH_RECYCLABLE_ADDRESS; - -public: - - /// Constructor - ACE_Bounded_Cached_Connect_Strategy (size_t max_size, - CACHING_STRATEGY &caching_s, - ACE_Creation_Strategy *cre_s = 0, - ACE_Concurrency_Strategy *con_s = 0, - ACE_Recycling_Strategy *rec_s = 0, - MUTEX *lock = 0, - int delete_lock = 0); - - /// Destructor - virtual ~ACE_Bounded_Cached_Connect_Strategy (void); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - - virtual int find_or_create_svc_handler_i (SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - bool reuse_addr, - int flags, - int perms, - ACE_Hash_Map_Entry, - std::pair > *&entry, - int &found); - -protected: - - /// Max items in the cache, used as a bound for the creation of svc_handlers. - size_t max_size_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Cached_Connect_Strategy_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Cached_Connect_Strategy_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* CACHED_CONNECT_STRATEGY_T_H */ diff --git a/dep/acelite/ace/Caching_Strategies_T.cpp b/dep/acelite/ace/Caching_Strategies_T.cpp deleted file mode 100644 index 2b0fd4e764a..00000000000 --- a/dep/acelite/ace/Caching_Strategies_T.cpp +++ /dev/null @@ -1,59 +0,0 @@ -//$Id: Caching_Strategies_T.cpp 80826 2008-03-04 14:51:23Z wotte $ - -#ifndef ACE_CACHING_STRATEGIES_T_CPP -#define ACECACHING_STRATEGIES_T_CPP - -#include "ace/Caching_Strategies_T.h" -#include "ace/Log_Msg.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Caching_Strategies_T.inl" -#endif /* __ACE_INLINE__ */ - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Caching_Strategy::~ACE_Caching_Strategy (void) -{ -} - -////////////////////////////////////////////////////////////////////////////////// - -template -ACE_LRU_Caching_Strategy::ACE_LRU_Caching_Strategy (void) - : timer_ (0), - purge_percent_ (10) -{ -} - -//////////////////////////////////////////////////////////////////////////////////////////////// - -template -ACE_LFU_Caching_Strategy::ACE_LFU_Caching_Strategy (void) - : purge_percent_ (10) -{ -} - -//////////////////////////////////////////////////////////////////////////////////////////////// - -template -ACE_FIFO_Caching_Strategy::ACE_FIFO_Caching_Strategy (void) - : order_ (0), - purge_percent_ (10) -{ -} - -//////////////////////////////////////////////////////////////////////////////////////////////// - -ACE_ALLOC_HOOK_DEFINE(ACE_LRU_Caching_Strategy) -ACE_ALLOC_HOOK_DEFINE(ACE_LFU_Caching_Strategy) -ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Caching_Strategy) -ACE_ALLOC_HOOK_DEFINE(ACE_Null_Caching_Strategy) - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_CACHING_STRATEGIES_T_CPP */ diff --git a/dep/acelite/ace/Caching_Strategies_T.h b/dep/acelite/ace/Caching_Strategies_T.h deleted file mode 100644 index 48f5e898e71..00000000000 --- a/dep/acelite/ace/Caching_Strategies_T.h +++ /dev/null @@ -1,552 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Caching_Strategies_T.h - * - * $Id: Caching_Strategies_T.h 92097 2010-09-30 05:41:49Z msmit $ - * - * @author Kirthika Parameswaran - */ -//============================================================================= - -#ifndef ACE_CACHING_STRATEGIES_H -#define ACE_CACHING_STRATEGIES_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" -#include "ace/Caching_Utility_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined(_MSC_VER) -#pragma warning(disable:4503) -#endif /* _MSC_VER */ - -// For linkers that cant grok long names. -#define ACE_Caching_Strategy ACS - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Caching_Strategy - * - * @brief This class is an abstract base class for a caching strategy. - * - * This class consists of all the interfaces a caching strategy should - * have and is used in association with the - * ACE_Caching_Strategy_Adaptor. - */ -template -class ACE_Caching_Strategy -{ -public: - /// Destructor. - virtual ~ACE_Caching_Strategy (void); - - /// Accessor method for the timer attributes. - virtual ATTRIBUTES attributes (void) = 0; - - /// Get the percentage of entries to purge. - virtual double purge_percent (void) = 0; - - /// Set the percentage of entries to purge. - virtual void purge_percent (double percentage) = 0; - - // = Strategy related Operations - - /// This method acts as a notification about the CONTAINERs bind - /// method call. - virtual int notify_bind (int result, - const ATTRIBUTES &attr) = 0; - - /// This method acts as a notification about the CONTAINERs find - /// method call - virtual int notify_find (int result, - ATTRIBUTES &attr) = 0; - - /// This method acts as a notification about the CONTAINERs unbind - /// method call - virtual int notify_unbind (int result, - const ATTRIBUTES &attr) = 0; - - /// This method acts as a notification about the CONTAINERs trybind - /// method call - virtual int notify_trybind (int result, - ATTRIBUTES &attr) = 0; - - /// This method acts as a notification about the CONTAINERs rebind - /// method call - virtual int notify_rebind (int result, - const ATTRIBUTES &attr) = 0; - - /// Purge the cache. - virtual CACHING_UTILITY &caching_utility (void) = 0; - - /// Dumps the state of the object. - virtual void dump (void) const = 0; -}; - -////////////////////////////////////////////////////////////////////////// - -#define ACE_Caching_Strategy_Adapter ACSA - -/** - * @class ACE_Caching_Strategy_Adapter - * - * @brief This class follows the Adaptor pattern and is used to provide - * External Polymorphism by deriving from ACE_Caching_Strategy. - * - * This class simply delegates all requests to the - * IMPLEMNETATION object within. This class should be passed in - * place of the the abstract base ACE_Caching_Strategy class as - * part of the External Polymorphism pattern. - */ -template -class ACE_Caching_Strategy_Adapter - : public ACE_Caching_Strategy -{ - -public: - - /// Constructor. - ACE_Caching_Strategy_Adapter (IMPLEMENTATION *implementation = 0, - bool delete_implementation = false); - - /// Destructor. - ~ACE_Caching_Strategy_Adapter (void); - - /// Accessor method for the timer attributes. - ATTRIBUTES attributes (void); - - /// Get the percentage of entries to purge. - double purge_percent (void); - - /// Set the percentage of entries to purge. - void purge_percent (double percentage); - - // = Strategy related Operations - - /// This method acts as a notification about the CONTAINERs bind - /// method call. - int notify_bind (int result, - const ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs find - /// method call - int notify_find (int result, - ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs unbind - /// method call - int notify_unbind (int result, - const ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs trybind - /// method call - int notify_trybind (int result, - ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs rebind - /// method call - int notify_rebind (int result, - const ATTRIBUTES &attr); - - /// Accessor to the implementation. - IMPLEMENTATION &implementation (void); - - /// Purge the cache. - CACHING_UTILITY &caching_utility (void); - - /// Dumps the state of the object. - void dump (void) const; - -private: - - /// Implementation class. - IMPLEMENTATION *implementation_; - - /// Do we need to delete the implementation? - bool delete_implementation_; -}; - -////////////////////////////////////////////////////////////////////////// -#define ACE_LRU_Caching_Strategy ALRU - -/** - * @class ACE_LRU_Caching_Strategy - * - * @brief Defines a Least Recently Used strategy which will decide on - * the item to be removed from the cache. - * - * This is a strategy which makes use of a virtual timer which - * is updated whenever an item is inserted or looked up in the - * container. When the need of purging entries arises, the items - * with the lowest timer values are removed. - * Explanation of the template parameter list: - * CONTAINER is any map with entries of type . - * The ATTRIBUTES are the deciding factor for purging of entries - * and should logically be included with the VALUE. Some ways of - * doing this are: As being a member of the VALUE or VALUE being - * std::pair. The CACHING_UTILITY is the - * class which can be plugged in and which decides the entries - * to purge. - */ -template -class ACE_LRU_Caching_Strategy -{ -public: - - // Traits. - typedef ATTRIBUTES CACHING_ATTRIBUTES; - - // = Initialisation and termination. - - /** - * The is the map in which the entries reside. The - * timer attribute is initialed to zero in this constructor. And - * the field denotes the percentage of the entries - * in the cache which can be purged automagically and by default is - * set to 10%. - */ - ACE_LRU_Caching_Strategy (void); - - // = Operations of the strategy. - - /// Accessor method for the timer attributes. - ATTRIBUTES attributes (void); - - /// Get the percentage of entries to purge. - double purge_percent (void); - - /// Set the percentage of entries to purge. - void purge_percent (double percentage); - - // = Strategy related Operations - - /// This method acts as a notification about the CONTAINERs bind - /// method call. - int notify_bind (int result, - const ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs find - /// method call - int notify_find (int result, - ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs unbind - /// method call - int notify_unbind (int result, - const ATTRIBUTES &attr); - - - /// This method acts as a notification about the CONTAINERs trybind - /// method call - int notify_trybind (int result, - ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs rebind - /// method call - int notify_rebind (int result, - const ATTRIBUTES &attr); - - /// Purge the cache. - CACHING_UTILITY &caching_utility (void); - - /// Dumps the state of the object. - void dump (void) const; - -private: - - /// This element is the one which is the deciding factor for purging - /// of an ITEM. - ATTRIBUTES timer_; - - /// The level about which the purging will happen automagically. - double purge_percent_; - - /// This is the helper class which will decide and expunge entries - /// from the cache. - CACHING_UTILITY caching_utility_; -}; - -////////////////////////////////////////////////////////////////////////// -#define ACE_LFU_Caching_Strategy ALFU - -/** - * @class ACE_LFU_Caching_Strategy - * - * @brief Defines a Least Frequently Used strategy for which will decide on - * the item to be removed from the cache. - * - * A attribute is tagged to each item which increments whenever - * the item is bound or looked up in the cache. Thus it denotes - * the frequency of use. According to the value of the attribute - * the item is removed from the CONTAINER i.e cache. - * Explanation of the template parameter list: - * CONTAINER is any map with entries of type . - * The ATTRIBUTES are the deciding factor for purging of entries - * and should logically be included with the VALUE. Some ways of - * doing this are: As being a member of the VALUE or VALUE being - * std::pair. The CACHING_UTILITY is the - * class which can be plugged in and which decides the entries - * to purge. - */ -template -class ACE_LFU_Caching_Strategy -{ - -public: - - // Traits. - typedef ATTRIBUTES CACHING_ATTRIBUTES; - - // = Initialisation and termination methods. - - /** - * The is the map in which the entries reside. The - * timer attribute is initialed to zero in this constructor. And - * the field denotes the percentage of the entries - * in the cache which can be purged automagically and by default is - * set to 10%. - */ - ACE_LFU_Caching_Strategy (void); - - // = Strategy methods. - - /// Access the attributes. - ATTRIBUTES attributes (void); - - /// Get the percentage of entries to purge. - double purge_percent (void); - - /// Set the percentage of entries to purge. - void purge_percent (double percentage); - - // = Strategy related Operations - - /// This method acts as a notification about the CONTAINERs bind - /// method call. - int notify_bind (int result, - const ATTRIBUTES &attr); - - /// Lookup notification. - int notify_find (int result, - ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs unbind - /// method call - int notify_unbind (int result, - const ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs trybind - /// method call - int notify_trybind (int result, - ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs rebind - /// method call - int notify_rebind (int result, - const ATTRIBUTES &attr); - - /// Purge the cache. - CACHING_UTILITY &caching_utility (void); - - /// Dumps the state of the object. - void dump (void) const; - -private: - - /// The level about which the purging will happen automagically. - double purge_percent_; - - /// This is the helper class which will decide and expunge entries - /// from the cache. - CACHING_UTILITY caching_utility_; -}; - -///////////////////////////////////////////////////////////// -#define ACE_FIFO_Caching_Strategy AFIFO - -/** - * @class ACE_FIFO_Caching_Strategy - * - * @brief The First In First Out strategy is implemented wherein each - * item is ordered. - * - * The order tag of each item is used to decide the item to be - * removed from the cache. The items with least order are removed. - * Explanation of the template parameter list: - * CONTAINER is any map with entries of type . - * The ATTRIBUTES are the deciding factor for purging of entries - * and should logically be included with the VALUE. Some ways of - * doing this are: As being a member of the VALUE or VALUE being - * std::pair. The CACHING_UTILITY is the - * class which can be plugged in and which decides the entries - * to purge. - */ -template -class ACE_FIFO_Caching_Strategy -{ - -public: - - typedef ATTRIBUTES CACHING_ATTRIBUTES; - - // = Initialisation and termination. - - /** - * The is the map in which the entries reside. The - * timer attribute is initialed to zero in this constructor. And - * the field denotes the percentage of the entries - * in the cache which can be purged automagically and by default is - * set to 10%. - */ - ACE_FIFO_Caching_Strategy (void); - - // = Strategy methods. - - /// Accessor method. - ATTRIBUTES attributes (void); - - /// Get the percentage of entries to purge. - double purge_percent (void); - - /// Set the percentage of entries to purge. - void purge_percent (double percentage); - - // = Strategy related Operations - - /// Notification for an item getting bound into the cache. - int notify_bind (int result, - const ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs find - /// method call - int notify_find (int result, - ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs unbind - /// method call - int notify_unbind (int result, - const ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs trybind - /// method call - int notify_trybind (int result, - ATTRIBUTES &attr); - - /// Notification for an item getting bound again into the cache. - int notify_rebind (int result, - const ATTRIBUTES &attr); - - /// Purge the cache. - CACHING_UTILITY &caching_utility (void); - - /// Dumps the state of the object. - void dump (void) const; - -private: - - /// The order is the deciding factor for the item to be removed from - /// the cache. - ATTRIBUTES order_; - - /// The level about which the purging will happen automagically. - double purge_percent_; - - /// This is the helper class which will decide and expunge entries - /// from the cache. - CACHING_UTILITY caching_utility_; -}; - -////////////////////////////////////////////////////////////////////// -#define ACE_Null_Caching_Strategy ANULL - -/** - * @class ACE_Null_Caching_Strategy - * - * @brief The is a special caching strategy which doesnt have the purging - * feature. - * - * No purging provided. To be used when purging might be too expensive - * an operation. - */ -template -class ACE_Null_Caching_Strategy -{ - -public: - - // = Traits. - typedef ATTRIBUTES CACHING_ATTRIBUTES; - - // = Strategy methods. All are NO_OP methods!!! - - /// Accessor method. - ATTRIBUTES attributes (void); - - /// Get the percentage of entries to purge. - double purge_percent (void); - - /// Set the percentage of entries to purge. - void purge_percent (double percentage); - - // = Strategy related Operations - - /// Notification for an item getting bound into the cache. - int notify_bind (int result, - const ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs find - /// method call - int notify_find (int result, - ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs unbind - /// method call - int notify_unbind (int result, - const ATTRIBUTES &attr); - - /// This method acts as a notification about the CONTAINERs trybind - /// method call - int notify_trybind (int result, - ATTRIBUTES &attr); - - /// Notification for an item getting bound again into the cache. - int notify_rebind (int result, - const ATTRIBUTES &attr); - - /// Purge the cache. - CACHING_UTILITY &caching_utility (void); - - /// Dumps the state of the object. - void dump (void) const; - -private: - - /// This is the helper class which will decide and expunge entries - /// from the cache. - CACHING_UTILITY caching_utility_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Caching_Strategies_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Caching_Strategies_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Caching_Strategies_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_CACHING_STRATEGIES_H */ diff --git a/dep/acelite/ace/Caching_Strategies_T.inl b/dep/acelite/ace/Caching_Strategies_T.inl deleted file mode 100644 index 41fa2d30301..00000000000 --- a/dep/acelite/ace/Caching_Strategies_T.inl +++ /dev/null @@ -1,456 +0,0 @@ -// -*-C++-*- -// -//$Id: Caching_Strategies_T.inl 80826 2008-03-04 14:51:23Z wotte $ - -////////////////////////////////////////////////////////////////////////////////// - -#include "ace/OS_Memory.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE -ACE_Caching_Strategy_Adapter::ACE_Caching_Strategy_Adapter (IMPLEMENTATION *implementation, - bool delete_implementation) - : implementation_ (implementation), - delete_implementation_ (delete_implementation) -{ - if (this->implementation_ == 0) - { - ACE_NEW (this->implementation_, - IMPLEMENTATION); - this->delete_implementation_ = true; - } -} - -template ACE_INLINE -ACE_Caching_Strategy_Adapter::~ACE_Caching_Strategy_Adapter (void) -{ - if (this->delete_implementation_) - { - delete this->implementation_; - this->delete_implementation_ = false; - this->implementation_ = 0; - } -} - -template ACE_INLINE ATTRIBUTES -ACE_Caching_Strategy_Adapter::attributes (void) -{ - return this->implementation_->attributes (); -} - -template ACE_INLINE double -ACE_Caching_Strategy_Adapter::purge_percent (void) -{ - return this->implementation_->purge_percent (); -} - -template ACE_INLINE void -ACE_Caching_Strategy_Adapter::purge_percent (double percentage) -{ - this->implementation_->purge_percent (percentage); -} - -template ACE_INLINE int -ACE_Caching_Strategy_Adapter::notify_bind (int result, - const ATTRIBUTES &attr) -{ - return this->implementation_->notify_bind (result, - attr); -} - -template ACE_INLINE int -ACE_Caching_Strategy_Adapter::notify_find (int result, - ATTRIBUTES &attr) -{ - return this->implementation_->notify_find (result, - attr); -} - -template ACE_INLINE int -ACE_Caching_Strategy_Adapter::notify_unbind (int result, - const ATTRIBUTES &attr) -{ - return this->implementation_->notify_unbind (result, - attr); -} - -template ACE_INLINE int -ACE_Caching_Strategy_Adapter::notify_trybind (int result, - ATTRIBUTES &attr) -{ - return this->implementation_->notify_trybind (result, - attr); -} - -template ACE_INLINE int -ACE_Caching_Strategy_Adapter::notify_rebind (int result, - const ATTRIBUTES &attr) -{ - return this->implementation_->notify_rebind (result, - attr); -} - -template ACE_INLINE IMPLEMENTATION & -ACE_Caching_Strategy_Adapter::implementation (void) -{ - return *this->implementation_; -} - -template ACE_INLINE CACHING_UTILITY & -ACE_Caching_Strategy_Adapter::caching_utility (void) -{ - return this->implementation_->caching_utility (); -} - -template ACE_INLINE void -ACE_Caching_Strategy_Adapter::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Caching_Strategy_Adapter::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -////////////////////////////////////////////////////////////////////////////////// - -template ACE_INLINE ATTRIBUTES -ACE_LRU_Caching_Strategy::attributes (void) -{ - return this->timer_; -} - -template ACE_INLINE double -ACE_LRU_Caching_Strategy::purge_percent (void) -{ - return this->purge_percent_; -} - -template ACE_INLINE void -ACE_LRU_Caching_Strategy::purge_percent (double percentage) -{ - this->purge_percent_ = percentage; -} - -template ACE_INLINE int -ACE_LRU_Caching_Strategy::notify_bind ( - int result, - const ATTRIBUTES & /* attr */) -{ - if (result == 0) - ++this->timer_; - - return result; -} - -template ACE_INLINE int -ACE_LRU_Caching_Strategy::notify_find ( - int result, - ATTRIBUTES &attr) -{ - if (result == 0) - { - attr = this->timer_; - ++this->timer_; - } - - return result; -} - -template ACE_INLINE int -ACE_LRU_Caching_Strategy::notify_unbind ( - int result, - const ATTRIBUTES & /* attr */) -{ - return result; -} - -template ACE_INLINE int -ACE_LRU_Caching_Strategy::notify_trybind ( - int result, - ATTRIBUTES & /* attr */) -{ - return result; -} - -template ACE_INLINE int -ACE_LRU_Caching_Strategy::notify_rebind ( - int result, - const ATTRIBUTES & /* attr */) -{ - if (result == 0) - ++this->timer_; - - return result; -} - -template ACE_INLINE CACHING_UTILITY & -ACE_LRU_Caching_Strategy::caching_utility (void) -{ - return this->caching_utility_; -} - -template ACE_INLINE void -ACE_LRU_Caching_Strategy::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_LRU_Caching_Strategy::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("timer_ = %d "), this->timer_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -////////////////////////////////////////////////////////////////////////////////// - -template ACE_INLINE ATTRIBUTES -ACE_LFU_Caching_Strategy::attributes (void) -{ - return 0; -} - -template ACE_INLINE double -ACE_LFU_Caching_Strategy::purge_percent (void) -{ - return this->purge_percent_; -} - -template ACE_INLINE void -ACE_LFU_Caching_Strategy::purge_percent (double percentage) -{ - this->purge_percent_ = percentage; -} - -template ACE_INLINE int -ACE_LFU_Caching_Strategy::notify_bind (int result, - const ATTRIBUTES & /* attr */) -{ - - return result; -} - -template ACE_INLINE int -ACE_LFU_Caching_Strategy::notify_find (int result, - ATTRIBUTES &attr) -{ - if (result == 0) - ++attr; - - return result; -} - -template ACE_INLINE int -ACE_LFU_Caching_Strategy::notify_trybind (int result, - ATTRIBUTES & /* attr */) -{ - return result; -} - -template ACE_INLINE int -ACE_LFU_Caching_Strategy::notify_rebind (int result, - const ATTRIBUTES & /* attr */) -{ - return result; -} - -template ACE_INLINE int -ACE_LFU_Caching_Strategy::notify_unbind (int result, - const ATTRIBUTES & /* attr */) -{ - return result; -} - -template ACE_INLINE CACHING_UTILITY & -ACE_LFU_Caching_Strategy::caching_utility (void) -{ - return this->caching_utility_; -} - -template ACE_INLINE void -ACE_LFU_Caching_Strategy::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_LFU_Caching_Strategy::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -////////////////////////////////////////////////////////////////////////////////////// - -template ACE_INLINE ATTRIBUTES -ACE_FIFO_Caching_Strategy::attributes (void) -{ - return this->order_; -} - -template ACE_INLINE double -ACE_FIFO_Caching_Strategy::purge_percent (void) -{ - return this->purge_percent_; -} - -template ACE_INLINE void -ACE_FIFO_Caching_Strategy::purge_percent (double percentage) -{ - this->purge_percent_ = percentage; -} - -template ACE_INLINE int -ACE_FIFO_Caching_Strategy::notify_bind (int result, - const ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - if (result == 0) - ++this->order_; - - return result; -} - -template ACE_INLINE int -ACE_FIFO_Caching_Strategy::notify_find (int result, - ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - return result; -} - -template ACE_INLINE int -ACE_FIFO_Caching_Strategy::notify_unbind (int result, - const ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - return result; -} - -template ACE_INLINE int -ACE_FIFO_Caching_Strategy::notify_trybind (int result, - ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - return result; -} - -template ACE_INLINE int -ACE_FIFO_Caching_Strategy::notify_rebind (int result, - const ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - if (result == 0) - ++this->order_; - - return result; -} - -template ACE_INLINE CACHING_UTILITY & -ACE_FIFO_Caching_Strategy::caching_utility (void) -{ - return this->caching_utility_; -} - -template ACE_INLINE void -ACE_FIFO_Caching_Strategy::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_FIFO_Caching_Strategy::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("order_ = %d "), this->order_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -////////////////////////////////////////////////////////////////////////////////// - -template ACE_INLINE ATTRIBUTES -ACE_Null_Caching_Strategy::attributes (void) -{ - return 0; -} - -template ACE_INLINE double -ACE_Null_Caching_Strategy::purge_percent (void) -{ - return 0; -} - -template ACE_INLINE void -ACE_Null_Caching_Strategy::purge_percent (double percentage) -{ - ACE_UNUSED_ARG (percentage); -} - -template ACE_INLINE int -ACE_Null_Caching_Strategy::notify_bind (int result, - const ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - return result; -} - -template ACE_INLINE int -ACE_Null_Caching_Strategy::notify_find (int result, - ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - return result; -} - -template ACE_INLINE int -ACE_Null_Caching_Strategy::notify_unbind (int result, - const ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - return result; -} - -template ACE_INLINE int -ACE_Null_Caching_Strategy::notify_trybind (int result, - ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - return result; -} - -template ACE_INLINE int -ACE_Null_Caching_Strategy::notify_rebind (int result, - const ATTRIBUTES &attr) -{ - ACE_UNUSED_ARG (attr); - - return result; -} - -template ACE_INLINE CACHING_UTILITY & -ACE_Null_Caching_Strategy::caching_utility (void) -{ - return this->caching_utility_; -} - -template ACE_INLINE void -ACE_Null_Caching_Strategy::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Null_Caching_Strategy::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -////////////////////////////////////////////////////////////////////////////////// diff --git a/dep/acelite/ace/Caching_Utility_T.cpp b/dep/acelite/ace/Caching_Utility_T.cpp deleted file mode 100644 index 4713c974bc7..00000000000 --- a/dep/acelite/ace/Caching_Utility_T.cpp +++ /dev/null @@ -1,500 +0,0 @@ -// $Id: Caching_Utility_T.cpp 92264 2010-10-19 18:12:46Z olli $ - -#ifndef ACE_CACHING_UTILITY_T_CPP -#define ACE_CACHING_UTILITY_T_CPP - -#include "ace/Caching_Utility_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/ACE.h" -#include "ace/Min_Max.h" -#include "ace/OS_Memory.h" -#include "ace/Recyclable.h" - -////////////////////////////////////////////////////////////////////////////// - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Pair_Caching_Utility::ACE_Pair_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy, - bool delete_cleanup_strategy) - : cleanup_strategy_ (cleanup_strategy), - delete_cleanup_strategy_ (delete_cleanup_strategy) -{ - if (cleanup_strategy == 0) - { - ACE_NEW (this->cleanup_strategy_, - CLEANUP_STRATEGY); - this->delete_cleanup_strategy_ = true; - } -} - -template -ACE_Pair_Caching_Utility::~ACE_Pair_Caching_Utility (void) -{ - if (this->delete_cleanup_strategy_) - delete this->cleanup_strategy_; -} - -template int -ACE_Pair_Caching_Utility::clear_cache (CONTAINER &container, - double purge_percent) -{ - // Check that the purge_percent is non-zero. - if (ACE::is_equal (purge_percent, 0.0)) - return 0; - - // Get the number of entries in the container. - size_t current_map_size = container.current_size (); - - // Also whether the number of entries in the cache! - // Oops! then there is no way out but exiting. So return an error. - if (current_map_size == 0) - return 0; - - // Calculate the no of entries to remove from the cache depending - // upon the . - size_t const entries_to_remove - = ACE_MAX (static_cast (1), - static_cast (static_cast (purge_percent) - / 100 * current_map_size)); - KEY *key_to_remove = 0; - VALUE *value_to_remove = 0; - - for (size_t i = 0; i < entries_to_remove ; ++i) - { - this->minimum (container, - key_to_remove, - value_to_remove); - - // Simply verifying that the key is non-zero. - // This is important for strategies where the minimum - // entry cant be found due to constraints on the type of entry - // to remove. - if (key_to_remove == 0) - return 0; - - if (this->cleanup_strategy_->cleanup (container, - key_to_remove, - value_to_remove) == -1) - return -1; - - } - - return 0; -} - -template void -ACE_Pair_Caching_Utility::minimum (CONTAINER &container, - KEY *&key_to_remove, - VALUE *&value_to_remove) -{ - // Starting values. - ITERATOR iter = container.begin (); - ITERATOR end = container.end (); - ATTRIBUTES min = (*iter).int_id_.second; - key_to_remove = &(*iter).ext_id_; - value_to_remove = &(*iter).int_id_; - - // The iterator moves thru the container searching for the entry - // with the lowest ATTRIBUTES. - for (++iter; - iter != end; - ++iter) - { - if (min > (*iter).int_id_.second) - { - // Ah! an item with lower ATTTRIBUTES... - min = (*iter).int_id_.second; - key_to_remove = &(*iter).ext_id_; - value_to_remove = &(*iter).int_id_; - } - } -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////// - -template -ACE_Recyclable_Handler_Caching_Utility::ACE_Recyclable_Handler_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy, - bool delete_cleanup_strategy) - : cleanup_strategy_ (cleanup_strategy), - delete_cleanup_strategy_ (delete_cleanup_strategy) -{ - if (cleanup_strategy == 0) - { - ACE_NEW (this->cleanup_strategy_, - CLEANUP_STRATEGY); - this->delete_cleanup_strategy_ = true; - } -} - -template -ACE_Recyclable_Handler_Caching_Utility::~ACE_Recyclable_Handler_Caching_Utility (void) -{ - if (this->delete_cleanup_strategy_) - delete this->cleanup_strategy_; -} - -template int -ACE_Recyclable_Handler_Caching_Utility::clear_cache (CONTAINER &container, - double purge_percent) -{ - // Check that the purge_percent is non-zero. - if (ACE::is_equal (purge_percent, 0.0)) - return 0; - - // Get the number of entries in the container. - size_t current_map_size = container.current_size (); - - // Also whether the number of entries in the cache is just one! - // Oops! then there is no way out but exiting. So return an error. - // if (current_map_size <= 1) - if (current_map_size == 0) - return 0; - - // Calculate the no of entries to remove from the cache depending - // upon the . - size_t const entries_to_remove - = ACE_MAX (static_cast (1), - static_cast (static_cast (purge_percent) - / 100 * current_map_size)); - - KEY *key_to_remove = 0; - VALUE *value_to_remove = 0; - - for (size_t i = 0; i < entries_to_remove ; ++i) - { - this->minimum (container, - key_to_remove, - value_to_remove); - - // Simply verifying that the key is non-zero. - // This is important for strategies where the minimum - // entry cant be found due to constraints on the type of entry - // to remove. - if (key_to_remove == 0) - return 0; - - if (this->cleanup_strategy_->cleanup (container, - key_to_remove, - value_to_remove) == -1) - return -1; - } - - return 0; -} - -template void -ACE_Recyclable_Handler_Caching_Utility::minimum (CONTAINER &container, - KEY *&key_to_remove, - VALUE *&value_to_remove) -{ - // Starting values. - ITERATOR end = container.end (); - ITERATOR iter = container.begin (); - ATTRIBUTES min = (*iter).int_id_.second; - key_to_remove = 0; - value_to_remove = 0; - // Found the minimum entry to be purged? - int found = 0; - - // The iterator moves thru the container searching for the entry - // with the lowest ATTRIBUTES. - for (; - iter != end; - ++iter) - { - // If the entry isnt IDLE_AND_PURGABLE continue until you reach - // the first entry which can be purged. This is the minimum with - // which you will compare the rest of the purgable entries. - if ((*iter).ext_id_.recycle_state () == ACE_RECYCLABLE_IDLE_AND_PURGABLE || - (*iter).ext_id_.recycle_state () == ACE_RECYCLABLE_PURGABLE_BUT_NOT_IDLE) - { - if (found == 0) - { - min = (*iter).int_id_.second; - key_to_remove = &(*iter).ext_id_; - value_to_remove = &(*iter).int_id_; - found = 1; - } - else - { - // Ah! an entry with lower ATTTRIBUTES... - if (min > (*iter).int_id_.second) - { - min = (*iter).int_id_.second; - key_to_remove = &(*iter).ext_id_; - value_to_remove = &(*iter).int_id_; - } - } - } - } -} - -//////////////////////////////////////////////////////////////////////////////// - -template -ACE_Refcounted_Recyclable_Handler_Caching_Utility::ACE_Refcounted_Recyclable_Handler_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy, - bool delete_cleanup_strategy) - : cleanup_strategy_ (cleanup_strategy), - delete_cleanup_strategy_ (delete_cleanup_strategy), - marked_as_closed_entries_ (0) -{ - if (cleanup_strategy == 0) - { - ACE_NEW (this->cleanup_strategy_, - CLEANUP_STRATEGY); - this->delete_cleanup_strategy_ = true; - } -} - -template -ACE_Refcounted_Recyclable_Handler_Caching_Utility::~ACE_Refcounted_Recyclable_Handler_Caching_Utility (void) -{ - if (this->delete_cleanup_strategy_) - delete this->cleanup_strategy_; -} - -template int -ACE_Refcounted_Recyclable_Handler_Caching_Utility::clear_cache (CONTAINER &container, - double purge_percent) -{ - // Check that the purge_percent is non-zero. - if (ACE::is_equal (purge_percent, 0.0)) - return 0; - - // Get the number of entries in the container which can be considered for purging. - size_t const available_entries = - container.current_size () - this->marked_as_closed_entries_; - - // Also whether the number of entries in the cache zero. - // Oops! then there is no way out but exiting. - if (available_entries <= 0) - return 0; - - // Calculate the no of entries to remove from the cache depending - // upon the . - size_t entries_to_remove - = ACE_MAX (static_cast (1), - static_cast (static_cast (purge_percent) - / 100 * available_entries)); - - if (entries_to_remove >= available_entries || entries_to_remove == 0) - entries_to_remove = available_entries - 1; - - KEY *key_to_remove = 0; - VALUE *value_to_remove = 0; - - for (size_t i = 0; i < entries_to_remove ; ++i) - { - this->minimum (container, - key_to_remove, - value_to_remove); - - // Simply verifying that the key is non-zero. - // This is important for strategies where the minimum - // entry cant be found due to constraints on the type of entry - // to remove. - if (key_to_remove == 0) - return 0; - - if (this->cleanup_strategy_->cleanup (container, - key_to_remove, - value_to_remove) == -1) - return -1; - - ++this->marked_as_closed_entries_; - } - - return 0; -} - -template void -ACE_Refcounted_Recyclable_Handler_Caching_Utility::minimum (CONTAINER &container, - KEY *&key_to_remove, - VALUE *&value_to_remove) -{ - // Starting values. - ITERATOR end = container.end (); - ITERATOR iter = container.begin (); - ATTRIBUTES min = (*iter).int_id_.second (); - key_to_remove = 0; - value_to_remove = 0; - // Found the minimum entry to be purged? - int found = 0; - - // The iterator moves thru the container searching for the entry - // with the lowest ATTRIBUTES. - for (; - iter != end; - ++iter) - { - // If the entry isnt IDLE_AND_PURGABLE continue until you reach - // the first entry which can be purged. This is the minimum with - // which you will compare the rest of the purgable entries. - if ((*iter).ext_id_.recycle_state () == ACE_RECYCLABLE_IDLE_AND_PURGABLE || - (*iter).ext_id_.recycle_state () == ACE_RECYCLABLE_PURGABLE_BUT_NOT_IDLE) - { - if (found == 0) - { - min = (*iter).int_id_.second (); - key_to_remove = &(*iter).ext_id_; - value_to_remove = &(*iter).int_id_; - found = 1; - } - else - { - // Ah! an entry with lower ATTTRIBUTES... - if (min > (*iter).int_id_.second ()) - { - min = (*iter).int_id_.second (); - key_to_remove = &(*iter).ext_id_; - value_to_remove = &(*iter).int_id_; - } - } - } - } -} - -//////////////////////////////////////////////////////////////////////////////// - -template -ACE_Handler_Caching_Utility::ACE_Handler_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy, - bool delete_cleanup_strategy) - : cleanup_strategy_ (cleanup_strategy), - delete_cleanup_strategy_ (delete_cleanup_strategy) -{ - if (cleanup_strategy == 0) - { - ACE_NEW (this->cleanup_strategy_, - CLEANUP_STRATEGY); - this->delete_cleanup_strategy_ = true; - } -} - -template -ACE_Handler_Caching_Utility::~ACE_Handler_Caching_Utility (void) -{ - if (this->delete_cleanup_strategy_) - delete this->cleanup_strategy_; -} - -template int -ACE_Handler_Caching_Utility::clear_cache (CONTAINER &container, - double purge_percent) -{ - // Check that the purge_percent is non-zero. - if (ACE::is_equal (purge_percent, 0.0)) - return 0; - - // Get the number of entries in the container. - size_t current_map_size = container.current_size (); - - // Also whether the number of entries in the cache is just one! - // Oops! then there is no way out but exiting. So return an error. - if (current_map_size == 0) - return 0; - - // Calculate the no of entries to remove from the cache depending - // upon the . - size_t entries_to_remove - = ACE_MAX (static_cast (1), - static_cast (static_cast (purge_percent) - / 100 * current_map_size)); - - KEY *key_to_remove = 0; - VALUE *value_to_remove = 0; - - for (size_t i = 0; i < entries_to_remove ; ++i) - { - this->minimum (container, - key_to_remove, - value_to_remove); - - if (this->cleanup_strategy_->cleanup (container, - key_to_remove, - value_to_remove) == -1) - return -1; - } - - return 0; -} - -template void -ACE_Handler_Caching_Utility::minimum (CONTAINER &container, - KEY *&key_to_remove, - VALUE *&value_to_remove) -{ - // Starting values. - ITERATOR iter = container.begin (); - ITERATOR end = container.end (); - ATTRIBUTES min = (*iter).int_id_->caching_attributes (); - key_to_remove = &(*iter).ext_id_; - value_to_remove = &(*iter).int_id_; - - // The iterator moves thru the container searching for the entry - // with the lowest ATTRIBUTES. - for (++iter; - iter != end; - ++iter) - { - if (min > (*iter).int_id_->caching_attributes () && - (*iter).int_id_->active () != 1) - { - // Ah! an item with lower ATTTRIBUTES... - min = (*iter).int_id_->caching_attributes (); - key_to_remove = &(*iter).ext_id_; - value_to_remove = &(*iter).int_id_; - } - } -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////// - -template -ACE_Null_Caching_Utility::ACE_Null_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy, - bool delete_cleanup_strategy) - : cleanup_strategy_ (cleanup_strategy), - delete_cleanup_strategy_ (delete_cleanup_strategy) -{ - if (cleanup_strategy == 0) - { - ACE_NEW (this->cleanup_strategy_, - CLEANUP_STRATEGY); - this->delete_cleanup_strategy_ = true; - } -} - -template -ACE_Null_Caching_Utility::~ACE_Null_Caching_Utility (void) -{ - if (this->delete_cleanup_strategy_) - delete this->cleanup_strategy_; -} - -template int -ACE_Null_Caching_Utility::clear_cache (CONTAINER &container, - double purge_percent) -{ - ACE_UNUSED_ARG (container); - ACE_UNUSED_ARG (purge_percent); - - return 0; -} - -template void -ACE_Null_Caching_Utility::minimum (CONTAINER &container, - KEY *&key_to_remove, - VALUE *&value_to_remove) -{ - ACE_UNUSED_ARG (container); - ACE_UNUSED_ARG (key_to_remove); - ACE_UNUSED_ARG (value_to_remove); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_CACHING_UTILITY_T_CPP */ diff --git a/dep/acelite/ace/Caching_Utility_T.h b/dep/acelite/ace/Caching_Utility_T.h deleted file mode 100644 index 9340d73ac64..00000000000 --- a/dep/acelite/ace/Caching_Utility_T.h +++ /dev/null @@ -1,313 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Caching_Utility_T.h - * - * $Id: Caching_Utility_T.h 92085 2010-09-29 12:23:13Z johnnyw $ - * - * @author Kirthika Parameswaran - */ -//============================================================================= - -#ifndef ACE_CACHING_UTILITY_H -#define ACE_CACHING_UTILITY_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Global_Macros.h" -#include "ace/Cleanup_Strategies_T.h" -#include "ace/Copy_Disabled.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Pair_Caching_Utility - * - * @brief Defines a helper class for the Caching Strategies. - * - * This class defines the methods commonly used by the different - * caching strategies. For instance: method which - * decides and purges the entry from the container. @note This - * class helps in the caching_strategies using a container - * containing entries of > - * kind. The attributes helps in deciding the entries to be - * purged. The Cleanup_Strategy is the callback class to which the - * entries to be cleaned up will be delegated. - */ -template -class ACE_Pair_Caching_Utility : private ACE_Copy_Disabled -{ -public: - - typedef ACE_Cleanup_Strategy CLEANUP_STRATEGY; - - /// Constructor. - ACE_Pair_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy = 0, - bool delete_cleanup_strategy = false); - - /// Destructor. - ~ACE_Pair_Caching_Utility (void); - - /** - * Purge entries from the @a container. The Cleanup_Strategy will do the - * actual job of cleanup once the entries to be cleaned up are decided. - */ - int clear_cache (CONTAINER &container, double purge_percent); - -protected: - - /// Find the entry with minimum caching attributes. - void minimum (CONTAINER &container, - KEY *&key_to_remove, - VALUE *&value_to_remove); - - /// The cleanup strategy which can be used to destroy the entries of - /// the container. - CLEANUP_STRATEGY *cleanup_strategy_; - - /// Whether the cleanup_strategy should be destroyed or not. - bool delete_cleanup_strategy_; -}; - -/** - * @class ACE_Recyclable_Handler_Caching_Utility - * - * @brief Defines a helper class for the Caching Strategies. - * - * This class defines the methods commonly used by the different - * caching strategies. For instance: method which - * decides and purges the entry from the container. @note This - * class helps in the caching_strategies using a container - * containing entries of kind. The attributes - * helps in deciding the entries to be purged. The - * Cleanup_Strategy is the callback class to which the entries to - * be cleaned up will be delegated. - */ -template -class ACE_Recyclable_Handler_Caching_Utility : private ACE_Copy_Disabled -{ - -public: - - typedef ACE_Recyclable_Handler_Cleanup_Strategy CLEANUP_STRATEGY; - typedef ACE_Cleanup_Strategy CLEANUP_STRATEGY_BASE; - - /// Constructor. - ACE_Recyclable_Handler_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy = 0, - bool delete_cleanup_strategy = false); - - /// Destructor. - ~ACE_Recyclable_Handler_Caching_Utility (void); - - /** - * Purge entries from the . The Cleanup_Strategy will do - * the actual job of cleanup once the entries to be cleaned up are - * decided. - */ - int clear_cache (CONTAINER &container, - double purge_percent); - -protected: - - /// Find the entry with minimum caching attributes. - void minimum (CONTAINER &container, - KEY *&key_to_remove, - VALUE *&value_to_remove); - - /// This is the default Cleanup Strategy for this utility. - CLEANUP_STRATEGY_BASE *cleanup_strategy_; - - /// Whether the cleanup_strategy should be destroyed or not. - bool delete_cleanup_strategy_; -}; - -/** - * @class ACE_Refcounted_Recyclable_Handler_Caching_Utility - * - * @brief Defines a helper class for the Caching Strategies. - * - * This class defines the methods commonly used by the different - * caching strategies. For instance: clear_cache () method which - * decides and purges the entry from the container. @note This - * class helps in the caching_strategies using a container - * containing entries of kind. The attributes helps in - * deciding the entries to be purged. The Cleanup_Strategy is the - * callback class to which the entries to be cleaned up will be - * delegated. - */ -template -class ACE_Refcounted_Recyclable_Handler_Caching_Utility : private ACE_Copy_Disabled -{ -public: - typedef ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy CLEANUP_STRATEGY; - typedef ACE_Cleanup_Strategy CLEANUP_STRATEGY_BASE; - - /// Constructor. - ACE_Refcounted_Recyclable_Handler_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy = 0, - bool delete_cleanup_strategy = false); - - /// Destructor. - ~ACE_Refcounted_Recyclable_Handler_Caching_Utility (void); - - /** - * Purge entries from the . The Cleanup_Strategy will do - * the actual job of cleanup once the entries to be cleaned up are - * decided. - */ - int clear_cache (CONTAINER &container, - double purge_percent); - -protected: - - /// Find the entry with minimum caching attributes. - void minimum (CONTAINER &container, - KEY *&key_to_remove, - VALUE *&value_to_remove); - - /// This is the default Cleanup Strategy for this utility. - CLEANUP_STRATEGY_BASE *cleanup_strategy_; - - /// Whether the cleanup_strategy should be destroyed or not. - bool delete_cleanup_strategy_; - - /** - * This figure denotes the number of entries are there in the - * container which have been marked as closed already but might - * not have been unbound from the container. - */ - size_t marked_as_closed_entries_; -}; - -/** - * @class ACE_Handler_Caching_Utility - * - * @brief Defines a helper class for the Caching Strategies. - * - * This class defines the methods commonly used by the different - * caching strategies. For instance: method which - * decides and purges the entry from the container. @note This - * class helps in the caching_strategies using a container - * containing entries of kind where the HANDLER - * contains the caching attributes which help in deciding the - * entries to be purged. The Cleanup_Strategy is the callback - * class to which the entries to be cleaned up will be delegated. - */ -template -class ACE_Handler_Caching_Utility : private ACE_Copy_Disabled -{ -public: - - typedef ACE_Handler_Cleanup_Strategy CLEANUP_STRATEGY; - typedef ACE_Cleanup_Strategy CLEANUP_STRATEGY_BASE; - - /// Constructor. - ACE_Handler_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy = 0, - bool delete_cleanup_strategy = false); - - /// Destructor. - ~ACE_Handler_Caching_Utility (void); - - /** - * Purge entries from the . The Cleanup_Strategy will do - * the actual job of cleanup once the entries to be cleaned up are - * decided. - */ - int clear_cache (CONTAINER &container, - double purge_percent); - -protected: - - /** - * Find the entry with minimum caching attributes. This is handler - * specific since this utility is to be used very specifically for - * handler who have caching_attributes for server side acched - * connection management. - */ - void minimum (CONTAINER &container, - KEY *&key_to_remove, - VALUE *&value_to_remove); - - /// The cleanup strategy which can be used to destroy the entries of - /// the container. - CLEANUP_STRATEGY_BASE *cleanup_strategy_; - - /// Whether the cleanup_strategy should be destroyed or not. - bool delete_cleanup_strategy_; -}; - -/** - * @class ACE_Null_Caching_Utility - * - * @brief Defines a dummy helper class for the Caching Strategies. - * - * This class defines the methods commonly used by the different - * caching strategies. For instance: method which - * decides and purges the entry from the container. @note This - * class is be used with the Null_Caching_Strategy. The - * Cleanup_Strategy is the callback class to which the entries to - * be cleaned up will be delegated. - */ -template -class ACE_Null_Caching_Utility : private ACE_Copy_Disabled -{ -public: - - typedef ACE_Null_Cleanup_Strategy CLEANUP_STRATEGY; - typedef ACE_Cleanup_Strategy CLEANUP_STRATEGY_BASE; - - /// Constructor. - ACE_Null_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy = 0, - bool delete_cleanup_strategy = false); - - /// Destructor. - ~ACE_Null_Caching_Utility (void); - - /** - * Purge entries from the . The Cleanup_Strategy will do - * the actual job of cleanup once the entries to be cleaned up are - * decided. @note Here it is a no-op. - */ - int clear_cache (CONTAINER &container, - double purge_percent); - -protected: - - /** - * Find the entry with minimum caching attributes. This is handler - * specific since this utility is to be used very specifically for - * handler who have caching_attributes for server side acched - * connection management.@note Here it is a no-op. - */ - void minimum (CONTAINER &container, - KEY *&key_to_remove, - VALUE *&value_to_remove); - - /// The cleanup strategy which can be used to destroy the entries of - /// the container. - CLEANUP_STRATEGY_BASE *cleanup_strategy_; - - /// Whether the cleanup_strategy should be destroyed or not. - bool delete_cleanup_strategy_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Caching_Utility_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Caching_Utility_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_CACHING_UTILITY_H */ diff --git a/dep/acelite/ace/Capabilities.cpp b/dep/acelite/ace/Capabilities.cpp deleted file mode 100644 index 7533f15f0d2..00000000000 --- a/dep/acelite/ace/Capabilities.cpp +++ /dev/null @@ -1,352 +0,0 @@ -// $Id: Capabilities.cpp 91287 2010-08-05 10:30:49Z johnnyw $ - -#include "ace/Capabilities.h" -#include "ace/OS_NS_ctype.h" -#include "ace/OS_Memory.h" -#include "ace/OS_NS_string.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Capabilities.inl" -#endif /* !__ACE_INLINE__ */ - -#include "ace/OS_NS_stdio.h" - -#define ACE_ESC ((ACE_TCHAR)0x1b) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_CapEntry::~ACE_CapEntry (void) -{ -} - -ACE_Capabilities::ACE_Capabilities (void) - : caps_ () -{ -} - -ACE_Capabilities::~ACE_Capabilities (void) -{ - this->resetcaps (); -} - -const ACE_TCHAR * -ACE_Capabilities::parse (const ACE_TCHAR *buf, ACE_TString &cap) -{ - while (*buf != ACE_TEXT ('\0') && *buf != ACE_TEXT (',')) - { - if (*buf == ACE_TEXT ('\\')) - { - ++buf; - if (*buf == ACE_TEXT ('E') || *buf == ACE_TEXT ('e')) - { - cap += ACE_ESC; - ++buf; - continue; - } - else if (*buf == ACE_TEXT ('r')) - { - cap += ACE_TEXT ('\r'); - ++buf; - continue; - } - else if (*buf == ACE_TEXT ('n')) - { - cap += ACE_TEXT ('\n'); - ++buf; - continue; - } - else if (*buf == ACE_TEXT ('t')) - { - cap += ACE_TEXT ('\t'); - ++buf; - continue; - } - else if (*buf == ACE_TEXT ('\\')) - { - cap += *buf++; - continue; - } - if (ACE_OS::ace_isdigit(*buf)) - { - // @@ UNICODE Does this work with unicode? - int oc = 0; - for (int i = 0; - i < 3 && *buf && ACE_OS::ace_isdigit (*buf); - i++) - oc = oc * 8 + (*buf++ - ACE_TEXT ('0')); - - cap += (ACE_TCHAR) oc; - continue; - } - } - cap += *buf++; - } - return buf; -} - -const ACE_TCHAR * -ACE_Capabilities::parse (const ACE_TCHAR *buf, int &cap) -{ - int n = 0; - - while (*buf && ACE_OS::ace_isdigit (*buf)) - n = n * 10 + (*buf++ - ACE_TEXT ('0')); - - cap = n; - - return buf; -} - -void -ACE_Capabilities::resetcaps (void) -{ - for (CAPABILITIES_MAP::ITERATOR iter (this->caps_); - !iter.done (); - iter.advance ()) - { - CAPABILITIES_MAP::ENTRY *entry = 0; - iter.next (entry); - delete entry->int_id_; - } - - this->caps_.close (); - this->caps_.open (); -} - -int -ACE_Capabilities::fillent (const ACE_TCHAR *buf) -{ - this->resetcaps (); - while (*buf) - { - ACE_TString s; - int n; - ACE_TString name; - ACE_CapEntry *ce; - - // Skip blanks - while (*buf && ACE_OS::ace_isspace(*buf)) buf++; - // If we get end of line return - - if (*buf == ACE_TEXT ('\0')) - break; - - if (*buf == ACE_TEXT ('#')) - { - while (*buf && *buf != ACE_TEXT ('\n')) - buf++; - if (*buf == ACE_TEXT ('\n')) - buf++; - continue; - } - while(*buf && *buf != ACE_TEXT ('=') - && *buf!= ACE_TEXT ('#') - && *buf != ACE_TEXT (',')) - name += *buf++; - - // If name is null. - switch (*buf) - { - case ACE_TEXT ('='): - // String property - buf = this->parse (buf + 1, s); - ACE_NEW_RETURN (ce, - ACE_StringCapEntry (s), - -1); - if (this->caps_.bind (name, ce) == -1) - { - delete ce; - return -1; - } - break; - case ACE_TEXT ('#'): - // Integer property - buf = this->parse (buf + 1, n); - ACE_NEW_RETURN (ce, - ACE_IntCapEntry (n), - -1); - if (this->caps_.bind (name, ce) == -1) - { - delete ce; - return -1; - } - break; - case ACE_TEXT (','): - // Boolean - ACE_NEW_RETURN (ce, - ACE_BoolCapEntry (1), - -1); - if (this->caps_.bind (name, ce) == -1) - { - delete ce; - return -1; - } - break; - default: - return 0; - } - - if (*buf++ != ACE_TEXT (',')) - return -1; - } - - return 0; -} - -int -ACE_Capabilities::is_entry (const ACE_TCHAR *name, const ACE_TCHAR *line) -{ - for (;;) - { - // Skip blanks or irrelevant characters - while (*line && ACE_OS::ace_isspace(*line)) - ++line; - - // End of line reached - if (*line == ACE_TEXT ('\0')) - break; - - // Build the entry name - ACE_TString nextname; - while (*line && *line != ACE_TEXT ('|') && *line != ACE_TEXT (',')) - nextname += *line++; - - // We have found the required entry? - if (ACE_OS::strcmp (nextname.c_str (), name) == 0) - return 1; - - // Skip puntuaction char if neccesary. - if (*line == ACE_TEXT ('|') || *line == ACE_TEXT (',')) - ++line; - else - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("Invalid entry\n"))); - break; - } - } - return 0; -} - -int -ACE_Capabilities::getline (FILE *fp, ACE_TString &line) -{ - int ch; - - line.set (0, 0); - - while ((ch = ACE_OS::fgetc (fp)) != EOF && ch != ACE_TEXT ('\n')) - line += (ACE_TCHAR) ch; - - if (ch == EOF && line.length () == 0) - return -1; - else - return 0; -} - -int -ACE_Capabilities::getval (const ACE_TCHAR *keyname, ACE_TString &val) -{ - ACE_CapEntry* cap = 0; - if (this->caps_.find (keyname, cap) == -1) - return -1; - - ACE_StringCapEntry *scap = - dynamic_cast (cap); - if (scap == 0) - return -1; - - val = scap->getval (); - return 0; -} - -int -ACE_Capabilities::getval (const ACE_TCHAR *keyname, int &val) -{ - ACE_CapEntry *cap = 0; - if (this->caps_.find (keyname, cap) == -1) - return -1; - - ACE_IntCapEntry *icap = - dynamic_cast (cap); - if (icap != 0) - { - val = icap->getval (); - return 0; - } - - ACE_BoolCapEntry *bcap = - dynamic_cast (cap); - - if (bcap == 0) - return -1; - - val = bcap->getval (); - return 0; -} - -#if !defined (ACE_IS_SPLITTING) -static int -is_empty (const ACE_TCHAR *line) -{ - while (*line && ACE_OS::ace_isspace (*line)) - ++line; - - return *line == ACE_TEXT ('\0') || *line == ACE_TEXT ('#'); -} - -static int -is_line (const ACE_TCHAR *line) -{ - while (*line && ACE_OS::ace_isspace (*line)) - ++line; - - return *line != ACE_TEXT ('\0'); -} -#endif /* !ACE_IS_SPLITTING */ - -int -ACE_Capabilities::getent (const ACE_TCHAR *fname, const ACE_TCHAR *name) -{ - FILE *fp = ACE_OS::fopen (fname, ACE_TEXT ("r")); - - if (fp == 0) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("Can't open %s file\n"), - fname), - -1); - - int done; - ACE_TString line; - - while (0 == (done = (this->getline (fp, line) == -1)) - && is_empty (line.c_str ())) - continue; - - while (!done) - { - ACE_TString newline; - ACE_TString description; - - while (0 == (done = (this->getline (fp, newline) == -1))) - if (is_line (newline.c_str ())) - description += newline; - else - break; - - if (this->is_entry (name, line.c_str())) - { - ACE_OS::fclose (fp); - return this->fillent (description.c_str ()); - } - - line = newline; - while (!done && is_empty (line.c_str ())) - done = this->getline (fp, line) == -1; - } - - ACE_OS::fclose (fp); - return -1; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Capabilities.h b/dep/acelite/ace/Capabilities.h deleted file mode 100644 index f4c8b5cc6fb..00000000000 --- a/dep/acelite/ace/Capabilities.h +++ /dev/null @@ -1,221 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Capabilities.h - * - * $Id: Capabilities.h 91077 2010-07-13 14:33:08Z johnnyw $ - * - * @author Arturo Montes - */ -//============================================================================= - - -#ifndef ACE_CAPABILITIES_H -#define ACE_CAPABILITIES_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Null_Mutex.h" -#include "ace/Hash_Map_Manager_T.h" -#include "ace/Containers.h" -#include "ace/SString.h" -#include "ace/Functor_String.h" - -#if defined (ACE_IS_SPLITTING) -# include "ace/OS_NS_ctype.h" -#endif /* ACE_IS_SPLITTING */ - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_CapEntry - * - * @brief This class is the base class for all ACE Capabilities entry - * subclasses. - * - * This class is not instantiable and does not provide accessors - * or methods. If you want to add a new kind of attribute subclass - * this class and dynamic_cast to proper subclass. - */ -class ACE_Export ACE_CapEntry -{ -public: - - virtual ~ACE_CapEntry (void); - -protected: - - enum - { - ACE_INTCAP = 0, - ACE_STRINGCAP = 1, - ACE_BOOLCAP = 2 - }; - - ACE_CapEntry (int captype); - -protected: - - int captype_; - -}; - -/** - * @class ACE_IntCapEntry - * - * @brief This class implement the ACE Integer Capability subclass. - * - * This is a container class for ACE Capabilities integer container - * values. - */ -class ACE_Export ACE_IntCapEntry : public ACE_CapEntry -{ -public: - ACE_IntCapEntry (int val); - int getval (void) const; - -protected: - int val_; -}; - -/** - * @class ACE_StringCapEntry - * - * @brief This class implement the ACE String Capability subclass. - * - * This is a container class for ACE Capabilities String container - * values. - */ -class ACE_Export ACE_StringCapEntry : public ACE_CapEntry -{ -public: - ACE_StringCapEntry (const ACE_TString &val); - ACE_TString getval (void) const; - -protected: - ACE_TString val_; -}; - -/** - * @class ACE_BoolCapEntry - * - * @brief This class implement the ACE Bool Capability subclass. - * - * This is a container class for ACE Capabilities bool container - * values. - */ -class ACE_Export ACE_BoolCapEntry : public ACE_CapEntry -{ -public: - ACE_BoolCapEntry (int val); - int getval (void) const; - -protected: - int val_; -}; - -/** - * @class ACE_Capabilities - * - * @brief - * This class implement the ACE Capabilities. - * - * This is a container class for ACE Capabilities - * values. Currently exist three different capability values: - * ACE_IntCapEntry (integer), ACE_BoolCapEntry (bool) and - * ACE_StringCapEntry (String). An ACE_Capabilities is a - * unordered set of pair = (String, ACE_CapEntry *). Where - * the first component is the name of capability and the second - * component is a pointer to the capability value container. A - * FILE is a container for ACE_Capabilities, the - * ACE_Capabilities has a name in the file, as a termcap file. - */ -class ACE_Export ACE_Capabilities -{ -public: - - typedef ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_Null_Mutex> CAPABILITIES_MAP; - - /// The Constructor - ACE_Capabilities (void); - - /// The Destructor - ~ACE_Capabilities(void); - -public: - - /// Get a string entry. - int getval (const ACE_TCHAR *ent, ACE_TString &val); - - /// Get an integer entry. - int getval (const ACE_TCHAR *ent, int &val); - - /// Get the ACE_Capabilities name from FILE fname and load the - /// associated capabitily entries in map. - int getent (const ACE_TCHAR *fname, const ACE_TCHAR *name); - -protected: - - /// Parse an integer property - const ACE_TCHAR *parse (const ACE_TCHAR *buf, int &cap); - - /// Parse a string property - const ACE_TCHAR *parse (const ACE_TCHAR *buf, ACE_TString &cap); - - /// Fill the ACE_Capabilities with description in ent. - int fillent(const ACE_TCHAR *ent); - - /// Parse a cap entry - int parseent (const ACE_TCHAR *name, ACE_TCHAR *line); - - /// Get a line from FILE input stream - int getline (FILE* fp, - ACE_TString &line); - - /// Is a valid entry - int is_entry (const ACE_TCHAR *name, const ACE_TCHAR *line); - - /// Reset the set of capabilities - void resetcaps (void); - -private: - - /// This is the set of ACE_CapEntry. - CAPABILITIES_MAP caps_; -}; - -#if defined (ACE_IS_SPLITTING) -int -is_empty (const ACE_TCHAR *line) -{ - while (*line && ACE_OS::ace_isspace (*line)) - ++line; - - return *line == ACE_TEXT ('\0') || *line == ACE_TEXT ('#'); -} - -int -is_line (const ACE_TCHAR *line) -{ - while (*line && ACE_OS::ace_isspace (*line)) - ++line; - - return *line != ACE_TEXT ('\0'); -} -#endif /* ACE_IS_SPLITTING */ - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Capabilities.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* __ACE_CAPABILITIES_H__ */ diff --git a/dep/acelite/ace/Capabilities.inl b/dep/acelite/ace/Capabilities.inl deleted file mode 100644 index 37284b28696..00000000000 --- a/dep/acelite/ace/Capabilities.inl +++ /dev/null @@ -1,52 +0,0 @@ -// -*- C++ -*- -// -// $Id: Capabilities.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_CapEntry::ACE_CapEntry (int captype) - : captype_ (captype) -{ -} - -ACE_INLINE -ACE_IntCapEntry::ACE_IntCapEntry (int val) - : ACE_CapEntry (ACE_INTCAP), - val_ (val) -{ -} - -ACE_INLINE int -ACE_IntCapEntry::getval (void) const -{ - return val_; -} - -ACE_INLINE -ACE_StringCapEntry::ACE_StringCapEntry (const ACE_TString &val) - : ACE_CapEntry (ACE_STRINGCAP), - val_ (val) -{ -} - -ACE_INLINE ACE_TString -ACE_StringCapEntry::getval (void) const -{ - return val_; -} - -ACE_INLINE -ACE_BoolCapEntry::ACE_BoolCapEntry (int val) - : ACE_CapEntry (ACE_BOOLCAP), - val_(val) -{ -} - -ACE_INLINE int -ACE_BoolCapEntry::getval (void) const -{ - return val_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Cleanup.cpp b/dep/acelite/ace/Cleanup.cpp deleted file mode 100644 index 1d5fe99f0c1..00000000000 --- a/dep/acelite/ace/Cleanup.cpp +++ /dev/null @@ -1,177 +0,0 @@ -// $Id: Cleanup.cpp 91368 2010-08-16 13:03:34Z mhengstmengel $ - -#include "ace/Cleanup.h" - -#if !defined (ACE_HAS_INLINED_OSCALLS) -# include "ace/Cleanup.inl" -#endif /* ACE_HAS_INLINED_OSCALLS */ - -#include "ace/OS_Memory.h" -#include "ace/OS_NS_string.h" -#include "ace/os_include/os_typeinfo.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -void -ACE_Cleanup::cleanup (void *) -{ - delete this; -} - -ACE_Cleanup::~ACE_Cleanup (void) -{ -} - -/*****************************************************************************/ - -extern "C" void -ACE_CLEANUP_DESTROYER_NAME (ACE_Cleanup *object, void *param) -{ - object->cleanup (param); -} - -/*****************************************************************************/ - -ACE_Cleanup_Info_Node::ACE_Cleanup_Info_Node (void) - : object_ (0), - cleanup_hook_ (0), - param_ (0), - name_ (0) -{ -} - -ACE_Cleanup_Info_Node::ACE_Cleanup_Info_Node (void *object, - ACE_CLEANUP_FUNC cleanup_hook, - void *param, - const char *name) - : object_ (object), - cleanup_hook_ (cleanup_hook), - param_ (param), - name_ (name ? ACE_OS::strdup (name) : 0) -{ -} - -ACE_Cleanup_Info_Node::~ACE_Cleanup_Info_Node (void) -{ - if (this->name_) - ACE_OS::free ((void *) name_); -} - -bool -ACE_Cleanup_Info_Node::operator== (const ACE_Cleanup_Info_Node &o) const -{ - return o.object_ == this->object_ - && o.cleanup_hook_ == this->cleanup_hook_ - && o.param_ == this->param_; -} - -bool -ACE_Cleanup_Info_Node::operator!= (const ACE_Cleanup_Info_Node &o) const -{ - return !(*this == o); -} - - -/*****************************************************************************/ - -ACE_OS_Exit_Info::ACE_OS_Exit_Info (void) -{ -} - -ACE_OS_Exit_Info::~ACE_OS_Exit_Info (void) -{ -} - -int -ACE_OS_Exit_Info::at_exit_i (void *object, - ACE_CLEANUP_FUNC cleanup_hook, - void *param, - const char* name) -{ - // Return -1 and sets errno if unable to allocate storage. Enqueue - // at the head and dequeue from the head to get LIFO ordering. - ACE_Cleanup_Info_Node *new_node = 0; - - ACE_NEW_RETURN (new_node, - ACE_Cleanup_Info_Node (object, cleanup_hook, param, name), - -1); - - registered_objects_.push_front (new_node); - - return 0; -} - -bool -ACE_OS_Exit_Info::find (void *object) -{ - for (ACE_Cleanup_Info_Node *iter = registered_objects_.head (); - iter != 0; - iter = iter->next ()) - { - if (iter->object () == object) - { - // The object has already been registered. - return true; - } - } - - return false; -} - -bool -ACE_OS_Exit_Info::remove (void *object) -{ - ACE_Cleanup_Info_Node *node = 0; - for (ACE_Cleanup_Info_Node *iter = registered_objects_.head (); - iter != 0; - iter = iter->next ()) - { - if (iter->object () == object) - { - node = iter; - break; - } - } - - if (node) - { - registered_objects_.remove (node); - delete node; - return true; - } - - return false; -} - - -void -ACE_OS_Exit_Info::call_hooks (void) -{ - // Call all registered cleanup hooks, in reverse order of - // registration. - for (ACE_Cleanup_Info_Node *iter = registered_objects_.pop_front (); - iter != 0; - iter = registered_objects_.pop_front ()) - { - if (iter->cleanup_hook () == reinterpret_cast ( - ACE_CLEANUP_DESTROYER_NAME)) - { - // The object is an ACE_Cleanup. - ACE_CLEANUP_DESTROYER_NAME ( - reinterpret_cast (iter->object ()), - iter->param ()); - } - else if (iter->object () == &ace_exit_hook_marker) - { - // The hook is an ACE_EXIT_HOOK. - (* reinterpret_cast (iter->cleanup_hook ())) (); - } - else - { - (*iter->cleanup_hook ()) (iter->object (), iter->param ()); - } - delete iter; - } -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Cleanup.h b/dep/acelite/ace/Cleanup.h deleted file mode 100644 index bd750724fb3..00000000000 --- a/dep/acelite/ace/Cleanup.h +++ /dev/null @@ -1,160 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Cleanup.h - * - * $Id: Cleanup.h 84163 2009-01-15 07:57:27Z johnnyw $ - * - * @author Douglas C. Schmidt - * @author Jesper S. M|ller - * @author and a cast of thousands... - * - * Originally in OS.h. - */ -//============================================================================= - -#ifndef ACE_CLEANUP_H -# define ACE_CLEANUP_H - -# include /**/ "ace/pre.h" - -# include "ace/config-lite.h" - -# if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -# endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include /**/ "ace/ACE_export.h" - -# include "ace/Intrusive_List.h" -# include "ace/Intrusive_List_Node.h" - -#if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1) -# include "ace/Global_Macros.h" -# define ACE_CLEANUP_DESTROYER_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ace_cleanup_destroyer) -#else -# define ACE_CLEANUP_DESTROYER_NAME ace_cleanup_destroyer -#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Cleanup - * - * @brief Base class for objects that are cleaned by ACE_Object_Manager. - */ -class ACE_Export ACE_Cleanup -{ -public: - /// No-op constructor. - ACE_Cleanup (void); - - /// Destructor. - virtual ~ACE_Cleanup (void); - - /// Cleanup method that, by default, simply deletes itself. - virtual void cleanup (void *param = 0); -}; - -/// Adapter for cleanup, used by ACE_Object_Manager. -extern "C" ACE_Export -void ACE_CLEANUP_DESTROYER_NAME (ACE_Cleanup *, void *param = 0); - -/** - * @class ACE_Cleanup_Info_Node - * - * @brief For maintaining a list of ACE_Cleanup_Info items. - * - * For internal use by ACE_Object_Manager. - */ -class ACE_Cleanup_Info_Node : public ACE_Intrusive_List_Node -{ -public: - ACE_Cleanup_Info_Node (void); - ACE_Cleanup_Info_Node (void *object, - ACE_CLEANUP_FUNC cleanup_hook, - void *param, - const char *name); - ~ACE_Cleanup_Info_Node (void); - - /// Equality operator. - bool operator== (const ACE_Cleanup_Info_Node &o) const; - - /// Inequality operator. - bool operator!= (const ACE_Cleanup_Info_Node &o) const; - - void* object(void); - - ACE_CLEANUP_FUNC cleanup_hook (void); - - void *param (void); -private: - /// Point to object that gets passed into the . - void *object_; - - /// Cleanup hook that gets called back. - ACE_CLEANUP_FUNC cleanup_hook_; - - /// Parameter passed to the . - void *param_; - - /// Name of the cleanup object - const char *name_; -}; - -typedef ACE_Intrusive_List ACE_Cleanup_Info_Node_List; - -/** - * @class ACE_OS_Exit_Info - * - * @brief Hold Object Manager cleanup (exit) information. - * - * @internal - * - * For internal use by the ACE library, only. - */ -class ACE_Export ACE_OS_Exit_Info -{ -public: - /// Default constructor. - ACE_OS_Exit_Info (void); - - /// Destructor. - ~ACE_OS_Exit_Info (void); - - /// Use to register a cleanup hook. - int at_exit_i (void *object, ACE_CLEANUP_FUNC cleanup_hook, void *param, const char* name = 0); - - /// Look for a registered cleanup hook object. Returns true if already - /// registered, false if not. - bool find (void *object); - - /// Remove a registered cleanup hook object. Returns true if removed - /// false if not. - bool remove (void *object); - - /// Call all registered cleanup hooks, in reverse order of - /// registration. - void call_hooks (); - -private: - /** - * Keeps track of all registered objects. - */ - ACE_Cleanup_Info_Node_List registered_objects_; -}; - - -ACE_END_VERSIONED_NAMESPACE_DECL - -# if defined (ACE_HAS_INLINED_OSCALLS) -# if defined (ACE_INLINE) -# undef ACE_INLINE -# endif /* ACE_INLINE */ -# define ACE_INLINE inline -# include "ace/Cleanup.inl" -# endif /* ACE_HAS_INLINED_OSCALLS */ - -# include /**/ "ace/post.h" -#endif /* ACE_CLEANUP_H */ diff --git a/dep/acelite/ace/Cleanup.inl b/dep/acelite/ace/Cleanup.inl deleted file mode 100644 index 196a9f4788f..00000000000 --- a/dep/acelite/ace/Cleanup.inl +++ /dev/null @@ -1,30 +0,0 @@ -// -*- C++ -*- -// -// $Id: Cleanup.inl 83956 2008-12-03 07:57:38Z johnnyw $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Cleanup::ACE_Cleanup (void) -{ -} - -ACE_INLINE void* -ACE_Cleanup_Info_Node::object(void) -{ - return this->object_; -} - -ACE_INLINE ACE_CLEANUP_FUNC -ACE_Cleanup_Info_Node::cleanup_hook (void) -{ - return this->cleanup_hook_; -} - -ACE_INLINE void * -ACE_Cleanup_Info_Node::param (void) -{ - return this->param_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Cleanup_Strategies_T.cpp b/dep/acelite/ace/Cleanup_Strategies_T.cpp deleted file mode 100644 index 7ce542e2843..00000000000 --- a/dep/acelite/ace/Cleanup_Strategies_T.cpp +++ /dev/null @@ -1,95 +0,0 @@ -//$Id: Cleanup_Strategies_T.cpp 92097 2010-09-30 05:41:49Z msmit $ - -#ifndef ACE_CLEANUP_STRATEGIES_T_CPP -#define ACE_CLEANUP_STRATEGIES_T_CPP - -#include "ace/Cleanup_Strategies_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -//////////////////////////////////////////////////////////////////////////// - -template -ACE_Cleanup_Strategy::~ACE_Cleanup_Strategy (void) -{ -} - -template int -ACE_Cleanup_Strategy::cleanup (CONTAINER &container, - KEY *key, - VALUE *) -{ - return container.unbind (*key); -} - -//////////////////////////////////////////////////////////////////////////// - -template int -ACE_Recyclable_Handler_Cleanup_Strategy::cleanup ( - CONTAINER &container, - KEY *key, - VALUE *) -{ - VALUE value; - - if (container.unbind (*key, value) == -1) - return -1; - - value.first->recycler (0, 0); - - value.first->close (); - - return 0; -} - -///////////////////////////////////////////////////////////////////////////// - -template int -ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy::cleanup ( - CONTAINER &, - KEY *, - VALUE *value) -{ - return value->first ()->handle_close_i (); -} - -//////////////////////////////////////////////////////////////////////////// - -template int -ACE_Handler_Cleanup_Strategy::cleanup ( - CONTAINER &container, - KEY *key, - VALUE *value) -{ - // Remove the item from cache only if the handler isnt in use. - if ((*value)->active () == 0) - { - (*value)->close (); - - if (container.unbind (*key) == -1) - return -1; - - } - - return 0; -} - -//////////////////////////////////////////////////////////////////////////// - -template int -ACE_Null_Cleanup_Strategy::cleanup (CONTAINER &, - KEY *, - VALUE *) -{ - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_CLEANUP_STRATEGIES_T_CPP */ diff --git a/dep/acelite/ace/Cleanup_Strategies_T.h b/dep/acelite/ace/Cleanup_Strategies_T.h deleted file mode 100644 index ca51b47b10f..00000000000 --- a/dep/acelite/ace/Cleanup_Strategies_T.h +++ /dev/null @@ -1,149 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Cleanup_Strategies_T.h - * - * $Id: Cleanup_Strategies_T.h 81388 2008-04-23 14:02:05Z johnnyw $ - * - * @author Kirthika Parameswaran - */ -//============================================================================= - - -#ifndef CLEANUP_STRATEGIES_H -#define CLEANUP_STRATEGIES_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// For linkers that cant grok long names. -#define ACE_Cleanup_Strategy ACLE - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Cleanup_Strategy - * - * @brief Defines a default strategy to be followed for cleaning up - * entries from a map which is the container. - * - * By default the entry to be cleaned up is removed from the - * container. - */ -template -class ACE_Cleanup_Strategy -{ - -public: - - /// Destructor. - virtual ~ACE_Cleanup_Strategy (void); - - /// The method which will do the cleanup of the entry in the container. - virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value); -}; - -////////////////////////////////////////////////////////////////////// -#define ACE_Recyclable_Handler_Cleanup_Strategy ARHCLE - -/** - * @class ACE_Recyclable_Handler_Cleanup_Strategy - * - * @brief Defines a strategy to be followed for cleaning up - * entries which are svc_handlers from a container. - * - * The entry to be cleaned up is removed from the container. - * Here, since we are dealing with svc_handlers specifically, we - * perform a couple of extra operations. @note To be used when - * the handler is recyclable. - */ -template -class ACE_Recyclable_Handler_Cleanup_Strategy : public ACE_Cleanup_Strategy -{ - -public: - - /// The method which will do the cleanup of the entry in the container. - virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value); -}; - -////////////////////////////////////////////////////////////////////// -#define ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy ARRHCLE - -/** - * @class ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy - * - * @brief Defines a strategy to be followed for cleaning up - * entries which are svc_handlers from a container. - * - * The entry to be cleaned up is removed from the container. - * Here, since we are dealing with recyclable svc_handlers with - * addresses which are refcountable specifically, we perform a - * couple of extra operations and do so without any locking. - */ -template -class ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy : public ACE_Cleanup_Strategy -{ -public: - /// The method which will do the cleanup of the entry in the container. - virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value); -}; - -////////////////////////////////////////////////////////////////////// - -/** - * @class ACE_Handler_Cleanup_Strategy - * - * @brief Defines a strategy to be followed for cleaning up - * entries which are svc_handlers from a container. - * - * The entry to be cleaned up is removed from the container. - * Here, since we are dealing with svc_handlers specifically, we - * perform a couple of extra operations. @note This cleanup strategy - * should be used in the case when the handler has the caching - * attributes. - */ -template -class ACE_Handler_Cleanup_Strategy : public ACE_Cleanup_Strategy -{ -public: - /// The method which will do the cleanup of the entry in the container. - virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value); -}; - -////////////////////////////////////////////////////////////////////// -#define ACE_Null_Cleanup_Strategy ANCLE - -/** - * @class ACE_Null_Cleanup_Strategy - * - * @brief Defines a do-nothing implementation of the cleanup strategy. - * - * This class simply does nothing at all! Can be used to nullify - * the effect of the Cleanup Strategy. - */ -template -class ACE_Null_Cleanup_Strategy : public ACE_Cleanup_Strategy -{ -public: - /// The dummy cleanup method. - virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Cleanup_Strategies_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Cleanup_Strategies_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* CLEANUP_STRATEGIES_H */ diff --git a/dep/acelite/ace/Codecs.cpp b/dep/acelite/ace/Codecs.cpp deleted file mode 100644 index f7107114aed..00000000000 --- a/dep/acelite/ace/Codecs.cpp +++ /dev/null @@ -1,232 +0,0 @@ -// $Id: Codecs.cpp 91813 2010-09-17 07:52:52Z johnnyw $ - -#include "ace/Codecs.h" -#include "ace/Log_Msg.h" -#include "ace/OS_Memory.h" -#include "ace/OS_NS_ctype.h" - -namespace -{ - // Just in case ... -#undef alphabet -#undef pad -#undef max_columns - - // Symbols which form the Base64 alphabet (Defined as per RFC 2045) - ACE_Byte const alphabet[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - - // The padding character used in the encoding - ACE_Byte const pad = '='; - - // Number of columns per line of encoded output (Can have a maximum - // value of 76). - int const max_columns = 72; -} - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -bool ACE_Base64::init_ = false; - -ACE_Byte ACE_Base64::decoder_[256]; - -ACE_Byte ACE_Base64::member_[256]; - -ACE_Byte* -ACE_Base64::encode (const ACE_Byte* input, - const size_t input_len, - size_t* output_len, - bool is_chunked) -{ - if (!ACE_Base64::init_) - ACE_Base64::init(); - - if (!input) - return 0; - - ACE_Byte* result = 0; - - size_t length = ((input_len + 2) / 3) * 4; - size_t num_lines = length / max_columns + 1; - length += num_lines + 1; - ACE_NEW_RETURN (result, ACE_Byte[length], 0); - - int char_count = 0; - int bits = 0; - size_t pos = 0; - int cols = 0; - - for (size_t i = 0; i < input_len; ++i) - { - bits += input[i]; - ++char_count; - - if (char_count == 3) - { - result[pos++] = alphabet[bits >> 18]; - result[pos++] = alphabet[(bits >> 12) & 0x3f]; - result[pos++] = alphabet[(bits >> 6) & 0x3f]; - result[pos++] = alphabet[bits & 0x3f]; - cols += 4; - if (cols == max_columns) { - if (is_chunked) - result[pos++] = '\n'; - cols = 0; - } - bits = 0; - char_count = 0; - } - else - { - bits <<= 8; - } - } - - if (char_count != 0) - { - bits <<= (16 - (8 * char_count)); - result[pos++] = alphabet[bits >> 18]; - result[pos++] = alphabet[(bits >> 12) & 0x3f]; - cols += 2; - if (char_count == 1) - { - result[pos++] = pad; - result[pos++] = pad; - cols += 2; - } - else - { - result[pos++] = alphabet[(bits >> 6) & 0x3f]; - result[pos++] = pad; - cols += 2; - } - } - - if (cols > 0 && is_chunked) - result[pos++] = '\n'; - - result[pos] = 0; - *output_len = pos; - return result; -} - -size_t -ACE_Base64::length (const ACE_Byte* input) -{ - if (!ACE_Base64::init_) - ACE_Base64::init(); - - ACE_Byte* ptr = const_cast (input); - while (*ptr != 0 && - (member_[*(ptr)] == 1 || *ptr == pad - || ACE_OS::ace_isspace (*ptr))) - ++ptr; - size_t len = ptr - input; - len = ((len + 3) / 4) * 3 + 1 ; - return len; -} - -ACE_Byte* -ACE_Base64::decode (const ACE_Byte* input, size_t* output_len) -{ - if (!ACE_Base64::init_) - ACE_Base64::init(); - - if (!input) - return 0; - - size_t result_len = ACE_Base64::length (input); - ACE_Byte* result = 0; - ACE_NEW_RETURN (result, ACE_Byte[result_len], 0); - - ACE_Byte* ptr = const_cast (input); - while (*ptr != 0 && - (member_[*(ptr)] == 1 || *ptr == pad - || ACE_OS::ace_isspace (*ptr))) - ++ptr; - size_t input_len = ptr - input; - - int char_count = 0; - int bits = 0; - size_t pos = 0; - - size_t i = 0; - for (; i < input_len; ++i) - { - if (input[i] == pad) - break; - if (!ACE_Base64::member_[input[i]]) - continue; - bits += decoder_[input[i]]; - ++char_count; - - if (char_count == 4) - { - result[pos++] = static_cast (bits >> 16); - result[pos++] = static_cast ((bits >> 8) & 0xff); - result[pos++] = static_cast (bits & 0xff); - bits = 0; - char_count = 0; - } - else - { - bits <<= 6; - } - } - - int errors = 0; - if ( i == input_len) - { - if (char_count) - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Decoding incomplete: atleast %d bits truncated\n"), - (4 - char_count) * 6)); - ++errors; - } - } - else - { - switch (char_count) - { - case 1: - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Decoding incomplete: atleast 2 bits missing\n"))); - ++errors; - break; - case 2: - result[pos++] = static_cast (bits >> 10); - break; - case 3: - result[pos++] = static_cast (bits >> 16); - result[pos++] = static_cast ((bits >> 8) & 0xff); - break; - } - } - - if (errors) - { - delete[] result; - return 0; - } - result[pos] = 0; - *output_len = pos; - return result; -} - -void -ACE_Base64::init () -{ - if (!ACE_Base64::init_) - { - for (ACE_Byte i = 0; i < sizeof (alphabet); ++i) - { - ACE_Base64::decoder_[alphabet[i]] = i; - ACE_Base64::member_ [alphabet[i]] = 1; - } - ACE_Base64::init_ = true; - } - return; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Codecs.h b/dep/acelite/ace/Codecs.h deleted file mode 100644 index 2c4227dd0ad..00000000000 --- a/dep/acelite/ace/Codecs.h +++ /dev/null @@ -1,121 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Codecs.h - * - * $Id: Codecs.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Krishnakumar B - * - * Codecs is a generic wrapper for various encoding and decoding - * mechanisms. Currently it includes Base64 content transfer-encoding as - * specified by RFC 2045, Multipurpose Internet Mail Extensions (MIME) Part - * One: Format of Internet Message Bodies. - * - */ -//============================================================================= - -#ifndef ACE_CODECS_H -#define ACE_CODECS_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Basic_Types.h" -#include "ace/Global_Macros.h" - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Base64 - * - * @brief Encode/Decode a stream of bytes according to Base64 encoding. - * - * This class provides methods to encode or decode a stream of bytes - * to/from Base64 encoding. It doesn't convert the input stream to a - * canonical form before encoding. - * - */ -class ACE_Export ACE_Base64 -{ -public: - - //@{ - - /** - * Encodes a stream of bytes to Base64 data - * - * @param input Binary data in byte stream. - * @param input_len Length of the byte stream. - * @param output_len Length of the encoded Base64 byte stream. - * @param is_chunked If true, terminate 72 character blocks with newline - * @return Encoded Base64 data in byte stream or NULL if input data cannot - * be encoded. - */ - - static ACE_Byte* encode (const ACE_Byte* input, - const size_t input_len, - size_t* output_len, - bool is_chunked = true); - /** - * Decodes a stream of Base64 to bytes data - * - * @param input Encoded Base64 data in byte stream. - * @param output_len Length of the binary byte stream. - * @return Binary data in byte stream or NULL if input data cannot - * be encoded. - */ - static ACE_Byte* decode (const ACE_Byte* input, - size_t* output_len); - - /** - * Return the length of the encoded input data - * - * @param input Encoded Base64 data in byte stream. - * @return Length of the encoded Base64 data. - * - */ - static size_t length (const ACE_Byte* input); - - //@} - -protected: - - // Prevent default construction. - ACE_Base64 (void) {} - -private: - - // Preventing copying and assignment. - ACE_Base64 (ACE_Base64 const &); - ACE_Base64 & operator= (ACE_Base64 const &); - - /// Initialize the tables for encoding/decoding. - static void init (void); - -private: - - /// Alphabet used for decoding i.e decoder_[alphabet_[i = 0..63]] = i - static ACE_Byte decoder_[]; - - /// Alphabet used to check valid range of encoded input i.e - /// member_[alphabet_[0..63]] = 1 - static ACE_Byte member_[]; - - /// Boolean to denote whether initialization is complete - static bool init_; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_CODECS_H */ diff --git a/dep/acelite/ace/Codeset_IBM1047.cpp b/dep/acelite/ace/Codeset_IBM1047.cpp deleted file mode 100644 index 3f5bad0b7c5..00000000000 --- a/dep/acelite/ace/Codeset_IBM1047.cpp +++ /dev/null @@ -1,305 +0,0 @@ - -//============================================================================= -/** - * @file Codeset_IBM1047.cpp - * - * $Id: Codeset_IBM1047.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - * - * Defines the arrays required to convert between ISO8859 (aka - * Latin/1) and IBM1047 (aka EBCDIC). - * - * - * @author Jim Rogers (jrogers@viasoft.com) - */ -//============================================================================= - - -#include "ace/Codeset_IBM1047.h" - -#if defined (ACE_HAS_EBCDIC) - -#include "ace/OS_Memory.h" -#include "ace/OS_NS_string.h" - -namespace -{ - char const to_IBM1047[] = - { - "\x00\x01\x02\x03\x37\x2D\x2E\x2F\x16\x05\x25\x0B\x0C\x0D\x0E\x0F" // 00-0F - "\x10\x11\x12\x13\x3C\x3D\x32\x26\x18\x19\x3F\x27\x22\x1D\x35\x1F" // 10-1F - "\x40\x5A\x7F\x7B\x5B\x6C\x50\x7D\x4D\x5D\x5C\x4E\x6B\x60\x4B\x61" // 20-2F - "\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\x7A\x5E\x4C\x7E\x6E\x6F" // 30-3F - "\x7C\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xD1\xD2\xD3\xD4\xD5\xD6" // 40-4F - "\xD7\xD8\xD9\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xAD\xE0\xBD\x5F\x6D" // 50-5F - "\x79\x81\x82\x83\x84\x85\x86\x87\x88\x89\x91\x92\x93\x94\x95\x96" // 60-6F - "\x97\x98\x99\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xC0\x4F\xD0\xA1\x07" // 70-7F - "\x43\x20\x21\x1C\x23\xEB\x24\x9B\x71\x28\x38\x49\x90\xBA\xEC\xDF" // 80-8F - "\x45\x29\x2A\x9D\x72\x2B\x8A\x9A\x67\x56\x64\x4A\x53\x68\x59\x46" // 90-9F - "\xEA\xDA\x2C\xDE\x8B\x55\x41\xFE\x58\x51\x52\x48\x69\xDB\x8E\x8D" // A0-AF - "\x73\x74\x75\xFA\x15\xB0\xB1\xB3\xB4\xB5\x6A\xB7\xB8\xB9\xCC\xBC" // B0-BF - "\xAB\x3E\x3B\x0A\xBF\x8F\x3A\x14\xA0\x17\xCB\xCA\x1A\x1B\x9C\x04" // C0-CF - "\x34\xEF\x1E\x06\x08\x09\x77\x70\xBE\xBB\xAC\x54\x63\x65\x66\x62" // D0-DF - "\x30\x42\x47\x57\xEE\x33\xB6\xE1\xCD\xED\x36\x44\xCE\xCF\x31\xAA" // E0-EF - "\xFC\x9E\xAE\x8C\xDD\xDC\x39\xFB\x80\xAF\xFD\x78\x76\xB2\x9F\xFF" // F0-FF -}; - - char const from_IBM1047[] = - { - "\x00\x01\x02\x03\xCF\x09\xD3\x7F\xD4\xD5\xC3\x0B\x0C\x0D\x0E\x0F" // 00-0F - "\x10\x11\x12\x13\xC7\xB4\x08\xC9\x18\x19\xCC\xCD\x83\x1D\xD2\x1F" // 10-1F - "\x81\x82\x1C\x84\x86\x0A\x17\x1B\x89\x91\x92\x95\xA2\x05\x06\x07" // 20-2F - "\x20\xEE\x16\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\xC1\x1A" // 30-3F - "\x20\xA6\xE1\x80\xEB\x90\x9F\xE2\xAB\x8B\x9B\x2E\x3C\x28\x2B\x7C" // 40-4F - "\x26\xA9\xAA\x9C\xDB\xA5\x99\xE3\xA8\x9E\x21\x24\x2A\x29\x3B\x5E" // 50-5F - "\x2D\x2F\xDF\xDC\x9A\xDD\xDE\x98\x9D\xAC\xBA\x2C\x25\x5F\x3E\x3F" // 60-6F - "\xD7\x88\x94\xB0\xB1\xB2\xFC\xD6\xFB\x60\x3A\x23\x40\x27\x3D\x22" // 70-7F - "\xF8\x61\x62\x63\x64\x65\x66\x67\x68\x69\x96\xA4\xF3\xAF\xAE\xC5" // 80-8F - "\x8C\x6A\x6B\x6C\x6D\x6E\x6F\x70\x71\x72\x97\x87\xCE\x93\xF1\xFE" // 90-9F - "\xC8\x7E\x73\x74\x75\x76\x77\x78\x79\x7A\xEF\xC0\xDA\x5B\xF2\xF9" // A0-AF - "\xB5\xB6\xFD\xB7\xB8\xB9\xE6\xBB\xBC\xBD\x8D\xD9\xBF\x5D\xD8\xC4" // B0-BF - "\x7B\x41\x42\x43\x44\x45\x46\x47\x48\x49\xCB\xCA\xBE\xE8\xEC\xED" // C0-CF - "\x7D\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\xA1\xAD\xF5\xF4\xA3\x8F" // D0-DF - "\x5C\xE7\x53\x54\x55\x56\x57\x58\x59\x5A\xA0\x85\x8E\xE9\xE4\xD1" // E0-EF - "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\xB3\xF7\xF0\xFA\xA7\xFF" // F0-FF - }; -} - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_IBM1047_ISO8859::ACE_IBM1047_ISO8859 (void) -{ -} - -ACE_IBM1047_ISO8859::~ACE_IBM1047_ISO8859 (void) -{ -} - -ACE_CDR::ULong -ACE_IBM1047_ISO8859::ncs () -{ - return 0x10020417; -} - -ACE_CDR::ULong -ACE_IBM1047_ISO8859::tcs () -{ - return 0x00010001; -} - -ACE_CDR::Boolean -ACE_IBM1047_ISO8859::read_char (ACE_InputCDR &in, - ACE_CDR::Char &x) -{ - if (this->read_1 (in, reinterpret_cast (&x))) - { - x = to_IBM1047[x]; - return 1; - } - return 0; -} - -ACE_CDR::Boolean -ACE_IBM1047_ISO8859::read_string (ACE_InputCDR& in, - ACE_CDR::Char *& x) -{ - ACE_CDR::ULong len; - - in.read_ulong (len); - - if (len > 0) - { - ACE_NEW_RETURN (x, - ACE_CDR::Char[len], - 0); - - if (this->read_char_array (in, x, len)) - return 1; - - delete [] x; - } - - x = 0; - return 0; -} - -ACE_CDR::Boolean -ACE_IBM1047_ISO8859::read_char_array (ACE_InputCDR& in, - ACE_CDR::Char* x, - ACE_CDR::ULong len) -{ - if (this->read_array (in, - x, - ACE_CDR::OCTET_SIZE, - ACE_CDR::OCTET_ALIGN, - len)) - { - for (ACE_CDR::ULong i = 0; i != len; ++i) - x[i] = to_IBM1047[x[i]]; - - return 1; - } - - return 0; -} - -ACE_CDR::Boolean -ACE_IBM1047_ISO8859::write_char (ACE_OutputCDR& out, - ACE_CDR::Char x) -{ - return - this->write_1 (out, - reinterpret_cast (&from_IBM1047[x])); -} - -ACE_CDR::Boolean -ACE_IBM1047_ISO8859::write_string (ACE_OutputCDR& out, - ACE_CDR::ULong len, - const ACE_CDR::Char* x) -{ - if (out.write_ulong (len + 1)) - return this->write_char_array (out, x, len + 1); - return 0; -} - -ACE_CDR::Boolean -ACE_IBM1047_ISO8859::write_char_array (ACE_OutputCDR& out, - const ACE_CDR::Char* x, - ACE_CDR::ULong len) -{ - char *buf = 0; - if (this->adjust (out, len, 1, buf) == 0) - { - ACE_OS::memcpy (buf, x, len); - - for (ACE_CDR::ULong i = 0; i != len; ++i) - buf[i] = from_IBM1047[buf[i]]; - - return 1; - } - - this->good_bit(out, 0); - return 0; -} - -// **************************************************************** - -ACE_ISO8859_IBM1047::ACE_ISO8859_IBM1047 (void) -{ -} - -ACE_ISO8859_IBM1047::~ACE_ISO8859_IBM1047 (void) -{ -} - -ACE_CDR::ULong -ACE_ISO8859_IBM1047::ncs () -{ - return 0x00010001; -} - -ACE_CDR::ULong -ACE_ISO8859_IBM1047::tcs () -{ - return 0x10020417; -} - -ACE_CDR::Boolean -ACE_ISO8859_IBM1047::read_char (ACE_InputCDR& in, - ACE_CDR::Char& x) -{ - if (this->read_1 (in, reinterpret_cast (&x))) - { - x = from_IBM1047[x]; - return 1; - } - return 0; -} - -ACE_CDR::Boolean -ACE_ISO8859_IBM1047::read_string (ACE_InputCDR &in, - ACE_CDR::Char *&x) -{ - ACE_CDR::ULong len; - - in.read_ulong (len); - - if (len > 0) - { - ACE_NEW_RETURN (x, - ACE_CDR::Char[len], - 0); - - if (this->read_char_array (in, x, len)) - return 1; - - delete [] x; - } - - x = 0; - return 0; -} - -ACE_CDR::Boolean -ACE_ISO8859_IBM1047::read_char_array (ACE_InputCDR &in, - ACE_CDR::Char *x, - ACE_CDR::ULong len) -{ - if (this->read_array (in, - x, - ACE_CDR::OCTET_SIZE, - ACE_CDR::OCTET_ALIGN, - len)) - { - for (ACE_CDR::ULong i = 0; i != len; ++i) - x[i] = from_IBM1047[x[i]]; - - return 1; - } - - return 0; -} - -ACE_CDR::Boolean -ACE_ISO8859_IBM1047::write_char (ACE_OutputCDR &out, - ACE_CDR::Char x) -{ - return - this->write_1 (out, - reinterpret_cast (&to_IBM1047[x])); -} - -ACE_CDR::Boolean -ACE_ISO8859_IBM1047::write_string (ACE_OutputCDR& out, - ACE_CDR::ULong len, - const ACE_CDR::Char* x) -{ - if (out.write_ulong (len + 1)) - return this->write_char_array (out, x, len + 1); - else - return 0; -} - -ACE_CDR::Boolean -ACE_ISO8859_IBM1047::write_char_array (ACE_OutputCDR &out, - const ACE_CDR::Char *x, - ACE_CDR::ULong len) -{ - char *buf = 0; - - if (this->adjust (out, len, 1, buf) == 0) - { - ACE_OS::memcpy (buf, x, len); - - for (ACE_CDR::ULong i = 0; i != len; ++i) - buf[i] = to_IBM1047[buf[i]]; - - return 1; - } - - this->good_bit (out, 0); - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_EBCDIC */ diff --git a/dep/acelite/ace/Codeset_IBM1047.h b/dep/acelite/ace/Codeset_IBM1047.h deleted file mode 100644 index 3caa8881fbf..00000000000 --- a/dep/acelite/ace/Codeset_IBM1047.h +++ /dev/null @@ -1,127 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Codeset_IBM1047.h - * - * $Id: Codeset_IBM1047.h 81388 2008-04-23 14:02:05Z johnnyw $ - * - * Declares the arrays required to convert between ISO8859 (aka - * Latin/1) and IBM1047 (aka EBCDIC). - * - * @author Jim Rogers (jrogers@viasoft.com) - */ -//============================================================================= - - -#ifndef ACE_CODESET_IMB1047_H -#define ACE_CODESET_IMB1047_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_EBCDIC) - -#include "ace/CDR_Stream.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// **************************************************************** - -/** - * @class ACE_IBM1047_ISO8859 - * - * @brief Codeset translation specialization. - * - * This class performs the codeset translation: - * - Native: IBM_1047 (i.e. EBCDIC) - * - Stream: ISO-8859 (i.e. Latin/1) - */ -class ACE_Export ACE_IBM1047_ISO8859 : public ACE_Char_Codeset_Translator -{ -public: - /// A do nothing constructor. - ACE_IBM1047_ISO8859 (void); - - /// Virtual destruction - virtual ~ACE_IBM1047_ISO8859 (void); - - // = Documented in $ACE_ROOT/ace/CDR_Stream.h - virtual ACE_CDR::Boolean read_char (ACE_InputCDR &, - ACE_CDR::Char &); - virtual ACE_CDR::Boolean read_string (ACE_InputCDR &, - ACE_CDR::Char *&); - virtual ACE_CDR::Boolean read_char_array (ACE_InputCDR &, - ACE_CDR::Char *, - ACE_CDR::ULong); - virtual ACE_CDR::Boolean write_char (ACE_OutputCDR &, - ACE_CDR::Char); - virtual ACE_CDR::Boolean write_string (ACE_OutputCDR &, - ACE_CDR::ULong, - const ACE_CDR::Char *); - virtual ACE_CDR::Boolean write_char_array (ACE_OutputCDR &, - const ACE_CDR::Char *, - ACE_CDR::ULong); - - /// Return the native codeset ID as defined in the OSF code and character - /// set registry, 0x10020417 - virtual ACE_CDR::ULong ncs (); - /// Return the translated codeset ID as defined in the OSF code and character - /// set registry, 0x00010001 - virtual ACE_CDR::ULong tcs (); -}; - -/** - * @class ACE_ISO8859_IBM1047 - * - * @brief Codeset translation specialization. - * - * This class performs the codeset translation: - * - Native: ISO-8859 (i.e. Latin/1) - * - Stream: IBM-1047 (i.e. EBCDIC) - */ -class ACE_Export ACE_ISO8859_IBM1047 : public ACE_Char_Codeset_Translator -{ -public: - /// A do nothing constructor. - ACE_ISO8859_IBM1047 (void); - - /// Virtual destruction - virtual ~ACE_ISO8859_IBM1047 (void); - - // = Documented in $ACE_ROOT/ace/CDR_Stream.h - virtual ACE_CDR::Boolean read_char (ACE_InputCDR &, - ACE_CDR::Char &); - virtual ACE_CDR::Boolean read_string (ACE_InputCDR &, - ACE_CDR::Char *&); - virtual ACE_CDR::Boolean read_char_array (ACE_InputCDR &, - ACE_CDR::Char *, - ACE_CDR::ULong); - virtual ACE_CDR::Boolean write_char (ACE_OutputCDR &, - ACE_CDR::Char); - virtual ACE_CDR::Boolean write_string (ACE_OutputCDR &, - ACE_CDR::ULong, - const ACE_CDR::Char *); - virtual ACE_CDR::Boolean write_char_array (ACE_OutputCDR &, - const ACE_CDR::Char *, - ACE_CDR::ULong); - - /// Return the native codeset ID as defined in the OSF code and character - /// set registry, 0x00010001 - virtual ACE_CDR::ULong ncs (); - /// Return the translated codeset ID as defined in the OSF code and character - /// set registry, 0x10020417 - virtual ACE_CDR::ULong tcs (); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_EBCDIC */ - -#include /**/ "ace/post.h" - -#endif /* ACE_CODESET_IMB1047_H */ diff --git a/dep/acelite/ace/Codeset_Registry.cpp b/dep/acelite/ace/Codeset_Registry.cpp deleted file mode 100644 index 6c132a88081..00000000000 --- a/dep/acelite/ace/Codeset_Registry.cpp +++ /dev/null @@ -1,107 +0,0 @@ -//============================================================================= -/** - * @file Codeset_Registry.cpp - * - * $Id: Codeset_Registry.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - * - * emulated codset regstry functions - * - * - * @author Phil Mesnier - */ -//============================================================================= - -#include "ace/Codeset_Registry.h" -#include "ace/OS_Memory.h" -#include "ace/OS_NS_string.h" - -// $Id: Codeset_Registry.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#if !defined (__ACE_INLINE__) -#include "ace/Codeset_Registry.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -int -ACE_Codeset_Registry::locale_to_registry_i (const ACE_CString &locale, - ACE_CDR::ULong &codeset_id, - ACE_CDR::UShort *num_sets, - ACE_CDR::UShort **char_sets) -{ - registry_entry const *element = 0; - for (size_t i = 0; element == 0 && i < num_registry_entries_; i++) - if (ACE_OS::strcmp (registry_db_[i].loc_name_, locale.c_str ()) == 0) - element = ®istry_db_[i]; - if (element == 0) - return 0; - codeset_id = element->codeset_id_; - if (num_sets != 0) - *num_sets = element->num_sets_; - if (char_sets != 0) - { - ACE_NEW_RETURN (*char_sets,ACE_CDR::UShort[element->num_sets_],0); - ACE_OS::memcpy (*char_sets, element->char_sets_, - element->num_sets_ * sizeof (ACE_CDR::UShort)); - } - return 1; -} - -int -ACE_Codeset_Registry::registry_to_locale_i (ACE_CDR::ULong codeset_id, - ACE_CString &locale, - ACE_CDR::UShort *num_sets, - ACE_CDR::UShort **char_sets) -{ - registry_entry const *element = 0; - for (size_t i = 0; element == 0 && i < num_registry_entries_; i++) - if (codeset_id == registry_db_[i].codeset_id_) - element = ®istry_db_[i]; - if (element == 0) - return 0; - locale.set (element->loc_name_); - if (num_sets != 0) - *num_sets = element->num_sets_; - if (char_sets != 0) - { - ACE_NEW_RETURN (*char_sets,ACE_CDR::UShort[element->num_sets_],0); - ACE_OS::memcpy (*char_sets, element->char_sets_, - element->num_sets_ * sizeof (ACE_CDR::UShort)); - } - return 1; -} - -int -ACE_Codeset_Registry::is_compatible_i (ACE_CDR::ULong codeset_id, - ACE_CDR::ULong other) -{ - registry_entry const *lhs = 0; - registry_entry const *rhs = 0; - for (size_t i = 0; (lhs == 0 || rhs == 0) && i < num_registry_entries_; i++) - { - if (codeset_id == registry_db_[i].codeset_id_) - lhs = ®istry_db_[i]; - if (other == registry_db_[i].codeset_id_) - rhs = ®istry_db_[i]; - } - - if (lhs == 0 || rhs == 0) - return 0; - - for (ACE_CDR::UShort l = 0; l < lhs->num_sets_; l++) - for (ACE_CDR::UShort r = 0; r < rhs->num_sets_; r++) - if (rhs->char_sets_[r] == lhs->char_sets_[l]) - return 1; - return 0; -} - -ACE_CDR::Short -ACE_Codeset_Registry::get_max_bytes_i (ACE_CDR::ULong codeset_id) -{ - for (size_t i = 0; i < num_registry_entries_; i++) - if (codeset_id == registry_db_[i].codeset_id_) - return registry_db_[i].max_bytes_; - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Codeset_Registry.h b/dep/acelite/ace/Codeset_Registry.h deleted file mode 100644 index 28bd629add0..00000000000 --- a/dep/acelite/ace/Codeset_Registry.h +++ /dev/null @@ -1,100 +0,0 @@ -// -*- C++ -*- -//============================================================================= -/** - * @file Codeset_Registry.h - * - * $Id: Codeset_Registry.h 93651 2011-03-28 08:49:11Z johnnyw $ - * - * ACE wrapper around access functions for the OSF's DCE codeset registry - * access functions - * - * For environments that intrinsicly support the DCE defined access functions, - * the methods in this class are simply wrappers. On other platforms, emulation - * is provided. The motivation for this class is to support interoperability - * via translators and the CDR streams, primarily in TAO, but this capability - * is not restricted to CORBA. - * - * The emulated functionality supports Open Group RFC #40, currently RFC 40.2, - * www.opengroup.org/tech/rfc/rfc40.2.html - * - * @author Phil Mesnier - */ -//============================================================================= - -#ifndef ACE_CODESET_REGISTRY_H -#define ACE_CODESET_REGISTRY_H - -#include /**/ "ace/pre.h" -#include "ace/SString.h" -#include "ace/CDR_Base.h" -#include "ace/Codeset_Symbols.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Export ACE_Codeset_Registry -{ -public: - - /// Based on a locale string, find the registry value and optional codeset - /// collection. This wraps the dce_cs_loc_to_rgy function, or emulates it. - static int locale_to_registry (const ACE_CString &locale, - ACE_CDR::ULong &codeset_id, - ACE_CDR::UShort * = 0, - ACE_CDR::UShort ** = 0); - - /// Based on a registry value, find the locale string and optional codeset - /// collection. This wraps the dce_cs_rgy_to_loc function, or emulates it. - static int registry_to_locale (ACE_CDR::ULong codeset_id, - ACE_CString &locale, - ACE_CDR::UShort * = 0, - ACE_CDR::UShort ** = 0); - - /// Tell if two codesets are compatible. This wraps the - /// rpc_cs_char_set_compat_check function. - static int is_compatible (ACE_CDR::ULong codeset_id, - ACE_CDR::ULong other); - - /// Return the max number of bytes required to represent a single character. - /// This wraps the rpc_rgy_get_max_bytes function. - static ACE_CDR::Short get_max_bytes (ACE_CDR::ULong codeset_id); - - enum {max_charsets_ = 5}; -protected: - typedef struct { - const char * desc_; - const char * loc_name_; - ACE_CDR::ULong codeset_id_; - ACE_CDR::UShort num_sets_; - ACE_CDR::UShort char_sets_[max_charsets_]; - ACE_CDR::UShort max_bytes_; - } registry_entry; - -private: - static size_t const num_registry_entries_; - static registry_entry const registry_db_[]; - - static int locale_to_registry_i (const ACE_CString &locale, - ACE_CDR::ULong &codeset_id, - ACE_CDR::UShort * = 0, - ACE_CDR::UShort ** = 0); - static int registry_to_locale_i (ACE_CDR::ULong codeset_id, - ACE_CString &locale, - ACE_CDR::UShort * = 0, - ACE_CDR::UShort ** = 0); - static int is_compatible_i (ACE_CDR::ULong codeset_id, - ACE_CDR::ULong other); - static ACE_CDR::Short get_max_bytes_i (ACE_CDR::ULong codeset_id); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Codeset_Registry.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_CODESET_REGISTRY_H */ diff --git a/dep/acelite/ace/Codeset_Registry.inl b/dep/acelite/ace/Codeset_Registry.inl deleted file mode 100644 index a8348180009..00000000000 --- a/dep/acelite/ace/Codeset_Registry.inl +++ /dev/null @@ -1,66 +0,0 @@ -// -*- C++ -*- -//============================================================================= -/** - * @file Codeset_Registry.inl - * - * $Id: Codeset_Registry.inl 93651 2011-03-28 08:49:11Z johnnyw $ - * - * ACE wrapper around access functions for the OSF's DCE codeset registry - * access functions - the inline functions either call the system supplied - * DCE based codeset regsitry function, or calls the emulation - * - * - * @author Phil Mesnier - */ -//============================================================================= - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -int -ACE_Codeset_Registry::locale_to_registry(const ACE_CString &locale, - ACE_CDR::ULong &codeset_id, - ACE_CDR::UShort *num_sets, - ACE_CDR::UShort **char_sets) -{ - return ACE_Codeset_Registry::locale_to_registry_i (locale, - codeset_id, - num_sets, - char_sets); -} - -// based on a registry value, find the locale string and optional codeset -// collection. This wraps the dce_cs_rgy_to_loc function, or emulates it. -ACE_INLINE -int -ACE_Codeset_Registry::registry_to_locale(ACE_CDR::ULong codeset_id, - ACE_CString &locale, - ACE_CDR::UShort *num_sets, - ACE_CDR::UShort **char_sets) -{ - return ACE_Codeset_Registry::registry_to_locale_i (codeset_id, - locale, - num_sets, - char_sets); -} - -// Tell if two codesets are compatible. This wraps the -// rpc_cs_char_set_compat_check function. -ACE_INLINE -int -ACE_Codeset_Registry::is_compatible (ACE_CDR::ULong codeset_id, - ACE_CDR::ULong other) -{ - return ACE_Codeset_Registry::is_compatible_i (codeset_id,other); -} - -// Return the max number of bytes required to represent a single character. -// This wraps the rpc_rgy_get_max_bytes function. -ACE_INLINE -ACE_CDR::Short -ACE_Codeset_Registry::get_max_bytes (ACE_CDR::ULong codeset_id) -{ - return ACE_Codeset_Registry::get_max_bytes_i (codeset_id); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Codeset_Registry_db.cpp b/dep/acelite/ace/Codeset_Registry_db.cpp deleted file mode 100644 index 32b38631c6f..00000000000 --- a/dep/acelite/ace/Codeset_Registry_db.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* $Id: Codeset_Registry_db.cpp 81756 2008-05-22 09:47:33Z johnnyw $ - * Codeset registry DB, generated Fri Feb 28 21:01:30 2003 - * source: code_set_registry1.2g.txt - * - * To populate the registry_db, construct a codeset registry text file based - * on the OSF's Character and Code Set Registry. See DCE RFC 40.1 for details - * on obtaining the full text for the current registry. Once you have composed - * a text file containing all the desired codeset information, build and run - * mkcsregdb. The source is in $ACE_ROOT/apps/mkcsregdb. It will generate a new - * copy of this file, with the registry_db_ array properly initialized. - */ - -#include "ace/Codeset_Registry.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Codeset_Registry::registry_entry const -ACE_Codeset_Registry::registry_db_[] = -{ - {"ISO/IEC 10646-1:1993; UCS-2, Level 1","UCS-2",0x00010100,1,{0x1000},2}, - {"ISO 8859-1:1987; Latin Alphabet No. 1","ISO8859_1",0x00010001,1,{0x0011},1}, - {"IBM-1047 (CCSID 01047); Latin-1 Open System","EBCDIC",0x10020417,1,{0x0011},1}, - {"ISO/IEC 10646-1:1993; UCS-4, Level 1","UCS-4",0x00010104,1,{0x1000},4}, - {"ISO/IEC 10646-1:1993; UTF-16, UCS Transformation Format 16-bit form","UTF-16",0x00010109,1,{0x1000},2}, - {"X/Open UTF-8; UCS Transformation Format 8 (UTF-8)","UTF-8",0x05010001,1,{0x1000},6}, - {"ISO/IEC 8859-5:1988; Latin-Cyrillic Alphabet","ISO-8859-5",0x00010005,1,{0x0015},1}, - {"IBM-1251 (CCSID 01251); MS Windows Cyrillic","CP1251",0x100204e3,1,{0x0015},1}, - {"IBM-855 (CCSID 04951); Cyrillic Personal Computer","CP855",0x10021357,1,{0x0015},1} -}; - -size_t const ACE_Codeset_Registry::num_registry_entries_ = 9; - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Codeset_Symbols.h b/dep/acelite/ace/Codeset_Symbols.h deleted file mode 100644 index 6ffe198c1a9..00000000000 --- a/dep/acelite/ace/Codeset_Symbols.h +++ /dev/null @@ -1,220 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Codeset_Symbols.h - * - * $Id: Codeset_Symbols.h 80826 2008-03-04 14:51:23Z wotte $ - * - * Symbolic names for codeset ids. - * - * @author Dale Wilson (wilson_d@ociweb.com) - */ -//============================================================================= -#ifndef CODESET_SYMBOLS_H -#define CODESET_SYMBOLS_H - -// These numbers are assigned by the OpenGroup, a database is -// available at -// -// ftp://ftp.opengroup.org/pub/code_set_registry/ -// -// Alas, the database is in a semi-regular text file -- difficult to use. -// The following C/C++-friendly version of the codeset ids was captured -// from Version 1.2g of the registry. -// -#define ACE_CODESET_ID_ISO_8859_1 0x00010001U -#define ACE_CODESET_ID_ISO_8859_2 0x00010002U -#define ACE_CODESET_ID_ISO_8859_3 0x00010003U -#define ACE_CODESET_ID_ISO_8859_4 0x00010004U -#define ACE_CODESET_ID_ISO_8859_5 0x00010005U -#define ACE_CODESET_ID_ISO_8859_6 0x00010006U -#define ACE_CODESET_ID_ISO_8859_7 0x00010007U -#define ACE_CODESET_ID_ISO_8859_8 0x00010008U -#define ACE_CODESET_ID_ISO_8859_9 0x00010009U -#define ACE_CODESET_ID_ISO_8859_10 0x0001000AU -#define ACE_CODESET_ID_ISO_8859_15 0x0001000FU -#define ACE_CODESET_ID_ISO_646 0x00010020U -#define ACE_CODESET_ID_ISO_UCS_2_LEVEL_1 0x00010100U -#define ACE_CODESET_ID_ISO_UCS_2_LEVEL_2 0x00010101U -#define ACE_CODESET_ID_ISO_UCS_2_LEVEL_3 0x00010102U -#define ACE_CODESET_ID_ISO_UCS_4_LEVEL_1 0x00010104U -#define ACE_CODESET_ID_ISO_UCS_4_LEVEL_2 0x00010105U -#define ACE_CODESET_ID_ISO_UCS_4_LEVEL_3 0x00010106U -#define ACE_CODESET_ID_ISO_UTF_8 0x00010108U -#define ACE_CODESET_ID_ISO_UTF_16 0x00010109U -#define ACE_CODESET_ID_JIS_X0201 0x00030001U -#define ACE_CODESET_ID_JIS_X0208_1978 0x00030004U -#define ACE_CODESET_ID_JIS_X0208_1983 0x00030005U -#define ACE_CODESET_ID_JIS_X0208_1990 0x00030006U -#define ACE_CODESET_ID_JIS_X0212 0x0003000AU -#define ACE_CODESET_ID_JIS_EUCJP 0x00030010U -#define ACE_CODESET_ID_KS_C5601 0x00040001U -#define ACE_CODESET_ID_KS_C5657 0x00040002U -#define ACE_CODESET_ID_KS_EUCKR 0x0004000AU -#define ACE_CODESET_ID_CNS_11643_1986 0x00050001U -#define ACE_CODESET_ID_CNS_11643_1992 0x00050002U -#define ACE_CODESET_ID_CNS_EUCTW_1991 0x0005000AU -#define ACE_CODESET_ID_CNS_EUCTW_1993 0x00050010U -#define ACE_CODESET_ID_TIS_620_25290X000B0001U -#define ACE_CODESET_ID_TTB_CCDC 0x000D0001U -#define ACE_CODESET_ID_OSF_JAPANESE_UJIS 0x05000010U -#define ACE_CODESET_ID_OSF_JAPANESE_SJIS_1 0x05000011U -#define ACE_CODESET_ID_OSF_JAPANESE_SJIS_2 0x05000012U -#define ACE_CODESET_ID_XOPEN_UTF_8 0x05010001U -#define ACE_CODESET_ID_JVC_EUCJP 0x05020001U -#define ACE_CODESET_ID_JVC_SJIS 0x05020002U -#define ACE_CODESET_ID_DEC_KANJI 0x10000001U -#define ACE_CODESET_ID_SUPER_DEC_KANJI 0x10000002U -#define ACE_CODESET_ID_DEC_SHIFT_JIS 0x10000003U -#define ACE_CODESET_ID_HP_ROMAN8 0x10010001U -#define ACE_CODESET_ID_HP_KANA8 0x10010002U -#define ACE_CODESET_ID_HP_ARABIC8 0x10010003U -#define ACE_CODESET_ID_HP_GREEK8 0x10010004U -#define ACE_CODESET_ID_HP_HEBREW8 0x10010005U -#define ACE_CODESET_ID_HP_TURKISH8 0x10010006U -#define ACE_CODESET_ID_HP15CN 0x10010007U -#define ACE_CODESET_ID_HP_BIG5 0x10010008U -#define ACE_CODESET_ID_HP_JAPANESE15__SJIS_ 0x10010009U -#define ACE_CODESET_ID_HP_SJISHI 0x1001000AU -#define ACE_CODESET_ID_HP_SJISPC 0x1001000BU -#define ACE_CODESET_ID_HP_UJIS 0x1001000CU -#define ACE_CODESET_ID_IBM_037 0x10020025U -#define ACE_CODESET_ID_IBM_273 0x10020111U -#define ACE_CODESET_ID_IBM_277 0x10020115U -#define ACE_CODESET_ID_IBM_278 0x10020116U -#define ACE_CODESET_ID_IBM_280 0x10020118U -#define ACE_CODESET_ID_IBM_282 0x1002011AU -#define ACE_CODESET_ID_IBM_284 0x1002011CU -#define ACE_CODESET_ID_IBM_285 0x1002011DU -#define ACE_CODESET_ID_IBM_290 0x10020122U -#define ACE_CODESET_ID_IBM_297 0x10020129U -#define ACE_CODESET_ID_IBM_300 0x1002012CU -#define ACE_CODESET_ID_IBM_301 0x1002012DU -#define ACE_CODESET_ID_IBM_420 0x100201A4U -#define ACE_CODESET_ID_IBM_424 0x100201A8U -#define ACE_CODESET_ID_IBM_437 0x100201B5U -#define ACE_CODESET_ID_IBM_500 0x100201F4U -#define ACE_CODESET_ID_IBM_833 0x10020341U -#define ACE_CODESET_ID_IBM_834 0x10020342U -#define ACE_CODESET_ID_IBM_835 0x10020343U -#define ACE_CODESET_ID_IBM_836 0x10020344U -#define ACE_CODESET_ID_IBM_837 0x10020345U -#define ACE_CODESET_ID_IBM_838 0x10020346U -#define ACE_CODESET_ID_IBM_839 0x10020347U -#define ACE_CODESET_ID_IBM_850 0x10020352U -#define ACE_CODESET_ID_IBM_852 0x10020354U -#define ACE_CODESET_ID_IBM_855 0x10020357U -#define ACE_CODESET_ID_IBM_856 0x10020358U -#define ACE_CODESET_ID_IBM_857 0x10020359U -#define ACE_CODESET_ID_IBM_861 0x1002035DU -#define ACE_CODESET_ID_IBM_862 0x1002035EU -#define ACE_CODESET_ID_IBM_863 0x1002035FU -#define ACE_CODESET_ID_IBM_864 0x10020360U -#define ACE_CODESET_ID_IBM_866 0x10020362U -#define ACE_CODESET_ID_IBM_868 0x10020364U -#define ACE_CODESET_ID_IBM_869 0x10020365U -#define ACE_CODESET_ID_IBM_870 0x10020366U -#define ACE_CODESET_ID_IBM_871 0x10020367U -#define ACE_CODESET_ID_IBM_874 0x1002036AU -#define ACE_CODESET_ID_IBM_875 0x1002036BU -#define ACE_CODESET_ID_IBM_880 0x10020370U -#define ACE_CODESET_ID_IBM_891 0x1002037BU -#define ACE_CODESET_ID_IBM_896 0x10020380U -#define ACE_CODESET_ID_IBM_897 0x10020381U -#define ACE_CODESET_ID_IBM_903 0x10020387U -#define ACE_CODESET_ID_IBM_904 0x10020388U -#define ACE_CODESET_ID_IBM_918 0x10020396U -#define ACE_CODESET_ID_IBM_921 0x10020399U -#define ACE_CODESET_ID_IBM_922 0x1002039AU -#define ACE_CODESET_ID_IBM_926 0x1002039EU -#define ACE_CODESET_ID_IBM_927 0x1002039FU -#define ACE_CODESET_ID_IBM_928 0x100203A0U -#define ACE_CODESET_ID_IBM_929 0x100203A1U -#define ACE_CODESET_ID_IBM_930 0x100203A2U -#define ACE_CODESET_ID_IBM_932 0x100203A4U -#define ACE_CODESET_ID_IBM_933 0x100203A5U -#define ACE_CODESET_ID_IBM_934 0x100203A6U -#define ACE_CODESET_ID_IBM_935 0x100203A7U -#define ACE_CODESET_ID_IBM_936 0x100203A8U -#define ACE_CODESET_ID_IBM_937 0x100203A9U -#define ACE_CODESET_ID_IBM_938 0x100203AAU -#define ACE_CODESET_ID_IBM_939 0x100203ABU -#define ACE_CODESET_ID_IBM_941 0x100203ADU -#define ACE_CODESET_ID_IBM_942 0x100203AEU -#define ACE_CODESET_ID_IBM_943 0x100203AFU -#define ACE_CODESET_ID_IBM_946 0x100203B2U -#define ACE_CODESET_ID_IBM_947 0x100203B3U -#define ACE_CODESET_ID_IBM_948 0x100203B4U -#define ACE_CODESET_ID_IBM_949 0x100203B5U -#define ACE_CODESET_ID_IBM_950 0x100203B6U -#define ACE_CODESET_ID_IBM_951 0x100203B7U -#define ACE_CODESET_ID_IBM_955 0x100203BBU -#define ACE_CODESET_ID_IBM_964 0x100203C4U -#define ACE_CODESET_ID_IBM_970 0x100203CAU -#define ACE_CODESET_ID_IBM_1006 0x100203EEU -#define ACE_CODESET_ID_IBM_1025 0x10020401U -#define ACE_CODESET_ID_IBM_1026 0x10020402U -#define ACE_CODESET_ID_IBM_1027 0x10020403U -#define ACE_CODESET_ID_IBM_1040 0x10020410U -#define ACE_CODESET_ID_IBM_1041 0x10020411U -#define ACE_CODESET_ID_IBM_1043 0x10020413U -#define ACE_CODESET_ID_IBM_1046 0x10020416U -#define ACE_CODESET_ID_IBM_1047 0x10020417U -#define ACE_CODESET_ID_IBM_1088 0x10020440U -#define ACE_CODESET_ID_IBM_1097 0x10020449U -#define ACE_CODESET_ID_IBM_1098 0x1002044AU -#define ACE_CODESET_ID_IBM_1112 0x10020458U -#define ACE_CODESET_ID_IBM_1114 0x1002045AU -#define ACE_CODESET_ID_IBM_1115 0x1002045BU -#define ACE_CODESET_ID_IBM_1122 0x10020462U -#define ACE_CODESET_ID_IBM_1250 0x100204E2U -#define ACE_CODESET_ID_IBM_1251 0x100204E3U -#define ACE_CODESET_ID_IBM_1252 0x100204E4U -#define ACE_CODESET_ID_IBM_1253 0x100204E5U -#define ACE_CODESET_ID_IBM_1254 0x100204E6U -#define ACE_CODESET_ID_IBM_1255 0x100204E7U -#define ACE_CODESET_ID_IBM_1256 0x100204E8U -#define ACE_CODESET_ID_IBM_1257 0x100204E9U -#define ACE_CODESET_ID_IBM_1380 0x10020564U -#define ACE_CODESET_ID_IBM_1381 0x10020565U -#define ACE_CODESET_ID_IBM_1383 0x10020567U -#define ACE_CODESET_ID_IBM_4396 0x1002112CU -#define ACE_CODESET_ID_IBM_4946 0x10021352U -#define ACE_CODESET_ID_IBM_4948 0x10021354U -#define ACE_CODESET_ID_IBM_4951 0x10021357U -#define ACE_CODESET_ID_IBM_4952 0x10021358U -#define ACE_CODESET_ID_IBM_4953 0x10021359U -#define ACE_CODESET_ID_IBM_4960 0x10021360U -#define ACE_CODESET_ID_IBM_4964 0x10021364U -#define ACE_CODESET_ID_IBM_4965 0x10021365U -#define ACE_CODESET_ID_IBM_5026 0x100213A2U -#define ACE_CODESET_ID_IBM_5031 0x100213A7U -#define ACE_CODESET_ID_IBM_5035 0x100213ABU -#define ACE_CODESET_ID_IBM_5048 0x100213B8U -#define ACE_CODESET_ID_IBM_5049 0x100213B9U -#define ACE_CODESET_ID_IBM_5067 0x100213CBU -#define ACE_CODESET_ID_IBM_8612 0x100221A4U -#define ACE_CODESET_ID_IBM_9025 0x10022341U -#define ACE_CODESET_ID_IBM_9026 0x10022342U -#define ACE_CODESET_ID_IBM_9030 0x10022346U -#define ACE_CODESET_ID_IBM_9056 0x10022360U -#define ACE_CODESET_ID_IBM_9066 0x1002236AU -#define ACE_CODESET_ID_IBM_9125 0x100223A5U -#define ACE_CODESET_ID_IBM_25426 0x10026352U -#define ACE_CODESET_ID_IBM_25432 0x10026358U -#define ACE_CODESET_ID_IBM_1042 0x10026412U -#define ACE_CODESET_ID_IBM_28709 0x10027025U -#define ACE_CODESET_ID_IBM_33624 0x10028358U -#define ACE_CODESET_ID_IBM_33722 0x100283BAU -#define ACE_CODESET_ID_HTCSJIS 0x10030001U -#define ACE_CODESET_ID_HTCUJIS 0x10030002U -#define ACE_CODESET_ID_FUJITSU_U90 0x10040001U -#define ACE_CODESET_ID_FUJITSU_S90 0x10040002U -#define ACE_CODESET_ID_FUJITSU_R90 0x10040003U -#define ACE_CODESET_ID_EBCDIC_ASCII_AND_JEF 0x10040004U -#define ACE_CODESET_ID_EBCDIC_KATAKANA_AND_JEF 0x10040005U -#define ACE_CODESET_ID_EBCDIC_JAPANESE_ENGLISH_AND_JEF 0x10040006U - -#define ACE_CODESET_ID_TAO_BACKWARD_COMPATIBLE 0xf54414F0U -#endif // CODESET_SYMBOLS_H diff --git a/dep/acelite/ace/Compression/ACE_Compression_export.h b/dep/acelite/ace/Compression/ACE_Compression_export.h deleted file mode 100644 index 119e14b16ea..00000000000 --- a/dep/acelite/ace/Compression/ACE_Compression_export.h +++ /dev/null @@ -1,58 +0,0 @@ - -// -*- C++ -*- -// $Id: ACE_Compression_export.h 95545 2012-02-23 07:57:08Z johnnyw $ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl ACE_Compression -// ------------------------------ -#ifndef ACE_COMPRESSION_EXPORT_H -#define ACE_COMPRESSION_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_COMPRESSION_HAS_DLL) -# define ACE_COMPRESSION_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && ACE_COMPRESSION_HAS_DLL */ - -#if !defined (ACE_COMPRESSION_HAS_DLL) -# define ACE_COMPRESSION_HAS_DLL 1 -#endif /* ! ACE_COMPRESSION_HAS_DLL */ - -#if defined (ACE_COMPRESSION_HAS_DLL) && (ACE_COMPRESSION_HAS_DLL == 1) -# if defined (ACE_COMPRESSION_BUILD_DLL) -# define ACE_Compression_Export ACE_Proper_Export_Flag -# define ACE_COMPRESSION_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define ACE_COMPRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* ACE_COMPRESSION_BUILD_DLL */ -# define ACE_Compression_Export ACE_Proper_Import_Flag -# define ACE_COMPRESSION_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define ACE_COMPRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* ACE_COMPRESSION_BUILD_DLL */ -#else /* ACE_COMPRESSION_HAS_DLL == 1 */ -# define ACE_Compression_Export -# define ACE_COMPRESSION_SINGLETON_DECLARATION(T) -# define ACE_COMPRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* ACE_COMPRESSION_HAS_DLL == 1 */ - -// Set ACE_COMPRESSION_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (ACE_COMPRESSION_NTRACE) -# if (ACE_NTRACE == 1) -# define ACE_COMPRESSION_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define ACE_COMPRESSION_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !ACE_COMPRESSION_NTRACE */ - -#if (ACE_COMPRESSION_NTRACE == 1) -# define ACE_COMPRESSION_TRACE(X) -#else /* (ACE_COMPRESSION_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define ACE_COMPRESSION_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (ACE_COMPRESSION_NTRACE == 1) */ - -#endif /* ACE_COMPRESSION_EXPORT_H */ - -// End of auto generated file. diff --git a/dep/acelite/ace/Compression/Compressor.cpp b/dep/acelite/ace/Compression/Compressor.cpp deleted file mode 100644 index 86d1a1f3dd2..00000000000 --- a/dep/acelite/ace/Compression/Compressor.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// $Id: Compressor.cpp 95556 2012-02-24 09:14:51Z johnnyw $ - -#include "Compressor.h" - -#if !defined (__ACE_INLINE__) -#include "Compressor.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Compressor::ACE_Compressor( ACE_CompressorId compressor_id, - ACE_UINT32 compression_level ) - : compressor_id_ (compressor_id) - , compression_level_ (compression_level) - , compressed_bytes_ (0) - , uncompressed_bytes_ (0) -{} - -ACE_Compressor::~ACE_Compressor () -{ -} - -ACE_UINT64 -ACE_Compressor::compressed_bytes(void) const -{ - ACE_GUARD_RETURN( ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0 ); - return this->compressed_bytes_; -} - -ACE_UINT64 -ACE_Compressor::uncompressed_bytes(void) const -{ - ACE_GUARD_RETURN( ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0 ); - return this->uncompressed_bytes_; -} - -void -ACE_Compressor::reset_stats(void) -{ - ACE_GUARD( ACE_SYNCH_MUTEX, ace_mon, this->mutex_ ); - this->compressed_bytes_ = 0; - this->uncompressed_bytes_ = 0; -} - -void -ACE_Compressor::update_stats(ACE_UINT64 uncompressed_bytes, ACE_UINT64 compressed_bytes) -{ - ACE_GUARD( ACE_SYNCH_MUTEX, ace_mon, this->mutex_ ); - this->compressed_bytes_ += compressed_bytes; - this->uncompressed_bytes_ += uncompressed_bytes; -} - -float -ACE_Compressor::compression_ratio(void) const -{ - ACE_GUARD_RETURN( ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0.0f ); - if (this->uncompressed_bytes_ > 0) { - return static_cast(this->compressed_bytes_) / this->uncompressed_bytes_; - } - return 0.0f; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Compression/Compressor.h b/dep/acelite/ace/Compression/Compressor.h deleted file mode 100644 index eb71167a5e0..00000000000 --- a/dep/acelite/ace/Compression/Compressor.h +++ /dev/null @@ -1,137 +0,0 @@ -// -*- C++ -*- -//============================================================================= -/** - * @file Compressor.h - * - * $Id: Compressor.h - * - * @author ACE version by - * @author Derek Dominish - */ -//============================================================================= - -#ifndef ACE_COMPRESSOR_H -#define ACE_COMPRESSOR_H - -#include /**/ "ace/pre.h" - -#include /**/ "ACE_Compression_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Guard_T.h" -#include "ace/Thread_Mutex.h" -#include "ace/Synch_Traits.h" -#include "ace/Copy_Disabled.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * CompressorId from OMG Compression::CompressorId - * see $(TAO_ROOT)/tao/Compression.pidl - */ -enum ACE_CompressorId -{ - ACE_COMPRESSORID_NONE = 0, - ACE_COMPRESSORID_GZIP = 1, - ACE_COMPRESSORID_PKZIP = 2, - ACE_COMPRESSORID_BZIP2 = 3, - ACE_COMPRESSORID_ZLIB = 4, - ACE_COMPRESSORID_LZMA = 5, - ACE_COMPRESSORID_LZO = 6, - ACE_COMPRESSORID_RZIP = 7, - ACE_COMPRESSORID_7X = 8, - ACE_COMPRESSORID_XAR = 9, - ACE_COMPRESSORID_RLE = 10 -}; - -class ACE_Compression_Export ACE_Compressor : private ACE_Copy_Disabled -{ -public: - - ACE_CompressorId get_compressor_id(void) const; - - ACE_UINT32 get_compression_level(void) const; - - /** - * Compress the @a in_ptr buffer for @a in_len into the - * @a dest_ptr buffer with a maximum @a max_out_len. If the - * @a max_out_len is exhausted through the compress process - * then a value of -1 will be returned from the function, - * otherwise the return value will indicate the resultant - * @a out_ptr compressed buffer length. - * - * NOTE: it is advisable that the @max_out_len be slightly - * larger of the input @a in_len (i.e. x 1.1F) to cater - * for the possibility that a reduced compressed length - * is not possible. - */ - virtual ACE_UINT64 compress( const void *in_ptr, - ACE_UINT64 in_len, - void *out_ptr, - ACE_UINT64 max_out_len ) = 0; - - /** - * DeCompress the @a in_ptr buffer for @a in_len into the - * @a out_ptr buffer with a maximum @a max_out_len. If the - * @a max_out_len is exhausted during decompression - * then a value of -1 will be returned from the function, - * otherwise the return value will indicate the resultant - * @a out_ptr decompressed buffer length. - */ - virtual ACE_UINT64 decompress( const void *in_ptr, - ACE_UINT64 in_len, - void *out_ptr, - ACE_UINT64 max_out_len ) = 0; - - /** - * Return the current compressed bytes statistics counter. - */ - virtual ACE_UINT64 compressed_bytes(void) const; - - /** - * Return the current uncompressed bytes statistics counter. - */ - virtual ACE_UINT64 uncompressed_bytes(void) const; - - /** - * Return the current compression ratio statistics. - */ - virtual float compression_ratio(void) const; - - /** - * Reset the statistics to zero. - */ - virtual void reset_stats(void); - - virtual ~ACE_Compressor (void); - -protected: - ACE_Compressor(ACE_CompressorId compressor_id, - ACE_UINT32 compression_level = 0); // Must be inherited. - - virtual void update_stats( ACE_UINT64 uncompressed_bytes, - ACE_UINT64 compressed_bytes ); - -private: - ACE_CompressorId compressor_id_; - ACE_UINT32 compression_level_; - - // Ensure we can lock with imutability (i.e. const) - mutable ACE_SYNCH_MUTEX mutex_; - - ACE_UINT64 compressed_bytes_; - ACE_UINT64 uncompressed_bytes_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "Compressor.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif // ACE_COMPRESSOR_H diff --git a/dep/acelite/ace/Compression/Compressor.inl b/dep/acelite/ace/Compression/Compressor.inl deleted file mode 100644 index b9809018e41..00000000000 --- a/dep/acelite/ace/Compression/Compressor.inl +++ /dev/null @@ -1,18 +0,0 @@ -// -*- C++ -*- -// $Id: Compressor.inl 95545 2012-02-23 07:57:08Z johnnyw $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE ACE_CompressorId -ACE_Compressor::get_compressor_id(void) const -{ - return this->compressor_id_; -} - -ACE_INLINE ACE_UINT32 -ACE_Compressor::get_compression_level(void) const -{ - return this->compression_level_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Compression/rle/ACE_RLECompression_export.h b/dep/acelite/ace/Compression/rle/ACE_RLECompression_export.h deleted file mode 100644 index f0364580879..00000000000 --- a/dep/acelite/ace/Compression/rle/ACE_RLECompression_export.h +++ /dev/null @@ -1,57 +0,0 @@ -// -*- C++ -*- -// $Id: ACE_RLECompression_export.h 95545 2012-02-23 07:57:08Z johnnyw $ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl ACE_RLECompression -// ------------------------------ -#ifndef ACE_RLECOMPRESSION_EXPORT_H -#define ACE_RLECOMPRESSION_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_RLECOMPRESSION_HAS_DLL) -# define ACE_RLECOMPRESSION_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && ACE_RLECOMPRESSION_HAS_DLL */ - -#if !defined (ACE_RLECOMPRESSION_HAS_DLL) -# define ACE_RLECOMPRESSION_HAS_DLL 1 -#endif /* ! ACE_RLECOMPRESSION_HAS_DLL */ - -#if defined (ACE_RLECOMPRESSION_HAS_DLL) && (ACE_RLECOMPRESSION_HAS_DLL == 1) -# if defined (ACE_RLECOMPRESSION_BUILD_DLL) -# define ACE_RLECompression_Export ACE_Proper_Export_Flag -# define ACE_RLECOMPRESSION_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define ACE_RLECOMPRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* ACE_RLECOMPRESSION_BUILD_DLL */ -# define ACE_RLECompression_Export ACE_Proper_Import_Flag -# define ACE_RLECOMPRESSION_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define ACE_RLECOMPRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* ACE_RLECOMPRESSION_BUILD_DLL */ -#else /* ACE_RLECOMPRESSION_HAS_DLL == 1 */ -# define ACE_RLECompression_Export -# define ACE_RLECOMPRESSION_SINGLETON_DECLARATION(T) -# define ACE_RLECOMPRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* ACE_RLECOMPRESSION_HAS_DLL == 1 */ - -// Set ACE_RLECOMPRESSION_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (ACE_RLECOMPRESSION_NTRACE) -# if (ACE_NTRACE == 1) -# define ACE_RLECOMPRESSION_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define ACE_RLECOMPRESSION_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !ACE_RLECOMPRESSION_NTRACE */ - -#if (ACE_RLECOMPRESSION_NTRACE == 1) -# define ACE_RLECOMPRESSION_TRACE(X) -#else /* (ACE_RLECOMPRESSION_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define ACE_RLECOMPRESSION_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (ACE_RLECOMPRESSION_NTRACE == 1) */ - -#endif /* ACE_RLECOMPRESSION_EXPORT_H */ - -// End of auto generated file. diff --git a/dep/acelite/ace/Compression/rle/RLECompressor.cpp b/dep/acelite/ace/Compression/rle/RLECompressor.cpp deleted file mode 100644 index 423d8a0f0ac..00000000000 --- a/dep/acelite/ace/Compression/rle/RLECompressor.cpp +++ /dev/null @@ -1,158 +0,0 @@ -// $Id: RLECompressor.cpp 95560 2012-02-27 08:11:54Z johnnyw $ - -#include "RLECompressor.h" -#include "ace/OS_NS_string.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_RLECompressor::ACE_RLECompressor(void) - : ACE_Compressor(ACE_COMPRESSORID_RLE) -{ -} - -ACE_RLECompressor::~ACE_RLECompressor(void) -{ -} - -ACE_UINT64 -ACE_RLECompressor::compress( const void *in_ptr, - ACE_UINT64 in_len, - void *out_ptr, - ACE_UINT64 max_out_len ) -{ - const ACE_UINT8 *in_p = static_cast(in_ptr); - ACE_UINT8 *out_p = static_cast(out_ptr); - - ACE_UINT64 src_len = in_len; // Save for stats - ACE_UINT64 out_len = 0; - ACE_UINT64 out_index = 0; - ACE_UINT64 out_base = 0; - - ACE_UINT32 run_count = 0; - ACE_UINT32 dup_count = 0; - - bool run_code = false; - - ACE_UINT8 nxt_byte, cur_byte; - - if (in_p && out_p) while (in_len-- > 0) { - - if (run_code) switch (run_count) { - - default: - - out_p[out_index = out_base] = ACE_UINT8(run_count++ | 0x80); - out_p[++out_index] = cur_byte = *in_p++; - - if (in_len ? cur_byte == (nxt_byte = *in_p) : true) { - continue; - } - - // Fall Through - - case 128: - - if (++out_index >= max_out_len) { - return ACE_UINT64(-1); // Output Exhausted - } else if (in_len == 0) { - continue; - } - - run_code = false; - out_p[out_base = out_index] = 0; - dup_count = run_count = 0; - continue; - } - - switch (run_count) { - - case 128: - - if (++out_index >= max_out_len) { - return ACE_UINT64(-1); // Output Exhausted - } - out_p[out_base = out_index] = 0; - dup_count = run_count = 0; - - // Fall Through - - default : - - cur_byte = *in_p++; - - if (in_len > 0) { - if (cur_byte == (nxt_byte = *in_p)) { - if (dup_count++ == 1) { - if (run_count >= dup_count) { - out_p[out_base] = static_cast(run_count - dup_count); - out_base += run_count; - } - run_code = true; - run_count = dup_count - 1; - dup_count = 0; - out_p[out_index = out_base] = static_cast(run_count++ | 0x80); - break; - } - } else dup_count = 0; - } - out_p[out_base] = char(run_count++); - break; - } - - if (++out_index >= max_out_len) { - return ACE_UINT64(-1); // Output Exhausted - } - - out_p[out_index] = cur_byte; - } - - out_len = ++out_index; // Update our output length - - this->update_stats(src_len, out_len); - - return out_len; -} - -// Decompress using Run Length Encoding (RLE) -ACE_UINT64 -ACE_RLECompressor::decompress( const void *in_ptr, - ACE_UINT64 in_len, - void *out_ptr, - ACE_UINT64 max_out_len ) -{ - ACE_UINT64 out_len = 0; - - const ACE_UINT8 *in_p = static_cast(in_ptr); - ACE_UINT8 *out_p = static_cast(out_ptr); - - if (in_p && out_p) while(in_len-- > 0) { - - ACE_UINT8 cur_byte = *in_p++; - ACE_UINT32 cpy_len = ACE_UINT32((cur_byte & 0x7F) + 1); - - if (cpy_len > max_out_len) { - return ACE_UINT64(-1); // Output Exhausted - } else if ((cur_byte & 0x80) != 0) { // compressed - if (in_len-- > 0) { - ACE_OS::memset(out_p, *in_p++, cpy_len); - } else { - return ACE_UINT64(-1); // Output Exhausted - } - } else if (in_len >= cpy_len) { - ACE_OS::memcpy(out_p, in_p, cpy_len); - in_p += cpy_len; - in_len -= cpy_len; - } else { - return ACE_UINT64(-1); // Output Exhausted - } - - out_p += cpy_len; - max_out_len -= cpy_len; - out_len += cpy_len; - } - - return out_len; -} - -// Close versioned namespace, if enabled by the user. -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Compression/rle/RLECompressor.h b/dep/acelite/ace/Compression/rle/RLECompressor.h deleted file mode 100644 index 7371d22bf50..00000000000 --- a/dep/acelite/ace/Compression/rle/RLECompressor.h +++ /dev/null @@ -1,108 +0,0 @@ -// -*- C++ -*- -//============================================================================= -/** - * @file RLECompressor.h - * - * $Id: RLECompressor.h - * - * @author TAO version by - * @author Derek Dominish - * @author ACE version by - * @author Derek Dominish - * - * Run-length encoding (RLE) is a very simple form of data compression - * in which runs of data (that is, sequences in which the same data value - * occurs in many consecutive data elements) are stored as a single data - * value and count, rather than as the original run. This is most useful - * on data that contains many such runs: for example, simple graphic - * images such as icons, line drawings, and animations. It is not useful - * with files that don't have many runs as it could slightly increase the - * output size. - * ALGORITHM: This algorithm is an optimized version of the traditional - * RLE algorithm in that it behaves better with very few runs. - * - * With a run of a character where that run is >= 3 this is - * replaced with the repeat indicator 0X80 and then the repeat count OR'd - * over this ident. This repeat count is therefore has a maximum value - * of 127 (0x7F) which is to be interpreted as the next character repeated - * another 'repeat count' times (i.e. a maximum of 128 characters can be - * represented in any single dupal). if the repeat ident is not present - * then the count is to be interpreted as a copy of the next repeat count - * characters + 1. - * - * EXAMPLE: the following arbitary string of 67 bytes:- - * WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW - * will produce (as a HEXDUMP) of 14 bytes - * 8B 57 00 42 8B 57 82 42 97 57 00 42 8D 57 .W.B.W.B.W.B.W - */ -//============================================================================= - -#ifndef ACE_RLECOMPRESSOR_H -#define ACE_RLECOMPRESSOR_H - -#include /**/ "ace/pre.h" - -#include "ACE_RLECompression_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Compression/Compressor.h" -#include "ace/Singleton.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_RLECompression_Export ACE_RLECompressor : public ACE_Compressor -{ -public: - /** - * Default constructor. Should use instance() to get global instance. - */ - ACE_RLECompressor(void); - - virtual ~ACE_RLECompressor(void); - - /** - * Compress the @a in_ptr buffer for @a in_len into the - * @a dest_ptr buffer with a maximum @a max_out_len using - * the Run Length Ecoding (RLE) algorithm. If the - * @a max_out_len is exhausted through the compress process - * then a value of -1 will be returned from the function, - * otherwise the return value will indicate the resultant - * @a out_ptr compressed buffer length. - * - * @note It is advisable that the @max_out_len be slightly - * larger of the input @a in_len (i.e. x 1.1F) to cater - * for the possibility that a reduced compressed length - * is not possible. - */ - virtual ACE_UINT64 compress( const void *in_ptr, - ACE_UINT64 in_len, - void *out_ptr, - ACE_UINT64 max_out_len ); - - /** - * DeCompress the @a in_ptr buffer for @a in_len into the - * @a out_ptr buffer with a maximum @a max_out_len using - * the Run Length Ecoding (RLE) algorithm. If the - * @a max_out_len is exhausted during decompression - * then a value of -1 will be returned from the function, - * otherwise the return value will indicate the resultant - * @a out_ptr decompressed buffer length. - */ - virtual ACE_UINT64 decompress( const void *in_ptr, - ACE_UINT64 in_len, - void *out_ptr, - ACE_UINT64 max_out_len ); -}; - -ACE_RLECOMPRESSION_SINGLETON_DECLARE(ACE_Singleton, ACE_RLECompressor, ACE_SYNCH_MUTEX); - -typedef class ACE_Singleton ACE_RLECompression; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif // ACE_RLECOMPRESSOR_H diff --git a/dep/acelite/ace/Condition_Attributes.cpp b/dep/acelite/ace/Condition_Attributes.cpp deleted file mode 100644 index 49a02635ba8..00000000000 --- a/dep/acelite/ace/Condition_Attributes.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* -*- C++ -*- */ -/** - * @file Condition_Attributes.cpp - * - * $Id: Condition_Attributes.cpp 96061 2012-08-16 09:36:07Z mcorino $ - * - * Originally in Synch.cpp - * - * @author Douglas C. Schmidt - */ - -#include "ace/Condition_Thread_Mutex.h" -#include "ace/Condition_Attributes.h" - -#if defined (ACE_HAS_THREADS) - -#if !defined (__ACE_INLINE__) -#include "ace/Condition_Attributes.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_THREADS */ diff --git a/dep/acelite/ace/Condition_Attributes.h b/dep/acelite/ace/Condition_Attributes.h deleted file mode 100644 index 0d53b273285..00000000000 --- a/dep/acelite/ace/Condition_Attributes.h +++ /dev/null @@ -1,101 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Condition_Attributes.h - * - * $Id: Condition_Attributes.h 96077 2012-08-20 08:13:23Z johnnyw $ - * - * Moved from Synch.h. - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_CONDITION_ATTRIBUTES_H -#define ACE_CONDITION_ATTRIBUTES_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/OS_NS_Thread.h" - -#if defined (ACE_HAS_THREADS) - -// ACE platform supports some form of threading. - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Export ACE_Condition_Attributes -{ -public: - /// Constructor - ACE_Condition_Attributes (int type = ACE_DEFAULT_SYNCH_TYPE); - - /// Destructor - ~ACE_Condition_Attributes (void); - - /// Accessor for retrieving the current attributes - const ACE_condattr_t& attributes (void) const; - -protected: - /// The attributes - ACE_condattr_t attributes_; - -private: - // = Prevent assignment and initialization. - void operator= (const ACE_Condition_Attributes &); - ACE_Condition_Attributes (const ACE_Condition_Attributes &); -}; - -template -class ACE_Condition_Attributes_T : public ACE_Condition_Attributes -{ -public: - /// Constructor - ACE_Condition_Attributes_T (int type = ACE_DEFAULT_SYNCH_TYPE) - : ACE_Condition_Attributes (type) - {} - - /// Destructor - ~ACE_Condition_Attributes_T (void) {} - -private: - // = Prevent assignment and initialization. - void operator= (const ACE_Condition_Attributes_T &); - ACE_Condition_Attributes_T (const ACE_Condition_Attributes_T &); -}; - -class ACE_Monotonic_Time_Policy; - -template <> -class ACE_Export ACE_Condition_Attributes_T - : public ACE_Condition_Attributes -{ -public: - /// Constructor - ACE_Condition_Attributes_T (int type = ACE_DEFAULT_SYNCH_TYPE); - - /// Destructor - ~ACE_Condition_Attributes_T (void); - -private: - // = Prevent assignment and initialization. - void operator= (const ACE_Condition_Attributes_T &); - ACE_Condition_Attributes_T (const ACE_Condition_Attributes_T &); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Condition_Attributes.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* !ACE_HAS_THREADS */ - -#include /**/ "ace/post.h" -#endif /* ACE_CONDITION_ATTRIBUTES_H */ diff --git a/dep/acelite/ace/Condition_Attributes.inl b/dep/acelite/ace/Condition_Attributes.inl deleted file mode 100644 index 12afde24c80..00000000000 --- a/dep/acelite/ace/Condition_Attributes.inl +++ /dev/null @@ -1,40 +0,0 @@ -// -*- C++ -*- -// -// $Id: Condition_Attributes.inl 96096 2012-08-23 12:34:02Z johnnyw $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Condition_Attributes::ACE_Condition_Attributes (int type) -{ - (void) ACE_OS::condattr_init (this->attributes_, type); -} - -ACE_INLINE -ACE_Condition_Attributes::~ACE_Condition_Attributes (void) -{ - ACE_OS::condattr_destroy (this->attributes_); -} - -ACE_INLINE -const ACE_condattr_t& -ACE_Condition_Attributes::attributes (void) const -{ - return this->attributes_; -} - -ACE_INLINE -ACE_Condition_Attributes_T::ACE_Condition_Attributes_T (int type) - : ACE_Condition_Attributes (type) -{ -#if (defined (_POSIX_MONOTONIC_CLOCK) && !defined (ACE_LACKS_MONOTONIC_TIME)) || defined (ACE_HAS_CLOCK_GETTIME_MONOTONIC) - (void) ACE_OS::condattr_setclock (this->attributes_, CLOCK_MONOTONIC); -#endif -} - -ACE_INLINE -ACE_Condition_Attributes_T::~ACE_Condition_Attributes_T (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Condition_Recursive_Thread_Mutex.cpp b/dep/acelite/ace/Condition_Recursive_Thread_Mutex.cpp deleted file mode 100644 index 74922b65c5d..00000000000 --- a/dep/acelite/ace/Condition_Recursive_Thread_Mutex.cpp +++ /dev/null @@ -1,133 +0,0 @@ -// -*- C++ -*- - -/** - * @file Condition_Recursive_Thread_Mutex.cpp - * - * $Id: Condition_Recursive_Thread_Mutex.cpp 96077 2012-08-20 08:13:23Z johnnyw $ - * - * Originally in Synch.cpp - * - * @author Douglas C. Schmidt - */ - -#include "ace/Condition_Recursive_Thread_Mutex.h" - -#if defined (ACE_HAS_THREADS) - -#include "ace/Log_Msg.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -int -ACE_Condition::remove (void) -{ - return ACE_OS::cond_destroy (&this->cond_); -} - -void -ACE_Condition::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_Condition::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - // No dump method for ACE_cond_t even in emulated mode. - // cond_.dump (); - this->mutex_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Condition::~ACE_Condition (void) -{ - this->remove (); -} - -ACE_Condition::ACE_Condition (ACE_Recursive_Thread_Mutex &m) - : mutex_ (m) -{ - if (ACE_OS::cond_init (&this->cond_) != 0) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Condition::ACE_Condition"))); -} - -ACE_Condition::ACE_Condition (ACE_Recursive_Thread_Mutex &m, - const ACE_Condition_Attributes &attributes) - : mutex_ (m) -{ - if (ACE_OS::cond_init (&this->cond_, - const_cast (attributes.attributes ())) != 0) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Condition::ACE_Condition"))); -} - -int -ACE_Condition::wait (const ACE_Time_Value *abstime) -{ - return this->wait (this->mutex_, abstime); -} - -int -ACE_Condition::wait (ACE_Recursive_Thread_Mutex &mutex, - const ACE_Time_Value *abstime) -{ - ACE_recursive_mutex_state mutex_state_holder; - ACE_recursive_thread_mutex_t &recursive_mutex = mutex.lock (); - - if (ACE_OS::recursive_mutex_cond_unlock (&recursive_mutex, - mutex_state_holder) == -1) - return -1; - - // We wait on the condition, specifying the nesting mutex. For platforms - // with ACE_HAS_RECURSIVE_MUTEXES, this is the recursive mutex itself, - // and is the same as recursive_mutex, above. The caller should have been - // holding the lock on entry to this method, and it is still held. - // For other platforms, this is the nesting mutex that guards the - // ACE_recursive_mutex_t internals, and recursive_mutex_cond_unlock() - // returned with the lock held, but waiters primed and waiting to be - // released. At cond_wait below, the mutex will be released. - // On return, it will be reacquired. - int const result = abstime == 0 - ? ACE_OS::cond_wait (&this->cond_, - &mutex.get_nesting_mutex ()) - : ACE_OS::cond_timedwait (&this->cond_, - &mutex.get_nesting_mutex (), - const_cast (abstime)); - // We are holding the mutex, whether the wait succeeded or failed. - // Stash errno (in case it failed) and then we need to reset the - // recursive mutex state to what it was on entry to this method. - // Resetting it may require a wait for another thread to release - // the ACE_recursive_thread_mutex_t if this is a platform without - // ACE_HAS_RECURSIVE_MUTEXES, and recursive_mutex_cond_relock() takes - // care of that. - { - ACE_Errno_Guard error (errno); - ACE_OS::recursive_mutex_cond_relock (&recursive_mutex, - mutex_state_holder); - } - - return result; -} - -int -ACE_Condition::signal (void) -{ - return ACE_OS::cond_signal (&this->cond_); -} - -int -ACE_Condition::broadcast (void) -{ - return ACE_OS::cond_broadcast (&this->cond_); -} - -ACE_Recursive_Thread_Mutex & -ACE_Condition::mutex (void) -{ - return this->mutex_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_THREADS */ diff --git a/dep/acelite/ace/Condition_Recursive_Thread_Mutex.h b/dep/acelite/ace/Condition_Recursive_Thread_Mutex.h deleted file mode 100644 index a313a7f7b6e..00000000000 --- a/dep/acelite/ace/Condition_Recursive_Thread_Mutex.h +++ /dev/null @@ -1,114 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Condition_Recursive_Thread_Mutex.h - * - * $Id: Condition_Recursive_Thread_Mutex.h 96073 2012-08-17 13:39:55Z mcorino $ - * - * Moved from Synch.h. - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_CONDITION_RECURSIVE_THREAD_MUTEX_H -#define ACE_CONDITION_RECURSIVE_THREAD_MUTEX_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_HAS_THREADS) -# include "ace/Null_Condition.h" -#else /* ACE_HAS_THREADS */ -#include "ace/Recursive_Thread_Mutex.h" -#include "ace/Condition_Attributes.h" -#include "ace/Condition_T.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @brief ACE_Condition template specialization written using - * @a ACE_Recursive_Thread_Mutex. This allows threads to block until - * shared data changes state using recursive mutexes. - */ -template<> -class ACE_Export ACE_Condition -{ -public: - /// Initialize the condition variable with a recursive mutex. - ACE_Condition (ACE_Recursive_Thread_Mutex &m); - - /// Initialize the condition variable. - ACE_Condition (ACE_Recursive_Thread_Mutex &m, - const ACE_Condition_Attributes &attributes); - - /// Implicitly destroy the condition variable. - ~ACE_Condition (void); - - /** - * Explicitly destroy the condition variable. Note that only one - * thread should call this method since it doesn't protect against - * race conditions. - */ - int remove (void); - - /** - * Block on condition, or until absolute time-of-day has passed. If - * abstime == 0 use "blocking" semantics. Else, if @a abstime - * != 0 and the call times out before the condition is signaled - * returns -1 and sets errno to ETIME. - */ - int wait (const ACE_Time_Value *abstime = 0); - - /** - * Block on condition or until absolute time-of-day has passed. If - * abstime == 0 use "blocking" wait() semantics on the recursive @a mutex - * passed as a parameter (this is useful if you need to store the - * in shared memory). Else, if @a abstime != 0 and the - * call times out before the condition is signaled returns -1 - * and sets errno to ETIME. - */ - int wait (ACE_Recursive_Thread_Mutex &mutex, - const ACE_Time_Value *abstime = 0); - - /// Signal one waiting thread. - int signal (void); - - /// Signal *all* waiting threads. - int broadcast (void); - - /// Returns a reference to the underlying mutex; - ACE_Recursive_Thread_Mutex &mutex (void); - - /// Dump the state of an object. - void dump (void) const; - -private: - - // = Prevent assignment and copying. - void operator= (const ACE_Condition &); - ACE_Condition (const ACE_Condition &); - -private: - - /// A normal (i.e., non-recursive) condition variable. - ACE_cond_t cond_; - - /// Reference to the recursive mutex. - ACE_Recursive_Thread_Mutex &mutex_; - -}; - -typedef ACE_Condition ACE_Condition_Recursive_Thread_Mutex; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* !ACE_HAS_THREADS */ - -#include /**/ "ace/post.h" -#endif /* ACE_CONDITION_RECURSIVE_THREAD_MUTEX_H */ diff --git a/dep/acelite/ace/Condition_T.cpp b/dep/acelite/ace/Condition_T.cpp deleted file mode 100644 index 4b5e32d09f9..00000000000 --- a/dep/acelite/ace/Condition_T.cpp +++ /dev/null @@ -1,144 +0,0 @@ -// $Id: Condition_T.cpp 96077 2012-08-20 08:13:23Z johnnyw $ - -#ifndef ACE_CONDITION_T_CPP -#define ACE_CONDITION_T_CPP - -#include "ace/Condition_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_THREADS) - -#include "ace/Log_Msg.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Condition_T.inl" -#include "ace/Time_Value.h" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Condition) - -template void -ACE_Condition::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_Condition::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Thread_Condition::ACE_Thread_Condition (MUTEX &m, - const ACE_TCHAR *name, - void *arg) - : ACE_Condition (m, USYNC_THREAD, name, arg) -{ -// ACE_TRACE ("ACE_Thread_Condition::ACE_Thread_Condition"); -} - -template void -ACE_Thread_Condition::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_Thread_Condition::dump"); - - ACE_Condition::dump (); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Condition::ACE_Condition (MUTEX &m, - int type, - const ACE_TCHAR *name, - void *arg) - : - mutex_ (m) -{ - // ACE_TRACE ("ACE_Condition::ACE_Condition"); - - if (ACE_OS::cond_init (&this->cond_, - (short) type, - name, - arg) != 0) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Condition::ACE_Condition"))); -} - -template -ACE_Condition::ACE_Condition (MUTEX &m, - const ACE_Condition_Attributes &attributes, - const ACE_TCHAR *name, - void *arg) - : mutex_ (m) -{ -// ACE_TRACE ("ACE_Condition::ACE_Condition"); - if (ACE_OS::cond_init (&this->cond_, - const_cast (attributes.attributes ()), - name, arg) != 0) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Condition::ACE_Condition"))); -} - -template -ACE_Condition::~ACE_Condition (void) -{ - // ACE_TRACE ("ACE_Condition::~ACE_Condition"); - - if (this->remove () == -1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Condition::~ACE_Condition"))); -} - -template int -ACE_Condition::wait (void) -{ - // ACE_TRACE ("ACE_Condition::wait"); - return ACE_OS::cond_wait (&this->cond_, - &this->mutex_.lock ()); -} - -template int -ACE_Condition::wait (MUTEX &mutex, - const ACE_Time_Value *abstime) -{ -// ACE_TRACE ("ACE_Condition::wait"); - if (abstime == 0) - { - return ACE_OS::cond_wait (&this->cond_, - &mutex.lock ()); - } - else - { - ACE_Time_Value tv = *abstime; - return ACE_OS::cond_timedwait (&this->cond_, - &mutex.lock (), - &tv); - } -} - -// Peform an "alertable" timed wait. If the argument ABSTIME == 0 -// then we do a regular cond_wait(), else we do a timed wait for up to -// ABSTIME using the Solaris cond_timedwait() function. - -template int -ACE_Condition::wait (const ACE_Time_Value *abstime) -{ -// ACE_TRACE ("ACE_Condition::wait"); - return this->wait (this->mutex_, abstime); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_THREADS */ - -#endif /* ACE_CONDITION_T_CPP */ diff --git a/dep/acelite/ace/Condition_T.h b/dep/acelite/ace/Condition_T.h deleted file mode 100644 index cbae002d7a2..00000000000 --- a/dep/acelite/ace/Condition_T.h +++ /dev/null @@ -1,172 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Condition_T.h - * - * $Id: Condition_T.h 96061 2012-08-16 09:36:07Z mcorino $ - * - * Moved from Synch.h. - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_CONDITION_T_H -#define ACE_CONDITION_T_H - -#include /**/ "ace/pre.h" - -#include "ace/OS_NS_Thread.h" -#include "ace/Condition_Attributes.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_THREADS) /* ACE platform supports some form of threading. */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Time_Value; - -/** - * @class ACE_Condition - * - * @brief ACE_Condition variable wrapper, which allows threads to block - * until shared data changes state. - * - * A condition variable enables threads to atomically block and - * test the condition under the protection of a mutual exclusion - * lock (mutex) until the condition is satisfied. That is, - * the mutex must have been held by the thread before calling - * wait or signal on the condition. If the condition is false, - * a thread blocks on a condition variable and atomically - * releases the mutex that is waiting for the condition to - * change. If another thread changes the condition, it may wake - * up waiting threads by signaling the associated condition - * variable. The waiting threads, upon awakening, reacquire the - * mutex and re-evaluate the condition. - * Note, you can only parameterize with - * @a ACE_Thread_Mutex, @a ACE_Recursive_Thread_Mutex, or @a ACE_Null_Mutex. - */ -template -class ACE_Condition -{ -public: - /// Initialize the condition variable. - ACE_Condition (MUTEX &m, int type = USYNC_THREAD, - const ACE_TCHAR *name = 0, void *arg = 0); - - /// Initialize the condition variable. - ACE_Condition (MUTEX &m, - const ACE_Condition_Attributes &attributes, - const ACE_TCHAR *name = 0, - void *arg = 0); - - /// Implicitly destroy the condition variable. - ~ACE_Condition (void); - - // = Lock accessors. - /** - * Block on condition, or until absolute time-of-day has passed. If - * @a abstime == 0 use "blocking" semantics. Else, if @a abstime - * != 0 and the call times out before the condition is signaled - * wait() returns -1 and sets errno to ETIME. - */ - int wait (const ACE_Time_Value *abstime); - - /// Block on condition. - int wait (void); - - /** - * Block on condition or until absolute time-of-day has passed. If - * @a abstime == 0 use "blocking" wait() semantics on the @a mutex - * passed as a parameter (this is useful if you need to store the - * in shared memory). Else, if @a abstime != 0 and the - * call times out before the condition is signaled wait() returns -1 - * and sets errno to ETIME. - */ - int wait (MUTEX &mutex, const ACE_Time_Value *abstime = 0); - - /// Signal one waiting thread. - int signal (void); - - /// Signal *all* waiting threads. - int broadcast (void); - - // = Utility methods. - /// Explicitly destroy the condition variable. - int remove (void); - - /// Returns a reference to the underlying mutex_; - MUTEX &mutex (void); - - /// Dump the state of an object. - void dump (void) const; - - // ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. - -protected: - /// Condition variable. - ACE_cond_t cond_; - - /// Reference to mutex lock. - MUTEX &mutex_; - -private: - // = Prevent assignment and initialization. - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Condition &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Condition (const ACE_Condition &)) -}; - -/** - * @class ACE_Thread_Condition - * - * @brief ACE_Condition variable wrapper that works within processes. - * - * A condition variable enables threads to atomically block and - * test the condition under the protection of a mutual exclu- - * sion lock (mutex) until the condition is satisfied. That is, - * the mutex must have been held by the thread before calling - * wait or signal on the condition. If the condition is false, - * a thread blocks on a condition variable and atomically - * releases the mutex that is waiting for the condition to - * change. If another thread changes the condition, it may wake - * up waiting threads by signaling the associated condition - * variable. The waiting threads, upon awakening, reacquire the - * mutex and re-evaluate the condition. - */ -template -class ACE_Thread_Condition : public ACE_Condition -{ -public: - // = Initialization method. - ACE_Thread_Condition (MUTEX &m, const ACE_TCHAR *name = 0, void *arg = 0); - - /// Dump the state of an object. - void dump (void) const; - - // ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Condition_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Condition_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Condition_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#endif /* ACE_HAS_THREADS */ - -#include /**/ "ace/post.h" -#endif /* ACE_CONDITION_T_H */ diff --git a/dep/acelite/ace/Condition_T.inl b/dep/acelite/ace/Condition_T.inl deleted file mode 100644 index e3b452734a2..00000000000 --- a/dep/acelite/ace/Condition_T.inl +++ /dev/null @@ -1,51 +0,0 @@ -// -*- C++ -*- -// -// $Id: Condition_T.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE int -ACE_Condition::remove (void) -{ - // ACE_TRACE ("ACE_Condition::remove"); - - // cond_destroy() is called in a loop if the condition variable is - // BUSY. This avoids a condition where a condition is signaled and - // because of some timing problem, the thread that is to be signaled - // has called the cond_wait routine after the signal call. Since - // the condition signal is not queued in any way, deadlock occurs. - - int result = 0; - - while ((result = ACE_OS::cond_destroy (&this->cond_)) == -1 - && errno == EBUSY) - { - ACE_OS::cond_broadcast (&this->cond_); - ACE_OS::thr_yield (); - } - - return result; -} - -template ACE_INLINE MUTEX & -ACE_Condition::mutex (void) -{ - // ACE_TRACE ("ACE_Condition::mutex"); - return this->mutex_; -} - -template ACE_INLINE int -ACE_Condition::signal (void) -{ -// ACE_TRACE ("ACE_Condition::signal"); - return ACE_OS::cond_signal (&this->cond_); -} - -template ACE_INLINE int -ACE_Condition::broadcast (void) -{ -// ACE_TRACE ("ACE_Condition::broadcast"); - return ACE_OS::cond_broadcast (&this->cond_); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Condition_Thread_Mutex.cpp b/dep/acelite/ace/Condition_Thread_Mutex.cpp deleted file mode 100644 index c3fcd7936b0..00000000000 --- a/dep/acelite/ace/Condition_Thread_Mutex.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- C++ -*- */ -/** - * @file Condition_Thread_Mutex.cpp - * - * $Id: Condition_Thread_Mutex.cpp 96077 2012-08-20 08:13:23Z johnnyw $ - * - * Originally in Synch.cpp - * - * @author Douglas C. Schmidt - */ - -#include "ace/Condition_Thread_Mutex.h" - -#if defined (ACE_HAS_THREADS) - -#if !defined (__ACE_INLINE__) -#include "ace/Condition_Thread_Mutex.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Log_Msg.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Condition) - -void -ACE_Condition::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_Condition::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); -#if defined (ACE_WIN32) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("waiters = %d\n"), - this->cond_.waiters ())); -#endif /* ACE_WIN32 */ - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Condition::ACE_Condition (ACE_Thread_Mutex &m, - const ACE_TCHAR *name, - void *arg) - : mutex_ (m), - removed_ (false) -{ -// ACE_TRACE ("ACE_Condition::ACE_Condition"); - if (ACE_OS::cond_init (&this->cond_, - (short) USYNC_THREAD, - name, - arg) != 0) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Condition::ACE_Condition"))); -} - -ACE_Condition::ACE_Condition (ACE_Thread_Mutex &m, - const ACE_Condition_Attributes &attributes, - const ACE_TCHAR *name, - void *arg) - : mutex_ (m), - removed_ (false) -{ -// ACE_TRACE ("ACE_Condition::ACE_Condition"); - if (ACE_OS::cond_init (&this->cond_, - const_cast (attributes.attributes ()), - name, arg) != 0) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Condition::ACE_Condition"))); -} - -ACE_Condition::~ACE_Condition (void) -{ -// ACE_TRACE ("ACE_Condition::~ACE_Condition"); - this->remove (); -} - -// Peform an "alertable" timed wait. If the argument == 0 -// then we do a regular , else we do a timed wait for up to -// using the function. - -int -ACE_Condition::wait (void) -{ -// ACE_TRACE ("ACE_Condition::wait"); - return ACE_OS::cond_wait (&this->cond_, &this->mutex_.lock ()); -} - -int -ACE_Condition::wait (ACE_Thread_Mutex &mutex, - const ACE_Time_Value *abstime) -{ -// ACE_TRACE ("ACE_Condition::wait"); - return ACE_OS::cond_timedwait (&this->cond_, - &mutex.lock (), - const_cast (abstime)); -} - -int -ACE_Condition::wait (const ACE_Time_Value *abstime) -{ -// ACE_TRACE ("ACE_Condition::wait"); - return this->wait (this->mutex_, abstime); -} - -int -ACE_Condition::signal (void) -{ -// ACE_TRACE ("ACE_Condition::signal"); - return ACE_OS::cond_signal (&this->cond_); -} - -int -ACE_Condition::broadcast (void) -{ -// ACE_TRACE ("ACE_Condition::broadcast"); - return ACE_OS::cond_broadcast (&this->cond_); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_THREADS */ diff --git a/dep/acelite/ace/Condition_Thread_Mutex.h b/dep/acelite/ace/Condition_Thread_Mutex.h deleted file mode 100644 index f39829cfe71..00000000000 --- a/dep/acelite/ace/Condition_Thread_Mutex.h +++ /dev/null @@ -1,146 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Condition_Thread_Mutex.h - * - * $Id: Condition_Thread_Mutex.h 96073 2012-08-17 13:39:55Z mcorino $ - * - * Moved from Synch.h. - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_CONDITION_THREAD_MUTEX_H -#define ACE_CONDITION_THREAD_MUTEX_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_HAS_THREADS) -# include "ace/Null_Condition.h" -#else /* ACE_HAS_THREADS */ -// ACE platform supports some form of threading. - -#include "ace/Thread_Mutex.h" -#include "ace/Condition_Attributes.h" -#include "ace/Condition_T.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Time_Value; - -/** - * @brief ACE_Condition template specialization written using - * ACE_Mutexes. This allows threads to block until shared data - * changes state. - * A condition variable enables threads to atomically block and - * test the condition under the protection of a mutual exclu- - * sion lock (mutex) until the condition is satisfied. That is, - * the mutex must have been held by the thread before calling - * wait or signal on the condition. If the condition is false, - * a thread blocks on a condition variable and atomically - * releases the mutex that is waiting for the condition to - * change. If another thread changes the condition, it may wake - * up waiting threads by signaling the associated condition - * variable. The waiting threads, upon awakening, reacquire the - * mutex and re-evaluate the condition. - */ -template <> -class ACE_Export ACE_Condition -{ -public: - /// Initialize the condition variable. - ACE_Condition (ACE_Thread_Mutex &m, - const ACE_TCHAR *name = 0, - void *arg = 0); - - /// Initialize the condition variable. - ACE_Condition (ACE_Thread_Mutex &m, - const ACE_Condition_Attributes &attributes, - const ACE_TCHAR *name = 0, - void *arg = 0); - - /// Implicitly destroy the condition variable. - ~ACE_Condition (void); - - /** - * Explicitly destroy the condition variable. Note that only one - * thread should call this method since it doesn't protect against - * race conditions. - */ - int remove (void); - - /** - * Block on condition, or until absolute time-of-day has passed. If - * abstime == 0 use "blocking" semantics. Else, if @a abstime - * != 0 and the call times out before the condition is signaled - * returns -1 and sets errno to ETIME. - */ - int wait (const ACE_Time_Value *abstime); - - /// Block on condition. - int wait (void); - - /** - * Block on condition or until absolute time-of-day has passed. If - * abstime == 0 use "blocking" wait() semantics on the @a mutex - * passed as a parameter (this is useful if you need to store the - * in shared memory). Else, if @a abstime != 0 and the - * call times out before the condition is signaled returns -1 - * and sets errno to ETIME. - */ - int wait (ACE_Thread_Mutex &mutex, const ACE_Time_Value *abstime = 0); - - /// Signal one waiting thread. - int signal (void); - - /// Signal *all* waiting threads. - int broadcast (void); - - /// Returns a reference to the underlying mutex; - ACE_Thread_Mutex &mutex (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Condition variable. - ACE_cond_t cond_; - - /// Reference to mutex lock. - ACE_Thread_Mutex &mutex_; - - /// Keeps track of whether has been called yet to avoid - /// multiple calls, e.g., explicitly and implicitly in the - /// destructor. This flag isn't protected by a lock, so make sure - /// that you don't have multiple threads simultaneously calling - /// on the same object, which is a bad idea anyway... - bool removed_; - -private: - // = Prevent assignment and initialization. - void operator= (const ACE_Condition &); - ACE_Condition (const ACE_Condition &); -}; - -typedef ACE_Condition ACE_Condition_Thread_Mutex; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Condition_Thread_Mutex.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* !ACE_HAS_THREADS */ - -#include /**/ "ace/post.h" -#endif /* ACE_CONDITION_THREAD_MUTEX_H */ diff --git a/dep/acelite/ace/Condition_Thread_Mutex.inl b/dep/acelite/ace/Condition_Thread_Mutex.inl deleted file mode 100644 index 76cbc82ea82..00000000000 --- a/dep/acelite/ace/Condition_Thread_Mutex.inl +++ /dev/null @@ -1,41 +0,0 @@ -// -*- C++ -*- -// -// $Id: Condition_Thread_Mutex.inl 96061 2012-08-16 09:36:07Z mcorino $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -ACE_Condition::remove (void) -{ -// ACE_TRACE ("ACE_Condition::remove"); - - // is called in a loop if the condition variable is - // BUSY. This avoids a condition where a condition is signaled and - // because of some timing problem, the thread that is to be signaled - // has called the cond_wait routine after the signal call. Since - // the condition signal is not queued in any way, deadlock occurs. - - int result = 0; - - if (!this->removed_) - { - this->removed_ = true; - - while ((result = ACE_OS::cond_destroy (&this->cond_)) == -1 - && errno == EBUSY) - { - ACE_OS::cond_broadcast (&this->cond_); - ACE_OS::thr_yield (); - } - } - return result; -} - -ACE_INLINE ACE_Thread_Mutex & -ACE_Condition::mutex (void) -{ -// ACE_TRACE ("ACE_Condition::mutex"); - return this->mutex_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Configuration.cpp b/dep/acelite/ace/Configuration.cpp deleted file mode 100644 index 85bbf1ca0c0..00000000000 --- a/dep/acelite/ace/Configuration.cpp +++ /dev/null @@ -1,2132 +0,0 @@ -// $Id: Configuration.cpp 92828 2010-12-08 09:38:57Z mcorino $ -#include "ace/Configuration.h" -#include "ace/Auto_Ptr.h" -#include "ace/SString.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_strings.h" -#include "ace/Tokenizer_T.h" - -#if !defined (ACE_LACKS_ACCESS) -# include "ace/OS_NS_unistd.h" -#endif /* ACE_LACKS_ACCESS */ - -#if !defined (__ACE_INLINE__) -#include "ace/Configuration.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Section_Key_Internal::ACE_Section_Key_Internal (void) - : ref_count_ (0) -{ -} - -ACE_Section_Key_Internal::~ACE_Section_Key_Internal (void) -{ -} - -int -ACE_Section_Key_Internal::add_ref (void) -{ - ++ref_count_; - return 0; -} - -int -ACE_Section_Key_Internal::dec_ref (void) -{ - if (!--ref_count_) - delete this; - return 0; -} - -ACE_Configuration_Section_Key::ACE_Configuration_Section_Key (void) - : key_ (0) -{ -} - -ACE_Configuration_Section_Key::~ACE_Configuration_Section_Key (void) -{ - if (key_) - key_->dec_ref (); -} - -ACE_Configuration_Section_Key::ACE_Configuration_Section_Key (ACE_Section_Key_Internal* key) - : key_ (key) -{ - if (key_) - key_->add_ref (); -} - -ACE_Configuration_Section_Key::ACE_Configuration_Section_Key (const ACE_Configuration_Section_Key& rhs) - : key_ (rhs.key_) -{ - if (key_) - key_->add_ref (); -} - -ACE_Configuration_Section_Key& -ACE_Configuration_Section_Key::operator= (const ACE_Configuration_Section_Key& rhs) -{ - if (this != &rhs) - { - if (key_) - key_->dec_ref (); - - key_ = rhs.key_; - - if (key_) - key_->add_ref (); - } - return *this; -} - -////////////////////////////////////////////////////////////////////////////// - -ACE_TCHAR ACE_Configuration::NULL_String_ = '\0'; - -ACE_Configuration::ACE_Configuration (void) - : root_ () -{ -} - -ACE_Configuration::~ACE_Configuration (void) -{ -} - -ACE_Section_Key_Internal* -ACE_Configuration::get_internal_key (const ACE_Configuration_Section_Key& key) -{ - return key.key_; -} - -int -ACE_Configuration::expand_path (const ACE_Configuration_Section_Key& key, - const ACE_TString& path_in, - ACE_Configuration_Section_Key& key_out, - int create) -{ - // Make a copy of key - ACE_Configuration_Section_Key current_section = key; - ACE_Auto_Basic_Array_Ptr pData (path_in.rep ()); - ACE_Tokenizer parser (pData.get ()); - parser.delimiter_replace ('\\', '\0'); - parser.delimiter_replace ('/', '\0'); - - for (ACE_TCHAR *temp = parser.next (); - temp != 0; - temp = parser.next ()) - { - // Open the section - if (open_section (current_section, - temp, - create, - key_out)) - return -1; - - current_section = key_out; - } - - return 0; - -} - -int -ACE_Configuration::validate_name (const ACE_TCHAR* name, int allow_path) -{ - // Invalid character set - const ACE_TCHAR* reject = - allow_path ? ACE_TEXT ("][") : ACE_TEXT ("\\]["); - - // Position of the first invalid character or terminating null. - size_t const pos = ACE_OS::strcspn (name, reject); - - // Check if it is an invalid character. - if (name[pos] != ACE_TEXT ('\0')) - { - errno = EINVAL; - return -1; - } - - // The first character can never be a path separator. - if (name[0] == ACE_TEXT ('\\')) - { - errno = EINVAL; - return -1; - } - - // Validate length. - if (pos == 0 || pos > 255) - { - errno = ENAMETOOLONG; - return -1; - } - - return 0; -} - -int -ACE_Configuration::validate_value_name (const ACE_TCHAR* name) -{ - if (name == 0 || *name == this->NULL_String_) - return 0; - - return this->validate_name (name); -} - -const ACE_Configuration_Section_Key& -ACE_Configuration::root_section (void) const -{ - return root_; -} - -/** - * Determine if the contents of this object is the same as the - * contents of the object on the right hand side. - * Returns 1 (True) if they are equal and 0 (False) if they are not equal - */ -bool -ACE_Configuration::operator== (const ACE_Configuration& rhs) const -{ - bool rc = true; - int sectionIndex = 0; - ACE_TString sectionName; - ACE_Configuration *nonconst_this = const_cast (this); - ACE_Configuration &nonconst_rhs = const_cast (rhs); - - const ACE_Configuration_Section_Key& rhsRoot = rhs.root_section (); - ACE_Configuration_Section_Key rhsSection; - ACE_Configuration_Section_Key thisSection; - - // loop through each section in this object - while ((rc) && (nonconst_this->enumerate_sections (this->root_, - sectionIndex, - sectionName) == 0)) - { - // find that section in the rhs object - if (nonconst_rhs.open_section (rhsRoot, - sectionName.c_str (), - 0, - rhsSection) != 0) - { - // If the rhs object does not contain the section then we are - // not equal. - rc = false; - } - else if (nonconst_this->open_section (this->root_, - sectionName.c_str (), - 0, - thisSection) != 0) - { - // if there is some error opening the section in this object - rc = false; - } - else - { - // Well the sections match - int valueIndex = 0; - ACE_TString valueName; - VALUETYPE valueType; - VALUETYPE rhsType; - - // Enumerate each value in this section - while ((rc) && nonconst_this->enumerate_values (thisSection, - valueIndex, - valueName, - valueType) == 0) - { - // look for the same value in the rhs section - if (nonconst_rhs.find_value (rhsSection, - valueName.c_str (), - rhsType) != 0) - { - // We're not equal if the same value cannot - // be found in the rhs object. - rc = false; - } - else if (valueType != rhsType) - { - // we're not equal if the types do not match. - rc = false; - } - else - { - // finally compare values. - if (valueType == STRING) - { - ACE_TString thisString, rhsString; - if (nonconst_this->get_string_value (thisSection, - valueName.c_str (), - thisString) != 0) - { - // we're not equal if we cannot get this string - rc = false; - } - else if (nonconst_rhs.get_string_value ( - rhsSection, - valueName.c_str (), - rhsString) != 0) - { - // we're not equal if we cannot get rhs string - rc = false; - } - rc = (thisString == rhsString); - } - else if (valueType == INTEGER) - { - u_int thisInt = 0; - u_int rhsInt = 0; - if (nonconst_this->get_integer_value ( - thisSection, - valueName.c_str (), - thisInt) != 0) - { - // we're not equal if we cannot get this int - rc = false; - } - else if (nonconst_rhs.get_integer_value ( - rhsSection, - valueName.c_str (), - rhsInt) != 0) - { - // we're not equal if we cannot get rhs int - rc = false; - } - rc = (thisInt == rhsInt); - } - else if (valueType == BINARY) - { - void* thisData = 0; - void* rhsData = 0; - size_t thisLength = 0; - size_t rhsLength = 0; - if (nonconst_this->get_binary_value (thisSection, - valueName.c_str (), - thisData, - thisLength) != 0) - { - // we're not equal if we cannot get this data - rc = false; - } - else if (nonconst_rhs.get_binary_value ( - rhsSection, - valueName.c_str (), - rhsData, - rhsLength) != 0) - { - // we're not equal if we cannot get this data - rc = false; - } - - rc = (thisLength == rhsLength); - // are the length's the same? - - if (rc) - { - unsigned char* thisCharData = - (unsigned char*)thisData; - unsigned char* rhsCharData = (unsigned char*)rhsData; - // yes, then check each element - for (size_t count = 0; - (rc) && (count < thisLength); - count++) - { - rc = (* (thisCharData + count) == * (rhsCharData + count)); - } - - delete [] thisCharData; - delete [] rhsCharData; - }// end if the length's match - } - // We should never have valueTypes of INVALID, therefore - // we're not comparing them. How would we since we have - // no get operation for invalid types. - // So, if we have them, we guess they are equal. - - }// end else if values match. - - ++valueIndex; - - }// end value while loop - - // look in the rhs for values not in this - valueIndex = 0; - while ((rc) && (nonconst_rhs.enumerate_values (rhsSection, - valueIndex, - valueName, - rhsType) == 0)) - { - // look for the same value in this section - if (nonconst_this->find_value (thisSection, - valueName.c_str (), - valueType) != 0) - { - // We're not equal if the same value cannot - // be found in the rhs object. - rc = false; - } - ++valueIndex; - }// end while for rhs values not in this. - - }// end else if sections match. - - ++sectionIndex; - - }// end section while loop - - // Finally, make sure that there are no sections in rhs that do not - // exist in this - sectionIndex = 0; - while ((rc) - && (nonconst_rhs.enumerate_sections (rhsRoot, - sectionIndex, - sectionName) == 0)) - { - // find the section in this - if (nonconst_this->open_section (this->root_, - sectionName.c_str (), - 0, - thisSection) != 0) - { - // if there is some error opening the section in this object - rc = false; - } - else if (nonconst_rhs.open_section (rhsRoot, - sectionName.c_str (), - 0, - rhsSection) != 0) - { - // If the rhs object does not contain the section then we - // are not equal. - rc = false; - } - ++sectionIndex; - } - return rc; -} - -bool -ACE_Configuration::operator!= (const ACE_Configuration& rhs) const -{ - return !(*this == rhs); -} - -////////////////////////////////////////////////////////////////////////////// - -#if defined (ACE_WIN32) && !defined (ACE_LACKS_WIN32_REGISTRY) - -static const int ACE_DEFAULT_BUFSIZE = 256; - -static const ACE_TCHAR *temp_name (const ACE_TCHAR *name) -{ - if (name && *name == ACE_Configuration::NULL_String_) - return 0; - return name; -} - -ACE_Section_Key_Win32::ACE_Section_Key_Win32 (HKEY hKey) - : hKey_ (hKey) -{ -} - -ACE_Section_Key_Win32::~ACE_Section_Key_Win32 (void) -{ - ::RegCloseKey (hKey_); -} - -////////////////////////////////////////////////////////////////////////////// - -bool -ACE_Configuration_Win32Registry::operator== (const ACE_Configuration_Win32Registry &rhs) const -{ - ACE_UNUSED_ARG (rhs); - return true; -} - -bool -ACE_Configuration_Win32Registry::operator!= (const ACE_Configuration_Win32Registry &rhs) const -{ - ACE_UNUSED_ARG (rhs); - return true; -} - -ACE_Configuration_Win32Registry::ACE_Configuration_Win32Registry (HKEY hKey) -{ - ACE_Section_Key_Win32 *temp = 0; - - ACE_NEW (temp, ACE_Section_Key_Win32 (hKey)); - - root_ = ACE_Configuration_Section_Key (temp); -} - - -ACE_Configuration_Win32Registry::~ACE_Configuration_Win32Registry (void) -{ -} - -int -ACE_Configuration_Win32Registry::open_section (const ACE_Configuration_Section_Key& base, - const ACE_TCHAR* sub_section, - int create, - ACE_Configuration_Section_Key& result) -{ - if (validate_name (sub_section, 1)) - return -1; - - HKEY base_key; - if (load_key (base, base_key)) - return -1; - - int errnum; - HKEY result_key; - if ((errnum = ACE_TEXT_RegOpenKeyEx (base_key, - sub_section, - 0, - KEY_ALL_ACCESS, - &result_key)) != ERROR_SUCCESS) - { - if (!create) - { - errno = errnum; - return -1; - } - - if ((errnum = ACE_TEXT_RegCreateKeyEx (base_key, - sub_section, - 0, - 0, - REG_OPTION_NON_VOLATILE, - KEY_ALL_ACCESS, - 0, - &result_key, - (PDWORD) 0 - )) != ERROR_SUCCESS) - { - errno = errnum; - return -1; - } - } - - ACE_Section_Key_Win32 *temp; - - ACE_NEW_RETURN (temp, ACE_Section_Key_Win32 (result_key), -1); - result = ACE_Configuration_Section_Key (temp); - return 0; -} - -int -ACE_Configuration_Win32Registry::remove_section (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* sub_section, - bool recursive) -{ - if (validate_name (sub_section)) - return -1; - - HKEY base_key; - if (load_key (key, base_key)) - return -1; - - if (recursive) - { - ACE_Configuration_Section_Key section; - if (open_section (key, sub_section, 0, section)) - return -1; - - HKEY sub_key; - if (load_key (section, sub_key)) - return -1; - - ACE_TCHAR name_buffer[ACE_DEFAULT_BUFSIZE]; - DWORD buffer_size = ACE_DEFAULT_BUFSIZE; - // Note we don't increment the index because the - // enumeration becomes invalid if we change the - // subkey, which we do when we delete it. By leaving - // it 0, we always delete the top entry - while (ACE_TEXT_RegEnumKeyEx (sub_key, - 0, - name_buffer, - &buffer_size, - 0, - 0, - 0, - 0) == ERROR_SUCCESS) - { - remove_section (section, name_buffer, true); - buffer_size = ACE_DEFAULT_BUFSIZE; - } - } - - int const errnum = ACE_TEXT_RegDeleteKey (base_key, sub_section); - if (errnum != ERROR_SUCCESS) - { - errno = errnum; - return -1; - } - - return 0; -} - -int -ACE_Configuration_Win32Registry::enumerate_values (const ACE_Configuration_Section_Key& key, - int index, - ACE_TString& name, - VALUETYPE& type) -{ - HKEY base_key; - if (load_key (key, base_key)) - return -1; - - ACE_TCHAR name_buffer[ACE_DEFAULT_BUFSIZE]; - DWORD buffer_size = ACE_DEFAULT_BUFSIZE; - DWORD value_type; - - int rc = ACE_TEXT_RegEnumValue (base_key, - index, - name_buffer, - &buffer_size, - 0, - &value_type, - 0, - 0); - if (rc == ERROR_NO_MORE_ITEMS) - return 1; - else if (rc != ERROR_SUCCESS) - { - errno = rc; - return -1; - } - - name = name_buffer; - - switch (value_type) - { - case REG_BINARY: - type = BINARY; - break; - case REG_SZ: - type = STRING; - break; - case REG_DWORD: - type = INTEGER; - break; - default: - type = INVALID; - } - - return 0; -} - -int -ACE_Configuration_Win32Registry::enumerate_sections (const ACE_Configuration_Section_Key& key, - int index, - ACE_TString& name) -{ - HKEY base_key; - if (load_key (key, base_key)) - return -1; - - ACE_TCHAR name_buffer[ACE_DEFAULT_BUFSIZE]; - DWORD buffer_size = ACE_DEFAULT_BUFSIZE; - int rc = ACE_TEXT_RegEnumKeyEx (base_key, - index, - name_buffer, - &buffer_size, - 0, - 0, - 0, - 0); - if (rc == ERROR_NO_MORE_ITEMS) - return 1; - else if (rc != ERROR_MORE_DATA && rc != ERROR_SUCCESS) - { - errno = rc; - return -1; - } - - name = name_buffer; - - return 0; -} - -int -ACE_Configuration_Win32Registry::set_string_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - const ACE_TString& value) -{ - const ACE_TCHAR *t_name = temp_name (name); - if (validate_value_name (t_name)) - return -1; - - HKEY base_key; - if (load_key (key, base_key)) - return -1; - - int errnum; - DWORD len = static_cast (value.length () + 1); - len *= sizeof (ACE_TCHAR); - if ((errnum = ACE_TEXT_RegSetValueEx (base_key, - t_name, - 0, - REG_SZ, - (BYTE *) value.fast_rep (), - len)) - != ERROR_SUCCESS) - { - errno = errnum; - return -1; - } - - return 0; -} - -int -ACE_Configuration_Win32Registry::set_integer_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - u_int value) -{ - const ACE_TCHAR *t_name = temp_name (name); - if (validate_value_name (t_name)) - return -1; - - HKEY base_key; - if (load_key (key, base_key)) - return -1; - - int errnum; - if ((errnum = ACE_TEXT_RegSetValueEx (base_key, - t_name, - 0, - REG_DWORD, - (BYTE *) &value, - sizeof (value))) != ERROR_SUCCESS) - { - errno = errnum; - return -1; - } - - return 0; -} - -int -ACE_Configuration_Win32Registry::set_binary_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - const void* data, - size_t length) -{ - const ACE_TCHAR *t_name = temp_name (name); - if (validate_value_name (t_name)) - return -1; - - HKEY base_key; - if (load_key (key, base_key)) - return -1; - - int errnum; - if ((errnum = ACE_TEXT_RegSetValueEx (base_key, - t_name, - 0, - REG_BINARY, - (BYTE *) data, - static_cast (length))) - != ERROR_SUCCESS) - { - errno = errnum; - return -1; - } - - return 0; -} - -int -ACE_Configuration_Win32Registry::get_string_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - ACE_TString& value) -{ - const ACE_TCHAR *t_name = temp_name (name); - if (validate_value_name (t_name)) - return -1; - - HKEY base_key; - if (load_key (key, base_key)) - return -1; - - // Get the size of the binary data from windows - int errnum; - DWORD buffer_length = 0; - DWORD type; - if ((errnum = ACE_TEXT_RegQueryValueEx (base_key, - t_name, - 0, - &type, - (BYTE *) 0, - &buffer_length)) != ERROR_SUCCESS) - { - errno = errnum; - return -1; - } - - if (type != REG_SZ) - { - errno = ERROR_INVALID_DATATYPE; - return -1; - } - - ACE_TCHAR *temp = 0; - ACE_NEW_RETURN (temp, - ACE_TCHAR[buffer_length], - -1); - - ACE_Auto_Basic_Array_Ptr buffer (temp); - - if ((errnum = ACE_TEXT_RegQueryValueEx (base_key, - t_name, - 0, - &type, - (BYTE *) buffer.get (), - &buffer_length)) != ERROR_SUCCESS) - { - errno = errnum; - return -1; - } - - value = buffer.get (); - return 0; -} - -int -ACE_Configuration_Win32Registry::get_integer_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - u_int& value) -{ - const ACE_TCHAR *t_name = temp_name (name); - if (validate_value_name (t_name)) - return -1; - - HKEY base_key; - if (load_key (key, base_key)) - return -1; - - int errnum; - DWORD length = sizeof (value); - DWORD type; - if ((errnum = ACE_TEXT_RegQueryValueEx (base_key, - t_name, - 0, - &type, - (BYTE *) &value, - &length)) != ERROR_SUCCESS) - { - errno = errnum; - return -1; - } - - if (type != REG_DWORD) - { - errno = ERROR_INVALID_DATATYPE; - return -1; - } - - return 0; -} - -int -ACE_Configuration_Win32Registry::get_binary_value ( - const ACE_Configuration_Section_Key &key, - const ACE_TCHAR *name, - void *&data, - size_t &length) -{ - const ACE_TCHAR *t_name = temp_name (name); - if (validate_value_name (t_name)) - return -1; - - HKEY base_key; - if (load_key (key, base_key)) - return -1; - - // Get the size of the binary data from windows - int errnum; - DWORD buffer_length = 0; - DWORD type; - if ((errnum = ACE_TEXT_RegQueryValueEx (base_key, - t_name, - 0, - &type, - (BYTE *) 0, - &buffer_length)) != ERROR_SUCCESS) - { - errno = errnum; - return -1; - } - - if (type != REG_BINARY) - { - errno = ERROR_INVALID_DATATYPE; - return -1; - } - - length = buffer_length; - - BYTE * the_data = 0; - ACE_NEW_RETURN (the_data, BYTE[length], -1); - ACE_Auto_Basic_Array_Ptr safe_data (the_data); - - if ((errnum = ACE_TEXT_RegQueryValueEx (base_key, - t_name, - 0, - &type, - the_data, - &buffer_length)) != ERROR_SUCCESS) - { - data = 0; - errno = errnum; - return -1; - } - - data = safe_data.release (); - - return 0; -} - -int -ACE_Configuration_Win32Registry::find_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - VALUETYPE& type_out) -{ - const ACE_TCHAR *t_name = temp_name (name); - if (validate_value_name (t_name)) - return -1; - - HKEY base_key; - if (load_key (key, base_key)) - return -1; - - DWORD buffer_length=0; - DWORD type; - int result=ACE_TEXT_RegQueryValueEx (base_key, - t_name, - 0, - &type, - 0, - &buffer_length); - if (result != ERROR_SUCCESS) - { - errno = result; - return -1; - } - - switch (type) - { - case REG_SZ: - type_out = STRING; - break; - case REG_DWORD: - type_out = INTEGER; - break; - case REG_BINARY: - type_out = BINARY; - break; - default: - return -1; // unknown type - } - - return 0; -} - -int -ACE_Configuration_Win32Registry::remove_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name) -{ - const ACE_TCHAR *t_name = temp_name (name); - if (validate_value_name (t_name)) - return -1; - - HKEY base_key; - if (load_key (key, base_key)) - return -1; - - int errnum; - if ((errnum = ACE_TEXT_RegDeleteValue (base_key, t_name)) != ERROR_SUCCESS) - { - errno = errnum; - return -1; - } - - return 0; -} - - -int -ACE_Configuration_Win32Registry::load_key (const ACE_Configuration_Section_Key& key, - HKEY& hKey) -{ - ACE_Section_Key_Win32* pKey = dynamic_cast (get_internal_key (key)); - if (!pKey) - return -1; - - hKey = pKey->hKey_; - return 0; -} - -HKEY -ACE_Configuration_Win32Registry::resolve_key (HKEY hKey, - const ACE_TCHAR* path, - int create) -{ - HKEY result = 0; - // Make a copy of hKey - int errnum; -#if defined (ACE_HAS_WINCE) - if ((errnum = RegOpenKeyEx (hKey, 0, 0, 0, &result)) != ERROR_SUCCESS) -#else - if ((errnum = RegOpenKey (hKey, 0, &result)) != ERROR_SUCCESS) -#endif // ACE_HAS_WINCE - { - errno = errnum; - return 0; - } - - // recurse through the path - ACE_TCHAR *temp_path = 0; - ACE_NEW_RETURN (temp_path, - ACE_TCHAR[ACE_OS::strlen (path) + 1], - 0); - ACE_Auto_Basic_Array_Ptr pData (temp_path); - ACE_OS::strcpy (pData.get (), path); - ACE_Tokenizer parser (pData.get ()); - parser.delimiter_replace ('\\', '\0'); - parser.delimiter_replace ('/', '\0'); - - for (ACE_TCHAR *temp = parser.next (); - temp != 0; - temp = parser.next ()) - { - // Open the key - HKEY subkey; - -#if defined (ACE_HAS_WINCE) - if ((errnum = ACE_TEXT_RegOpenKeyEx (result, - temp, - 0, - 0, - &subkey)) != ERROR_SUCCESS) -#else - if ((errnum = ACE_TEXT_RegOpenKey (result, - temp, - &subkey)) != ERROR_SUCCESS) -#endif // ACE_HAS_WINCE - { - // try creating it - if (!create || (errnum = ACE_TEXT_RegCreateKeyEx (result, - temp, - 0, - 0, - 0, - KEY_ALL_ACCESS, - 0, - &subkey, - (PDWORD) 0 - )) !=ERROR_SUCCESS) - { - errno = errnum; - // error - ::RegCloseKey (result); - return 0; - } - } - // release our open key handle - ::RegCloseKey (result); - result = subkey; - } - - return result; -} - -#endif /* ACE_WIN32 && !ACE_LACKS_WIN32_REGISTRY */ - -/////////////////////////////////////////////////////////////// - -ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (void) - : type_ (ACE_Configuration::INVALID), - length_ (0) -{ - this->data_.ptr_ = 0; -} - -ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (ACE_TCHAR* string) - : type_ (ACE_Configuration::STRING), - length_ (0) -{ - this->data_.ptr_ = string; -} - -ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (u_int integer) - : type_ (ACE_Configuration::INTEGER), - length_ (0) -{ - this->data_.int_ = integer; -} - -ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (void* data, size_t length) - : type_ (ACE_Configuration::BINARY), - length_ (length) -{ - this->data_.ptr_ = data; -} - -ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (const ACE_Configuration_Value_IntId& rhs) - : type_ (rhs.type_), - data_ (rhs.data_), - length_ (rhs.length_) -{ -} - -ACE_Configuration_Value_IntId::~ACE_Configuration_Value_IntId (void) -{ -} - -ACE_Configuration_Value_IntId& ACE_Configuration_Value_IntId::operator= (const ACE_Configuration_Value_IntId& rhs) -{ - if (this != &rhs) - { - type_ = rhs.type_; - data_ = rhs.data_; - length_ = rhs.length_; - } - return *this; -} - -void -ACE_Configuration_Value_IntId::free (ACE_Allocator *alloc) -{ - if (this->type_ == ACE_Configuration::STRING - || this->type_ == ACE_Configuration::BINARY) - alloc->free (data_.ptr_); - // Do nothing in other cases... -} - -ACE_Configuration_ExtId::ACE_Configuration_ExtId (void) - : name_ (0) -{ -} - -ACE_Configuration_ExtId::ACE_Configuration_ExtId (const ACE_TCHAR* name) - : name_ (name) -{ -} - -ACE_Configuration_ExtId::ACE_Configuration_ExtId (const ACE_Configuration_ExtId& rhs) - : name_ (rhs.name_) -{ -} - -ACE_Configuration_ExtId::~ACE_Configuration_ExtId (void) -{ -} - -ACE_Configuration_ExtId& ACE_Configuration_ExtId::operator= (const ACE_Configuration_ExtId& rhs) -{ - if (this != &rhs) - name_ = rhs.name_; - - return *this; -} - -bool -ACE_Configuration_ExtId::operator== (const ACE_Configuration_ExtId& rhs) const -{ - return (ACE_OS::strcasecmp (name_, rhs.name_) == 0); -} - -bool -ACE_Configuration_ExtId::operator!= (const ACE_Configuration_ExtId& rhs) const -{ - return !this->operator== (rhs); -} - -u_long -ACE_Configuration_ExtId::hash (void) const -{ - ACE_TString temp (name_, 0, false); - return temp.hash (); -} - -void -ACE_Configuration_ExtId::free (ACE_Allocator *alloc) -{ - alloc->free ((void *) (name_)); -} - -/////////////////////////////////////////////////////////////////////// - -ACE_Configuration_Section_IntId::ACE_Configuration_Section_IntId (void) - : value_hash_map_ (0), - section_hash_map_ (0) -{ -} - -ACE_Configuration_Section_IntId::ACE_Configuration_Section_IntId (VALUE_MAP* value_hash_map, SUBSECTION_MAP* section_hash_map) - : value_hash_map_ (value_hash_map), - section_hash_map_ (section_hash_map) -{ -} - -ACE_Configuration_Section_IntId::ACE_Configuration_Section_IntId (const ACE_Configuration_Section_IntId& rhs) - : value_hash_map_ (rhs.value_hash_map_), - section_hash_map_ (rhs.section_hash_map_) -{ - -} - -ACE_Configuration_Section_IntId::~ACE_Configuration_Section_IntId () -{ -} - -ACE_Configuration_Section_IntId& -ACE_Configuration_Section_IntId::operator= (const ACE_Configuration_Section_IntId& rhs) -{ - if (this != &rhs) - { - value_hash_map_ = rhs.value_hash_map_; - section_hash_map_ = rhs.section_hash_map_; - } - return *this; -} - -void -ACE_Configuration_Section_IntId::free (ACE_Allocator *alloc) -{ - alloc->free ((void *) (value_hash_map_)); - alloc->free ((void *) (section_hash_map_)); -} - -ACE_Configuration_Section_Key_Heap::ACE_Configuration_Section_Key_Heap (const ACE_TCHAR* path) - : path_ (0), - value_iter_ (0), - section_iter_ (0) -{ - path_ = ACE_OS::strdup (path); -} - -ACE_Configuration_Section_Key_Heap::~ACE_Configuration_Section_Key_Heap () -{ - delete value_iter_; - delete section_iter_; - ACE_OS::free (path_); -} - -////////////////////////////////////////////////////////////////////////////// - -ACE_Configuration_Heap::ACE_Configuration_Heap (void) - : allocator_ (0), - index_ (0), - default_map_size_ (0) -{ - ACE_Configuration_Section_Key_Heap *temp = 0; - - ACE_NEW (temp, ACE_Configuration_Section_Key_Heap (ACE_TEXT (""))); - root_ = ACE_Configuration_Section_Key (temp); -} - -ACE_Configuration_Heap::~ACE_Configuration_Heap (void) -{ - if (allocator_) - allocator_->sync (); - - delete allocator_; -} - -int -ACE_Configuration_Heap::open (size_t default_map_size) -{ - if (this->allocator_ != 0) - { - errno = EBUSY; - return -1; - } - - default_map_size_ = default_map_size; - // Create the allocator with the appropriate options. - // The name used for the lock is the same as one used - // for the file. - ACE_NEW_RETURN (this->allocator_, - HEAP_ALLOCATOR (), - -1); - return create_index (); -} - - -int -ACE_Configuration_Heap::open (const ACE_TCHAR* file_name, - void* base_address, - size_t default_map_size) -{ - if (this->allocator_ != 0) - { - errno = EBUSY; - return -1; - } - - default_map_size_ = default_map_size; - - // Make sure that the file name is of the legal length. - if (ACE_OS::strlen (file_name) >= MAXNAMELEN + MAXPATHLEN) - { - errno = ENAMETOOLONG; - return -1; - } - - ACE_MMAP_Memory_Pool::OPTIONS options (base_address); - - // Create the allocator with the appropriate options. The name used - // for the lock is the same as one used for the file. - ACE_NEW_RETURN (this->allocator_, - PERSISTENT_ALLOCATOR (file_name, - file_name, - &options), - -1); - -#if !defined (ACE_LACKS_ACCESS) - // Now check if the backing store has been created successfully. - if (ACE_OS::access (file_name, F_OK) != 0) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("create_index\n")), - -1); -#endif /* ACE_LACKS_ACCESS */ - - return create_index (); -} - -int -ACE_Configuration_Heap::create_index (void) -{ - void *section_index = 0; - - // This is the easy case since if we find hash table in the - // memory-mapped file we know it's already initialized. - if (this->allocator_->find (ACE_CONFIG_SECTION_INDEX, section_index) == 0) - this->index_ = (SECTION_MAP *) section_index; - - // Create a new (because we've just created a new - // memory-mapped file). - else - { - size_t index_size = sizeof (SECTION_MAP); - section_index = this->allocator_->malloc (index_size); - - if (section_index == 0 - || create_index_helper (section_index) == -1 - || this->allocator_->bind (ACE_CONFIG_SECTION_INDEX, - section_index) == -1) - { - // Attempt to clean up. - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("create_index failed\n"))); - this->allocator_->remove (); - return -1; - } - // Add the root section - return new_section (ACE_TEXT (""), root_); - } - return 0; -} - -int -ACE_Configuration_Heap::create_index_helper (void *buffer) -{ - ACE_ASSERT (this->allocator_); - this->index_ = new (buffer) SECTION_MAP (this->allocator_); - return 0; -} - -int -ACE_Configuration_Heap::load_key (const ACE_Configuration_Section_Key& key, - ACE_TString& name) -{ - ACE_ASSERT (this->allocator_); - ACE_Configuration_Section_Key_Heap* pKey = - dynamic_cast (get_internal_key (key)); - - if (!pKey) - { - return -1; - } - - ACE_TString temp (pKey->path_, 0, false); - name.assign_nocopy (temp); - return 0; -} - - -int -ACE_Configuration_Heap::add_section (const ACE_Configuration_Section_Key& base, - const ACE_TCHAR* sub_section, - ACE_Configuration_Section_Key& result) -{ - ACE_ASSERT (this->allocator_); - ACE_TString section; - if (load_key (base, section)) - return -1; - - // Find the base section - ACE_Configuration_ExtId ExtId (section.fast_rep ()); - ACE_Configuration_Section_IntId IntId; - if (index_->find (ExtId, IntId, allocator_)) - return -1; - - // See if this section already exists - ACE_Configuration_ExtId SubSectionExtId (sub_section); - int ignored = 0; - - if (!IntId.section_hash_map_->find (SubSectionExtId, ignored, allocator_)) - { - // already exists! - errno = EEXIST; - return -1; - } - - // Create the new section name - // only prepend a separater if were not at the root - if (section.length ()) - section += ACE_TEXT ("\\"); - - section += sub_section; - - // Add it to the base section - ACE_TCHAR* pers_name = (ACE_TCHAR *) allocator_->malloc ((ACE_OS::strlen (sub_section) + 1) * sizeof (ACE_TCHAR)); - ACE_OS::strcpy (pers_name, sub_section); - ACE_Configuration_ExtId SSExtId (pers_name); - if (IntId.section_hash_map_->bind (SSExtId, ignored, allocator_)) - { - allocator_->free (pers_name); - return -1; - } - return (new_section (section, result)); -} - -int -ACE_Configuration_Heap::new_section (const ACE_TString& section, - ACE_Configuration_Section_Key& result) -{ - ACE_ASSERT (this->allocator_); - // Create a new section and add it to the global list - - // Allocate memory for items to be stored in the table. - size_t section_len = section.length () + 1; - ACE_TCHAR *ptr = (ACE_TCHAR*) this->allocator_->malloc (section_len * sizeof (ACE_TCHAR)); - - int return_value = -1; - - if (ptr == 0) - return -1; - else - { - // Populate memory with data. - ACE_OS::strcpy (ptr, section.fast_rep ()); - - void *value_hash_map = 0; - size_t map_size = sizeof (VALUE_MAP); - value_hash_map = this->allocator_->malloc (map_size); - - // If allocation failed ... - if (value_hash_map == 0) - return -1; - - // Initialize allocated hash map through placement new. - if (value_open_helper (default_map_size_, value_hash_map ) == -1) - { - this->allocator_->free (value_hash_map ); - return -1; - } - - // create the section map - void* section_hash_map = 0; - map_size = sizeof (SUBSECTION_MAP); - section_hash_map = this->allocator_->malloc (map_size); - - // If allocation failed - if (section_hash_map == 0) - return -1; - - // initialize allocated hash map through placement new - if (section_open_helper (default_map_size_, section_hash_map) == -1) - { - this->allocator_->free (value_hash_map ); - this->allocator_->free (section_hash_map); - return -1; - } - - ACE_Configuration_ExtId name (ptr); - ACE_Configuration_Section_IntId entry ((VALUE_MAP*) value_hash_map, - (SUBSECTION_MAP*) section_hash_map); - - // Do a normal bind. This will fail if there's already an - // entry with the same name. - return_value = this->index_->bind (name, entry, this->allocator_); - - if (return_value == 1 /* Entry already existed so bind failed. */ - || return_value == -1 /* Unable to bind for other reasons. */) - { - // Free our dynamically allocated memory. - this->allocator_->free (static_cast (ptr)); - return return_value; - } - - // If bind () succeed, it will automatically sync - // up the map manager entry. However, we must sync up our - // name/value memory. - this->allocator_->sync (ptr, section_len); - } - - // set the result - ACE_Configuration_Section_Key_Heap *temp; - ACE_NEW_RETURN (temp, - ACE_Configuration_Section_Key_Heap (ptr), - -1); - result = ACE_Configuration_Section_Key (temp); - return return_value; -} - -int -ACE_Configuration_Heap::value_open_helper (size_t hash_table_size, - void *buffer) -{ - ACE_ASSERT (this->allocator_); - new (buffer) VALUE_MAP (hash_table_size, this->allocator_); - return 0; -} - -int -ACE_Configuration_Heap::section_open_helper (size_t hash_table_size, - void *buffer) -{ - ACE_ASSERT (this->allocator_); - new (buffer) SUBSECTION_MAP (hash_table_size, this->allocator_); - return 0; -} - -int -ACE_Configuration_Heap::open_section (const ACE_Configuration_Section_Key& base, - const ACE_TCHAR* sub_section, - int create, - ACE_Configuration_Section_Key& result) -{ - ACE_ASSERT (this->allocator_); - if (validate_name (sub_section, 1)) // 1 == allow_path - return -1; - - result = base; - - for (const ACE_TCHAR* separator; - (separator = ACE_OS::strchr (sub_section, ACE_TEXT ('\\'))) != 0; - ) - { - ACE_TString simple_section (sub_section, separator - sub_section); - int ret_val = - open_simple_section (result, simple_section.c_str (), create, result); - if (ret_val) - return ret_val; - sub_section = separator + 1; - } - - return open_simple_section (result, sub_section, create, result); -} - -int -ACE_Configuration_Heap::open_simple_section (const ACE_Configuration_Section_Key& base, - const ACE_TCHAR* sub_section, - int create, - ACE_Configuration_Section_Key& result) -{ - ACE_TString section (0, 0, false); - - if (load_key (base, section)) - { - return -1; - } - - // Only add the \\ if were not at the root - if (section.length ()) - { - section += ACE_TEXT ("\\"); - } - - section += sub_section; - - // resolve the section - ACE_Configuration_ExtId ExtId (section.fast_rep ()); - ACE_Configuration_Section_IntId IntId; - - if (index_->find (ExtId, IntId, allocator_)) - { - if (!create) - { - errno = ENOENT; - return -1; - } - - return add_section (base, sub_section, result); - } - - ACE_Configuration_Section_Key_Heap *temp; - ACE_NEW_RETURN (temp, - ACE_Configuration_Section_Key_Heap (section.fast_rep ()), - -1); - result = ACE_Configuration_Section_Key (temp); - return 0; -} - -int -ACE_Configuration_Heap::remove_section (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* sub_section, - bool recursive) -{ - ACE_ASSERT (this->allocator_); - if (validate_name (sub_section)) - return -1; - - ACE_TString section; - if (load_key (key, section)) - return -1; - - // Find this key - ACE_Configuration_ExtId ParentExtId (section.fast_rep ()); - ACE_Configuration_Section_IntId ParentIntId; - if (index_->find (ParentExtId, ParentIntId, allocator_)) - return -1;// no parent key - - // Find this subkey - if (section.length ()) - section += ACE_TEXT ("\\"); - - section += sub_section; - ACE_Configuration_ExtId SectionExtId (section.fast_rep ()); - SECTION_HASH::ENTRY* section_entry = 0; - SECTION_HASH* hashmap = index_; - if (hashmap->find (SectionExtId, section_entry)) - return -1; - - if (recursive) - { - ACE_Configuration_Section_Key section; - if (open_section (key, sub_section, 0, section)) - return -1; - - int index = 0; - ACE_TString name; - while (!enumerate_sections (section, index, name)) - { - if (remove_section (section, name.fast_rep (), true)) - return -1; - - ++index; - } - } - - // Now make sure we dont have any subkeys - if (section_entry->int_id_.section_hash_map_->current_size ()) - { - errno = ENOTEMPTY; - return -1; - } - - // Now remove subkey from parent key - ACE_Configuration_ExtId SubSExtId (sub_section); - SUBSECTION_HASH::ENTRY* subsection_entry = 0; - if (((SUBSECTION_HASH*)ParentIntId.section_hash_map_)-> - find (SubSExtId, subsection_entry)) - return -1; - - if (ParentIntId.section_hash_map_->unbind (SubSExtId, allocator_)) - return -1; - - subsection_entry->ext_id_.free (allocator_); - - // Remember the pointers so we can free them after we unbind - ACE_Configuration_ExtId ExtIdToFree (section_entry->ext_id_); - ACE_Configuration_Section_IntId IntIdToFree (section_entry->int_id_); - - // iterate over all values and free memory - VALUE_HASH* value_hash_map = section_entry->int_id_.value_hash_map_; - VALUE_HASH::ITERATOR value_iter = value_hash_map->begin (); - while (!value_iter.done ()) - { - VALUE_HASH::ENTRY* value_entry = 0; - if (!value_iter.next (value_entry)) - return 1; - - value_entry->ext_id_.free (allocator_); - value_entry->int_id_.free (allocator_); - - value_iter.advance (); - } - - // remove it - if (index_->unbind (SectionExtId, allocator_)) - return -1; - - value_hash_map->close (); - section_entry->int_id_.section_hash_map_->close (allocator_); - - // Free the memory - ExtIdToFree.free (allocator_); - IntIdToFree.free (allocator_); - - return 0; -} - -int -ACE_Configuration_Heap::enumerate_values (const ACE_Configuration_Section_Key& key, - int index, - ACE_TString& name, - VALUETYPE& type) -{ - ACE_ASSERT (this->allocator_); - ACE_Configuration_Section_Key_Heap* pKey = - dynamic_cast (get_internal_key (key)); - if (!pKey) - return -1; - - name = pKey->path_; - - // resolve the section - ACE_Configuration_ExtId ExtId (pKey->path_); - ACE_Configuration_Section_IntId IntId; - if (index_->find (ExtId, IntId, allocator_)) - return -1; - - // Handle iterator resets - if (index == 0) - { - ACE_Hash_Map_Manager_Ex, - ACE_Equal_To, - ACE_Null_Mutex>* hash_map = IntId.value_hash_map_; - delete pKey->value_iter_; - - ACE_NEW_RETURN (pKey->value_iter_, - VALUE_HASH::ITERATOR (hash_map->begin ()), - -1); - } - - // Get the next entry - ACE_Hash_Map_Entry* entry = 0; - - if (!pKey->value_iter_->next (entry)) - return 1; - - // Return the value of the iterator and advance it - name = entry->ext_id_.name_; - type = entry->int_id_.type_; - pKey->value_iter_->advance (); - - return 0; -} - -int -ACE_Configuration_Heap::enumerate_sections (const ACE_Configuration_Section_Key& key, - int index, - ACE_TString& name) -{ - ACE_ASSERT (this->allocator_); - // cast to a heap section key - ACE_Configuration_Section_Key_Heap* pKey = - dynamic_cast (get_internal_key (key)); - if (!pKey) - return -1; // not a heap key! - - // resolve the section - ACE_Configuration_ExtId ExtId (pKey->path_); - ACE_Configuration_Section_IntId IntId; - if (index_->find (ExtId, IntId, allocator_)) - return -1; // unknown section - - // Handle iterator resets - if (index == 0) - { - if (pKey->section_iter_) - delete pKey->section_iter_; - - ACE_NEW_RETURN (pKey->section_iter_, - SUBSECTION_HASH::ITERATOR (IntId.section_hash_map_->begin ()), - -1); - } - - // Get the next entry - ACE_Hash_Map_Entry* entry = 0; - if (!pKey->section_iter_->next (entry)) - return 1; - - // Return the value of the iterator and advance it - pKey->section_iter_->advance (); - name = entry->ext_id_.name_; - - return 0; -} - -int -ACE_Configuration_Heap::set_string_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - const ACE_TString& value) -{ - ACE_ASSERT (this->allocator_); - const ACE_TCHAR *t_name = name ? name : &this->NULL_String_; - if (validate_value_name (t_name)) - return -1; - - ACE_TString section; - if (load_key (key, section)) - return -1; - - ACE_Configuration_ExtId section_ext (section.fast_rep ()); - ACE_Configuration_Section_IntId section_int; - if (index_->find (section_ext, section_int, allocator_)) - return -1; - - // Get the entry for this item (if it exists) - VALUE_HASH::ENTRY* entry = 0; - ACE_Configuration_ExtId item_name (t_name); - if (section_int.value_hash_map_->VALUE_HASH::find (item_name, entry) == 0) - { - // found item, replace it - // Free the old value - entry->int_id_.free (allocator_); - // Allocate the new value in this heap - ACE_TCHAR* pers_value = - (ACE_TCHAR *) allocator_->malloc ((value.length () + 1) * sizeof (ACE_TCHAR)); - ACE_OS::strcpy (pers_value, value.fast_rep ()); - ACE_Configuration_Value_IntId new_value_int (pers_value); - entry->int_id_ = new_value_int; - } - else - { - // it doesn't exist, bind it - ACE_TCHAR* pers_name = - (ACE_TCHAR *) allocator_->malloc ((ACE_OS::strlen (t_name) + 1) * sizeof (ACE_TCHAR)); - ACE_OS::strcpy (pers_name, t_name); - ACE_TCHAR* pers_value = - (ACE_TCHAR *) allocator_->malloc ((value.length () + 1) * sizeof (ACE_TCHAR)); - ACE_OS::strcpy (pers_value, value.fast_rep ()); - ACE_Configuration_ExtId item_name (pers_name); - ACE_Configuration_Value_IntId item_value (pers_value); - if (section_int.value_hash_map_->bind (item_name, item_value, allocator_)) - { - allocator_->free (pers_value); - allocator_->free (pers_name); - return -1; - } - return 0; - } - - return 0; -} - -int -ACE_Configuration_Heap::set_integer_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - u_int value) -{ - ACE_ASSERT (this->allocator_); - const ACE_TCHAR *t_name = name ? name : &this->NULL_String_; - if (validate_value_name (t_name)) - return -1; - - // Get the section name from the key - ACE_TString section; - if (load_key (key, section)) - return -1; - - // Find this section - ACE_Configuration_ExtId section_ext (section.fast_rep ()); - ACE_Configuration_Section_IntId section_int; - if (index_->find (section_ext, section_int, allocator_)) - return -1; // section does not exist - - // Get the entry for this item (if it exists) - VALUE_HASH::ENTRY* entry = 0; - ACE_Configuration_ExtId item_name (t_name); - if (section_int.value_hash_map_->VALUE_HASH::find (item_name, entry) == 0) - { - // found item, replace it - ACE_Configuration_Value_IntId new_value_int (value); - entry->int_id_ = new_value_int; - } - else - { - // it doesn't exist, bind it - ACE_TCHAR* pers_name = - (ACE_TCHAR *) allocator_->malloc ((ACE_OS::strlen (t_name) + 1) * sizeof (ACE_TCHAR)); - ACE_OS::strcpy (pers_name, t_name); - ACE_Configuration_ExtId item_name (pers_name); - ACE_Configuration_Value_IntId item_value (value); - if (section_int.value_hash_map_->bind (item_name, item_value, allocator_)) - { - allocator_->free (pers_name); - return -1; - } - return 0; - } - - return 0; -} - -int -ACE_Configuration_Heap::set_binary_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - const void* data, - size_t length) -{ - ACE_ASSERT (this->allocator_); - const ACE_TCHAR *t_name = name ? name : &this->NULL_String_; - if (validate_value_name (t_name)) - return -1; - - // Get the section name from the key - ACE_TString section; - if (load_key (key, section)) - return -1; - - // Find this section - ACE_Configuration_ExtId section_ext (section.fast_rep ()); - ACE_Configuration_Section_IntId section_int; - if (index_->find (section_ext, section_int, allocator_)) - return -1; // section does not exist - - // Get the entry for this item (if it exists) - VALUE_HASH::ENTRY* entry = 0; - ACE_Configuration_ExtId item_name (t_name); - if (section_int.value_hash_map_->VALUE_HASH::find (item_name, entry) == 0) - { - // found item, replace it - // Free the old value - entry->int_id_.free (allocator_); - // Allocate the new value in this heap - ACE_TCHAR* pers_value = (ACE_TCHAR *) allocator_->malloc (length); - ACE_OS::memcpy (pers_value, data, length); - ACE_Configuration_Value_IntId new_value_int (pers_value, length); - entry->int_id_ = new_value_int; - } - else - { - // it doesn't exist, bind it - ACE_TCHAR* pers_name = - (ACE_TCHAR *) allocator_->malloc ((ACE_OS::strlen (t_name) + 1) * sizeof (ACE_TCHAR)); - ACE_OS::strcpy (pers_name, t_name); - ACE_TCHAR* pers_value = (ACE_TCHAR *) allocator_->malloc (length); - ACE_OS::memcpy (pers_value, data, length); - ACE_Configuration_ExtId item_name (pers_name); - ACE_Configuration_Value_IntId item_value (pers_value, length); - if (section_int.value_hash_map_->bind (item_name, item_value, allocator_)) - { - allocator_->free (pers_value); - allocator_->free (pers_name); - return -1; - } - return 0; - } - - return 0; -} - -int -ACE_Configuration_Heap::get_string_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - ACE_TString& value) -{ - ACE_ASSERT (this->allocator_); - const ACE_TCHAR *t_name = name ? name : &this->NULL_String_; - if (validate_value_name (t_name)) - return -1; - - // Get the section name from the key - ACE_TString section; - if (load_key (key, section)) - return -1; - - // Find this section - ACE_Configuration_ExtId ExtId (section.fast_rep ()); - ACE_Configuration_Section_IntId IntId; - if (index_->find (ExtId, IntId, allocator_)) - return -1; // section does not exist - - // See if it exists first - ACE_Configuration_ExtId VExtId (t_name); - ACE_Configuration_Value_IntId VIntId; - if (IntId.value_hash_map_->find (VExtId, VIntId, allocator_)) - return -1; // unknown value - - // Check type - if (VIntId.type_ != ACE_Configuration::STRING) - { - errno = ENOENT; - return -1; - } - - // everythings ok, return the data - value = static_cast (VIntId.data_.ptr_); - return 0; -} - -int -ACE_Configuration_Heap::get_integer_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - u_int& value) -{ - ACE_ASSERT (this->allocator_); - - const ACE_TCHAR *t_name = name ? name : &this->NULL_String_; - if (validate_value_name (t_name)) - return -1; - - // Get the section name from the key - ACE_TString section (0, 0, false); - - if (this->load_key (key, section) != 0) - { - return -1; - } - - // Find this section - ACE_Configuration_ExtId ExtId (section.fast_rep ()); - ACE_Configuration_Section_IntId IntId; - - if (index_->find (ExtId, IntId, allocator_) != 0) - { - return -1; // section does not exist - } - - - // See if it exists first - ACE_Configuration_ExtId VExtId (t_name); - ACE_Configuration_Value_IntId VIntId; - - if (IntId.value_hash_map_->find (VExtId, VIntId, allocator_) != 0) - { - return -1; // unknown value - } - - // Check type - if (VIntId.type_ != ACE_Configuration::INTEGER) - { - errno = ENOENT; - return -1; - } - - // Everythings ok, return the data - value = VIntId.data_.int_; - return 0; -} - -int -ACE_Configuration_Heap::get_binary_value ( - const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - void*& data, - size_t& length) -{ - ACE_ASSERT (this->allocator_); - const ACE_TCHAR *t_name = name ? name : &this->NULL_String_; - if (validate_value_name (t_name)) - return -1; - - // Get the section name from the key - ACE_TString section; - if (load_key (key, section)) - return -1; - - // Find this section - ACE_Configuration_ExtId ExtId (section.fast_rep ()); - ACE_Configuration_Section_IntId IntId; - if (index_->find (ExtId, IntId, allocator_)) - return -1; // section does not exist - - ACE_Configuration_ExtId VExtId (t_name); - ACE_Configuration_Value_IntId VIntId; - // See if it exists first - if (IntId.value_hash_map_->find (VExtId, VIntId, allocator_)) - return -1; // unknown value - - // Check type - if (VIntId.type_ != ACE_Configuration::BINARY) - { - errno = ENOENT; - return -1; - } - - // Make a copy - ACE_NEW_RETURN (data, char[VIntId.length_], -1); - ACE_OS::memcpy (data, VIntId.data_.ptr_, VIntId.length_); - length = VIntId.length_; - return 0; -} - -int -ACE_Configuration_Heap::find_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - VALUETYPE& type_out) -{ - ACE_ASSERT (this->allocator_); - const ACE_TCHAR *t_name = name ? name : &this->NULL_String_; - if (validate_value_name (t_name)) - return -1; - - // Get the section name from the key - ACE_TString section; - if (load_key (key, section)) - return -1; - - // Find this section - ACE_Configuration_ExtId ExtId (section.fast_rep ()); - ACE_Configuration_Section_IntId IntId; - if (index_->find (ExtId, IntId, allocator_)) - return -1; // section does not exist - - // Find it - ACE_Configuration_ExtId ValueExtId (t_name); - VALUE_HASH::ENTRY* value_entry = 0; - if (((VALUE_HASH *) IntId.value_hash_map_)->find (ValueExtId, value_entry)) - return -1; // value does not exist - - type_out = value_entry->int_id_.type_; - return 0; -} - -int -ACE_Configuration_Heap::remove_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name) -{ - ACE_ASSERT (this->allocator_); - const ACE_TCHAR *t_name = name ? name : &this->NULL_String_; - if (validate_value_name (t_name)) - return -1; - - // Get the section name from the key - ACE_TString section; - if (load_key (key, section)) - return -1; - - // Find this section - ACE_Configuration_ExtId ExtId (section.fast_rep ()); - ACE_Configuration_Section_IntId IntId; - if (index_->find (ExtId, IntId, allocator_)) - return -1; // section does not exist - - // Find it - ACE_Configuration_ExtId ValueExtId (t_name); - VALUE_HASH::ENTRY* value_entry = 0; - if (((VALUE_HASH *) IntId.value_hash_map_)->find (ValueExtId, value_entry)) - return -1; - - // free it - value_entry->ext_id_.free (allocator_); - value_entry->int_id_.free (allocator_); - - // Unbind it - if (IntId.value_hash_map_->unbind (ValueExtId, allocator_)) - return -1; - - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Configuration.h b/dep/acelite/ace/Configuration.h deleted file mode 100644 index 4c931e6abed..00000000000 --- a/dep/acelite/ace/Configuration.h +++ /dev/null @@ -1,900 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Configuration.h - * - * $Id: Configuration.h 91688 2010-09-09 11:21:50Z johnnyw $ - * - * @author Chris Hafey - * - * The ACE configuration API provides a portable abstraction for - * program configuration similar to the Microsoft Windows registry. - * The API supports a tree based hierarchy of configuration sections. Each - * section contains other sections or values. Values may contain string, - * unsigned integer and binary data. - * - * @note These classes are not thread safe, if multiple threads use these - * classes, you are responsible for serializing access. - * - * For examples of using this class, see: - * -# The test code in ACE_wrappers/test - * -# wxConfigViewer, a Windows like Registry Editor for ACE_Configuration - * -# TAO's IFR, it makes extensive use of ACE_Configuration - * - * @todo Templatize this class with an ACE_LOCK to provide thread safety - */ -//============================================================================= - -#ifndef ACE_CONFIGURATION_H -#define ACE_CONFIGURATION_H -#include /**/ "ace/pre.h" - -#include "ace/SStringfwd.h" -#include "ace/Hash_Map_With_Allocator_T.h" -#include "ace/Malloc_T.h" -#include "ace/MMAP_Memory_Pool.h" -#include "ace/Local_Memory_Pool.h" -#include "ace/Synch_Traits.h" - - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// configurable parameters - -#if !defined (ACE_CONFIG_SECTION_INDEX) -# define ACE_CONFIG_SECTION_INDEX "Config_Section_Index" -#endif /* ! ACE_CONFIG_SECTION_INDEX */ - -#if !defined (ACE_DEFAULT_CONFIG_SECTION_SIZE) -#define ACE_DEFAULT_CONFIG_SECTION_SIZE 16 -#endif /* ACE_DEFAULT_CONFIG_SECTION_SIZE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Section_Key_Internal - * - * @internal - * - * @brief A base class for internal handles to section keys for - * configuration implementations - * - * Implementations subclass this base class to represent a - * section key. - */ -class ACE_Export ACE_Section_Key_Internal -{ -public: - /// Virtual destructor, make sure descendants are virtual! - virtual ~ACE_Section_Key_Internal (void); - - /// Increment reference count - virtual int add_ref (void); - - /// Decrement reference count. Will delete this if count gets to 0 - virtual int dec_ref (void); -protected: - ACE_Section_Key_Internal (void); - ACE_Section_Key_Internal (const ACE_Section_Key_Internal& rhs); - ACE_Section_Key_Internal& operator= (ACE_Section_Key_Internal& rhs); - - u_int ref_count_; -}; - -/** - * @class ACE_Configuration_Section_Key - * - * @brief Reference counted wrapper for ACE_Section_Key_Internal. - * - * Reference counted wrapper class for the abstract internal - * section key. A user gets one of these to represent a section - * in the configuration database. - */ -class ACE_Export ACE_Configuration_Section_Key -{ - friend class ACE_Configuration; -public: - /// Default constructor. - ACE_Configuration_Section_Key (void); - - /// Constructor that initializes to a pointer to a concrete internal key. - /** - * @param key The section key to reference. Calls add_ref() with @a key. - */ - explicit ACE_Configuration_Section_Key (ACE_Section_Key_Internal *key); - - /// Copy constructor, increments the reference count on the key. - ACE_Configuration_Section_Key (const ACE_Configuration_Section_Key &rhs); - - /// Destructor, decrements reference count on the referenced key. - ~ACE_Configuration_Section_Key (void); - - /// Assignment operator, increments reference count for this object - /// and decrements it on @a rhs. - ACE_Configuration_Section_Key & - operator= (const ACE_Configuration_Section_Key &rhs); -private: - ACE_Section_Key_Internal *key_; -}; - -/** - * @class ACE_Configuration - * - * @internal - * - * @brief Base class for configuration databases - * - * This class provides an interface for configuration databases. A concrete - * class is required that implements the interface. - * - * @sa ACE_Configuration_Heap - * @sa ACE_Configuration_Win32Registry - */ -class ACE_Export ACE_Configuration -{ -public: - /// Enumeration for the various types of values we can store. - enum VALUETYPE - { - STRING, - INTEGER, - BINARY, - INVALID - }; - - /// Destructor - virtual ~ACE_Configuration (void); - - /// Obtain a reference to the root section of this configuration. - /* - * @return Reference to the configuration's root section. Note that - * it is a const reference. - */ - virtual const ACE_Configuration_Section_Key& root_section (void) const; - - /** - * Opens a named section in an existing section. - * - * @param base Existing section in which to open the named section. - * @param sub_section Name of the section to open. - * @param create If zero, the named section must exist. If non-zero, - * the named section will be created if it does not exist. - * @param result Reference; receives the section key for the new - * section. - * - * @retval 0 for success. - * @retval -1 for error; ACE_OS::last_error() retrieves error code. - */ - virtual int open_section (const ACE_Configuration_Section_Key &base, - const ACE_TCHAR *sub_section, - int create, - ACE_Configuration_Section_Key& result) = 0; - - /// Removes a named section. - /** - * @param key Section key to remove the named section from. - * @param sub_section Name of the section to remove. - * @param recursive If true, any subkeys below @a sub_section are - * removed as well. - * - * @retval 0 for success. - * @retval -1 for error; ACE_OS::last_error() retrieves error code. - */ - virtual int remove_section (const ACE_Configuration_Section_Key &key, - const ACE_TCHAR *sub_section, - bool recursive) = 0; - - /** - * Enumerates through the values in a section. - * - * @param key Section key to iterate through. - * @param index Iteration position. Must be zero on the first call to - * iterate through @a key. Increment @a index by one on each - * successive call to this method. - * @param name Receives the value's name. - * @param type Receives the value's data type. - * - * @note You may not delete or add values while enumerating. If the - * section is modified during enumeration, results are undefined; - * you must restart the enumeration from index 0. - * - * @retval 0 for success, @a name and @a type are valid. - * @retval 1 there are no more values in the section. - * @retval -1 for error; ACE_OS::last_error() retrieves error code. - */ - virtual int enumerate_values (const ACE_Configuration_Section_Key& key, - int index, - ACE_TString& name, - VALUETYPE& type) = 0; - - /** - * Enumerates through the subsections in a section. - * - * @param key Section key to iterate through. - * @param index Iteration position. Must be zero on the first call to - * iterate through @a key. Increment @a index by one on each - * successive call to this method. - * @param name Receives the subsection's name. - * - * @note You may not modify the @a key section while enumerating. If the - * section is modified during enumeration, results are undefined; - * you must restart the enumeration from index 0. - * - * @retval 0 for success, @a name has a valid name. - * @retval 1 there are no more subsections in the section. - * @retval -1 for error; ACE_OS::last_error() retrieves error code. - */ - virtual int enumerate_sections (const ACE_Configuration_Section_Key& key, - int index, ACE_TString& name) = 0; - - /// Sets a string-typed value. - /** - * @param key Configuration section to set the value in. - * @param name Name of the configuration value to set. If a value with - * the specified name exists, it is replaced. - * @param value The string to set the configuration value to. - * - * @retval 0 for success. - * @retval -1 for error; ACE_OS::last_error() retrieves error code. - */ - virtual int set_string_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - const ACE_TString& value) = 0; - - /// Sets a integer-typed value. - /** - * @param key Configuration section to set the value in. - * @param name Name of the configuration value to set. If a value with - * the specified name exists, it is replaced. - * @param value The integer to set the configuration value to. - * - * @retval 0 for success. - * @retval -1 for error; ACE_OS::last_error() retrieves error code. - */ - virtual int set_integer_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - u_int value) = 0; - - /// Sets a binary-typed value. - /** - * @param key Configuration section to set the value in. - * @param name Name of the configuration value to set. If a value with - * the specified name exists, it is replaced. - * @param data Pointer to the binary data for the value. - * @param length Number of bytes for the new value. - * - * @retval 0 for success. - * @retval -1 for error; ACE_OS::last_error() retrieves error code. - */ - virtual int set_binary_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - const void* data, - size_t length) = 0; - - /// Gets a string-typed value. - /** - * @param key Configuration section to get the value from. - * @param name Name of the configuration value to get. - * @param value Receives the configuration value if it exists and - * has type STRING. - * - * @retval 0 for success. - * @retval -1 for error; ACE_OS::last_error() retrieves error code. - */ - virtual int get_string_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - ACE_TString& value) = 0; - - /// Gets an integer-typed value. - /** - * @param key Configuration section to get the value from. - * @param name Name of the configuration value to get. - * @param value Receives the configuration value if it exists and - * has type INTEGER. - * - * @retval 0 for success. - * @retval -1 for error; ACE_OS::last_error() retrieves error code. - */ - virtual int get_integer_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - u_int& value) = 0; - - /// Gets a binary-typed value. - /** - * @param key Configuration section to get the value from. - * @param name Name of the configuration value to get. - * @param data Receives a pointer to memory holding the binary data - * for the value. This method allocates the memory pointed - * to using operator new[]. The caller is responsible for - * freeing the memory using operator delete[]. - * @param length Receives the number of bytes in the value. - * - * @retval 0 for success; caller is responsible for freeing the - * returned memory. - * @retval -1 for error; ACE_OS::last_error() retrieves error code. - */ - virtual int get_binary_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - void*& data, - size_t& length) = 0; - - /** - * Retrieves the type of a named configuration value. - * - * @param key Configuration section to look up the name in. - * @param name Name of the configuration value to get the type of. - * @param type Receives the data type of the named value, if it exists. - * - * @retval 0 for success. - * @retval -1 for error; ACE_OS::last_error() retrieves error code. - */ - virtual int find_value(const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - VALUETYPE& type) = 0; - - /// Removes a named value. - /** - * @param key Configuration section to remove the named value from. - * @param name Name of the configuration value to remove. - * - * @retval 0 for success. - * @retval -1 for error; ACE_OS::last_error() retrieves error code. - */ - virtual int remove_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name) = 0; - - /** - * Expands @a path_in to @a key_out from @a key. If create is true, - * the subsections are created. Returns 0 on success, non zero on - * error The path consists of sections separated by the backslash - * '\' or forward slash '/'. - * Returns 0 on success, -1 if - virtual ~ACE_Section_Key_Win32 (void); - - // Not used - ACE_Section_Key_Win32 (const ACE_Section_Key_Win32& rhs); - ACE_Section_Key_Win32& operator= (const ACE_Section_Key_Win32& rhs); -}; - -/** - * @class ACE_Configuration_Win32Registry - * - * @brief The win32 registry implementation of a configuration database - * - * The win32 implementation basically makes calls through to the - * registry functions. The API is very similar so very little - * work must be done - */ -class ACE_Export ACE_Configuration_Win32Registry : public ACE_Configuration -{ -public: - - /** - * Constructor for registry configuration database. hKey is the - * base registry key to attach to. This class takes ownership of - * hKey, it will invoke on it upon destruction. - */ - explicit ACE_Configuration_Win32Registry (HKEY hKey); - - /// Destructor - virtual ~ACE_Configuration_Win32Registry (void); - - virtual int open_section (const ACE_Configuration_Section_Key& base, - const ACE_TCHAR* sub_section, - int create, - ACE_Configuration_Section_Key& result); - - virtual int remove_section (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* sub_section, - bool recursive); - - virtual int enumerate_values (const ACE_Configuration_Section_Key& key, - int index, - ACE_TString& name, - VALUETYPE& type); - - virtual int enumerate_sections (const ACE_Configuration_Section_Key& key, - int index, - ACE_TString& name); - - virtual int set_string_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - const ACE_TString& value); - - virtual int set_integer_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - u_int value); - - virtual int set_binary_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - const void* data, - size_t length); - - virtual int get_string_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - ACE_TString& value); - - virtual int get_integer_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - u_int& value); - - virtual int get_binary_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - void*& data, - size_t& length); - - virtual int find_value(const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - VALUETYPE& type); - - /// Removes the the value @a name from @a key. returns non zero on error - virtual int remove_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name); - - /** - * This method traverses through . It is useful when - * you want the HKEY for a specific registry key, especially when - * initializing this implementation. Caller is responsible for - * closeing this key when it is no longer used. If create is 1 - * (default) the keys are create if they don't already exist. - * Returns 0 on error - */ - static HKEY resolve_key (HKEY hKey, - const ACE_TCHAR* path, - int create = 1); - virtual bool operator== (const ACE_Configuration_Win32Registry &rhs) const; - virtual bool operator!= (const ACE_Configuration_Win32Registry &rhs) const; - -protected: - - /// Gets the HKEY for a configuration section - int load_key (const ACE_Configuration_Section_Key& key, HKEY& hKey); - - // Not used - ACE_Configuration_Win32Registry (void); - ACE_Configuration_Win32Registry (const ACE_Configuration_Win32Registry& rhs); - ACE_Configuration_Win32Registry& operator= (const ACE_Configuration_Win32Registry& rhs); -}; -#endif /* ACE_WIN32 && !ACE_LACKS_WIN32_REGISTRY */ - -// ACE_Allocator version - -typedef ACE_Allocator_Adapter > - PERSISTENT_ALLOCATOR; -typedef ACE_Allocator_Adapter > - HEAP_ALLOCATOR; - -/** - * @class ACE_Configuration_ExtId - * - * @brief External ID for the section and value hash - * - * Contains a pointer to the section or value name. - */ -class ACE_Export ACE_Configuration_ExtId -{ -public: - /// Defeault ctor - ACE_Configuration_ExtId (void); - - /// Named constructor - explicit ACE_Configuration_ExtId (const ACE_TCHAR* name); - - /// Copy ctor - ACE_Configuration_ExtId (const ACE_Configuration_ExtId& rhs); - - /// destructor - ~ACE_Configuration_ExtId (void); - - /// Assignment operator - ACE_Configuration_ExtId& operator= (const ACE_Configuration_ExtId& rhs); - - /// Equality comparison operator (must match name_). - bool operator== (const ACE_Configuration_ExtId &rhs) const; - - /// Inequality comparison operator. - bool operator!= (const ACE_Configuration_ExtId &rhs) const; - - /// Frees the name of the value. needed since we don't know the - /// allocator name_ was created in - void free (ACE_Allocator *alloc); - - /// hash function is required in order for this class to be usable by - /// ACE_Hash_Map_Manager. - u_long hash (void) const; - - // = Data members. - - const ACE_TCHAR * name_; - - // Accessors - const ACE_TCHAR *name (void); -}; - -typedef ACE_Hash_Map_With_Allocator - SUBSECTION_MAP; -typedef ACE_Hash_Map_Manager_Ex, - ACE_Equal_To, - ACE_Null_Mutex> - SUBSECTION_HASH; - -/** - * @class ACE_Configuration_Value_IntId - * - * @brief The section hash table internal value class - * - * This class is present as the internal portion of a section's - * value hash table It may store string, integer or binary data. - */ -class ACE_Export ACE_Configuration_Value_IntId -{ -public: - /// Default constructor - ACE_Configuration_Value_IntId (void); - - /// String constructor, takes ownership of string - explicit ACE_Configuration_Value_IntId (ACE_TCHAR* string); - - /// Integer constructor - explicit ACE_Configuration_Value_IntId (u_int integer); - - /// Binary constructor, takes ownership of data - ACE_Configuration_Value_IntId (void* data, size_t length); - - /// Copy ctor - ACE_Configuration_Value_IntId (const ACE_Configuration_Value_IntId& rhs); - - /// Destructor - ~ACE_Configuration_Value_IntId (void); - - /// Assignment operator - ACE_Configuration_Value_IntId& operator= ( - const ACE_Configuration_Value_IntId& rhs); - - void free (ACE_Allocator *alloc); - - // = Data members. - - /** - * Points to the string value or binary data or IS the integer - * Length is only used when type_ == BINARY - */ - ACE_Configuration::VALUETYPE type_; - union { - void * ptr_; - u_int int_; - } data_; - size_t length_; -}; - -typedef ACE_Hash_Map_With_Allocator - VALUE_MAP; -typedef ACE_Hash_Map_Manager_Ex, - ACE_Equal_To, - ACE_Null_Mutex> - VALUE_HASH; - -// Deprecated typedef. Use the VALUE_HASH::ENTRY trait instead. -typedef VALUE_HASH::ENTRY VALUE_ENTRY; - -/** - * @class ACE_Configuration_Section_IntId - * - * @brief The internal ID for a section hash table - * - * Contains a hash table containing value name/values - */ -class ACE_Export ACE_Configuration_Section_IntId -{ -public: - /// Default ctor - ACE_Configuration_Section_IntId (void); - - /// Named ctor - ACE_Configuration_Section_IntId (VALUE_MAP* value_hash_map, - SUBSECTION_MAP* section_hash_map); - - /// Copy ctor - ACE_Configuration_Section_IntId (const ACE_Configuration_Section_IntId& rhs); - - /// Destructor - ~ACE_Configuration_Section_IntId (void); - - /// Assignment operator - ACE_Configuration_Section_IntId& operator= ( - const ACE_Configuration_Section_IntId& rhs); - - /// Frees the hash table and all its values - void free (ACE_Allocator *alloc); - - // = Data Members. - VALUE_MAP* value_hash_map_; - - SUBSECTION_MAP* section_hash_map_; -}; - -typedef ACE_Hash_Map_With_Allocator - SECTION_MAP; -typedef ACE_Hash_Map_Manager_Ex, - ACE_Equal_To, - ACE_Null_Mutex> - SECTION_HASH; - -// Deprecated typedef. Use the SECTION_HASH::ENTRY trait instead. -typedef SECTION_HASH::ENTRY SECTION_ENTRY; - -/** - * @class ACE_Configuration_Section_Key_Heap - * - * @brief Internal section key class for heap based configuration - * database. - * - * Contains a value iterator and full path name of section. - */ -class ACE_Export ACE_Configuration_Section_Key_Heap - : public ACE_Section_Key_Internal -{ -public: - /// Constructor based on the full path of the section - ACE_Configuration_Section_Key_Heap (const ACE_TCHAR* path); - - /// The path itself - ACE_TCHAR* path_; - - /// The value iterator - VALUE_HASH::ITERATOR* value_iter_; - - /// The sub section iterator - SUBSECTION_HASH::ITERATOR* section_iter_; -protected: - /// Destructor - will delete the iterators - virtual ~ACE_Configuration_Section_Key_Heap (void); - - // Not used - ACE_Configuration_Section_Key_Heap (const ACE_Configuration_Section_Key_Heap& rhs); - ACE_Configuration_Section_Key_Heap& operator= (const ACE_Configuration_Section_Key_Heap& rhs); -}; - -/** - * @class ACE_Configuration_Heap - * - * @brief The concrete implementation of a allocator based - * configuration database - * - * This class uses ACE's Allocators to manage a memory - * representation of a configuration database. A persistent heap - * may be used to store configurations persistently - * - * @note Before using this class you must call one of the open methods. - * - * @todo - * - Need to investigate what happens if memory mapped file gets mapped to - * a location different than it was created with. - */ -class ACE_Export ACE_Configuration_Heap : public ACE_Configuration -{ -public: - - /// Default ctor - ACE_Configuration_Heap (void); - - /// Destructor - virtual ~ACE_Configuration_Heap (void); - - /** - * Opens a configuration that allocates its memory from a memory-mapped file. - * This makes it possible to persist a configuration to permanent storage. - * This is not the same as exporting the configuration to a file; the - * memory-mapped file is not likely to be very readable by humans. - * - * @param file_name Name of the file to map into memory. - * - * @param base_address Address to map the base of @a file_name to. - * - * @param default_map_size Starting size for the internal hash tables that - * contain configuration information. - * - * @retval 0 for success. - * @retval -1 for error, with errno set to indicate the cause. If open() - * is called multiple times, errno will be @c EBUSY. - */ - int open (const ACE_TCHAR* file_name, - void* base_address = ACE_DEFAULT_BASE_ADDR, - size_t default_map_size = ACE_DEFAULT_CONFIG_SECTION_SIZE); - - /** - * Opens a configuration that allocates memory from the heap. - * - * @param default_map_size Starting size for the internal hash tables that - * contain configuration information. - * - * @retval 0 for success. - * @retval -1 for error, with errno set to indicate the cause. If open() - * is called multiple times, errno will be @c EBUSY. - */ - int open (size_t default_map_size = ACE_DEFAULT_CONFIG_SECTION_SIZE); - - virtual int open_section (const ACE_Configuration_Section_Key& base, - const ACE_TCHAR* sub_section, - int create, ACE_Configuration_Section_Key& result); - - virtual int remove_section (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* sub_section, - bool recursive); - - virtual int enumerate_values (const ACE_Configuration_Section_Key& key, - int index, - ACE_TString& name, - VALUETYPE& type); - - virtual int enumerate_sections (const ACE_Configuration_Section_Key& key, - int index, - ACE_TString& name); - - virtual int set_string_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - const ACE_TString& value); - - virtual int set_integer_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - u_int value); - - virtual int set_binary_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - const void* data, - size_t length); - - virtual int get_string_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - ACE_TString& value); - - virtual int get_integer_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - u_int& value); - - virtual int get_binary_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - void* &data, - size_t &length); - - virtual int find_value(const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name, - VALUETYPE& type); - - /// Removes the the value @a name from @a key. returns non zero on error - virtual int remove_value (const ACE_Configuration_Section_Key& key, - const ACE_TCHAR* name); - -private: - /// @a sub_section may not contain path separators - int open_simple_section (const ACE_Configuration_Section_Key &base, - const ACE_TCHAR *sub_section, - int create, ACE_Configuration_Section_Key &result); - /// Adds a new section - int add_section (const ACE_Configuration_Section_Key &base, - const ACE_TCHAR *sub_section, - ACE_Configuration_Section_Key &result); - - /// Helper for the method. - int create_index (void); - - /// Helper for create_index() method: places hash table into an - /// allocated space. - int create_index_helper (void *buffer); - - int value_open_helper (size_t hash_table_size, void *buffer); - - int section_open_helper (size_t hash_table_size, void *buffer); - - int load_key (const ACE_Configuration_Section_Key& key, ACE_TString& name); - - int new_section (const ACE_TString& section, - ACE_Configuration_Section_Key& result); - - ACE_Configuration_Heap (const ACE_Configuration_Heap& rhs); - ACE_Configuration_Heap& operator= (const ACE_Configuration_Heap& rhs); - - ACE_Allocator *allocator_; - SECTION_MAP *index_; - size_t default_map_size_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Configuration.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIGURATION_H */ diff --git a/dep/acelite/ace/Configuration.inl b/dep/acelite/ace/Configuration.inl deleted file mode 100644 index 19c2c591bf4..00000000000 --- a/dep/acelite/ace/Configuration.inl +++ /dev/null @@ -1,13 +0,0 @@ -// -*- C++ -*- -// -// $Id: Configuration.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE const ACE_TCHAR* -ACE_Configuration_ExtId::name (void) -{ - return name_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Configuration_Import_Export.cpp b/dep/acelite/ace/Configuration_Import_Export.cpp deleted file mode 100644 index 15d869b8a09..00000000000 --- a/dep/acelite/ace/Configuration_Import_Export.cpp +++ /dev/null @@ -1,671 +0,0 @@ -// $Id: Configuration_Import_Export.cpp 96017 2012-08-08 22:18:09Z mitza $ - -#include "ace/Configuration_Import_Export.h" -#include "ace/OS_Errno.h" -#include "ace/OS_NS_stdio.h" -#include "ace/OS_NS_ctype.h" -#include "ace/OS_NS_string.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Config_ImpExp_Base::ACE_Config_ImpExp_Base (ACE_Configuration& config) - : config_ (config) -{ -} - -ACE_Config_ImpExp_Base::~ACE_Config_ImpExp_Base (void) -{ -} - -ACE_Registry_ImpExp::ACE_Registry_ImpExp (ACE_Configuration& config) - : ACE_Config_ImpExp_Base (config) -{ -} - -ACE_Registry_ImpExp::~ACE_Registry_ImpExp (void) -{ -} - -// Imports the configuration database from filename. -// No existing data is removed. -int -ACE_Registry_ImpExp::import_config (const ACE_TCHAR* filename) -{ - if (0 == filename) - { - errno = EINVAL; - return -1; - } - FILE* in = ACE_OS::fopen (filename, ACE_TEXT ("r")); - if (!in) - return -1; - - u_int buffer_size = 4096; - u_int read_pos = 0; - ACE_TCHAR *buffer = 0; - ACE_NEW_NORETURN (buffer, ACE_TCHAR[buffer_size]); - if (!buffer) - { - ACE_Errno_Guard guard (errno); - (void) ACE_OS::fclose (in); - return -1; - } - ACE_Configuration_Section_Key section; - ACE_TCHAR *end = 0; - - while (ACE_OS::fgets (buffer+read_pos, buffer_size - read_pos, in)) - { - // Check if we got all the line. - end = ACE_OS::strrchr (buffer + read_pos, - ACE_TEXT ('\n')); // look for end of line - if (!end) // we havn't reach the end of the line yet - { - // allocate a new buffer - double size the previous one - ACE_TCHAR *temp_buffer; - ACE_NEW_NORETURN (temp_buffer, ACE_TCHAR[buffer_size * 2]); - if (!temp_buffer) - { - ACE_Errno_Guard guard (errno); - delete [] buffer; - (void) ACE_OS::fclose (in); - return -1; - } - - // copy the beginnning of the line - ACE_OS::memcpy (temp_buffer, buffer, buffer_size); - read_pos = buffer_size - 1; - buffer_size *= 2; - delete [] buffer; - buffer = temp_buffer; - continue; - } - read_pos = 0; - - // Check for a comment - if (buffer[0] == ACE_TEXT (';') || buffer[0] == ACE_TEXT ('#')) - continue; - - if (buffer[0] == ACE_TEXT ('[')) - { - // We have a new section here, strip out the section name - end = ACE_OS::strrchr (buffer, ACE_TEXT (']')); - if (!end) - { - ACE_OS::fclose (in); - delete [] buffer; - return -3; - } - *end = 0; - - if (config_.expand_path (config_.root_section (), buffer + 1, section, 1)) - { - ACE_OS::fclose (in); - delete [] buffer; - return -3; - } - continue; - } // end if firs char is a [ - - if (buffer[0] == ACE_TEXT ('"')) - { - // we have a value - end = ACE_OS::strchr (buffer+1, '"'); - if (!end) // no closing quote, not a value so just skip it - continue; - - // null terminate the name - *end = 0; - ACE_TCHAR* name = buffer + 1; - end+=2; - // determine the type - if (*end == '\"') - { - // string type - // truncate trailing " - ++end; - ACE_TCHAR* trailing = ACE_OS::strrchr (end, '"'); - if (trailing) - *trailing = 0; - if (config_.set_string_value (section, name, end)) - { - ACE_OS::fclose (in); - delete [] buffer; - return -4; - } - } - else if (ACE_OS::strncmp (end, ACE_TEXT ("dword:"), 6) == 0) - { - // number type - ACE_TCHAR* endptr = 0; - unsigned long value = ACE_OS::strtoul (end + 6, &endptr, 16); - if (config_.set_integer_value (section, name, - static_cast (value))) - { - ACE_OS::fclose (in); - delete [] buffer; - return -4; - } - } - else if (ACE_OS::strncmp (end, ACE_TEXT ("hex:"), 4) == 0) - { - // binary type - size_t string_length = ACE_OS::strlen (end + 4); - // divide by 3 to get the actual buffer length - size_t length = string_length / 3; - size_t remaining = length; - u_char* data = 0; - ACE_NEW_RETURN (data, - u_char[length], - -1); - u_char* out = data; - ACE_TCHAR* inb = end + 4; - ACE_TCHAR* endptr = 0; - while (remaining) - { - u_char charin = (u_char) ACE_OS::strtoul (inb, &endptr, 16); - *out = charin; - ++out; - --remaining; - inb += 3; - } - if (config_.set_binary_value (section, name, data, length)) - { - ACE_OS::fclose (in); - delete [] data; - delete [] buffer; - return -4; - } - else - delete [] data; - } - else - { - // invalid type, ignore - continue; - } - }// end if first char is a " - else - { - // if the first character is not a ", [, ;, or # we may be - // processing a file in the old format. - // Try and process the line as such and if it fails, - // return an error - int rc = process_previous_line_format (buffer, section); - if (rc != 0) - { - ACE_OS::fclose (in); - delete [] buffer; - return rc; - } - } // end if maybe old format - } // end while fgets - - if (ferror (in)) - { - ACE_OS::fclose (in); - delete [] buffer; - return -1; - } - - ACE_OS::fclose (in); - delete [] buffer; - return 0; -} - -// This method exports the entire configuration database to . -// Once the file is opened this method calls 'export_section' passing -// the root section. -int -ACE_Registry_ImpExp::export_config (const ACE_TCHAR* filename) -{ - if (0 == filename) - { - errno = EINVAL; - return -1; - } - int result = -1; - - FILE* out = ACE_OS::fopen (filename, ACE_TEXT ("w")); - if (out) - { - result = this->export_section (config_.root_section (), - ACE_TEXT (""), - out); - // The data may have been buffered and will be flush on close, - // so we need to check that the close succeeds. - if (ACE_OS::fclose (out) < 0) - result = -7; - } - return result; -} - -// Method provided by derived classes in order to write one section -// to the file specified. Called by export_config when exporting -// the entire configuration object. - -int -ACE_Registry_ImpExp::export_section (const ACE_Configuration_Section_Key& section, - const ACE_TString& path, - FILE* out) -{ - // don't export the root - if (path.length ()) - { - // Write out the section header - ACE_TString header = ACE_TEXT ("["); - header += path; - header += ACE_TEXT ("]"); - header += ACE_TEXT ("\n"); - if (ACE_OS::fputs (header.fast_rep (), out) < 0) - return -1; - // Write out each value - int index = 0; - ACE_TString name; - ACE_Configuration::VALUETYPE type; - ACE_TString line; - ACE_TCHAR int_value[32]; - ACE_TCHAR bin_value[3]; - void* binary_data; - size_t binary_length; - ACE_TString string_value; - while (!config_.enumerate_values (section, index, name, type)) - { - line = ACE_TEXT ("\"") + name + ACE_TEXT ("\"="); - switch (type) - { - case ACE_Configuration::INTEGER: - { - u_int value; - if (config_.get_integer_value (section, name.fast_rep (), value)) - return -2; - ACE_OS::sprintf (int_value, ACE_TEXT ("%08x"), value); - line += ACE_TEXT ("dword:"); - line += int_value; - break; - } - case ACE_Configuration::STRING: - { - if (config_.get_string_value (section, - name.fast_rep (), - string_value)) - return -2; - line += ACE_TEXT ("\""); - line += string_value + ACE_TEXT ("\""); - break; - } -#ifdef _WIN32 - case ACE_Configuration::INVALID: - break; // JDO added break. Otherwise INVALID is processed - // like BINARY. If that's correct, please remove the - // break and these comments -#endif - case ACE_Configuration::BINARY: - { - // not supported yet - maybe use BASE64 codeing? - if (config_.get_binary_value (section, - name.fast_rep (), - binary_data, - binary_length)) - return -2; - line += ACE_TEXT ("hex:"); - unsigned char* ptr = (unsigned char*)binary_data; - while (binary_length) - { - if (ptr != binary_data) - { - line += ACE_TEXT (","); - } - ACE_OS::sprintf (bin_value, ACE_TEXT ("%02x"), *ptr); - line += bin_value; - --binary_length; - ++ptr; - } - delete [] (char*) binary_data; - break; - } - default: - return -3; - } - line += ACE_TEXT ("\n"); - if (ACE_OS::fputs (line.fast_rep (), out) < 0) - return -4; - ++index; - } - } - // Export all sub sections - int index = 0; - ACE_TString name; - ACE_Configuration_Section_Key sub_key; - ACE_TString sub_section; - while (!config_.enumerate_sections (section, index, name)) - { - ACE_TString sub_section (path); - if (path.length ()) - sub_section += ACE_TEXT ("\\"); - sub_section += name; - if (config_.open_section (section, name.fast_rep (), 0, sub_key)) - return -5; - if (export_section (sub_key, sub_section.fast_rep (), out)) - return -6; - ++index; - } - return 0; -} - -// -// This method read the line format origionally used in ACE 5.1 -// -int -ACE_Registry_ImpExp::process_previous_line_format (ACE_TCHAR* buffer, - ACE_Configuration_Section_Key& section) -{ - // Chop any cr/lf at the end of the line. - ACE_TCHAR *endp = ACE_OS::strpbrk (buffer, ACE_TEXT ("\r\n")); - if (endp != 0) - *endp = '\0'; - - // assume this is a value, read in the value name - ACE_TCHAR* end = ACE_OS::strchr (buffer, '='); - if (end) // no =, not a value so just skip it - { - // null terminate the name - *end = 0; - ++end; - // determine the type - if (*end == '\"') - { - // string type - if(config_.set_string_value (section, buffer, end + 1)) - return -4; - } - else if (*end == '#') - { - // number type - u_int value = ACE_OS::atoi (end + 1); - if (config_.set_integer_value (section, buffer, value)) - return -4; - } - } - return 0; -} // end read_previous_line_format - - -ACE_Ini_ImpExp::ACE_Ini_ImpExp (ACE_Configuration& config) - : ACE_Config_ImpExp_Base (config) -{ -} - -ACE_Ini_ImpExp::~ACE_Ini_ImpExp (void) -{ -} - -// Method to read file and populate object. -int -ACE_Ini_ImpExp::import_config (const ACE_TCHAR* filename) -{ - if (0 == filename) - { - errno = EINVAL; - return -1; - } - FILE* in = ACE_OS::fopen (filename, ACE_TEXT ("r")); - if (!in) - return -1; - - // @@ Make this a dynamic size! - ACE_TCHAR buffer[4096]; - ACE_Configuration_Section_Key section; - while (ACE_OS::fgets (buffer, sizeof buffer, in)) - { - ACE_TCHAR *line = this->squish (buffer); - // Check for a comment and blank line - if (line[0] == ACE_TEXT (';') || - line[0] == ACE_TEXT ('#') || - line[0] == '\0') - continue; - - if (line[0] == ACE_TEXT ('[')) - { - // We have a new section here, strip out the section name - ACE_TCHAR* end = ACE_OS::strrchr (line, ACE_TEXT (']')); - if (!end) - { - ACE_OS::fclose (in); - return -3; - } - *end = 0; - - if (config_.expand_path (config_.root_section (), - line + 1, - section, - 1)) - { - ACE_OS::fclose (in); - return -3; - } - - continue; - } - - // We have a line; name ends at equal sign. - ACE_TCHAR *end = ACE_OS::strchr (line, ACE_TEXT ('=')); - if (end == 0) // No '=' - { - ACE_OS::fclose (in); - return -3; - } - *end++ = '\0'; - ACE_TCHAR *name = this->squish (line); -#if 0 - if (ACE_OS::strlen (name) == 0) // No name; just an '=' - { - ACE_OS::fclose (in); - return -3; - } -#endif - // Now find the start of the value - ACE_TCHAR *value = this->squish (end); - size_t value_len = ACE_OS::strlen (value); - if (value_len > 0) - { - // ACE 5.2 (and maybe earlier) exported strings may be enclosed - // in quotes. If string is quote-delimited, strip the quotes. - // Newer exported files don't have quote delimiters. - if (value[0] == ACE_TEXT ('"') && - value[value_len - 1] == ACE_TEXT ('"')) - { - // Strip quotes off both ends. - value[value_len - 1] = '\0'; - ++value; - } - } - - if (config_.set_string_value (section, name, value)) - { - ACE_OS::fclose (in); - return -4; - } - } // end while fgets - - if (ferror (in)) - { - ACE_OS::fclose (in); - return -1; - } - - ACE_OS::fclose (in); - return 0; -} - -// This method exports the entire configuration database to . -// Once the file is opened this method calls 'export_section' passing -// the root section. -int -ACE_Ini_ImpExp::export_config (const ACE_TCHAR* filename) -{ - if (0 == filename) - { - errno = EINVAL; - return -1; - } - int result = -1; - - FILE* out = ACE_OS::fopen (filename, ACE_TEXT ("w")); - if (out) - { - result = this->export_section (config_.root_section (), - ACE_TEXT (""), - out); - // The data may have been buffered and will be flush on close, - // so we need to check that the close succeeds. - if (ACE_OS::fclose (out) < 0) - result = -7; - } - return result; -} - -// Method provided by derived classes in order to write one section to the -// file specified. Called by export_config when exporting the entire -// configuration objet - -int -ACE_Ini_ImpExp::export_section (const ACE_Configuration_Section_Key& section, - const ACE_TString& path, - FILE* out) -{ - // don't export the root - if (path.length ()) - { - // Write out the section header - ACE_TString header = ACE_TEXT ("["); - header += path; - header += ACE_TEXT ("]\n"); - if (ACE_OS::fputs (header.fast_rep (), out) < 0) - return -1; - // Write out each value - int index = 0; - ACE_TString name; - ACE_Configuration::VALUETYPE type; - ACE_TString line; - ACE_TCHAR int_value[32]; - ACE_TCHAR bin_value[3]; - void* binary_data; - size_t binary_length; - ACE_TString string_value; - while (!config_.enumerate_values (section, index, name, type)) - { - line = name + ACE_TEXT ("="); - switch (type) - { - case ACE_Configuration::INTEGER: - { - u_int value; - if (config_.get_integer_value (section, name.fast_rep (), value)) - return -2; - ACE_OS::sprintf (int_value, ACE_TEXT ("%08x"), value); - line += int_value; - break; - } - case ACE_Configuration::STRING: - { - if (config_.get_string_value (section, - name.fast_rep (), - string_value)) - return -2; - line += string_value; - break; - } -#ifdef _WIN32 - case ACE_Configuration::INVALID: - break; // JDO added break. Otherwise INVALID is processed - // like BINARY. If that's correct, please remove the - // break and these comments -#endif - case ACE_Configuration::BINARY: - { - // not supported yet - maybe use BASE64 codeing? - if (config_.get_binary_value (section, - name.fast_rep (), - binary_data, - binary_length)) - return -2; - line += ACE_TEXT ("\""); - unsigned char* ptr = (unsigned char*)binary_data; - while (binary_length) - { - if (ptr != binary_data) - { - line += ACE_TEXT (","); - } - ACE_OS::sprintf (bin_value, ACE_TEXT ("%02x"), *ptr); - line += bin_value; - --binary_length; - ++ptr; - } - line += ACE_TEXT ("\""); - delete [] (char *) binary_data; - break; - } - default: - return -3; - - }// end switch on type - - line += ACE_TEXT ("\n"); - if (ACE_OS::fputs (line.fast_rep (), out) < 0) - return -4; - ++index; - }// end while enumerating values - } - // Export all sub sections - int index = 0; - ACE_TString name; - ACE_Configuration_Section_Key sub_key; - ACE_TString sub_section; - while (!config_.enumerate_sections (section, index, name)) - { - ACE_TString sub_section (path); - if (path.length ()) - sub_section += ACE_TEXT ("\\"); - sub_section += name; - if (config_.open_section (section, name.fast_rep (), 0, sub_key)) - return -5; - if (export_section (sub_key, sub_section.fast_rep (), out)) - return -6; - ++index; - } - return 0; - -} - -// Method to squish leading and trailing whitespaces from a string. -// Whitespace is defined as: spaces (' '), tabs ('\t') or end-of-line -// (cr/lf). The terminating nul is moved up to expunge trailing -// whitespace and the returned pointer points at the first -// non-whitespace character in the string, which may be the nul -// terminator if the string is all whitespace. - -ACE_TCHAR * -ACE_Ini_ImpExp::squish (ACE_TCHAR *src) -{ - ACE_TCHAR *cp = 0; - - if (src == 0) - return 0; - - // Start at the end and work backwards over all whitespace. - for (cp = src + ACE_OS::strlen (src) - 1; - cp != src; - --cp) - if (!ACE_OS::ace_isspace (*cp)) - break; - cp[1] = '\0'; // Chop trailing whitespace - - // Now start at the beginning and move over all whitespace. - for (cp = src; ACE_OS::ace_isspace (*cp); ++cp) - continue; - - return cp; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Configuration_Import_Export.h b/dep/acelite/ace/Configuration_Import_Export.h deleted file mode 100644 index 9995d095d83..00000000000 --- a/dep/acelite/ace/Configuration_Import_Export.h +++ /dev/null @@ -1,215 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Configuration_Import_Export.h - * - * $Id: Configuration_Import_Export.h 93359 2011-02-11 11:33:12Z mcorino $ - * - * @author Jerry D. Odenwelder Jr. - * Chris Hafey - * - * Classes defined in this file provide the ability to import and export - * ACE Configuration objects to/from disk files. The base class - * ACE_Config_ImpExp_Base provides the common functionality and the derived - * classes implement the import/export functionality for the specific format. - * - * @todo - * - Add locking for thread safety. - * - Provide ability to read file in one format and write in another. - * - See todo's in each class - */ -//============================================================================= - -#ifndef ACE_CONFIGURATION_IMPORT_EXPORT_H -#define ACE_CONFIGURATION_IMPORT_EXPORT_H -#include /**/ "ace/pre.h" - -#include "ace/Configuration.h" -#include "ace/SString.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Config_ImpExp_Base - * - * @brief Base class for file import/export configuration. - * - * This class provides base functionality for configuration objects - * that are persisted in files. It takes an ACE_Configuration - * object that it populates with the data read. - * - */ -class ACE_Export ACE_Config_ImpExp_Base -{ -public: - /// Constructor taking the ACE_Configuration to import/export to - ACE_Config_ImpExp_Base (ACE_Configuration& config); - - /** - * Destructor - */ - virtual ~ACE_Config_ImpExp_Base (void); - - /** - * Imports the configuration database from @a filename. - * No existing data is removed. - */ - virtual int import_config (const ACE_TCHAR* filename) = 0; - - /** - * This method exports the entire configuration database to @a filename. - * Once the file is opened this method calls 'export_section' passing - * the root section. - */ - virtual int export_config (const ACE_TCHAR* filename) = 0; - -protected: - ACE_Configuration &config_; - -private: - ACE_Config_ImpExp_Base (const ACE_Config_ImpExp_Base&); - ACE_Config_ImpExp_Base& operator= (const ACE_Config_ImpExp_Base&); -}; - -/** - * @class ACE_Registry_ImpExp - * - * @brief Configuration object that imports/exports data to a file formatted - * using the Win32 Registry file export format. This format looks like - * [Section] - * "key"="String Data" - * "key"=dword: numeric data in hexadecimal format - * "key"=hex: binary data - * - * @todo - * - Add dynamic buffer when importing. currently it will not allow - * importing of values greater than a fixed amount (4096 bytes) - * - */ -class ACE_Export ACE_Registry_ImpExp : public ACE_Config_ImpExp_Base -{ -public: - /// Construction - ACE_Registry_ImpExp (ACE_Configuration&); - - /// Destruction. - virtual ~ACE_Registry_ImpExp (void); - - /** - * Imports the configuration database from @a filename. - * No existing data is removed. - */ - virtual int import_config (const ACE_TCHAR* filename); - - /** - * This method exports the entire configuration database to @a filename. - * Once the file is opened this method calls export_section() passing - * the root section. - */ - virtual int export_config (const ACE_TCHAR* filename); - -private: - int export_section (const ACE_Configuration_Section_Key& section, - const ACE_TString& path, - FILE* out); - - int process_previous_line_format (ACE_TCHAR* buffer, - ACE_Configuration_Section_Key& section); - - ACE_Registry_ImpExp ( const ACE_Registry_ImpExp&); - ACE_Registry_ImpExp& operator= ( const ACE_Registry_ImpExp&); -}; - -/** - * @class ACE_Ini_ImpExp - * - * @brief Imports the configuration database from filename as strings. - * Allows non-typed values. (no #, dword: hex:, etc. prefixes) and - * skips whitespace (tabs and spaces) as in standard .ini and .conf - * files. Values (to right of equal sign) can be double quote - * delimited to embed tabs and spaces in the string. - * Caller must convert string to type. - * - * This method allows for lines in the .ini or .conf file like this: - * - * TimeToLive = 100 - * Delay = FALSE - * Flags = FF34 - * Heading = "ACE - Adaptive Communication Environment" - * - * (note leading whitespace (tabs) in examples below) - * - * SeekIndex = 14 - * TraceLevel = 6 # Can comment lines like this - * Justification = left_justified - * - * The caller can then retrieve the string with the regular - * get_string_value() function and convert the string to the - * desired data type. - * - * @todo - * - Strings with embedded newlines cause the import to fail - * - Strings with embedded quotes " cause the import to fail - * - Importing/exporting for values in the root section does not work - * - Add dynamic buffer when importing. currently it will not allow - * importing of values greater than a fixed amount (4096 bytes) -*/ -class ACE_Export ACE_Ini_ImpExp : public ACE_Config_ImpExp_Base -{ -public: - /** - * Construction - */ - ACE_Ini_ImpExp (ACE_Configuration&); - - /** - * Destructor - */ - virtual ~ACE_Ini_ImpExp (void); - - /** - * Imports the configuration database from @a filename. - * No existing data is removed. - */ - virtual int import_config (const ACE_TCHAR* filename); - - /** - * This method exports the entire configuration database to @a filename. - * Once the file is opened this method calls export_section() passing - * the root section. - */ - virtual int export_config (const ACE_TCHAR* filename); - -private: - /** - * Method provided by derived classes in order to write one section - * to the file specified. Called by export_config() when exporting - * the entire configuration object. - */ - int export_section (const ACE_Configuration_Section_Key& section, - const ACE_TString& path, - FILE* out); - - /** - * Method to squish leading and trailing whitespaces in a string. - * Whitespace is defined as: spaces (' '), tabs ('\\t') or cr/lf. - * Returns a pointer to the first non-whitespace character in the - * buffer provided, or a pointer to the terminating null if the string - * is all whitespace. The terminating null is moved forward to the - * first character past the last non-whitespace. - */ - ACE_TCHAR *squish (ACE_TCHAR *src); - - ACE_Ini_ImpExp (const ACE_Ini_ImpExp&); - ACE_Ini_ImpExp& operator= (const ACE_Ini_ImpExp&); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIGURATION_IMPORT_EXPORT_H */ diff --git a/dep/acelite/ace/Connection_Recycling_Strategy.cpp b/dep/acelite/ace/Connection_Recycling_Strategy.cpp deleted file mode 100644 index cab307de8a3..00000000000 --- a/dep/acelite/ace/Connection_Recycling_Strategy.cpp +++ /dev/null @@ -1,11 +0,0 @@ -// $Id: Connection_Recycling_Strategy.cpp 91287 2010-08-05 10:30:49Z johnnyw $ - -#include "ace/Connection_Recycling_Strategy.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Connection_Recycling_Strategy::~ACE_Connection_Recycling_Strategy (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Connection_Recycling_Strategy.h b/dep/acelite/ace/Connection_Recycling_Strategy.h deleted file mode 100644 index 75169638dcf..00000000000 --- a/dep/acelite/ace/Connection_Recycling_Strategy.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Connection_Recycling_Strategy.h - * - * $Id: Connection_Recycling_Strategy.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Doug Schmidt - */ -//============================================================================= -#ifndef ACE_CONNECTION_RECYCLING_STRATEGY_H -#define ACE_CONNECTION_RECYCLING_STRATEGY_H -#include /**/ "ace/pre.h" - -#include "ace/Recyclable.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Connection_Recycling_Strategy - * - * @brief Defines the interface for a connection recycler. - */ -class ACE_Export ACE_Connection_Recycling_Strategy -{ -public: - /// Virtual Destructor - virtual ~ACE_Connection_Recycling_Strategy (void); - - /// Remove from cache. - virtual int purge (const void *recycling_act) = 0; - - /// Add to cache. - virtual int cache (const void *recycling_act) = 0; - - virtual int recycle_state (const void *recycling_act, - ACE_Recyclable_State new_state) = 0; - - /// Get/Set recycle_state. - virtual ACE_Recyclable_State recycle_state (const void *recycling_act) const = 0; - - /// Mark as closed. - virtual int mark_as_closed (const void *recycling_act) = 0; - - /// Mark as closed.(non-locking version) - virtual int mark_as_closed_i (const void *recycling_act) = 0; - - /// Cleanup hint and reset @a act_holder to zero if @a act_holder != 0. - virtual int cleanup_hint (const void *recycling_act, - void **act_holder = 0) = 0; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /*ACE_CONNECTION_RECYCLING_STRATEGY*/ diff --git a/dep/acelite/ace/Connector.cpp b/dep/acelite/ace/Connector.cpp deleted file mode 100644 index a8399608ce5..00000000000 --- a/dep/acelite/ace/Connector.cpp +++ /dev/null @@ -1,1006 +0,0 @@ -// $Id: Connector.cpp 93433 2011-02-23 10:34:01Z vzykov $ - -#ifndef ACE_CONNECTOR_CPP -#define ACE_CONNECTOR_CPP - -#include "ace/Connector.h" -#include "ace/ACE.h" -#include "ace/OS_NS_stdio.h" -#include "ace/OS_NS_string.h" -#include "ace/os_include/os_fcntl.h" /* Has ACE_NONBLOCK */ - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Connector) - -template -ACE_NonBlocking_Connect_Handler::ACE_NonBlocking_Connect_Handler -(ACE_Connector_Base &connector, - SVC_HANDLER *sh, - long id) - : connector_ (connector) - , svc_handler_ (sh) - , cleanup_svc_handler_ (0) - , timer_id_ (id) -{ - ACE_TRACE ("ACE_NonBlocking_Connect_Handler::ACE_NonBlocking_Connect_Handler"); - - this->reference_counting_policy ().value - (ACE_Event_Handler::Reference_Counting_Policy::ENABLED); - - if (this->svc_handler_ != 0 && - this->svc_handler_->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED) - { - // If SVC_HANDLER is reference counted then NBCH holds a reference - // in cleanup_svc_handle_ which is both a pointer to SVC_HANDLER - // and a flag that triggers remove_reference in NBCH destructor. - this->cleanup_svc_handler_ = sh; - this->cleanup_svc_handler_->add_reference (); - } -} - -template -ACE_NonBlocking_Connect_Handler::~ACE_NonBlocking_Connect_Handler (void) -{ - if (this->cleanup_svc_handler_) - { - this->cleanup_svc_handler_->remove_reference (); - } -} - -template SVC_HANDLER * -ACE_NonBlocking_Connect_Handler::svc_handler (void) -{ - ACE_TRACE ("ACE_NonBlocking_Connect_Handler::svc_handler"); - return this->svc_handler_; -} - -template long -ACE_NonBlocking_Connect_Handler::timer_id (void) -{ - ACE_TRACE ("ACE_NonBlocking_Connect_Handler::timer_id"); - return this->timer_id_; -} - -template void -ACE_NonBlocking_Connect_Handler::timer_id (long id) -{ - ACE_TRACE ("ACE_NonBlocking_Connect_Handler::timer_id"); - this->timer_id_ = id; -} - -template void -ACE_NonBlocking_Connect_Handler::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_NonBlocking_Connect_Handler::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("svc_handler_ = %x"), this->svc_handler_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ntimer_id_ = %d"), this->timer_id_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template bool -ACE_NonBlocking_Connect_Handler::close (SVC_HANDLER *&sh) -{ - // Make sure that we haven't already initialized the Svc_Handler. - if (!this->svc_handler_) - return false; - - { - // Exclusive access to the Reactor. - ACE_GUARD_RETURN (ACE_Lock, - ace_mon, - this->reactor ()->lock (), - 0); - - // Double check. - if (!this->svc_handler_) - return false; - - // Remember the Svc_Handler. - sh = this->svc_handler_; - ACE_HANDLE h = sh->get_handle (); - this->svc_handler_ = 0; - - // Remove this handle from the set of non-blocking handles - // in the Connector. - this->connector_.non_blocking_handles ().remove (h); - - // Cancel timer. - if (this->reactor ()->cancel_timer (this->timer_id (), - 0, - 0) == -1) - return false; - - // Remove from Reactor. - if (-1 == this->reactor ()->remove_handler ( - h, - ACE_Event_Handler::ALL_EVENTS_MASK | ACE_Event_Handler::DONT_CALL)) - return false; - } - - return true; -} - - -template int -ACE_NonBlocking_Connect_Handler::handle_timeout -(const ACE_Time_Value &tv, - const void *arg) -{ - // This method is called if a connection times out before completing. - ACE_TRACE ("ACE_NonBlocking_Connect_Handler::handle_timeout"); - - SVC_HANDLER *svc_handler = 0; - int const retval = this->close (svc_handler) ? 0 : -1; - - // Forward to the SVC_HANDLER the that was passed in as a - // magic cookie during ACE_Connector::connect(). This gives the - // SVC_HANDLER an opportunity to take corrective action (e.g., wait - // a few milliseconds and try to reconnect again. - if (svc_handler != 0 && svc_handler->handle_timeout (tv, arg) == -1) - svc_handler->handle_close (svc_handler->get_handle (), - ACE_Event_Handler::TIMER_MASK); - - return retval; -} - - -template int -ACE_NonBlocking_Connect_Handler::handle_input (ACE_HANDLE) -{ - // Called when a failure occurs during asynchronous connection - // establishment. - ACE_TRACE ("ACE_NonBlocking_Connect_Handler::handle_input"); - - SVC_HANDLER *svc_handler = 0; - int const retval = this->close (svc_handler) ? 0 : -1; - - // Close Svc_Handler. - if (svc_handler != 0) - { - svc_handler->close (NORMAL_CLOSE_OPERATION); - } - - return retval; -} - -template int -ACE_NonBlocking_Connect_Handler::handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask m) -{ - // epoll on Linux will, at least sometimes, return EPOLLERR when a connect - // fails, triggering a total removal from the reactor. This is different from - // select()-based systems which select the fd for read on a connect failure. - // So just call handle_input() to rejoin common handling for a failed - // connect. - if (m == ACE_Event_Handler::ALL_EVENTS_MASK) - return this->handle_input (handle); - return -1; -} - -template int -ACE_NonBlocking_Connect_Handler::handle_output (ACE_HANDLE handle) -{ - // Called when a connection is establishment asynchronous. - ACE_TRACE ("ACE_NonBlocking_Connect_Handler::handle_output"); - - // Grab the connector ref before smashing ourselves in close(). - ACE_Connector_Base &connector = this->connector_; - SVC_HANDLER *svc_handler = 0; - int const retval = this->close (svc_handler) ? 0 : -1; - - if (svc_handler != 0) - { - connector.initialize_svc_handler (handle, svc_handler); - } - - return retval; -} - -template int -ACE_NonBlocking_Connect_Handler::handle_exception (ACE_HANDLE h) -{ - // On Win32, the except mask must also be set for asynchronous - // connects. - ACE_TRACE ("ACE_NonBlocking_Connect_Handler::handle_exception"); - return this->handle_output (h); -} - -template int -ACE_NonBlocking_Connect_Handler::resume_handler (void) -{ - return ACE_Event_Handler::ACE_EVENT_HANDLER_NOT_RESUMED; -} - -template void -ACE_Connector::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Connector::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nflags_ = %d"), this->flags_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template int -ACE_Connector::make_svc_handler (SVC_HANDLER *&sh) -{ - ACE_TRACE ("ACE_Connector::make_svc_handler"); - - if (sh == 0) - ACE_NEW_RETURN (sh, - SVC_HANDLER, - -1); - - // Set the reactor of the newly created to the same - // reactor that this is using. - sh->reactor (this->reactor ()); - return 0; -} - -template int -ACE_Connector::activate_svc_handler (SVC_HANDLER *svc_handler) -{ - ACE_TRACE ("ACE_Connector::activate_svc_handler"); - // No errors initially - int error = 0; - - // See if we should enable non-blocking I/O on the 's - // peer. - if (ACE_BIT_ENABLED (this->flags_, ACE_NONBLOCK) != 0) - { - if (svc_handler->peer ().enable (ACE_NONBLOCK) == -1) - error = 1; - } - // Otherwise, make sure it's disabled by default. - else if (svc_handler->peer ().disable (ACE_NONBLOCK) == -1) - error = 1; - - // We are connected now, so try to open things up. - if (error || svc_handler->open ((void *) this) == -1) - { - // Make sure to close down the to avoid descriptor - // leaks. - // The connection was already made; so this close is a "normal" - // close operation. - svc_handler->close (NORMAL_CLOSE_OPERATION); - return -1; - } - else - return 0; -} - -template ACE_PEER_CONNECTOR & -ACE_Connector::connector (void) const -{ - return const_cast (this->connector_); -} - -template int -ACE_Connector::connect_svc_handler -(SVC_HANDLER *&svc_handler, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) -{ - ACE_TRACE ("ACE_Connector::connect_svc_handler"); - - return this->connector_.connect (svc_handler->peer (), - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms); -} - -template int -ACE_Connector::connect_svc_handler -(SVC_HANDLER *&svc_handler, - SVC_HANDLER *&sh_copy, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) -{ - ACE_TRACE ("ACE_Connector::connect_svc_handler"); - - sh_copy = svc_handler; - return this->connector_.connect (svc_handler->peer (), - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms); -} - -template int -ACE_Connector::open (ACE_Reactor *r, int flags) -{ - ACE_TRACE ("ACE_Connector::open"); - this->reactor (r); - this->flags_ = flags; - return 0; -} - -template -ACE_Connector::ACE_Connector (ACE_Reactor *r, - int flags) -{ - ACE_TRACE ("ACE_Connector::ACE_Connector"); - (void) this->open (r, flags); -} - -template int -ACE_Connector::connect -(SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - const ACE_Synch_Options &synch_options, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) -{ - // Initiate connection to peer. - return this->connect_i (sh, - 0, - remote_addr, - synch_options, - local_addr, - reuse_addr, - flags, - perms); -} - -template int -ACE_Connector::connect -(SVC_HANDLER *&sh, - SVC_HANDLER *&sh_copy, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - const ACE_Synch_Options &synch_options, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) -{ - // Initiate connection to peer. - return this->connect_i (sh, - &sh_copy, - remote_addr, - synch_options, - local_addr, - reuse_addr, - flags, - perms); -} - -template int -ACE_Connector::connect_i -(SVC_HANDLER *&sh, - SVC_HANDLER **sh_copy, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - const ACE_Synch_Options &synch_options, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) -{ - ACE_TRACE ("ACE_Connector::connect_i"); - - // If the user hasn't supplied us with a we'll use the - // factory method to create one. Otherwise, things will remain as - // they are... - if (this->make_svc_handler (sh) == -1) - return -1; - - ACE_Time_Value *timeout = 0; - int const use_reactor = synch_options[ACE_Synch_Options::USE_REACTOR]; - - if (use_reactor) - timeout = const_cast (&ACE_Time_Value::zero); - else - timeout = const_cast (synch_options.time_value ()); - - int result; - if (sh_copy == 0) - result = this->connect_svc_handler (sh, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms); - else - result = this->connect_svc_handler (sh, - *sh_copy, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms); - - // Activate immediately if we are connected. - if (result != -1) - return this->activate_svc_handler (sh); - - // Delegate to connection strategy. - if (use_reactor && ACE_OS::last_error () == EWOULDBLOCK) - { - // If the connection hasn't completed and we are using - // non-blocking semantics then register - // ACE_NonBlocking_Connect_Handler with the ACE_Reactor so that - // it will call us back when the connection is complete or we - // timeout, whichever comes first... - int result; - - if (sh_copy == 0) - result = this->nonblocking_connect (sh, synch_options); - else - result = this->nonblocking_connect (*sh_copy, synch_options); - - // If for some reason the call failed, then - // will be set to the new error. If the call succeeds, however, - // we need to make sure that remains set to - // . - if (result == 0) - errno = EWOULDBLOCK; - } - else - { - // Save/restore errno. - ACE_Errno_Guard error (errno); - // Make sure to close down the service handler to avoid handle - // leaks. - if (sh_copy == 0) - { - if (sh) - sh->close (CLOSE_DURING_NEW_CONNECTION); - } - else if (*sh_copy) - (*sh_copy)->close (CLOSE_DURING_NEW_CONNECTION); - } - - return -1; -} - -template int -ACE_Connector::connect_n -(size_t n, - SVC_HANDLER *sh[], - ACE_PEER_CONNECTOR_ADDR remote_addrs[], - ACE_TCHAR *failed_svc_handlers, - const ACE_Synch_Options &synch_options) -{ - int result = 0; - - for (size_t i = 0; i < n; i++) - { - if (this->connect (sh[i], remote_addrs[i], synch_options) == -1 - && !(synch_options[ACE_Synch_Options::USE_REACTOR] - && errno == EWOULDBLOCK)) - { - result = -1; - if (failed_svc_handlers != 0) - // Mark this entry as having failed. - failed_svc_handlers[i] = 1; - } - else if (failed_svc_handlers != 0) - // Mark this entry as having succeeded. - failed_svc_handlers[i] = 0; - } - - return result; -} - -// Cancel a that was started asynchronously. -template int -ACE_Connector::cancel (SVC_HANDLER *sh) -{ - ACE_TRACE ("ACE_Connector::cancel"); - - ACE_Event_Handler *handler = - this->reactor ()->find_handler (sh->get_handle ()); - - if (handler == 0) - return -1; - - // find_handler() increments handler's refcount; ensure we decrement it. - ACE_Event_Handler_var safe_handler (handler); - - NBCH *nbch = - dynamic_cast (handler); - - if (nbch == 0) - return -1; - - SVC_HANDLER *tmp_sh = 0; - - if (nbch->close (tmp_sh) == false) - return -1; - - return 0; -} - -template int -ACE_Connector::nonblocking_connect -(SVC_HANDLER *sh, - const ACE_Synch_Options &synch_options) -{ - ACE_TRACE ("ACE_Connector::nonblocking_connect"); - - // Must have a valid Reactor for non-blocking connects to work. - if (this->reactor () == 0) - return -1; - - // Register the pending SVC_HANDLER so that it can be activated - // later on when the connection completes. - - ACE_HANDLE handle = sh->get_handle (); - long timer_id = -1; - ACE_Time_Value *tv = 0; - NBCH *nbch = 0; - - ACE_NEW_RETURN (nbch, - NBCH (*this, - sh, - -1), - -1); - - ACE_Event_Handler_var safe_nbch (nbch); - - // Exclusive access to the Reactor. - ACE_GUARD_RETURN (ACE_Lock, ace_mon, this->reactor ()->lock (), -1); - - // Register handle with the reactor for connection events. - ACE_Reactor_Mask mask = ACE_Event_Handler::CONNECT_MASK; - if (this->reactor ()->register_handler (handle, - nbch, - mask) == -1) - goto reactor_registration_failure; - - // Add handle to non-blocking handle set. - this->non_blocking_handles ().insert (handle); - - // If we're starting connection under timer control then we need to - // schedule a timeout with the ACE_Reactor. - tv = const_cast (synch_options.time_value ()); - if (tv != 0) - { - timer_id = - this->reactor ()->schedule_timer (nbch, - synch_options.arg (), - *tv); - if (timer_id == -1) - goto timer_registration_failure; - - // Remember timer id. - nbch->timer_id (timer_id); - } - - return 0; - - // Undo previous actions using the ol' "goto label and fallthru" - // trick... - timer_registration_failure: - - // Remove from Reactor. - this->reactor ()->remove_handler (handle, mask); - - // Remove handle from the set of non-blocking handles. - this->non_blocking_handles ().remove (handle); - - /* FALLTHRU */ - - reactor_registration_failure: - // Close the svc_handler - - sh->close (CLOSE_DURING_NEW_CONNECTION); - - return -1; -} - -template -ACE_Connector::~ACE_Connector (void) -{ - ACE_TRACE ("ACE_Connector::~ACE_Connector"); - - this->close (); -} - -template void -ACE_Connector::initialize_svc_handler -(ACE_HANDLE handle, - SVC_HANDLER *svc_handler) -{ - // Try to find out if the reactor uses event associations for the - // handles it waits on. If so we need to reset it. - bool reset_new_handle = - this->reactor ()->uses_event_associations (); - - if (reset_new_handle) - this->connector_.reset_new_handle (handle); - - // Transfer ownership of the ACE_HANDLE to the SVC_HANDLER. - svc_handler->set_handle (handle); - - ACE_PEER_CONNECTOR_ADDR raddr; - - // Check to see if we're connected. - if (svc_handler->peer ().get_remote_addr (raddr) != -1) - this->activate_svc_handler (svc_handler); - else // Somethings gone wrong, so close down... - { -#if defined (ACE_WIN32) - // Win32 (at least prior to Windows 2000) has a timing problem. - // If you check to see if the connection has completed too fast, - // it will fail - so wait 35 milliseconds to let it catch up. - ACE_Time_Value tv (0, ACE_NON_BLOCKING_BUG_DELAY); - ACE_OS::sleep (tv); - if (svc_handler->peer ().get_remote_addr (raddr) != -1) - this->activate_svc_handler (svc_handler); - else // do the svc handler close below... -#endif /* ACE_WIN32 */ - svc_handler->close (NORMAL_CLOSE_OPERATION); - } -} - -template void -ACE_Connector::reactor (ACE_Reactor *reactor) -{ - this->reactor_ = reactor; -} - -template ACE_Reactor * -ACE_Connector::reactor (void) const -{ - return this->reactor_; -} - -template ACE_Unbounded_Set & -ACE_Connector::non_blocking_handles (void) -{ - return this->non_blocking_handles_; -} - -template int -ACE_Connector::close (void) -{ - // If there are no non-blocking handle pending, return immediately. - if (this->non_blocking_handles ().size () == 0) - return 0; - - // Exclusive access to the Reactor. - ACE_GUARD_RETURN (ACE_Lock, ace_mon, this->reactor ()->lock (), -1); - - // Go through all the non-blocking handles. It is necessary to - // create a new iterator each time because we remove from the handle - // set when we cancel the Svc_Handler. - ACE_HANDLE *handle = 0; - while (1) - { - ACE_Unbounded_Set_Iterator - iterator (this->non_blocking_handles ()); - if (!iterator.next (handle)) - break; - - ACE_Event_Handler *handler = - this->reactor ()->find_handler (*handle); - if (handler == 0) - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%t: Connector::close h %d, no handler\n"), - *handle)); - // Remove handle from the set of non-blocking handles. - this->non_blocking_handles ().remove (*handle); - continue; - } - - // find_handler() incremented handler's refcount; ensure it's decremented - ACE_Event_Handler_var safe_handler (handler); - NBCH *nbch = dynamic_cast (handler); - if (nbch == 0) - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%t: Connector::close h %d handler %@ ") - ACE_TEXT ("not a legit handler\n"), - *handle, - handler)); - // Remove handle from the set of non-blocking handles. - this->non_blocking_handles ().remove (*handle); - continue; - } - SVC_HANDLER *svc_handler = nbch->svc_handler (); - - // Cancel the non-blocking connection. - this->cancel (svc_handler); - - // Close the associated Svc_Handler. - svc_handler->close (NORMAL_CLOSE_OPERATION); - } - - return 0; -} - -template int -ACE_Connector::fini (void) -{ - ACE_TRACE ("ACE_Connector::fini"); - - return this->close (); -} - -// Hook called by the explicit dynamic linking facility. - -template int -ACE_Connector::init (int, ACE_TCHAR *[]) -{ - ACE_TRACE ("ACE_Connector::init"); - return -1; -} - -template int -ACE_Connector::suspend (void) -{ - ACE_TRACE ("ACE_Connector::suspend"); - return -1; -} - -template int -ACE_Connector::resume (void) -{ - ACE_TRACE ("ACE_Connector::resume"); - return -1; -} - -template int -ACE_Connector::info (ACE_TCHAR **strp, size_t length) const -{ - ACE_TRACE ("ACE_Connector::info"); - ACE_TCHAR buf[BUFSIZ]; - - ACE_OS::sprintf (buf, - ACE_TEXT ("%s\t %s"), - ACE_TEXT ("ACE_Connector"), - ACE_TEXT ("# connector factory\n")); - - if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0) - return -1; - else - ACE_OS::strsncpy (*strp, buf, length); - return static_cast (ACE_OS::strlen (buf)); -} - -template int -ACE_Strategy_Connector::open (ACE_Reactor *r, - int flags) -{ - ACE_TRACE ("ACE_Strategy_Connector::open"); - return this->open (r, 0, 0, 0, flags); -} - -template int -ACE_Strategy_Connector::open -(ACE_Reactor *r, - ACE_Creation_Strategy *cre_s, - ACE_Connect_Strategy *conn_s, - ACE_Concurrency_Strategy *con_s, - int flags) -{ - ACE_TRACE ("ACE_Strategy_Connector::open"); - - this->reactor (r); - - // @@ Not implemented yet. - // this->flags_ = flags; - ACE_UNUSED_ARG (flags); - - // Initialize the creation strategy. - - // First we decide if we need to clean up. - if (this->creation_strategy_ != 0 && - this->delete_creation_strategy_ && - cre_s != 0) - { - delete this->creation_strategy_; - this->creation_strategy_ = 0; - this->delete_creation_strategy_ = false; - } - - if (cre_s != 0) - this->creation_strategy_ = cre_s; - else if (this->creation_strategy_ == 0) - { - ACE_NEW_RETURN (this->creation_strategy_, - CREATION_STRATEGY (0, r), - -1); - this->delete_creation_strategy_ = true; - } - - - // Initialize the accept strategy. - - if (this->connect_strategy_ != 0 && - this->delete_connect_strategy_ && - conn_s != 0) - { - delete this->connect_strategy_; - this->connect_strategy_ = 0; - this->delete_connect_strategy_ = false; - } - - if (conn_s != 0) - this->connect_strategy_ = conn_s; - else if (this->connect_strategy_ == 0) - { - ACE_NEW_RETURN (this->connect_strategy_, - CONNECT_STRATEGY, - -1); - this->delete_connect_strategy_ = true; - } - - // Initialize the concurrency strategy. - - if (this->concurrency_strategy_ != 0 && - this->delete_concurrency_strategy_ && - con_s != 0) - { - delete this->concurrency_strategy_; - this->concurrency_strategy_ = 0; - this->delete_concurrency_strategy_ = false; - } - - if (con_s != 0) - this->concurrency_strategy_ = con_s; - else if (this->concurrency_strategy_ == 0) - { - ACE_NEW_RETURN (this->concurrency_strategy_, - CONCURRENCY_STRATEGY, - -1); - this->delete_concurrency_strategy_ = true; - } - - return 0; -} - -template -ACE_Strategy_Connector::ACE_Strategy_Connector -(ACE_Reactor *reactor, - ACE_Creation_Strategy *cre_s, - ACE_Connect_Strategy *conn_s, - ACE_Concurrency_Strategy *con_s, - int flags) - : base_type (reactor), - creation_strategy_ (0), - delete_creation_strategy_ (false), - connect_strategy_ (0), - delete_connect_strategy_ (false), - concurrency_strategy_ (0), - delete_concurrency_strategy_ (false) -{ - ACE_TRACE ("ACE_Connector::ACE_Strategy_Connector"); - - if (this->open (reactor, cre_s, conn_s, con_s, flags) == -1) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_Strategy_Connector::ACE_Strategy_Connector"))); -} - -template -ACE_Strategy_Connector::~ACE_Strategy_Connector (void) -{ - ACE_TRACE ("ACE_Strategy_Connector::~ACE_Strategy_Connector"); - - // Close down - this->close (); -} - -template int -ACE_Strategy_Connector::close (void) -{ - if (this->delete_creation_strategy_) - delete this->creation_strategy_; - this->delete_creation_strategy_ = false; - this->creation_strategy_ = 0; - - if (this->delete_connect_strategy_) - delete this->connect_strategy_; - this->delete_connect_strategy_ = false; - this->connect_strategy_ = 0; - - if (this->delete_concurrency_strategy_) - delete this->concurrency_strategy_; - this->delete_concurrency_strategy_ = false; - this->concurrency_strategy_ = 0; - - return SUPER::close (); -} - -template int -ACE_Strategy_Connector::make_svc_handler (SVC_HANDLER *&sh) -{ - return this->creation_strategy_->make_svc_handler (sh); -} - -template int -ACE_Strategy_Connector::connect_svc_handler -(SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) -{ - return this->connect_strategy_->connect_svc_handler (sh, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms); -} - -template int -ACE_Strategy_Connector::connect_svc_handler -(SVC_HANDLER *&sh, - SVC_HANDLER *&sh_copy, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) -{ - return this->connect_strategy_->connect_svc_handler (sh, - sh_copy, - remote_addr, - timeout, - local_addr, - reuse_addr, - flags, - perms); -} - -template int -ACE_Strategy_Connector::activate_svc_handler (SVC_HANDLER *svc_handler) -{ - return this->concurrency_strategy_->activate_svc_handler (svc_handler, this); -} - -template ACE_Creation_Strategy * -ACE_Strategy_Connector::creation_strategy (void) const -{ - return this->creation_strategy_; -} - -template ACE_Connect_Strategy * -ACE_Strategy_Connector::connect_strategy (void) const -{ - return this->connect_strategy_; -} - -template ACE_Concurrency_Strategy * -ACE_Strategy_Connector::concurrency_strategy (void) const -{ - return this->concurrency_strategy_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_CONNECTOR_C */ diff --git a/dep/acelite/ace/Connector.h b/dep/acelite/ace/Connector.h deleted file mode 100644 index 320867852ae..00000000000 --- a/dep/acelite/ace/Connector.h +++ /dev/null @@ -1,572 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Connector.h - * - * $Id: Connector.h 91527 2010-08-27 15:03:31Z shuston $ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_CONNECTOR_H -#define ACE_CONNECTOR_H - -#include /**/ "ace/pre.h" - -#include "ace/Service_Object.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Strategies_T.h" -#include "ace/Synch_Options.h" -#include "ace/Unbounded_Set.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Connector_Base - * - * @brief This base interface allows ACE_NonBlocking_Connect_Handler - * to only care about the SVC_HANDLER template parameter of the - * ACE_Connector. Otherwise, ACE_NonBlocking_Connect_Handler would - * have to be configured with all the template parameters that - * ACE_Connector is configured with. - */ -template -class ACE_Connector_Base -{ -public: - - virtual ~ACE_Connector_Base (void) {} - - /// Initialize the Svc_Handler. - virtual void initialize_svc_handler (ACE_HANDLE handle, - SVC_HANDLER *svc_handler) = 0; - - /// Return the handle set representing the non-blocking connects in - /// progress. - virtual ACE_Unbounded_Set &non_blocking_handles (void) = 0; -}; - -/** - * @class ACE_NonBlocking_Connect_Handler - * - * @brief Performs non-blocking connects on behalf of the Connector. - */ -template -class ACE_NonBlocking_Connect_Handler : public ACE_Event_Handler -{ -public: - - /// Constructor. - ACE_NonBlocking_Connect_Handler (ACE_Connector_Base &connector, - SVC_HANDLER *, - long timer_id); - - /// Destructor. - ~ACE_NonBlocking_Connect_Handler (void); - - /// Close up and return underlying SVC_HANDLER through @c sh. - /** - * If the return value is true the close was performed succesfully, - * implying that this object was removed from the reactor and thereby - * (by means of reference counting decremented to 0) deleted. - * If the return value is false, the close was not successful. - * The @c sh does not have any connection to the return - * value. The argument will return a valid svc_handler object if a - * valid one exists within the object. Returning a valid svc_handler - * pointer also invalidates the svc_handler contained in this - * object. - */ - bool close (SVC_HANDLER *&sh); - - /// Get SVC_HANDLER. - SVC_HANDLER *svc_handler (void); - - /// Get handle. - ACE_HANDLE handle (void); - - /// Set handle. - void handle (ACE_HANDLE); - - /// Get timer id. - long timer_id (void); - - /// Set timer id. - void timer_id (long timer_id); - - /// Called by ACE_Reactor when asynchronous connections fail. - virtual int handle_input (ACE_HANDLE); - - /// Called by ACE_Dev_Poll_Reactor when asynchronous connections fail. - virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask); - - /// Called by ACE_Reactor when asynchronous connections succeed. - virtual int handle_output (ACE_HANDLE); - - /// Called by ACE_Reactor when asynchronous connections suceeds (on - /// some platforms only). - virtual int handle_exception (ACE_HANDLE fd); - - /// This method is called if a connection times out before - /// completing. - virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg); - - /// Should Reactor resume us if we have been suspended before the upcall? - virtual int resume_handler (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - - /// Connector base. - ACE_Connector_Base &connector_; - - /// Associated SVC_HANDLER. - SVC_HANDLER *svc_handler_; - - /// Same as svc_handler_ if svc_handler_ is reference counted. - SVC_HANDLER *cleanup_svc_handler_; - - /// Associated timer id. - long timer_id_; -}; - -/** - * @class ACE_Connector - * - * @brief Generic factory for actively connecting clients and creating - * service handlers (SVC_HANDLERs). - * - * Implements the strategy for actively establishing connections with - * clients. An ACE_Connector is parameterized by concrete types that - * conform to the interfaces of PEER_CONNECTOR and SVC_HANDLER. The - * PEER_CONNECTOR is instantiated with a transport mechanism that - * actively establishes connections. The SVC_HANDLER is instantiated - * with a concrete type that performs the application-specific - * service. Both blocking and non-blocking connects are supported. - * Further, non-blocking connects support timeouts. - */ -template -class ACE_Connector : public ACE_Connector_Base, public ACE_Service_Object -{ -public: - - // Useful STL-style traits. - typedef typename SVC_HANDLER::addr_type addr_type; - typedef ACE_PEER_CONNECTOR connector_type; - typedef SVC_HANDLER handler_type; - typedef typename SVC_HANDLER::stream_type stream_type; - typedef typename ACE_PEER_CONNECTOR::PEER_ADDR peer_addr_type; - typedef ACE_PEER_CONNECTOR_ADDR ACE_PEER_ADDR_TYPEDEF; - - /** - * Initialize a connector. @a flags indicates how SVC_HANDLER's - * should be initialized prior to being activated. Right now, the - * only flag that is processed is ACE_NONBLOCK, which enabled - * non-blocking I/O on the SVC_HANDLER when it is opened. - */ - ACE_Connector (ACE_Reactor *r = ACE_Reactor::instance (), - int flags = 0); - - /** - * Initialize a connector. @a flags indicates how SVC_HANDLER's - * should be initialized prior to being activated. Right now, the - * only flag that is processed is ACE_NONBLOCK, which enabled - * non-blocking I/O on the SVC_HANDLER when it is opened. - */ - virtual int open (ACE_Reactor *r = ACE_Reactor::instance (), - int flags = 0); - - /// Shutdown a connector and release resources. - virtual ~ACE_Connector (void); - - // = Connection establishment methods. - - /** - * Initiate connection of @a svc_handler to peer at @a remote_addr - * using @a synch_options. If the caller wants to designate the - * selected @a local_addr they can (and can also insist that the - * @a local_addr be reused by passing a value @a reuse_addr == - * 1). @a flags and @a perms can be used to pass any flags that are - * needed to perform specific operations such as opening a file - * within connect with certain permissions. If the connection fails - * the hook on the @a svc_handler will be called - * automatically to prevent resource leaks. - */ - virtual int connect (SVC_HANDLER *&svc_handler, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - const ACE_Synch_Options &synch_options = ACE_Synch_Options::defaults, - const ACE_PEER_CONNECTOR_ADDR &local_addr - = (peer_addr_type &) ACE_PEER_CONNECTOR_ADDR_ANY, - int reuse_addr = 0, - int flags = O_RDWR, - int perms = 0); - - /** - * This is a variation on the previous method. On cached - * connectors the @a svc_handler_hint variable can be used as a hint - * for future lookups. Since this variable is modified in the - * context of the internal cache its use is thread-safe. But the - * actual svc_handler for the current connection is returned in the - * second parameter @a svc_handler. If the connection fails the - * hook on the @a svc_handler will be called automatically to - * prevent resource leaks. - */ - virtual int connect (SVC_HANDLER *&svc_handler_hint, - SVC_HANDLER *&svc_handler, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - const ACE_Synch_Options &synch_options = ACE_Synch_Options::defaults, - const ACE_PEER_CONNECTOR_ADDR &local_addr - = (peer_addr_type &) ACE_PEER_CONNECTOR_ADDR_ANY, - int reuse_addr = 0, - int flags = O_RDWR, - int perms = 0); - - /** - * Initiate connection of @a n @a svc_handlers to peers at - * @a remote_addrs using @a synch_options. Returns -1 if failure - * occurs and 0 otherwise. If @a failed_svc_handlers is non-NULL, a - * 1 is placed in the corresponding index of @a failed_svc_handlers - * for each that failed to connect, else a 0 is - * placed in that index. - */ - virtual int connect_n (size_t n, - SVC_HANDLER *svc_handlers[], - ACE_PEER_CONNECTOR_ADDR remote_addrs[], - ACE_TCHAR *failed_svc_handlers = 0, - const ACE_Synch_Options &synch_options = - ACE_Synch_Options::defaults); - - /** - * Cancel the @a svc_handler that was started asynchronously. Note that - * this is the only case when the Connector does not actively close - * the @a svc_handler. It is left up to the caller of to - * decide the fate of the @a svc_handler. - */ - virtual int cancel (SVC_HANDLER *svc_handler); - - /// Close down the Connector. All pending non-blocking connects are - /// canceled and the corresponding svc_handler is closed. - virtual int close (void); - - /// Return the underlying PEER_CONNECTOR object. - virtual ACE_PEER_CONNECTOR &connector (void) const; - - /// Initialize Svc_Handler. - virtual void initialize_svc_handler (ACE_HANDLE handle, - SVC_HANDLER *svc_handler); - - /// Set Reactor. - virtual void reactor (ACE_Reactor *reactor); - - /// Get Reactor. - virtual ACE_Reactor *reactor (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - // = Helpful typedefs. - typedef ACE_NonBlocking_Connect_Handler NBCH; - - // = The following two methods define the Connector's strategies for - // creating, connecting, and activating SVC_HANDLER's, respectively. - - /** - * Bridge method for creating a SVC_HANDLER. The default is to - * create a new SVC_HANDLER only if @a sh == 0, else @a sh is - * unchanged. However, subclasses can override this policy to - * perform SVC_HANDLER creation in any way that they like (such as - * creating subclass instances of SVC_HANDLER, using a singleton, - * dynamically linking the handler, etc.). Returns -1 if failure, - * else 0. - */ - virtual int make_svc_handler (SVC_HANDLER *&sh); - - /** - * Bridge method for connecting the @a svc_handler to the - * @a remote_addr. The default behavior delegates to the - * . - */ - virtual int connect_svc_handler (SVC_HANDLER *&svc_handler, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms); - virtual int connect_svc_handler (SVC_HANDLER *&svc_handler, - SVC_HANDLER *&sh_copy, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms); - - /** - * Bridge method for activating a @a svc_handler with the appropriate - * concurrency strategy. The default behavior of this method is to - * activate the SVC_HANDLER by calling its method (which - * allows the SVC_HANDLER to define its own concurrency strategy). - * However, subclasses can override this strategy to do more - * sophisticated concurrency activations (such as creating the - * SVC_HANDLER as an "active object" via multi-threading or - * multi-processing). - */ - virtual int activate_svc_handler (SVC_HANDLER *svc_handler); - - /// Creates and registers ACE_NonBlocking_Connect_Handler. - int nonblocking_connect (SVC_HANDLER *, - const ACE_Synch_Options &); - - /// Implementation of the connect methods. - virtual int connect_i (SVC_HANDLER *&svc_handler, - SVC_HANDLER **sh_copy, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - const ACE_Synch_Options &synch_options, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms); - - /// Return the handle set representing the non-blocking connects in - /// progress. - ACE_Unbounded_Set &non_blocking_handles (void); - - // = Dynamic linking hooks. - /// Default version does no work and returns -1. Must be overloaded - /// by application developer to do anything meaningful. - virtual int init (int argc, ACE_TCHAR *argv[]); - - /// Calls handle_close() to shutdown the Connector gracefully. - virtual int fini (void); - - /// Default version returns address info in @a buf. - virtual int info (ACE_TCHAR **strp, size_t length) const; - - // = Service management hooks. - /// Default version does no work and returns -1. Must be overloaded - /// by application developer to do anything meaningful. - virtual int suspend (void); - - /// Default version does no work and returns -1. Must be overloaded - /// by application developer to do anything meaningful. - virtual int resume (void); - -private: - /// This is the peer connector factory. - ACE_PEER_CONNECTOR connector_; - - /** - * Flags that indicate how SVC_HANDLER's should be initialized - * prior to being activated. Right now, the only flag that is - * processed is ACE_NONBLOCK, which enabled non-blocking I/O on - * the SVC_HANDLER when it is opened. - */ - int flags_; - - /// Pointer to the Reactor. - ACE_Reactor *reactor_; - - /// Handle set representing the non-blocking connects in progress. - ACE_Unbounded_Set non_blocking_handles_; - -}; - -/** - * @class ACE_Strategy_Connector - * - * @brief Abstract factory for creating a service handler - * (SVC_HANDLER), connecting the SVC_HANDLER, and activating the - * SVC_HANDLER. - * - * Implements a flexible and extensible set of strategies for - * actively establishing connections with clients. There are - * three main strategies: (1) creating a SVC_HANDLER, (2) - * actively initiating a new connection from the client, - * and (3) activating the SVC_HANDLER with a - * particular concurrency mechanism after the connection is established. - */ -template -class ACE_Strategy_Connector - : public ACE_Connector -{ -public: - - // Useful STL-style traits. - typedef ACE_Creation_Strategy - creation_strategy_type; - typedef ACE_Connect_Strategy - connect_strategy_type; - typedef ACE_Concurrency_Strategy - concurrency_strategy_type; - typedef ACE_Connector - base_type; - - // = Define some useful (old style) traits. - typedef ACE_Creation_Strategy - CREATION_STRATEGY; - typedef ACE_Connect_Strategy - CONNECT_STRATEGY; - typedef ACE_Concurrency_Strategy - CONCURRENCY_STRATEGY; - typedef ACE_Connector - SUPER; - - /** - * Initialize a connector. @a flags indicates how SVC_HANDLER's - * should be initialized prior to being activated. Right now, the - * only flag that is processed is ACE_NONBLOCK, which enabled - * non-blocking I/O on the SVC_HANDLER when it is opened. - */ - ACE_Strategy_Connector (ACE_Reactor *r = ACE_Reactor::instance (), - ACE_Creation_Strategy * = 0, - ACE_Connect_Strategy * = 0, - ACE_Concurrency_Strategy * = 0, - int flags = 0); - - /** - * Initialize a connector. @a flags indicates how SVC_HANDLER's - * should be initialized prior to being activated. Right now, the - * only flag that is processed is ACE_NONBLOCK, which enabled - * non-blocking I/O on the SVC_HANDLER when it is opened. - * Default strategies would be created and used. - */ - virtual int open (ACE_Reactor *r, - int flags); - - /** - * Initialize a connector. @a flags indicates how SVC_HANDLER's - * should be initialized prior to being activated. Right now, the - * only flag that is processed is ACE_NONBLOCK, which enabled - * non-blocking I/O on the SVC_HANDLER when it is opened. - */ - virtual int open (ACE_Reactor *r = ACE_Reactor::instance (), - ACE_Creation_Strategy * = 0, - ACE_Connect_Strategy * = 0, - ACE_Concurrency_Strategy * = 0, - int flags = 0); - - /// Shutdown a connector and release resources. - virtual ~ACE_Strategy_Connector (void); - - /// Close down the Connector - virtual int close (void); - - // = Strategies accessors - virtual ACE_Creation_Strategy *creation_strategy (void) const; - virtual ACE_Connect_Strategy *connect_strategy (void) const; - virtual ACE_Concurrency_Strategy *concurrency_strategy (void) const; - -protected: - // = The following three methods define the 's strategies - // for creating, connecting, and activating SVC_HANDLER's, - // respectively. - - /** - * Bridge method for creating a SVC_HANDLER. The strategy for - * creating a SVC_HANDLER are configured into the Connector via - * it's . The default is to create a new - * SVC_HANDLER only if @a sh == 0, else @a sh is unchanged. - * However, subclasses can override this policy to perform - * SVC_HANDLER creation in any way that they like (such as - * creating subclass instances of SVC_HANDLER, using a singleton, - * dynamically linking the handler, etc.). Returns -1 if failure, - * else 0. - */ - virtual int make_svc_handler (SVC_HANDLER *&sh); - - /** - * Bridge method for connecting the new connection into the - * SVC_HANDLER. The default behavior delegates to the - * in the . - */ - virtual int connect_svc_handler (SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms); - - /** - * Bridge method for connecting the new connection into the - * SVC_HANDLER. The default behavior delegates to the - * in the . - * @a sh_copy is used to obtain a copy of the @a sh pointer, but that - * can be kept in the stack; the motivation is a bit too long to - * include here, but basically we want to modify @a sh safely, using - * the internal locks in the Connect_Strategy, while saving a TSS - * copy in @a sh_copy, usually located in the stack. - */ - virtual int connect_svc_handler (SVC_HANDLER *&sh, - SVC_HANDLER *&sh_copy, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms); - - /** - * Bridge method for activating a SVC_HANDLER with the appropriate - * concurrency strategy. The default behavior of this method is to - * activate the SVC_HANDLER by calling its method (which - * allows the SVC_HANDLER to define its own concurrency strategy). - * However, subclasses can override this strategy to do more - * sophisticated concurrency activations (such as creating the - * SVC_HANDLER as an "active object" via multi-threading or - * multi-processing). - */ - virtual int activate_svc_handler (SVC_HANDLER *svc_handler); - - // = Strategy objects. - - /// Creation strategy for an Connector. - CREATION_STRATEGY *creation_strategy_; - - /// True if Connector created the creation strategy and thus should - /// delete it, else false. - bool delete_creation_strategy_; - - /// Connect strategy for a Connector. - CONNECT_STRATEGY *connect_strategy_; - - /// True if Connector created the connect strategy and thus should - /// delete it, else false. - bool delete_connect_strategy_; - - /// Concurrency strategy for a Connector. - CONCURRENCY_STRATEGY *concurrency_strategy_; - - /// True if Connector created the concurrency strategy and thus should - /// delete it, else false. - bool delete_concurrency_strategy_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Connector.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Connector.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_CONNECTOR_H */ diff --git a/dep/acelite/ace/Containers.cpp b/dep/acelite/ace/Containers.cpp deleted file mode 100644 index 5a8ef29f948..00000000000 --- a/dep/acelite/ace/Containers.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// $Id: Containers.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/Containers.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Containers.inl" -#endif /* __ACE_INLINE__ */ - diff --git a/dep/acelite/ace/Containers.h b/dep/acelite/ace/Containers.h deleted file mode 100644 index ecff8e368e4..00000000000 --- a/dep/acelite/ace/Containers.h +++ /dev/null @@ -1,71 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Containers.h - * - * $Id: Containers.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_CONTAINERS_H -#define ACE_CONTAINERS_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template class ACE_Double_Linked_List; -template class ACE_Double_Linked_List_Iterator_Base; -template class ACE_Double_Linked_List_Iterator; -template class ACE_Double_Linked_List_Reverse_Iterator; - -/** - * @class ACE_DLList_Node - * - * @brief Base implementation of element in a DL list. Needed for - * ACE_Double_Linked_List. - */ -class ACE_Export ACE_DLList_Node -{ -public: - friend class ACE_Double_Linked_List; - friend class ACE_Double_Linked_List_Iterator_Base; - friend class ACE_Double_Linked_List_Iterator; - friend class ACE_Double_Linked_List_Reverse_Iterator; - - ACE_DLList_Node (void *i, - ACE_DLList_Node *n = 0, - ACE_DLList_Node *p = 0); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - void *item_; - - ACE_DLList_Node *next_; - ACE_DLList_Node *prev_; - -protected: - ACE_DLList_Node (void); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Containers.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Containers_T.h" - -#include /**/ "ace/post.h" - -#endif /* ACE_CONTAINERS_H */ diff --git a/dep/acelite/ace/Containers.inl b/dep/acelite/ace/Containers.inl deleted file mode 100644 index 8094672a8f6..00000000000 --- a/dep/acelite/ace/Containers.inl +++ /dev/null @@ -1,25 +0,0 @@ -// -*- C++ -*- -// -// $Id: Containers.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_DLList_Node::ACE_DLList_Node (void) - : item_ (0), - next_ (0), - prev_ (0) -{ -} - -ACE_INLINE -ACE_DLList_Node::ACE_DLList_Node (void *i, - ACE_DLList_Node *n, - ACE_DLList_Node *p) - : item_ (i), - next_ (n), - prev_ (p) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Containers_T.cpp b/dep/acelite/ace/Containers_T.cpp deleted file mode 100644 index 411b26dc834..00000000000 --- a/dep/acelite/ace/Containers_T.cpp +++ /dev/null @@ -1,1903 +0,0 @@ -// $Id: Containers_T.cpp 92069 2010-09-28 11:38:59Z johnnyw $ - -#ifndef ACE_CONTAINERS_T_CPP -#define ACE_CONTAINERS_T_CPP - -#include "ace/Log_Msg.h" -#include "ace/Malloc_Base.h" -#include "ace/OS_Memory.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Containers.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Containers_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Bounded_Stack) - -template void -ACE_Bounded_Stack::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Bounded_Stack::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Bounded_Stack::ACE_Bounded_Stack (size_t size) - : size_ (size), - top_ (0) -{ - ACE_NEW (this->stack_, - T[size]); - ACE_TRACE ("ACE_Bounded_Stack::ACE_Bounded_Stack"); -} - -template -ACE_Bounded_Stack::ACE_Bounded_Stack (const ACE_Bounded_Stack &s) - : size_ (s.size_), - top_ (s.top_) -{ - ACE_NEW (this->stack_, - T[s.size_]); - - ACE_TRACE ("ACE_Bounded_Stack::ACE_Bounded_Stack"); - - for (size_t i = 0; i < this->top_; i++) - this->stack_[i] = s.stack_[i]; -} - -template void -ACE_Bounded_Stack::operator= (const ACE_Bounded_Stack &s) -{ - ACE_TRACE ("ACE_Bounded_Stack::operator="); - - if (&s != this) - { - if (this->size_ < s.size_) - { - delete [] this->stack_; - ACE_NEW (this->stack_, - T[s.size_]); - this->size_ = s.size_; - } - this->top_ = s.top_; - - for (size_t i = 0; i < this->top_; i++) - this->stack_[i] = s.stack_[i]; - } -} - -template -ACE_Bounded_Stack::~ACE_Bounded_Stack (void) -{ - ACE_TRACE ("ACE_Bounded_Stack::~ACE_Bounded_Stack"); - delete [] this->stack_; -} - -// ---------------------------------------- - -ACE_ALLOC_HOOK_DEFINE(ACE_Fixed_Stack) - -template void -ACE_Fixed_Stack::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Fixed_Stack::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Fixed_Stack::ACE_Fixed_Stack (void) - : size_ (ACE_SIZE), - top_ (0) -{ - ACE_TRACE ("ACE_Fixed_Stack::ACE_Fixed_Stack"); -} - -template -ACE_Fixed_Stack::ACE_Fixed_Stack (const ACE_Fixed_Stack &s) - : size_ (s.size_), - top_ (s.top_) -{ - ACE_TRACE ("ACE_Fixed_Stack::ACE_Fixed_Stack"); - for (size_t i = 0; i < this->top_; i++) - this->stack_[i] = s.stack_[i]; -} - -template void -ACE_Fixed_Stack::operator= (const ACE_Fixed_Stack &s) -{ - ACE_TRACE ("ACE_Fixed_Stack::operator="); - - if (&s != this) - { - this->top_ = s.top_; - - for (size_t i = 0; i < this->top_; i++) - this->stack_[i] = s.stack_[i]; - } -} - -template -ACE_Fixed_Stack::~ACE_Fixed_Stack (void) -{ - ACE_TRACE ("ACE_Fixed_Stack::~ACE_Fixed_Stack"); -} - -//---------------------------------------- - -ACE_ALLOC_HOOK_DEFINE(ACE_Unbounded_Stack) - -template void -ACE_Unbounded_Stack::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - // ACE_TRACE ("ACE_Unbounded_Stack::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Unbounded_Stack::ACE_Unbounded_Stack (ACE_Allocator *alloc) - : head_ (0), - cur_size_ (0), - allocator_ (alloc) -{ - // ACE_TRACE ("ACE_Unbounded_Stack::ACE_Unbounded_Stack"); - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - ACE_NEW_MALLOC (this->head_, - (ACE_Node *) this->allocator_->malloc (sizeof (ACE_Node)), - ACE_Node); - this->head_->next_ = this->head_; -} - -template void -ACE_Unbounded_Stack::delete_all_nodes (void) -{ - // ACE_TRACE ("ACE_Unbounded_Stack::delete_all_nodes"); - - while (this->is_empty () == 0) - { - ACE_Node *temp = this->head_->next_; - this->head_->next_ = temp->next_; - ACE_DES_FREE_TEMPLATE (temp, this->allocator_->free, - ACE_Node, ); - } - - this->cur_size_ = 0; - - ACE_ASSERT (this->head_ == this->head_->next_ - && this->is_empty ()); -} - -template void -ACE_Unbounded_Stack::copy_all_nodes (const ACE_Unbounded_Stack &s) -{ - // ACE_TRACE ("ACE_Unbounded_Stack::copy_all_nodes"); - - ACE_ASSERT (this->head_ == this->head_->next_); - - ACE_Node *temp = this->head_; - - for (ACE_Node *s_temp = s.head_->next_; - s_temp != s.head_; - s_temp = s_temp->next_) - { - ACE_Node *nptr = temp->next_; - ACE_NEW_MALLOC (temp->next_, - (ACE_Node *) this->allocator_->malloc (sizeof (ACE_Node)), - ACE_Node (s_temp->item_, nptr)); - temp = temp->next_; - } - this->cur_size_ = s.cur_size_; -} - -template -ACE_Unbounded_Stack::ACE_Unbounded_Stack (const ACE_Unbounded_Stack &s) - : head_ (0), - cur_size_ (0), - allocator_ (s.allocator_) -{ - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - ACE_NEW_MALLOC (this->head_, - (ACE_Node *) this->allocator_->malloc (sizeof (ACE_Node)), - ACE_Node); - this->head_->next_ = this->head_; - - // ACE_TRACE ("ACE_Unbounded_Stack::ACE_Unbounded_Stack"); - this->copy_all_nodes (s); -} - -template void -ACE_Unbounded_Stack::operator= (const ACE_Unbounded_Stack &s) -{ - // ACE_TRACE ("ACE_Unbounded_Stack::operator="); - - if (this != &s) - { - this->delete_all_nodes (); - this->copy_all_nodes (s); - } -} - -template -ACE_Unbounded_Stack::~ACE_Unbounded_Stack (void) -{ - // ACE_TRACE ("ACE_Unbounded_Stack::~ACE_Unbounded_Stack"); - - this->delete_all_nodes (); - ACE_DES_FREE_TEMPLATE (head_, - this->allocator_->free, - ACE_Node, - ); -} - -template int -ACE_Unbounded_Stack::push (const T &new_item) -{ - // ACE_TRACE ("ACE_Unbounded_Stack::push"); - - ACE_Node *temp = 0; - - ACE_NEW_MALLOC_RETURN (temp, - static_cast *> (this->allocator_->malloc (sizeof (ACE_Node))), - ACE_Node (new_item, this->head_->next_), - -1); - this->head_->next_ = temp; - ++this->cur_size_; - return 0; -} - -template int -ACE_Unbounded_Stack::pop (T &item) -{ - // ACE_TRACE ("ACE_Unbounded_Stack::pop"); - - if (this->is_empty ()) - return -1; - else - { - ACE_Node *temp = this->head_->next_; - item = temp->item_; - this->head_->next_ = temp->next_; - - ACE_DES_FREE_TEMPLATE (temp, - this->allocator_->free, - ACE_Node, - ); - --this->cur_size_; - return 0; - } -} - -template int -ACE_Unbounded_Stack::find (const T &item) const -{ - // ACE_TRACE ("ACE_Unbounded_Stack::find"); - // Set into the dummy node. - this->head_->item_ = item; - - ACE_Node *temp = this->head_->next_; - - // Keep looping until we find the item. - while (!(temp->item_ == item)) - temp = temp->next_; - - // If we found the dummy node then it's not really there, otherwise, - // it is there. - return temp == this->head_ ? -1 : 0; -} - -template int -ACE_Unbounded_Stack::insert (const T &item) -{ - // ACE_TRACE ("ACE_Unbounded_Stack::insert"); - - if (this->find (item) == 0) - return 1; - else - return this->push (item); -} - -template int -ACE_Unbounded_Stack::remove (const T &item) -{ - // ACE_TRACE ("ACE_Unbounded_Stack::remove"); - - // Insert the item to be founded into the dummy node. - this->head_->item_ = item; - - ACE_Node *curr = this->head_; - - while (!(curr->next_->item_ == item)) - curr = curr->next_; - - if (curr->next_ == this->head_) - return -1; // Item was not found. - else - { - ACE_Node *temp = curr->next_; - // Skip over the node that we're deleting. - curr->next_ = temp->next_; - --this->cur_size_; - ACE_DES_FREE_TEMPLATE (temp, - this->allocator_->free, - ACE_Node, - ); - return 0; - } -} - -//-------------------------------------------------- -ACE_ALLOC_HOOK_DEFINE(ACE_Double_Linked_List_Iterator_Base) - -template -ACE_Double_Linked_List_Iterator_Base::ACE_Double_Linked_List_Iterator_Base (const ACE_Double_Linked_List &dll) - : current_ (0), dllist_ (&dll) -{ - // Do nothing -} - -template -ACE_Double_Linked_List_Iterator_Base::ACE_Double_Linked_List_Iterator_Base (const ACE_Double_Linked_List_Iterator_Base &iter) - : current_ (iter.current_), - dllist_ (iter.dllist_) -{ - // Do nothing -} - - -template T * -ACE_Double_Linked_List_Iterator_Base::next (void) const -{ - return this->not_done (); -} - -template int -ACE_Double_Linked_List_Iterator_Base::next (T *&ptr) const -{ - ptr = this->not_done (); - return ptr ? 1 : 0; -} - - -template int -ACE_Double_Linked_List_Iterator_Base::done (void) const -{ - return this->not_done () ? 0 : 1; -} - -template T & -ACE_Double_Linked_List_Iterator_Base::operator* (void) const -{ - return *(this->not_done ()); -} - -// @@ Is this a valid retasking? Make sure to check with Purify and -// whatnot that we're not leaking memory or doing any other screwing things. -template void -ACE_Double_Linked_List_Iterator_Base::reset (ACE_Double_Linked_List &dll) -{ - current_ = 0; - dllist_ = &dll; -} - - template int -ACE_Double_Linked_List_Iterator_Base::go_head (void) -{ - this->current_ = static_cast (dllist_->head_->next_); - return this->current_ ? 1 : 0; -} - -template int -ACE_Double_Linked_List_Iterator_Base::go_tail (void) -{ - this->current_ = static_cast (dllist_->head_->prev_); - return this->current_ ? 1 : 0; -} - -template T * -ACE_Double_Linked_List_Iterator_Base::not_done (void) const -{ - if (this->current_ != this->dllist_->head_) - return this->current_; - else - return 0; -} - -template T * -ACE_Double_Linked_List_Iterator_Base::do_advance (void) -{ - if (this->not_done ()) - { - this->current_ = static_cast (this->current_->next_); - return this->not_done (); - } - else - return 0; -} - -template T * -ACE_Double_Linked_List_Iterator_Base::do_retreat (void) -{ - if (this->not_done ()) - { - this->current_ = static_cast (this->current_->prev_); - return this->not_done (); - } - else - return 0; -} - -template void -ACE_Double_Linked_List_Iterator_Base::dump_i (void) const -{ - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("current_ = %x"), this->current_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -} - -//-------------------------------------------------- -ACE_ALLOC_HOOK_DEFINE(ACE_Double_Linked_List_Iterator) - -template -ACE_Double_Linked_List_Iterator::ACE_Double_Linked_List_Iterator (const ACE_Double_Linked_List &dll) - : ACE_Double_Linked_List_Iterator_Base (dll) -{ - this->current_ = static_cast (dll.head_->next_); - // Advance current_ out of the null area and onto the first item in - // the list -} - -template void -ACE_Double_Linked_List_Iterator::reset (ACE_Double_Linked_List &dll) -{ - this->ACE_Double_Linked_List_Iterator_Base ::reset (dll); - this->current_ = static_cast (dll.head_->next_); - // Advance current_ out of the null area and onto the first item in - // the list -} - -template int -ACE_Double_Linked_List_Iterator::first (void) -{ - return this->go_head (); -} - -template int -ACE_Double_Linked_List_Iterator::advance (void) -{ - return this->do_advance () ? 1 : 0; -} - -template T* -ACE_Double_Linked_List_Iterator::advance_and_remove (bool dont_remove) -{ - T* item = 0; - if (dont_remove) - this->do_advance (); - else - { - item = this->next (); - this->do_advance (); - // It seems dangerous to remove nodes in an iterator, but so it goes... - ACE_Double_Linked_List *dllist = - const_cast *> (this->dllist_); - dllist->remove (item); - } - return item; -} - -template void -ACE_Double_Linked_List_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - this->dump_i (); -#endif /* ACE_HAS_DUMP */ -} - -// Prefix advance. - -template -ACE_Double_Linked_List_Iterator & -ACE_Double_Linked_List_Iterator::operator++ (void) -{ - this->do_advance (); - return *this; -} - - -// Postfix advance. - -template -ACE_Double_Linked_List_Iterator -ACE_Double_Linked_List_Iterator::operator++ (int) -{ - ACE_Double_Linked_List_Iterator retv (*this); - this->do_advance (); - return retv; -} - - -// Prefix reverse. - -template -ACE_Double_Linked_List_Iterator & -ACE_Double_Linked_List_Iterator::operator-- (void) -{ - this->do_retreat (); - return *this; -} - - -// Postfix reverse. - -template -ACE_Double_Linked_List_Iterator -ACE_Double_Linked_List_Iterator::operator-- (int) -{ - ACE_Double_Linked_List_Iterator retv (*this); - this->do_retreat (); - return retv; -} - - -//-------------------------------------------------- -ACE_ALLOC_HOOK_DEFINE(ACE_Double_Linked_List_Reverse_Iterator) - - template -ACE_Double_Linked_List_Reverse_Iterator::ACE_Double_Linked_List_Reverse_Iterator (ACE_Double_Linked_List &dll) - : ACE_Double_Linked_List_Iterator_Base (dll) -{ - this->current_ = static_cast (dll.head_->prev_); - // Advance current_ out of the null area and onto the last item in - // the list -} - -template void -ACE_Double_Linked_List_Reverse_Iterator::reset (ACE_Double_Linked_List &dll) -{ - this->ACE_Double_Linked_List_Iterator_Base ::reset (dll); - this->current_ = static_cast (dll.head_->prev_); - // Advance current_ out of the null area and onto the last item in - // the list -} - -template int -ACE_Double_Linked_List_Reverse_Iterator::first (void) -{ - return this->go_tail (); -} - -template int -ACE_Double_Linked_List_Reverse_Iterator::advance (void) -{ - return this->do_retreat () ? 1 : 0; -} - -template T* -ACE_Double_Linked_List_Reverse_Iterator::advance_and_remove (bool dont_remove) -{ - T* item = 0; - if (dont_remove) - { - this->do_retreat (); - } - else - { - item = this->next (); - this->do_retreat (); - // It seems dangerous to remove nodes in an iterator, but so it goes... - ACE_Double_Linked_List *dllist = - const_cast *> (this->dllist_); - dllist->remove (item); - } - return item; -} - -template void -ACE_Double_Linked_List_Reverse_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - this->dump_i (); -#endif /* ACE_HAS_DUMP */ -} - -// Prefix advance. - -template -ACE_Double_Linked_List_Reverse_Iterator & -ACE_Double_Linked_List_Reverse_Iterator::operator++ (void) -{ - this->do_retreat (); - return *this; -} - - -// Postfix advance. - -template -ACE_Double_Linked_List_Reverse_Iterator -ACE_Double_Linked_List_Reverse_Iterator::operator++ (int) -{ - ACE_Double_Linked_List_Reverse_Iterator retv (*this); - this->do_retreat (); - return retv; -} - - -// Prefix reverse. - -template -ACE_Double_Linked_List_Reverse_Iterator & -ACE_Double_Linked_List_Reverse_Iterator::operator-- (void) -{ - this->do_advance (); - return *this; -} - - -// Postfix reverse. - -template -ACE_Double_Linked_List_Reverse_Iterator -ACE_Double_Linked_List_Reverse_Iterator::operator-- (int) -{ - ACE_Double_Linked_List_Reverse_Iterator retv (*this); - this->do_advance (); - return retv; -} - - -ACE_ALLOC_HOOK_DEFINE(ACE_Double_Linked_List) - - template -ACE_Double_Linked_List:: ACE_Double_Linked_List (ACE_Allocator *alloc) - : size_ (0), allocator_ (alloc) -{ - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - ACE_NEW_MALLOC (this->head_, - (T *) this->allocator_->malloc (sizeof (T)), - T); - this->init_head (); -} - -template -ACE_Double_Linked_List::ACE_Double_Linked_List (const ACE_Double_Linked_List &cx) - : allocator_ (cx.allocator_) -{ - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - ACE_NEW_MALLOC (this->head_, - (T *) this->allocator_->malloc (sizeof (T)), - T); - this->init_head (); - this->copy_nodes (cx); - this->size_ = cx.size_; -} - -template void -ACE_Double_Linked_List::operator= (const ACE_Double_Linked_List &cx) -{ - if (this != &cx) - { - this->delete_nodes (); - this->copy_nodes (cx); - } -} - -template -ACE_Double_Linked_List::~ACE_Double_Linked_List (void) -{ - this->delete_nodes (); - - ACE_DES_FREE (head_, - this->allocator_->free, - T); - - this->head_ = 0; -} - -template int -ACE_Double_Linked_List::is_empty (void) const -{ - return this->size () ? 0 : 1; -} - -template int -ACE_Double_Linked_List::is_full (void) const -{ - return 0; // We have no bound. -} - -template T * -ACE_Double_Linked_List::insert_tail (T *new_item) -{ - // Insert it before , i.e., at tail. - this->insert_element (new_item, 1); - return new_item; -} - -template T * -ACE_Double_Linked_List::insert_head (T *new_item) -{ - this->insert_element (new_item); // Insert it after , i.e., at head. - return new_item; -} - -template T * -ACE_Double_Linked_List::delete_head (void) -{ - if (this->is_empty ()) - return 0; - - T *temp = static_cast (this->head_->next_); - // Detach it from the list. - this->remove_element (temp); - return temp; -} - -template T * -ACE_Double_Linked_List::delete_tail (void) -{ - if (this->is_empty ()) - return 0; - - T *temp = static_cast (this->head_->prev_); - // Detach it from the list. - this->remove_element (temp); - return temp; -} - -template void -ACE_Double_Linked_List::reset (void) -{ - this->delete_nodes (); -} - -template int -ACE_Double_Linked_List::get (T *&item, size_t slot) -{ - ACE_Double_Linked_List_Iterator iter (*this); - - for (size_t i = 0; - i < slot && !iter.done (); - i++) - iter.advance (); - - item = iter.next (); - return item ? 0 : -1; -} - -template size_t -ACE_Double_Linked_List::size (void) const -{ - return this->size_; -} - -template void -ACE_Double_Linked_List::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - // Dump the state of an object. -#endif /* ACE_HAS_DUMP */ -} - -template int -ACE_Double_Linked_List::remove (T *n) -{ - return this->remove_element (n); -} - -template void -ACE_Double_Linked_List::delete_nodes (void) -{ - while (! this->is_empty ()) - { - T * temp = static_cast (this->head_->next_); - this->remove_element (temp); - ACE_DES_FREE (temp, - this->allocator_->free, - T); - } -} - -template void -ACE_Double_Linked_List::copy_nodes (const ACE_Double_Linked_List &c) -{ - for (ACE_Double_Linked_List_Iterator iter (c); - !iter.done (); - iter.advance ()) - { - T* temp = 0; - ACE_NEW_MALLOC (temp, - (T *)this->allocator_->malloc (sizeof (T)), - T (*iter.next ())); - this->insert_tail (temp); - } -} - -template void -ACE_Double_Linked_List::init_head (void) -{ - this->head_->next_ = this->head_; - this->head_->prev_ = this->head_; -} - -template int -ACE_Double_Linked_List::insert_element (T *new_item, - int before, - T *old_item) -{ - if (old_item == 0) - old_item = this->head_; - - if (before) - old_item = static_cast (old_item->prev_); - - new_item->next_ = old_item->next_; - new_item->next_->prev_ = new_item; - new_item->prev_ = old_item; - old_item->next_ = new_item; - ++this->size_; - return 0; // Well, what will cause errors here? -} - -template int -ACE_Double_Linked_List::remove_element (T *item) -{ - // Notice that you have to ensure that item is an element of this - // list. We can't do much checking here. - - if (item == this->head_ || item->next_ == 0 - || item->prev_ == 0 || this->size () == 0) // Can't remove head - return -1; - - item->prev_->next_ = item->next_; - item->next_->prev_ = item->prev_; - item->next_ = item->prev_ = 0; // reset pointers to prevent double removal. - --this->size_; - return 0; -} - -//-------------------------------------------------- -ACE_ALLOC_HOOK_DEFINE(ACE_Fixed_Set) - -template size_t -ACE_Fixed_Set::size (void) const -{ - ACE_TRACE ("ACE_Fixed_Set::size"); - return this->cur_size_; -} - -template void -ACE_Fixed_Set::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Fixed_Set::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Fixed_Set::~ACE_Fixed_Set (void) -{ - ACE_TRACE ("ACE_Fixed_Set::~ACE_Fixed_Set"); - this->cur_size_ = 0; -} - -template -ACE_Fixed_Set::ACE_Fixed_Set (const ACE_Fixed_Set &fs) - : cur_size_ (fs.cur_size_) -{ - ACE_TRACE ("ACE_Fixed_Set::ACE_Fixed_Set"); - - for (size_t i = 0, j = 0; i < fs.max_size_ && j < this->cur_size_; ++i) - if (fs.search_structure_[i].is_free_ == 0) - this->search_structure_[j++] = fs.search_structure_[i]; -} - -template void -ACE_Fixed_Set::operator= (const ACE_Fixed_Set &fs) -{ - ACE_TRACE ("ACE_Fixed_Set::operator="); - - if (this != &fs) - { - this->cur_size_ = fs.cur_size_; - - for (size_t i = 0, j = 0; i < fs.max_size_ && j < this->cur_size_; ++i) - if (fs.search_structure_[i].is_free_ == 0) - this->search_structure_[j++] = fs.search_structure_[i]; - } -} - -template -ACE_Fixed_Set::ACE_Fixed_Set (void) - : cur_size_ (0), - max_size_ (ACE_SIZE) -{ - ACE_TRACE ("ACE_Fixed_Set::ACE_Fixed_Set"); - for (size_t i = 0; i < this->max_size_; i++) - this->search_structure_[i].is_free_ = 1; -} - -template int -ACE_Fixed_Set::find (const T &item) const -{ - ACE_TRACE ("ACE_Fixed_Set::find"); - - for (size_t i = 0, j = 0; i < this->max_size_ && j < this->cur_size_; ++i) - if (this->search_structure_[i].is_free_ == 0) - { - if (this->search_structure_[i].item_ == item) - return 0; - ++j; - } - - return -1; -} - -template int -ACE_Fixed_Set::insert (const T &item) -{ - ACE_TRACE ("ACE_Fixed_Set::insert"); - ssize_t first_free = -1; // Keep track of first free slot. - size_t i; - - for (i = 0; - i < this->max_size_ && first_free == -1; - ++i) - - // First, make sure we don't allow duplicates. - - if (this->search_structure_[i].is_free_ == 0) - { - if (this->search_structure_[i].item_ == item) - return 1; - } - else - first_free = static_cast (i); - - // If we found a free spot let's reuse it. - - if (first_free > -1) - { - this->search_structure_[first_free].item_ = item; - this->search_structure_[first_free].is_free_ = 0; - this->cur_size_++; - return 0; - } - else /* No more room! */ - { - errno = ENOMEM; - return -1; - } -} - -template int -ACE_Fixed_Set::remove (const T &item) -{ - ACE_TRACE ("ACE_Fixed_Set::remove"); - - for (size_t i = 0, j = 0; - i < this->max_size_ && j < this->cur_size_; - ++i) - if (this->search_structure_[i].is_free_ == 0) - { - if (this->search_structure_[i].item_ == item) - { - // Mark this entry as being free. - this->search_structure_[i].is_free_ = 1; - - --this->cur_size_; - return 0; - } - else - ++j; - } - - return -1; -} - -//-------------------------------------------------- -ACE_ALLOC_HOOK_DEFINE(ACE_Fixed_Set_Iterator_Base) - -template void -ACE_Fixed_Set_Iterator_Base::dump_i (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Fixed_Set_Iterator_Base::dump_i"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Fixed_Set_Iterator_Base::ACE_Fixed_Set_Iterator_Base (ACE_Fixed_Set &s) - : s_ (s), - next_ (-1), - iterated_items_ (0) -{ - ACE_TRACE ("ACE_Fixed_Set_Iterator_Base::ACE_Fixed_Set_Iterator_Base"); - this->advance (); -} - -template int -ACE_Fixed_Set_Iterator_Base::advance (void) -{ - ACE_TRACE ("ACE_Fixed_Set_Iterator_Base::advance"); - - if (this->iterated_items_ < this->s_.cur_size_) - { - for (++this->next_; - static_cast (this->next_) < this->s_.max_size_; - ++this->next_) - if (this->s_.search_structure_[this->next_].is_free_ == 0) - { - ++this->iterated_items_; - return 1; - } - } - else - ++this->next_; - - return 0; -} - -template int -ACE_Fixed_Set_Iterator_Base::first (void) -{ - ACE_TRACE ("ACE_Fixed_Set_Iterator_Base::first"); - - next_ = -1; - iterated_items_ = 0; - return this->advance (); -} - -template int -ACE_Fixed_Set_Iterator_Base::done (void) const -{ - ACE_TRACE ("ACE_Fixed_Set_Iterator_Base::done"); - - return ! (this->iterated_items_ < this->s_.cur_size_); -} - -template int -ACE_Fixed_Set_Iterator_Base::next_i (T *&item) -{ - ACE_TRACE ("ACE_Fixed_Set_Iterator_Base::next_i"); - - if (static_cast (this->next_) < this->s_.max_size_) - do - { - if (this->s_.search_structure_[this->next_].is_free_ == 0) - { - item = &this->s_.search_structure_[this->next_].item_; - this->advance (); - return 1; - } - } - while (this->advance () == 1); - - return 0; -} - -//-------------------------------------------------- -ACE_ALLOC_HOOK_DEFINE(ACE_Fixed_Set_Iterator) - -template void -ACE_Fixed_Set_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - this->dump_i (); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Fixed_Set_Iterator::ACE_Fixed_Set_Iterator (ACE_Fixed_Set &s) - : ACE_Fixed_Set_Iterator_Base (s) -{ - ACE_TRACE ("ACE_Fixed_Set_Iterator::ACE_Fixed_Set_Iterator"); -} - -template int -ACE_Fixed_Set_Iterator::next (T *&item) -{ - ACE_TRACE ("ACE_Fixed_Set_Iterator::next"); - return this->next_i (item); -} - -template int -ACE_Fixed_Set_Iterator::remove (T *&item) -{ - ACE_TRACE ("ACE_Fixed_Set_Iterator::remove"); - - if (this->s_.search_structure_[this->next_].is_free_ == 0) - { - item = &this->s_.search_structure_[this->next_].item_; - this->s_.remove (*item); - --(this->iterated_items_); - return 1; - } - - return 0; -} - -template T& -ACE_Fixed_Set_Iterator::operator* (void) -{ - T *retv = 0; - - if (this->s_.search_structure_[this->next_].is_free_ == 0) - retv = &this->s_.search_structure_[this->next_].item_; - - ACE_ASSERT (retv != 0); - - return *retv; -} - -//-------------------------------------------------- -ACE_ALLOC_HOOK_DEFINE(ACE_Fixed_Set_Const_Iterator) - -template void -ACE_Fixed_Set_Const_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - this->dump_i (); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Fixed_Set_Const_Iterator::ACE_Fixed_Set_Const_Iterator (const ACE_Fixed_Set &s) - : ACE_Fixed_Set_Iterator_Base (s) -{ - ACE_TRACE ("ACE_Fixed_Set_Const_Iterator::ACE_Fixed_Set_Const_Iterator"); -} - -template int -ACE_Fixed_Set_Const_Iterator::next (const T *&item) -{ - ACE_TRACE ("ACE_Fixed_Set_Const_Iterator::next"); - - return this->next_i (item); -} - -template const T& -ACE_Fixed_Set_Const_Iterator::operator* (void) const -{ - const T *retv = 0; - - if (this->s_.search_structure_[this->next_].is_free_ == 0) - retv = &this->s_.search_structure_[this->next_].item_; - - ACE_ASSERT (retv != 0); - - return *retv; -} - -//-------------------------------------------------- -ACE_ALLOC_HOOK_DEFINE(ACE_Bounded_Set) - -template void -ACE_Bounded_Set::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Bounded_Set::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Bounded_Set::~ACE_Bounded_Set (void) -{ - ACE_TRACE ("ACE_Bounded_Set::~ACE_Bounded_Set"); - delete [] this->search_structure_; -} - -template -ACE_Bounded_Set::ACE_Bounded_Set (void) - : cur_size_ (0), - max_size_ (static_cast (ACE_Bounded_Set::DEFAULT_SIZE)) -{ - ACE_TRACE ("ACE_Bounded_Set::ACE_Bounded_Set"); - - ACE_NEW (this->search_structure_, - typename ACE_Bounded_Set::Search_Structure[this->max_size_]); - - for (size_t i = 0; i < this->max_size_; ++i) - this->search_structure_[i].is_free_ = 1; -} - -template size_t -ACE_Bounded_Set::size (void) const -{ - ACE_TRACE ("ACE_Bounded_Set::size"); - return this->cur_size_; -} - -template -ACE_Bounded_Set::ACE_Bounded_Set (const ACE_Bounded_Set &bs) - : cur_size_ (bs.cur_size_), - max_size_ (bs.max_size_) -{ - ACE_TRACE ("ACE_Bounded_Set::ACE_Bounded_Set"); - - ACE_NEW (this->search_structure_, - typename ACE_Bounded_Set::Search_Structure[this->max_size_]); - - for (size_t i = 0; i < this->cur_size_; i++) - this->search_structure_[i] = bs.search_structure_[i]; -} - -template void -ACE_Bounded_Set::operator= (const ACE_Bounded_Set &bs) -{ - ACE_TRACE ("ACE_Bounded_Set::operator="); - - if (this != &bs) - { - if (this->max_size_ < bs.cur_size_) - { - delete [] this->search_structure_; - ACE_NEW (this->search_structure_, - typename ACE_Bounded_Set::Search_Structure[bs.cur_size_]); - this->max_size_ = bs.cur_size_; - } - - this->cur_size_ = bs.cur_size_; - - for (size_t i = 0; i < this->cur_size_; i++) - this->search_structure_[i] = bs.search_structure_[i]; - } -} - -template -ACE_Bounded_Set::ACE_Bounded_Set (size_t size) - : cur_size_ (0), - max_size_ (size) -{ - ACE_TRACE ("ACE_Bounded_Set::ACE_Bounded_Set"); - ACE_NEW (this->search_structure_, - typename ACE_Bounded_Set::Search_Structure[size]); - - for (size_t i = 0; i < this->max_size_; i++) - this->search_structure_[i].is_free_ = 1; -} - -template int -ACE_Bounded_Set::find (const T &item) const -{ - ACE_TRACE ("ACE_Bounded_Set::find"); - - for (size_t i = 0; i < this->cur_size_; i++) - if (this->search_structure_[i].item_ == item - && this->search_structure_[i].is_free_ == 0) - return 0; - - return -1; -} - -template int -ACE_Bounded_Set::insert (const T &item) -{ - ACE_TRACE ("ACE_Bounded_Set::insert"); - int first_free = -1; // Keep track of first free slot. - size_t i; - - for (i = 0; i < this->cur_size_; i++) - // First, make sure we don't allow duplicates. - - if (this->search_structure_[i].item_ == item - && this->search_structure_[i].is_free_ == 0) - return 1; - else if (this->search_structure_[i].is_free_ && first_free == -1) - first_free = static_cast (i); - - if (first_free > -1) // If we found a free spot let's reuse it. - { - this->search_structure_[first_free].item_ = item; - this->search_structure_[first_free].is_free_ = 0; - return 0; - } - else if (i < this->max_size_) // Insert at the end of the active portion. - { - this->search_structure_[i].item_ = item; - this->search_structure_[i].is_free_ = 0; - this->cur_size_++; - return 0; - } - else /* No more room! */ - { - errno = ENOMEM; - return -1; - } -} - -template int -ACE_Bounded_Set::remove (const T &item) -{ - ACE_TRACE ("ACE_Bounded_Set::remove"); - for (size_t i = 0; i < this->cur_size_; i++) - if (this->search_structure_[i].item_ == item) - { - // Mark this entry as being free. - this->search_structure_[i].is_free_ = 1; - - // If we just unbound the highest entry, then we need to - // figure out where the next highest active entry is. - if (i + 1 == this->cur_size_) - { - while (i > 0 && this->search_structure_[--i].is_free_) - continue; - - if (i == 0 && this->search_structure_[i].is_free_) - this->cur_size_ = 0; - else - this->cur_size_ = i + 1; - } - return 0; - } - - return -1; -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Bounded_Set_Iterator) - - template void -ACE_Bounded_Set_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Bounded_Set_Iterator::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Bounded_Set_Iterator::ACE_Bounded_Set_Iterator (ACE_Bounded_Set &s) - : s_ (s), - next_ (-1) -{ - ACE_TRACE ("ACE_Bounded_Set_Iterator::ACE_Bounded_Set_Iterator"); - this->advance (); -} - -template int -ACE_Bounded_Set_Iterator::advance (void) -{ - ACE_TRACE ("ACE_Bounded_Set_Iterator::advance"); - - for (++this->next_; - static_cast (this->next_) < this->s_.cur_size_ - && this->s_.search_structure_[this->next_].is_free_; - ++this->next_) - continue; - - return static_cast (this->next_) < this->s_.cur_size_; -} - -template int -ACE_Bounded_Set_Iterator::first (void) -{ - ACE_TRACE ("ACE_Bounded_Set_Iterator::first"); - - next_ = -1; - return this->advance (); -} - -template int -ACE_Bounded_Set_Iterator::done (void) const -{ - ACE_TRACE ("ACE_Bounded_Set_Iterator::done"); - - return static_cast (this->next_) >= - this->s_.cur_size_; -} - -template int -ACE_Bounded_Set_Iterator::next (T *&item) -{ - ACE_TRACE ("ACE_Bounded_Set_Iterator::next"); - if (static_cast (this->next_) < this->s_.cur_size_) - { - item = &this->s_.search_structure_[this->next_].item_; - return 1; - } - else - return 0; -} - -ACE_ALLOC_HOOK_DEFINE(ACE_DNode) - - template -ACE_DNode::ACE_DNode (const T &i, ACE_DNode *n, ACE_DNode *p) - : next_ (n), prev_ (p), item_ (i) -{ -} - -template -ACE_DNode::~ACE_DNode (void) -{ -} - -// **************************************************************** - -template void -ACE_Unbounded_Stack_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - // ACE_TRACE ("ACE_Unbounded_Stack_Iterator::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Unbounded_Stack_Iterator::ACE_Unbounded_Stack_Iterator (ACE_Unbounded_Stack &q) - : current_ (q.head_->next_), - stack_ (q) -{ - // ACE_TRACE ("ACE_Unbounded_Stack_Iterator::ACE_Unbounded_Stack_Iterator"); -} - -template int -ACE_Unbounded_Stack_Iterator::advance (void) -{ - // ACE_TRACE ("ACE_Unbounded_Stack_Iterator::advance"); - this->current_ = this->current_->next_; - return this->current_ != this->stack_.head_; -} - -template int -ACE_Unbounded_Stack_Iterator::first (void) -{ - // ACE_TRACE ("ACE_Unbounded_Stack_Iterator::first"); - this->current_ = this->stack_.head_->next_; - return this->current_ != this->stack_.head_; -} - -template int -ACE_Unbounded_Stack_Iterator::done (void) const -{ - ACE_TRACE ("ACE_Unbounded_Stack_Iterator::done"); - - return this->current_ == this->stack_.head_; -} - -template int -ACE_Unbounded_Stack_Iterator::next (T *&item) -{ - // ACE_TRACE ("ACE_Unbounded_Stack_Iterator::next"); - if (this->current_ == this->stack_.head_) - return 0; - else - { - item = &this->current_->item_; - return 1; - } -} - - -ACE_ALLOC_HOOK_DEFINE(ACE_Ordered_MultiSet) - - - template -ACE_Ordered_MultiSet::ACE_Ordered_MultiSet (ACE_Allocator *alloc) - : head_ (0) - , tail_ (0) - , cur_size_ (0) - , allocator_ (alloc) -{ - // ACE_TRACE ("ACE_Ordered_MultiSet::ACE_Ordered_MultiSet"); - - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); -} - -template -ACE_Ordered_MultiSet::ACE_Ordered_MultiSet (const ACE_Ordered_MultiSet &us) - : head_ (0) - , tail_ (0) - , cur_size_ (0) - , allocator_ (us.allocator_) -{ - ACE_TRACE ("ACE_Ordered_MultiSet::ACE_Ordered_MultiSet"); - - if (this->allocator_ == 0) - this->allocator_ = ACE_Allocator::instance (); - - this->copy_nodes (us); -} - -template -ACE_Ordered_MultiSet::~ACE_Ordered_MultiSet (void) -{ - // ACE_TRACE ("ACE_Ordered_MultiSet::~ACE_Ordered_MultiSet"); - - this->delete_nodes (); -} - - -template void -ACE_Ordered_MultiSet::operator= (const ACE_Ordered_MultiSet &us) -{ - ACE_TRACE ("ACE_Ordered_MultiSet::operator="); - - if (this != &us) - { - this->delete_nodes (); - this->copy_nodes (us); - } -} - - -template int -ACE_Ordered_MultiSet::insert (const T &item) -{ - // ACE_TRACE ("ACE_Ordered_MultiSet::insert"); - - return this->insert_from (item, this->head_, 0); -} - -template int -ACE_Ordered_MultiSet::insert (const T &new_item, - ITERATOR &iter) -{ - // ACE_TRACE ("ACE_Ordered_MultiSet::insert using iterator"); - - return this->insert_from (new_item, iter.current_, &iter.current_); -} - -template int -ACE_Ordered_MultiSet::remove (const T &item) -{ - // ACE_TRACE ("ACE_Ordered_MultiSet::remove"); - - ACE_DNode *node = 0; - - int result = locate (item, 0, node); - - // if we found the node, remove from list and free it - if (node && (result == 0)) - { - if (node->prev_) - node->prev_->next_ = node->next_; - else - head_ = node->next_; - - if (node->next_) - node->next_->prev_ = node->prev_; - else - tail_ = node->prev_; - - --this->cur_size_; - - ACE_DES_FREE_TEMPLATE (node, - this->allocator_->free, - ACE_DNode, - ); - return 0; - } - - return -1; -} - -template int -ACE_Ordered_MultiSet::find (const T &item, - ITERATOR &iter) const -{ - // search an occurrence of item, using iterator's current position as a hint - ACE_DNode *node = iter.current_; - int const result = locate (item, node, node); - - // if we found the node, update the iterator and indicate success - if (node && (result == 0)) - { - iter.current_ = node; - return 0; - } - - return -1; -} - - - -template void -ACE_Ordered_MultiSet::reset (void) -{ - ACE_TRACE ("reset"); - - this->delete_nodes (); -} - -template void -ACE_Ordered_MultiSet::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - // ACE_TRACE ("ACE_Ordered_MultiSet::dump"); - // - // ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nhead_ = %u"), this->head_)); - // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nhead_->next_ = %u"), this->head_->next_)); - // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ncur_size_ = %d\n"), this->cur_size_)); - // - // T *item = 0; - // size_t count = 1; - // - // for (ACE_Ordered_MultiSet_Iterator iter (*(ACE_Ordered_MultiSet *) this); - // iter.next (item) != 0; - // iter.advance ()) - // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("count = %d\n"), count++)); - // - // ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template int -ACE_Ordered_MultiSet::insert_from (const T &item, ACE_DNode *position, - ACE_DNode **new_position) -{ - // ACE_TRACE ("ACE_Ordered_MultiSet::insert_from"); - - // create a new node - ACE_DNode *temp = 0; - ACE_NEW_MALLOC_RETURN (temp, - static_cast*> (this->allocator_->malloc (sizeof (ACE_DNode))), - ACE_DNode (item), - -1); - // obtain approximate location of the node - int result = locate (item, position, position); - - // if there are nodes in the multiset - if (position) - { - switch (result) - { - // insert after the approximate position - case -1: - - // if there is a following node - if (position->next_) - { - // link up with the following node - position->next_->prev_ = temp; - temp->next_ = position->next_; - } - else - // appending to the end of the set - tail_ = temp; - - // link up with the preceeding node - temp->prev_ = position; - position->next_ = temp; - - break; - - // insert before the position - case 0: - case 1: - - // if there is a preceeding node - if (position->prev_) - { - // link up with the preceeding node - position->prev_->next_ = temp; - temp->prev_ = position->prev_; - } - else - // prepending to the start of the set - head_ = temp; - - // link up with the preceeding node - temp->next_ = position; - position->prev_ = temp; - - break; - - default: - return -1; - } - } - else - { - // point the head and tail to the new node. - this->head_ = temp; - this->tail_ = temp; - } - - ++this->cur_size_; - if (new_position) - *new_position = temp; - - return 0; -} - -template int -ACE_Ordered_MultiSet::locate (const T &item, ACE_DNode *start_position, - ACE_DNode *&new_position) const -{ - if (! start_position) - start_position = this->head_; - - // If starting before the item, move forward until at or just before - // item. - while (start_position && start_position->item_ < item && - start_position->next_) - start_position = start_position->next_; - - // If starting after the item, move back until at or just after item - while (start_position && item < start_position->item_ && - start_position->prev_) - start_position = start_position->prev_; - - // Save the (approximate) location in the passed pointer. - new_position = start_position; - - // Show the location is after (1), before (-1) , or at (0) the item - if (!new_position) - return 1; - else if (item < new_position->item_) - return 1; - else if (new_position->item_ < item) - return -1; - else - return 0; -} - -// Looks for first occurrence of in the ordered set, using the -// passed starting position as a hint: if there is such an instance, -// it updates the new_position pointer to point to one such node and -// returns 0; if there is no such node, then if there is a node before -// where the item would have been, it updates the new_position pointer -// to point to this node and returns -1; if there is no such node, -// then if there is a node after where the item would have been, it -// updates the new_position pointer to point to this node (or 0 if -// there is no such node) and returns 1; - -template void -ACE_Ordered_MultiSet::copy_nodes (const ACE_Ordered_MultiSet &us) -{ - ACE_DNode *insertion_point = this->head_; - - for (ACE_DNode *curr = us.head_; - curr != 0; - curr = curr->next_) - this->insert_from (curr->item_, insertion_point, &insertion_point); -} - -template void -ACE_Ordered_MultiSet::delete_nodes (void) -{ - // iterate through list, deleting nodes - for (ACE_DNode *curr = this->head_; - curr != 0; - ) - { - ACE_DNode *temp = curr; - curr = curr->next_; - ACE_DES_FREE_TEMPLATE (temp, - this->allocator_->free, - ACE_DNode, - ); - } - - this->head_ = 0; - this->tail_ = 0; - this->cur_size_ = 0; -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Ordered_MultiSet_Iterator) - -template -ACE_Ordered_MultiSet_Iterator::ACE_Ordered_MultiSet_Iterator (ACE_Ordered_MultiSet &s) - : current_ (s.head_), - set_ (s) -{ - // ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::ACE_Ordered_MultiSet_Iterator"); -} - -template int -ACE_Ordered_MultiSet_Iterator::next (T *&item) const -{ - // ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::next"); - if (this->current_) - { - item = &this->current_->item_; - return 1; - } - - return 0; -} - -template T& -ACE_Ordered_MultiSet_Iterator::operator* (void) -{ - //ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::operator*"); - T *retv = 0; - - int const result = this->next (retv); - ACE_ASSERT (result != 0); - ACE_UNUSED_ARG (result); - - return *retv; -} - -ACE_ALLOC_HOOK_DEFINE (ACE_DLList_Node) - -template T * -ACE_DLList::insert_tail (T *new_item) -{ - ACE_DLList_Node *temp1 = 0; - ACE_NEW_MALLOC_RETURN (temp1, - static_cast (this->allocator_->malloc (sizeof (ACE_DLList_Node))), - ACE_DLList_Node (new_item), - 0); - ACE_DLList_Node *temp2 = ACE_DLList_Base::insert_tail (temp1); - return (T *) (temp2 ? temp2->item_ : 0); -} - -template T * -ACE_DLList::insert_head (T *new_item) -{ - ACE_DLList_Node *temp1 = 0; - ACE_NEW_MALLOC_RETURN (temp1, - (ACE_DLList_Node *) this->allocator_->malloc (sizeof (ACE_DLList_Node)), - ACE_DLList_Node (new_item), 0); - ACE_DLList_Node *temp2 = ACE_DLList_Base::insert_head (temp1); - return (T *) (temp2 ? temp2->item_ : 0); -} - -template T * -ACE_DLList::delete_head (void) -{ - ACE_DLList_Node *temp1 = ACE_DLList_Base::delete_head (); - T *temp2 = (T *) (temp1 ? temp1->item_ : 0); - ACE_DES_FREE (temp1, - this->allocator_->free, - ACE_DLList_Node); - - return temp2; -} - -template T * -ACE_DLList::delete_tail (void) -{ - ACE_DLList_Node *temp1 = ACE_DLList_Base::delete_tail (); - T *temp2 = (T *) (temp1 ? temp1->item_ : 0); - ACE_DES_FREE (temp1, - this->allocator_->free, - ACE_DLList_Node); - return temp2; -} - -// **************************************************************** - -// Compare this array with for equality. - -template bool -ACE_Array::operator== (const ACE_Array &s) const -{ - if (this == &s) - return true; - else if (this->size () != s.size ()) - return false; - - const size_t len = s.size (); - for (size_t slot = 0; slot < len; ++slot) - if ((*this)[slot] != s[slot]) - return false; - - return true; -} - -// **************************************************************** - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_CONTAINERS_T_CPP */ diff --git a/dep/acelite/ace/Containers_T.h b/dep/acelite/ace/Containers_T.h deleted file mode 100644 index 6e6c5bd34a0..00000000000 --- a/dep/acelite/ace/Containers_T.h +++ /dev/null @@ -1,2068 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Containers_T.h - * - * $Id: Containers_T.h 91995 2010-09-24 12:45:24Z johnnyw $ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_CONTAINERS_T_H -#define ACE_CONTAINERS_T_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// Need by ACE_DLList_Node. -#include "ace/Containers.h" - -// Shared with "ace/Unbounded_Set.h" -#include "ace/Node.h" - -// Backwards compatibility, please include "ace/Array_Base.h" directly. -#include "ace/Array_Base.h" - -// Backwards compatibility, please include "ace/Unbounded_Set.h" directly. -#include "ace/Unbounded_Set.h" - -// Backwards compatibility, please include "ace/Unbounded_Queue.h" directly. -#include "ace/Unbounded_Queue.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Allocator; - - -/** - * @class ACE_Bounded_Stack - * - * @brief Implement a generic LIFO abstract data type. - * - * This implementation of a Stack uses a bounded array - * that is allocated dynamically. The Stack interface - * provides the standard constant time push, pop, and top - * operations. - * - * Requirements and Performance Characteristics - * - Internal Structure - * Dynamic array - * - Duplicates allowed? - * Yes - * - Random access allowed? - * No - * - Search speed - * N/A - * - Insert/replace speed - * N/A - * - Iterator still valid after change to container? - * N/A - * - Frees memory for removed elements? - * No - * - Items inserted by - * Value - * - Requirements for contained type - * -# Default constructor - * -# Copy constructor - * -# operator= - * - */ -template -class ACE_Bounded_Stack -{ -public: - // = Initialization, assignment, and termination methods. - - /// Initialize a new empty stack with the provided size.. - /** - * Initialize and allocate space for a new Bounded_Stack with the provided - * size. - */ - ACE_Bounded_Stack (size_t size); - - /// Initialize the stack to be a copy of the stack provided. - /** - * Initialize the stack to be an exact copy of the Bounded_Stack provided - * as a parameter. - */ - ACE_Bounded_Stack (const ACE_Bounded_Stack &s); - - /// Assignment operator - /** - * Perform a deep copy operation using the Bounded_Stack parameter. If the - * capacity of the lhs isn't sufficient for the rhs, then the underlying data - * structure will be reallocated to accomadate the larger number of elements. - */ - void operator= (const ACE_Bounded_Stack &s); - - /// Perform actions needed when stack goes out of scope. - /** - * Deallocate the memory used by the Bounded_Stack. - */ - ~ACE_Bounded_Stack (void); - - // = Classic Stack operations. - - ///Add an element to the top of the stack. - /** - * Place a new item on top of the stack. Returns -1 if the stack - * is already full, 0 if the stack is not already full, and -1 if - * failure occurs. - */ - int push (const T &new_item); - - ///Remove an item from the top of stack. - /** - * Remove and return the top stack item. Returns -1 if the stack is - * already empty, 0 if the stack is not already empty, and -1 if - * failure occurs. - */ - int pop (T &item); - - ///Examine the contents of the top of stack. - /** - * Return top stack item without removing it. Returns -1 if the - * stack is already empty, 0 if the stack is not already empty, and - * -1 if failure occurs. - */ - int top (T &item) const; - - // = Check boundary conditions. - - /// Returns 1 if the container is empty, otherwise returns 0. - /** - * Performs constant time check to determine if the stack is empty. - */ - int is_empty (void) const; - - /// Returns 1 if the container is full, otherwise returns 0. - /** - * Performs constant time check to determine if the stack is at capacity. - */ - int is_full (void) const; - - /// The number of items in the stack. - /** - * Return the number of items currently in the stack. - */ - size_t size (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Size of the dynamically allocated data. - size_t size_; - - /// Keeps track of the current top of stack. - size_t top_; - - /// Holds the stack's contents. - T *stack_; -}; - -//---------------------------------------- - - -/** - * @class ACE_Fixed_Stack - * - * @brief Implement a generic LIFO abstract data type. - * - * This implementation of a Stack uses a fixed array - * with the size fixed at instantiation time. - * - * Requirements and Performance Characteristics - * - Internal Structure - * Fixed array - * - Duplicates allowed? - * Yes - * - Random access allowed? - * No - * - Search speed - * N/A - * - Insert/replace speed - * N/A - * - Iterator still valid after change to container? - * N/A - * - Frees memory for removed elements? - * No - * - Items inserted by - * Value - * - Requirements for contained type - * -# Default constructor - * -# Copy constructor - * -# operator= - * - */ -template -class ACE_Fixed_Stack -{ -public: - // = Initialization, assignment, and termination methods. - /// Initialize a new stack so that it is empty. - /** - * Initialize an empty stack. - */ - ACE_Fixed_Stack (void); - - /// The copy constructor (performs initialization). - /** - * Initialize the stack and copy the provided stack into the current stack. - */ - ACE_Fixed_Stack (const ACE_Fixed_Stack &s); - - /// Assignment operator (performs assignment). - /** - * Perform a deep copy of the provided stack. - */ - void operator= (const ACE_Fixed_Stack &s); - - /// Perform actions needed when stack goes out of scope. - /** - * Destroy the stack. - */ - ~ACE_Fixed_Stack (void); - - // = Classic Stack operations. - - ///Constant time placement of element on top of stack. - /** - * Place a new item on top of the stack. Returns -1 if the stack - * is already full, 0 if the stack is not already full, and -1 if - * failure occurs. - */ - int push (const T &new_item); - - ///Constant time removal of top of stack. - /** - * Remove and return the top stack item. Returns -1 if the stack is - * already empty, 0 if the stack is not already empty, and -1 if - * failure occurs. - */ - int pop (T &item); - - ///Constant time examination of top of stack. - /** - * Return top stack item without removing it. Returns -1 if the - * stack is already empty, 0 if the stack is not already empty, and - * -1 if failure occurs. - */ - int top (T &item) const; - - // = Check boundary conditions. - - /// Returns 1 if the container is empty, otherwise returns 0. - /** - * Performs constant time check to see if stack is empty. - */ - int is_empty (void) const; - - /// Returns 1 if the container is full, otherwise returns 0. - /** - * Performs constant time check to see if stack is full. - */ - int is_full (void) const; - - /// The number of items in the stack. - /** - * Constant time access to the current size of the stack. - */ - size_t size (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Size of the allocated data. - size_t size_; - - /// Keeps track of the current top of stack. - size_t top_; - - /// Holds the stack's contents. - T stack_[ACE_SIZE]; -}; - -//---------------------------------------- - -template class ACE_Ordered_MultiSet; -template class ACE_Ordered_MultiSet_Iterator; - -/** - * @class ACE_DNode - * - * @brief Implementation element in a bilinked list. - */ -template -class ACE_DNode -{ - friend class ACE_Ordered_MultiSet; - friend class ACE_Ordered_MultiSet_Iterator; - -public: - - /// This isn't necessary, but it keeps some compilers happy. - ~ACE_DNode (void); - -private: - - // = Initialization methods - ACE_DNode (const T &i, ACE_DNode *n = 0, ACE_DNode *p = 0); - - /// Pointer to next element in the list of {ACE_DNode}s. - ACE_DNode *next_; - - /// Pointer to previous element in the list of {ACE_DNode}s. - ACE_DNode *prev_; - - /// Current value of the item in this node. - T item_; -}; - - - -/** - * @class ACE_Unbounded_Stack - * - * @brief Implement a generic LIFO abstract data type. - * - * This implementation of an unbounded Stack uses a linked list. - * If you use the {insert} or {remove} methods you should keep - * in mind that duplicate entries aren't allowed. In general, - * therefore, you should avoid the use of these methods since - * they aren't really part of the ADT stack. The stack is implemented - * as a doubly linked list. - * - * Requirements and Performance Characteristics - * - Internal Structure - * Double linked list - * - Duplicates allowed? - * No - * - Random access allowed? - * No - * - Search speed - * Linear - * - Insert/replace speed - * Linear - * - Iterator still valid after change to container? - * Yes - * - Frees memory for removed elements? - * Yes - * - Items inserted by - * Value - * - Requirements for contained type - * -# Default constructor - * -# Copy constructor - * -# operator= - * - */ -template -class ACE_Unbounded_Stack -{ -public: - friend class ACE_Unbounded_Stack_Iterator; - - // Trait definition. - typedef ACE_Unbounded_Stack_Iterator ITERATOR; - - // = Initialization, assignment, and termination methods. - /// Initialize a new stack so that it is empty. Use user defined - /// allocation strategy if specified. - /** - * Initialize an empty stack using the user specified allocation strategy - * if provided. - */ - ACE_Unbounded_Stack (ACE_Allocator *the_allocator = 0); - - /// The copy constructor (performs initialization). - /** - * Initialize this stack to be an exact copy of {s}. - */ - ACE_Unbounded_Stack (const ACE_Unbounded_Stack &s); - - /// Assignment operator (performs assignment). - /** - * Perform a deep copy of the rhs into the lhs. - */ - void operator= (const ACE_Unbounded_Stack &s); - - /// Perform actions needed when stack goes out of scope. - /** - * Destroy the underlying list for the stack. - */ - ~ACE_Unbounded_Stack (void); - - // = Classic Stack operations. - - - ///Push an element onto the top of stack. - /** - * Place a new item on top of the stack. Returns -1 if the stack - * is already full, 0 if the stack is not already full, and -1 if - * failure occurs. - */ - int push (const T &new_item); - - ///Pop the top element of the stack. - /** - * Remove and return the top stack item. Returns -1 if the stack is - * already empty, 0 if the stack is not already empty, and -1 if - * failure occurs. - */ - int pop (T &item); - - ///Examine the top of the stack. - /** - * Return top stack item without removing it. Returns -1 if the - * stack is already empty, 0 if the stack is not already empty, and - * -1 if failure occurs. - */ - int top (T &item) const; - - // = Check boundary conditions. - - /// Returns 1 if the container is empty, otherwise returns 0. - /** - * Constant time check to see if the stack is empty. - */ - int is_empty (void) const; - - /// Returns 1 if the container is full, otherwise returns 0. - /** - * Always resturns 0 since the stack is unbounded. - */ - int is_full (void) const; - - // = Auxiliary methods (not strictly part of the Stack ADT). - - ///Linear Insert of an item. - /** - * Insert {new_item} into the Stack at the head (but doesn't allow - * duplicates). Returns -1 if failures occur, 1 if item is already - * present (i.e., no duplicates are allowed), else 0. - */ - int insert (const T &new_item); - - /// Remove @a item from the Stack. Returns 0 if it removes the item, - /// -1 if it can't find the item, and -1 if a failure occurs. - /** - * Linear remove operation. - */ - int remove (const T &item); - - /// Finds if @a item occurs the set. Returns 0 if finds, else -1. - /** - * Linear find operation. - */ - int find (const T &item) const; - - /// The number of items in the stack. - /** - * Constant time access to the current stack size. - */ - size_t size (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Delete all the nodes in the stack. - void delete_all_nodes (void); - - /// Copy all nodes from {s} to {this}. - void copy_all_nodes (const ACE_Unbounded_Stack &s); - - /// Head of the linked list of Nodes. - ACE_Node *head_; - - /// Current size of the stack. - size_t cur_size_; - - /// Allocation strategy of the stack. - ACE_Allocator *allocator_; -}; - -/** - * @class ACE_Unbounded_Stack_Iterator - * - * @brief Implement an iterator over an unbounded Stack. - */ -template -class ACE_Unbounded_Stack_Iterator -{ -public: - // = Initialization method. - /// Move to the first element in the {stack}. - ACE_Unbounded_Stack_Iterator (ACE_Unbounded_Stack &stack); - - // = Iteration methods. - - /// Pass back the @a next_item that hasn't been seen in the Stack. - /// Returns 0 when all items have been seen, else 1. - int next (T *&next_item); - - /// Move forward by one element in the Stack. Returns 0 when all the - /// items in the Stack have been seen, else 1. - int advance (void); - - /// Move to the first element in the Stack. Returns 0 if the - /// Stack is empty, else 1. - int first (void); - - /// Returns 1 when all items have been seen, else 0. - int done (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Pointer to the current node in the iteration. - ACE_Node *current_; - - /// Pointer to the Stack we're iterating over. - ACE_Unbounded_Stack &stack_; -}; - -template -class ACE_Double_Linked_List; - -/** - * @class ACE_Double_Linked_List_Iterator_Base - * - * @brief Implements a common base class for iterators for a double - * linked list ADT - */ -template -class ACE_Double_Linked_List_Iterator_Base -{ -public: - // = Iteration methods. - - /// Passes back the {entry} under the iterator. Returns 0 if the - /// iteration has completed, otherwise 1 - int next (T *&) const; - - /** - * @deprecated Return the address of next (current) unvisited item in - * the list. 0 if there is no more element available. - */ - T *next (void) const; - - /// Returns 1 when all items have been seen, else 0. - int done (void) const; - - /// STL-like iterator dereference operator: returns a reference - /// to the node underneath the iterator. - T & operator* (void) const ; - - /** - * Retasks the iterator to iterate over a new - * Double_Linked_List. This allows clients to reuse an iterator - * without incurring the constructor overhead. If you do use this, - * be aware that if there are more than one reference to this - * iterator, the other "clients" may be very bothered when their - * iterator changes. @@ Here be dragons. Comments? - */ - void reset (ACE_Double_Linked_List &); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - // = Initialization methods. - - /// Constructor - ACE_Double_Linked_List_Iterator_Base (const ACE_Double_Linked_List &); - - /// Copy constructor. - ACE_Double_Linked_List_Iterator_Base (const - ACE_Double_Linked_List_Iterator_Base - &iter); - - // = Iteration methods. - /** - * Move to the first element of the list. Returns 0 if the list is - * empty, else 1. - * @note the head of the ACE_DLList is actually a null entry, so the - * first element is actually the 2n'd entry - */ - int go_head (void); - - /// Move to the last element of the list. Returns 0 if the list is - /// empty, else 1. - int go_tail (void); - - /** - * Check if we reach the end of the list. Can also be used to get - * the *current* element in the list. Return the address of the - * current item if there are still elements left , 0 if we run out - * of element. - */ - T *not_done (void) const ; - - /// Advance to the next element in the list. Return the address of the - /// next element if there are more, 0 otherwise. - T *do_advance (void); - - /// Retreat to the previous element in the list. Return the address - /// of the previous element if there are more, 0 otherwise. - T *do_retreat (void); - - /// Dump the state of an object. - void dump_i (void) const; - - /// Remember where we are. - T *current_; - - const ACE_Double_Linked_List *dllist_; -}; - -/** - * @class ACE_Double_Linked_List_Iterator - * - * @brief Implements an iterator for a double linked list ADT - * - * Iterate thru the double-linked list. This class provides - * an interface that let users access the internal element - * addresses directly. Notice {class T} must declare - * ACE_Double_Linked_List<T>, - * ACE_Double_Linked_List_Iterator_Base <T> and - * ACE_Double_Linked_List_Iterator as friend classes and class T - * should also have data members T* next_ and T* prev_. - */ -template -class ACE_Double_Linked_List_Iterator : public ACE_Double_Linked_List_Iterator_Base -{ -public: - // = Initialization method. - ACE_Double_Linked_List_Iterator (const ACE_Double_Linked_List &); - - /** - * Retasks the iterator to iterate over a new - * Double_Linked_List. This allows clients to reuse an iterator - * without incurring the constructor overhead. If you do use this, - * be aware that if there are more than one reference to this - * iterator, the other "clients" may be very bothered when their - * iterator changes. - * @@ Here be dragons. Comments? - */ - void reset (ACE_Double_Linked_List &); - - /// Move to the first element in the list. Returns 0 if the - /// list is empty, else 1. - int first (void); - - /// Move forward by one element in the list. Returns 0 when all the - /// items in the list have been seen, else 1. - int advance (void); - - /** - * Advance the iterator while removing the original item from the - * list. Return a pointer points to the original (removed) item. - * If @a dont_remove equals false, this function behaves like {advance} - * but return 0 (NULL) instead. - */ - T* advance_and_remove (bool dont_remove); - - // = STL-style iteration methods - - /// Prefix advance. - ACE_Double_Linked_List_Iterator & operator++ (void); - - /// Postfix advance. - ACE_Double_Linked_List_Iterator operator++ (int); - - /// Prefix reverse. - ACE_Double_Linked_List_Iterator & operator-- (void); - - /// Postfix reverse. - ACE_Double_Linked_List_Iterator operator-- (int); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -/** - * @class ACE_Double_Linked_List_Reverse_Iterator - * - * @brief Implements a reverse iterator for a double linked list ADT - * - * Iterate backwards over the double-linked list. This class - * provide an interface that let users access the internal - * element addresses directly, which seems to break the - * encapsulation. Notice {class T} must declare - * ACE_Double_Linked_List<T>, - * ACE_Double_Linked_List_Iterator_Base <T> and - * ACE_Double_Linked_List_Iterator as friend classes and class T - * should also have data members T* next_ and T* prev_. - */ -template -class ACE_Double_Linked_List_Reverse_Iterator : public ACE_Double_Linked_List_Iterator_Base -{ -public: - // = Initialization method. - ACE_Double_Linked_List_Reverse_Iterator (ACE_Double_Linked_List &); - - /** - * Retasks the iterator to iterate over a new - * Double_Linked_List. This allows clients to reuse an iterator - * without incurring the constructor overhead. If you do use this, - * be aware that if there are more than one reference to this - * iterator, the other "clients" may be very bothered when their - * iterator changes. - * @@ Here be dragons. Comments? - */ - void reset (ACE_Double_Linked_List &); - - /// Move to the first element in the list. Returns 0 if the - /// list is empty, else 1. - int first (void); - - /// Move forward by one element in the list. Returns 0 when all the - /// items in the list have been seen, else 1. - int advance (void); - - /** - * Advance the iterator while removing the original item from the - * list. Return a pointer points to the original (removed) item. - * If @a dont_remove equals false, this function behaves like {advance} - * but return 0 (NULL) instead. - */ - T* advance_and_remove (bool dont_remove); - - // = STL-style iteration methods - - /// Prefix advance. - ACE_Double_Linked_List_Reverse_Iterator & operator++ (void); - - /// Postfix advance. - ACE_Double_Linked_List_Reverse_Iterator operator++ (int); - - /// Prefix reverse. - ACE_Double_Linked_List_Reverse_Iterator & operator-- (void); - - /// Postfix reverse. - ACE_Double_Linked_List_Reverse_Iterator operator-- (int); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - - -/** - * @class ACE_Double_Linked_List - * - * @brief A double-linked list implementation. - * - * This implementation of an unbounded double-linked list uses a - * circular linked list with a dummy node. It is pretty much - * like the {ACE_Unbounded_Queue} except that it allows removing - * of a specific element from a specific location. - * Notice that this class is an implementation of a very simple - * data structure. This is *NOT* a container class. You can use the - * class to implement other contains classes but it is *NOT* a - * general purpose container class. - * The parameter class *MUST* have members T* prev and T* next - * and users of this class are responsible to follow the general - * rules of using double-linked lists to maintaining the list - * integrity. - * If you need a double linked container class, use the DLList - * class which is a container but delegates to the Double_Linked_List - * class. - * - * Requirements and Performance Characteristics - * - Internal Structure - * Double Linked List - * - Duplicates allowed? - * Yes - * - Random access allowed? - * No - * - Search speed - * N/A - * - Insert/replace speed - * Linear - * - Iterator still valid after change to container? - * Yes - * - Frees memory for removed elements? - * No - * - Items inserted by - * Value - * - Requirements for contained type - * -# Default constructor - * -# Copy constructor - * -# operator= - * - */ -template -class ACE_Double_Linked_List -{ -public: - friend class ACE_Double_Linked_List_Iterator_Base; - friend class ACE_Double_Linked_List_Iterator; - friend class ACE_Double_Linked_List_Reverse_Iterator; - - // Trait definition. - typedef ACE_Double_Linked_List_Iterator ITERATOR; - typedef ACE_Double_Linked_List_Reverse_Iterator REVERSE_ITERATOR; - - // = Initialization and termination methods. - /// construction. Use user specified allocation strategy - /// if specified. - /** - * Initialize an empy list using the allocation strategy specified by the user. - * If none is specified, then use default allocation strategy. - */ - ACE_Double_Linked_List (ACE_Allocator *the_allocator = 0); - - /// Copy constructor. - /** - * Create a double linked list that is a copy of the provided - * parameter. - */ - ACE_Double_Linked_List (const ACE_Double_Linked_List &); - - /// Assignment operator. - /** - * Perform a deep copy of the provided list by first deleting the nodes of the - * lhs and then copying the nodes of the rhs. - */ - void operator= (const ACE_Double_Linked_List &); - - /// Destructor. - /** - * Clean up the memory allocated for the nodes of the list. - */ - ~ACE_Double_Linked_List (void); - - // = Check boundary conditions. - - /// Returns 1 if the container is empty, 0 otherwise. - /** - * Performs constant time check to determine if the list is empty. - */ - int is_empty (void) const; - - /// The list is unbounded, so this always returns 0. - /** - * Since the list is unbounded, the method simply returns 0. - */ - int is_full (void) const; - - // = Classic queue operations. - - /// Adds @a new_item to the tail of the list. Returns the new item - /// that was inserted. - /** - * Provides constant time insertion at the end of the list structure. - */ - T *insert_tail (T *new_item); - - /// Adds @a new_item to the head of the list.Returns the new item that - /// was inserted. - /** - * Provides constant time insertion at the head of the list. - */ - T *insert_head (T *new_item); - - /// Removes the head of the list and returns a pointer to that item. - /** - * Removes and returns the first {item} in the list. Returns - * internal node's address on success, 0 if the queue was empty. - * This method will *not* free the internal node. - */ - T* delete_head (void); - - /// Removes the tail of the list and returns a pointer to that item. - /** - * Removes and returns the last {item} in the list. Returns - * internal nodes's address on success, 0 if the queue was - * empty. This method will *not* free the internal node. - */ - T *delete_tail (void); - - // = Additional utility methods. - - ///Empty the list. - /** - * Reset the {ACE_Double_Linked_List} to be empty. - * Notice that since no one is interested in the items within, - * This operation will delete all items. - */ - void reset (void); - - /// Get the {slot}th element in the set. Returns -1 if the element - /// isn't in the range {0..{size} - 1}, else 0. - /** - * Iterates through the list to the desired index and assigns the provides pointer - * with the address of the node occupying that index. - */ - int get (T *&item, size_t slot = 0); - - /// The number of items in the queue. - /** - * Constant time call to return the current size of the list. - */ - size_t size (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Use DNode address directly. - /** - * Constant time removal of an item from the list using it's address. - */ - int remove (T *n); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Delete all the nodes in the list. - /** - * Removes and deallocates memory for all of the list nodes. - */ - void delete_nodes (void); - - /// Copy nodes from {rhs} into this list. - /** - * Copy the elements of the provided list by allocated new nodes and assigning - * them with the proper data. - */ - void copy_nodes (const ACE_Double_Linked_List &rhs); - - /// Setup header pointer. Called after we create the head node in ctor. - /** - * Initialize the head pointer so that the list has a dummy node. - */ - void init_head (void); - - ///Constant time insert a new item into the list structure. - /** - * Insert a @a new_item into the list. It will be added before - * or after @a old_item. Default is to insert the new item *after* - * {head_}. Return 0 if succeed, -1 if error occured. - */ - int insert_element (T *new_item, - int before = 0, - T *old_item = 0); - - ///Constant time delete an item from the list structure. - /** - * Remove @a item from the list. Return 0 if succeed, -1 otherwise. - * Notice that this function checks if item is {head_} and either its - * {next_} or {prev_} is NULL. The function resets item's {next_} and - * {prev_} to 0 to prevent clobbering the double-linked list if a user - * tries to remove the same node again. - */ - int remove_element (T *item); - - /// Head of the circular double-linked list. - T *head_; - - /// Size of this list. - size_t size_; - - /// Allocation Strategy of the queue. - ACE_Allocator *allocator_; -}; - - -template class ACE_DLList; -template class ACE_DLList_Iterator; -template class ACE_DLList_Reverse_Iterator; - -typedef ACE_Double_Linked_List ACE_DLList_Base; - -//typedef ACE_Double_Linked_List_Iterator -// ACE_DLList_Iterator_Base; -//typedef ACE_Double_Linked_List_Reverse_Iterator -// ACE_DLList_Reverse_Iterator_Base; -//@@ These two typedefs (inherited from James Hu's original design) -// have been removed because Sun CC 4.2 had problems with it. I guess -// having the DLList_Iterators inheriting from a class which is -// actually a typedef leads to problems. #define'ing rather than -// typedef'ing worked, but as per Carlos's reccomendation, I'm just -// replacing all references to the base classes with their actual -// type. Matt Braun (6/15/99) - -/** - * @class ACE_DLList - * - * @brief A double-linked list container class. - * - * ACE_DLList is a simple, unbounded container implemented using a - * double-linked list. It is critical to remember that ACE_DLList inherits - * from ACE_Double_Linked_List, wrapping each T pointer in a ACE_DLList_Node - * object which satisfies the next/prev pointer requirements imposed by - * ACE_Double_Linked_List. - * - * Each item inserted to an ACE_DLList is a pointer to a T object. The - * caller is responsible for lifetime of the T object. ACE_DLList takes no - * action on the T object; it is not copied on insertion and it is not - * deleted on removal from the ACE_DLList. - */ -template -class ACE_DLList : public ACE_DLList_Base -{ - friend class ACE_DLList_Node; - friend class ACE_Double_Linked_List_Iterator; - friend class ACE_DLList_Iterator; - friend class ACE_DLList_Reverse_Iterator; - -public: - - /// Delegates to ACE_Double_Linked_List. - void operator= (const ACE_DLList &l); - - /** - * @name Queue-like insert and delete methods - */ - //@{ - - /** - * Insert pointer for a new item at the tail of the list. - * - * @return Pointer to item inserted; 0 on error. - */ - T *insert_tail (T *new_item); - - /** - * Insert pointer for a new item at the head of the list. - * - * @return Pointer to item inserted; 0 on error. - */ - T *insert_head (T *new_item); - - /** - * Removes the item at the head of the list and returns its pointer. - * - * @return Pointer to previously inserted item; 0 if the list is empty, - * an error occurred, or the original pointer inserted was 0. - */ - T *delete_head (void); - - /** - * Removes the item at the tail of the list and returns its pointer. - * - * @return Pointer to previously inserted item; 0 if the list is empty, - * an error occurred, or the original pointer inserted was 0. - */ - T *delete_tail (void); - //@} - - /** - * Provide random access to any item in the list. - * - * @param item Receives a pointer to the T object pointer held at the - * specified position in the list. - * @param slot Position in the list to access. The first position is 0. - * - * @retval 0 Success; T pointer returned in item. - * @retval -1 Error, most likely slot is outside the range of the list. - */ - int get (T *&item, size_t slot = 0); - - /// Delegates to ACE_Double_Linked_List. - void dump (void) const; - - /// Delegates to ACE_Double_Linked_List. - int remove (ACE_DLList_Node *n); - - /** - * Constructor. - * - * @param the_allocator Allocator to use for allocating ACE_DLList_Node - * objects that wrap T objects for inclusion in the - * list. If 0, ACE_Allocator::instance() is used. - */ - ACE_DLList (ACE_Allocator *the_allocator = 0); - - /// Delegates to ACE_Double_Linked_List. - ACE_DLList (const ACE_DLList &l); - - /** - * Deletes all ACE_DLList_Node objects in the list starting from the head. - * No T objects referred to by the deleted ACE_DLList_Node objects are - * modified or freed. If you desire all of the T objects in the list to - * be deleted as well, code such as this should be used prior to destroying - * the ACE_DLList: - * @code - ACE_DLList list; - ... // insert dynamically allocated Items... - Item *p; - while ((p = list.delete_head()) != 0) - delete *p; - @endcode - */ - ~ACE_DLList (void); -}; - -/** - * @class ACE_DLList_Iterator - * - * @brief A double-linked list container class iterator. - * - * This implementation uses ACE_Double_Linked_List_Iterator to - * perform the logic behind this container class. It delegates - * all of its calls to ACE_Double_Linked_List_Iterator. - */ -template -class ACE_DLList_Iterator : public ACE_Double_Linked_List_Iterator -{ - - friend class ACE_DLList; - friend class ACE_DLList_Node; - -public: - - // = Initialization method. - ACE_DLList_Iterator (ACE_DLList &l); - - /** - * Retasks the iterator to iterate over a new - * Double_Linked_List. This allows clients to reuse an iterator - * without incurring the constructor overhead. If you do use this, - * be aware that if there are more than one reference to this - * iterator, the other "clients" may be very bothered when their - * iterator changes. - * @@ Here be dragons. Comments? - */ - void reset (ACE_DLList &l); - - // = Iteration methods. - /// Move forward by one element in the list. Returns 0 when all the - /// items in the list have been seen, else 1. - int advance (void); - - /// Pass back the {next_item} that hasn't been seen in the list. - /// Returns 0 when all items have been seen, else 1. - int next (T *&); - - /** - * @deprecated Delegates to ACE_Double_Linked_List_Iterator, except that - * whereas the Double_Linked_List version of next returns the node, this next - * returns the contents of the node - */ - T *next (void) const; - - /** - * Removes the current item (i.e., {next}) from the list. - * Note that DLList iterators do not support {advance_and_remove} - * directly (defined in its base class) and you will need to - * release the element returned by it. - */ - int remove (void); - - /// Delegates to ACE_Double_Linked_List_Iterator. - void dump (void) const; - -private: - ACE_DLList *list_; -}; - -/** - * @class ACE_DLList_Reverse_Iterator - * - * @brief A double-linked list container class iterator. - * - * This implementation uses ACE_Double_Linked_List_Iterator to - * perform the logic behind this container class. It delegates - * all of its calls to ACE_Double_Linked_List_Iterator. - */ -template -class ACE_DLList_Reverse_Iterator : public ACE_Double_Linked_List_Reverse_Iterator -{ - - friend class ACE_DLList; - friend class ACE_DLList_Node; - -public: - - // = Initialization method. - ACE_DLList_Reverse_Iterator (ACE_DLList &l); - - /** - * Retasks the iterator to iterate over a new - * Double_Linked_List. This allows clients to reuse an iterator - * without incurring the constructor overhead. If you do use this, - * be aware that if there are more than one reference to this - * iterator, the other "clients" may be very bothered when their - * iterator changes. - * @@ Here be dragons. Comments? - */ - void reset (ACE_DLList &l); - - // = Iteration methods. - /// Move forward by one element in the list. Returns 0 when all the - /// items in the list have been seen, else 1. - int advance (void); - - /// Pass back the {next_item} that hasn't been seen in the list. - /// Returns 0 when all items have been seen, else 1. - int next (T *&); - - /// @deprecated Delegates to ACE_Double_Linked_List_Iterator. - T *next (void) const; - - /// Removes the current item (i.e., {next}) from the list. - /// Note that DLList iterators do not support {advance_and_remove} - /// directly (defined in its base class) and you will need to - /// release the element returned by it. - int remove (void); - - /// Delegates to ACE_Double_Linked_List_Iterator. - void dump (void) const; - -private: - ACE_DLList *list_; -}; - -// Forward declaration. -template -class ACE_Fixed_Set; - -/** - * @class ACE_Fixed_Set_Iterator_Base - * - * @brief Implements a common base class for iterators for a unordered set. - */ -template -class ACE_Fixed_Set_Iterator_Base -{ -public: - // = Iteration methods. - - /// Pass back the {next_item} that hasn't been seen in the Set. - /// Returns 0 when all items have been seen, else 1. - int next (T *&next_item); - - /// Move forward by one element in the set. Returns 0 when all the - /// items in the set have been seen, else 1. - int advance (void); - - /// Move to the first element in the set. Returns 0 if the - /// set is empty, else 1. - int first (void); - - /// Returns 1 when all items have been seen, else 0. - int done (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - // = Initialization method. - ACE_Fixed_Set_Iterator_Base (ACE_Fixed_Set &s); - - /// Set we are iterating over. - ACE_Fixed_Set &s_; - - /// How far we've advanced over the set. - ssize_t next_; - - /// The number of non free items that the iterator had pointed at. - size_t iterated_items_; - - /// Dump the state of an object. - void dump_i (void) const; - - /// Pass back the {next_item} that hasn't been seen in the Set. - /// Returns 0 when all items have been seen, else 1. - int next_i (T *&next_item); -}; - -/** - * @class ACE_Fixed_Set_Iterator - * - * @brief Iterates through an unordered set. - * - * This implementation of an unordered set uses a fixed array. - * Allows deletions while iteration is occurring. - */ -template -class ACE_Fixed_Set_Iterator : public ACE_Fixed_Set_Iterator_Base -{ -public: - // = Initialization method. - ACE_Fixed_Set_Iterator (ACE_Fixed_Set &s); - - // = Iteration methods. - - /// Pass back the {next_item} that hasn't been seen in the Set. - /// Returns 0 when all items have been seen, else 1. - int next (T *&next_item); - - /// Dump the state of an object. - void dump (void) const; - - /// Remove the item where the itearetor is located at. - /// Returns 1 if it removes a item, else 0. - /// Pass back the removed {item}. - int remove (T *&item); - - /// STL-like iterator dereference operator: returns a reference - /// to the node underneath the iterator. - T & operator* (void); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -/** - * @class ACE_Fixed_Set_Const_Iterator - * - * @brief Iterates through a const unordered set. - * - * This implementation of an unordered set uses a fixed array. - */ -template -class ACE_Fixed_Set_Const_Iterator : public ACE_Fixed_Set_Iterator_Base -{ -public: - // = Initialization method. - ACE_Fixed_Set_Const_Iterator (const ACE_Fixed_Set &s); - - // = Iteration methods. - - /// Pass back the {next_item} that hasn't been seen in the Set. - /// Returns 0 when all items have been seen, else 1. - int next (const T *&next_item); - - /// Dump the state of an object. - void dump (void) const; - - /// STL-like iterator dereference operator: returns a reference - /// to the node underneath the iterator. - const T & operator* (void) const ; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -/** - * @class ACE_Fixed_Set - * - * @brief Implement a simple unordered set of {T} with maximum {ACE_SIZE}. - * - * This implementation of an unordered set uses a fixed array. - * It does not allow duplicate members. The set provides linear insertion/deletion - * operations. - * - * Requirements and Performance Characteristics - * - Internal Structure - * Fixed array - * - Duplicates allowed? - * No - * - Random access allowed? - * No - * - Search speed - * Linear - * - Insert/replace speed - * Linear - * - Iterator still valid after change to container? - * Yes - * - Frees memory for removed elements? - * No - * - Items inserted by - * Value - * - Requirements for contained type - * -# Default constructor - * -# Copy constructor - * -# operator= - * -# operator== - * - */ -template -class ACE_Fixed_Set -{ -public: - friend class ACE_Fixed_Set_Iterator_Base; - friend class ACE_Fixed_Set_Iterator; - friend class ACE_Fixed_Set_Const_Iterator; - - // Trait definitions. - typedef ACE_Fixed_Set_Iterator ITERATOR; - typedef ACE_Fixed_Set_Const_Iterator CONST_ITERATOR; - - // = Initialization and termination methods. - /// Default Constructor. - /** - * Creates an empy set - */ - ACE_Fixed_Set (void); - - /// Copy constructor. - /** - * Initializes a set to be a copy of the set parameter. - */ - ACE_Fixed_Set (const ACE_Fixed_Set &); - - /// Assignment operator. - /** - * Deep copy of one set to another. - */ - void operator= (const ACE_Fixed_Set &); - - /// Destructor. - /** - * Destroys a set. - */ - ~ACE_Fixed_Set (void); - - // = Check boundary conditions. - - /// Returns 1 if the container is empty, otherwise returns 0. - /** - * Performs constant time check to determine if a set is empty. - */ - int is_empty (void) const; - - /// Returns 1 if the container is full, otherwise returns 0. - /** - * Performs a constant time check to see if the set is full. - */ - int is_full (void) const; - - // = Classic unordered set operations. - - ///Linear time insertion of an item unique to the set. - /** - * Insert @a new_item into the set (doesn't allow duplicates). - * Returns -1 if failures occur, 1 if item is already present, else - * 0. - */ - int insert (const T &new_item); - - ///Linear time removal operation of an item. - /** - * Remove first occurrence of {item} from the set. Returns 0 if - * it removes the item, -1 if it can't find the item, and -1 if a - * failure occurs. Removal doesn't reclaim memory for the @a item. - */ - int remove (const T &item); - - /// Finds if @a item occurs in the set. Returns 0 if finds, else -1. - /** - * Performs a linear find operation for the specified @a item. - */ - int find (const T &item) const; - - /// Size of the set. - /** - * Returns the current size of the set. - */ - size_t size (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Holds the contents of the set. - struct - { - /// Item in the set. - T item_; - - /// Keeps track of whether this item is in use or not. - int is_free_; - } search_structure_[ACE_SIZE]; - - /// Current size of the set. - size_t cur_size_; - - /// Maximum size of the set. - size_t max_size_; -}; - -// Forward declaration. -template -class ACE_Bounded_Set; - -/** - * @class ACE_Bounded_Set_Iterator - * - * @brief Iterates through an unordered set. - * - * This implementation of an unordered set uses a Bounded array. - * Allows deletions while iteration is occurring. - */ -template -class ACE_Bounded_Set_Iterator -{ -public: - // = Initialization method. - ACE_Bounded_Set_Iterator (ACE_Bounded_Set &s); - - // = Iteration methods. - - /// Pass back the {next_item} that hasn't been seen in the Set. - /// Returns 0 when all items have been seen, else 1. - int next (T *&next_item); - - /// Move forward by one element in the set. Returns 0 when all the - /// items in the set have been seen, else 1. - int advance (void); - - /// Move to the first element in the set. Returns 0 if the - /// set is empty, else 1. - int first (void); - - /// Returns 1 when all items have been seen, else 0. - int done (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Set we are iterating over. - ACE_Bounded_Set &s_; - - /// How far we've advanced over the set. - ssize_t next_; -}; - - -/** - * @class ACE_Bounded_Set - * - * @brief Implement a simple unordered set of {T} with maximum - * set at creation time. - * - * This implementation of an unordered set uses a Bounded array. - * This implementation does not allow duplicates. It provides - * linear insert/remove/find operations. Insertion/removal does not - * invalidate iterators, but caution should be taken to ensure - * expected behavior. Once initialized, the object has a maximum size - * which can only be increased by the assignment of another larger Bounded_Set. - * - * Requirements and Performance Characteristics - * - Internal Structure - * Bounded array which can grow via assignment - * - Duplicates allowed? - * No - * - Random access allowed? - * No - * - Search speed - * Linear - * - Insert/replace speed - * Linear - * - Iterator still valid after change to container? - * Yes - * - Frees memory for removed elements? - * No - * - Items inserted by - * Value - * - Requirements for contained type - * -# Default constructor - * -# Copy constructor - * -# operator= - * -# operator== - * - */ -template -class ACE_Bounded_Set -{ -public: - friend class ACE_Bounded_Set_Iterator; - - // Trait definition. - typedef ACE_Bounded_Set_Iterator ITERATOR; - - enum - { - DEFAULT_SIZE = 10 - }; - - // = Initialization and termination methods. - /// Construct a Bounded_Set using the default size. - /** - * The default constructor initializes the Bounded_Set to a maximum size - * specified by the DEFAULT_SIZE. - */ - ACE_Bounded_Set (void); - - /// Construct a Bounded_Set with the provided sizeB. - /** - * Initialize the Bounded_Set to have a maximum size equal to the size - * parameter specified. - */ - ACE_Bounded_Set (size_t size); - - /// Construct a Bounded_Set that is a copy of the provides Bounded_Set. - /** - * Initialize the Bounded_Set to be a copy of the Bounded_Set parameter. - */ - ACE_Bounded_Set (const ACE_Bounded_Set &); - - /// Assignment operator. - /** - * The assignment will make a deep copy of the Bounded_Set provided. If the - * rhs has more elements than the capacity of the lhs, then the lhs will be - * deleted and reallocated to accomadate the larger number of elements. - */ - void operator= (const ACE_Bounded_Set &); - - /// Destructor - /** - * Clean up the underlying dynamically allocated memory that is used by - * the Bounded_Set. - */ - ~ACE_Bounded_Set (void); - - // = Check boundary conditions. - - /// Returns 1 if the container is empty, otherwise returns 0. - /** - * A constant time check is performed to determine if the Bounded_Set is - * empty. - */ - int is_empty (void) const; - - /// Returns 1 if the container is full, otherwise returns 0. - /** - * Performs a constant time check to determine if the Bounded_Set is at - * capacity. - */ - int is_full (void) const; - - // = Classic unordered set operations. - - ///Inserts a new element unique to the set. - /** - * Insert @a new_item into the set (doesn't allow duplicates) in linear - * time. - * Returns -1 if failures occur, 1 if item is already present, else - * 0. - */ - int insert (const T &new_item); - - ///Finds the specified element and removes it from the set. - /** - * Remove first occurrence of @a item from the set. Returns 0 if it - * removes the item, -1 if it can't find the item, and -1 if a - * failure occurs. The linear remove operation does not reclaim the - * memory associated with the removed item. - */ - int remove (const T &item); - - /// Finds if @a item occurs in the set. Returns 0 if finds, else -1. - /** - * find preforms a linear search for {item} and returns 0 on successful - * find and -1 otherwise. - */ - int find (const T &item) const; - - /// Size of the set. - /** - * Returns a size_t representing the current size of the set. - */ - size_t size (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - struct Search_Structure - { - /// Item in the set. - T item_; - - /// Keeps track of whether this item is in use or not. - int is_free_; - }; - - /// Holds the contents of the set. - Search_Structure *search_structure_; - - /// Current size of the set. - size_t cur_size_; - - /// Maximum size of the set. - size_t max_size_; -}; - -/** - * @class ACE_Ordered_MultiSet_Iterator - * - * @brief Implement a bidirectional iterator over an ordered multiset. - * This class template requires that < operator semantics be - * defined for the parameterized type {T}, but does not impose - * any restriction on how that ordering operator is implemented. - */ -template -class ACE_Ordered_MultiSet_Iterator -{ -public: - friend class ACE_Ordered_MultiSet; - - // = Initialization method. - ACE_Ordered_MultiSet_Iterator (ACE_Ordered_MultiSet &s); - - // = Iteration methods. - - /// Pass back the {next_item} that hasn't been seen in the ordered multiset. - /// Returns 0 when all items have been seen, else 1. - int next (T *&next_item) const; - - /// Repositions the iterator at the first item in the ordered multiset - /// Returns 0 if the list is empty else 1. - int first (void); - - /// Repositions the iterator at the last item in the ordered multiset - /// Returns 0 if the list is empty else 1. - int last (void); - - /// Move forward by one element in the set. Returns 0 when all the - /// items in the set have been seen, else 1. - int advance (void); - - /// Move backward by one element in the set. Returns 0 when all the - /// items in the set have been seen, else 1. - int retreat (void); - - /// Returns 1 when all items have been seen, else 0. - int done (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Returns a reference to the internal element {this} is pointing to. - T& operator* (void); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - - /// Pointer to the current node in the iteration. - ACE_DNode *current_; - - /// Pointer to the set we're iterating over. - ACE_Ordered_MultiSet &set_; -}; - - -/** - * @class ACE_Ordered_MultiSet - * - * @brief Implement a simple ordered multiset of {T} of unbounded size - * that allows duplicates. This class template requires that < - * operator semantics be defined for the parameterized type {T}, but - * does not impose any restriction on how that ordering operator is - * implemented. The set is implemented as a linked list. - * - * - * Requirements and Performance Characteristics - * - Internal Structure - * Double linked list - * - Duplicates allowed? - * Yes - * - Random access allowed? - * No - * - Search speed - * Linear - * - Insert/replace speed - * Linear - * - Iterator still valid after change to container? - * Yes - * - Frees memory for removed elements? - * Yes - * - Items inserted by - * Value - * - Requirements for contained type - * -# Default constructor - * -# Copy constructor - * -# operator= - * -# operator== - * -# operator< - * - * - */ -template -class ACE_Ordered_MultiSet -{ -public: - friend class ACE_Ordered_MultiSet_Iterator; - - // Trait definition. - typedef ACE_Ordered_MultiSet_Iterator ITERATOR; - - // = Initialization and termination methods. - /// Constructor. Use user specified allocation strategy - /// if specified. - /** - * Initialize the set using the allocation strategy specified. If none, use the - * default strategy. - */ - ACE_Ordered_MultiSet (ACE_Allocator *the_allocator = 0); - - /// Copy constructor. - /** - * Initialize the set to be a copy of the provided set. - */ - ACE_Ordered_MultiSet (const ACE_Ordered_MultiSet &); - - /// Destructor. - /** - * Delete the nodes of the set. - */ - ~ACE_Ordered_MultiSet (void); - - /// Assignment operator. - /** - * Delete the nodes in lhs, and copy the nodes from the rhs. - */ - void operator= (const ACE_Ordered_MultiSet &); - - // = Check boundary conditions. - - /// Returns 1 if the container is empty, otherwise returns 0. - /** - * Constant time check to determine if the set is empty. - */ - int is_empty (void) const; - - /// Size of the set. - /** - * Constant time check to determine the size of the set. - */ - size_t size (void) const; - - // = Classic unordered set operations. - - /// Insert @a new_item into the ordered multiset. - /// Returns -1 if failures occur, else 0. - /** - * Linear time, order preserving insert into the set beginning at the head. - */ - int insert (const T &new_item); - - ///Linear time insert beginning at the point specified by the provided iterator. - /** - * Insert @a new_item into the ordered multiset, starting its search at - * the node pointed to by the iterator, and if insertion was successful, - * updates the iterator to point to the newly inserted node. - * Returns -1 if failures occur, else 0. - */ - int insert (const T &new_item, ITERATOR &iter); - - /// Remove first occurrence of @a item from the set. Returns 0 if - /// it removes the item, -1 if it can't find the item. - /** - * Linear time search operation which removes the item from the set if found . - */ - int remove (const T &item); - - ///Linear find operation. - /** - * Finds first occurrence of @a item in the multiset, using the iterator's - * current position as a hint to improve performance. If find succeeds, - * it positions the iterator at that node and returns 0, or if it cannot - * locate the node, it leaves the iterator alone and just returns -1. - */ - int find (const T &item, ITERATOR &iter) const; - - /// Reset the ACE_Ordered_MultiSet to be empty. - /** - * Delete the nodes inside the set. - */ - void reset (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - - /** - * Insert @a item, starting its search at the position given, - * and if successful updates the passed pointer to point to - * the newly inserted item's node. - */ - int insert_from (const T &item, ACE_DNode *start_position, - ACE_DNode **new_position); - - /** - * Looks for first occurrence of @a item in the ordered set, using the - * passed starting position as a hint: if there is such an instance, it - * updates the new_position pointer to point to this node and returns 0; - * if there is no such node, then if there is a node before where the - * item would have been, it updates the new_position pointer to point - * to this node and returns -1; if there is no such node, then if there - * is a node after where the item would have been, it updates the - * new_position pointer to point to this node (or 0 if there is no such - * node) and returns 1; - */ - int locate (const T &item, ACE_DNode *start_position, - ACE_DNode *&new_position) const; - - /// Delete all the nodes in the Set. - void delete_nodes (void); - - /// Copy nodes into this set. - void copy_nodes (const ACE_Ordered_MultiSet &); - - /// Head of the bilinked list of Nodes. - ACE_DNode *head_; - - /// Head of the bilinked list of Nodes. - ACE_DNode *tail_; - - /// Current size of the set. - size_t cur_size_; - - /// Allocation strategy of the set. - ACE_Allocator *allocator_; -}; - -// **************************************************************** - -/** - * @class ACE_Array - * - * @brief A dynamic array class. - * - * This class extends ACE_Array_Base, adding comparison operators. - * - * Requirements and Performance Characteristics - * - Internal Structure - * Dynamic array - * - Duplicates allowed? - * Yes - * - Random access allowed? - * Yes - * - Search speed - * N/A - * - Insert/replace speed - * O(1) - * - Iterator still valid after change to container? - * - In general, yes. - * - If array size is changed during iteration, no. - * - Frees memory for removed elements? - * No - * - Items inserted by - * Value - * - Requirements for contained type - * -# Default constructor - * -# Copy constructor - * -# operator= - * -# operator!= - * - * @sa ACE_Array_Base. This class inherits its operations and requirements. - */ -template -class ACE_Array : public ACE_Array_Base -{ -public: - // Define a "trait" - typedef T TYPE; - typedef ACE_Array_Iterator ITERATOR; - - /// Dynamically create an uninitialized array. - /** - * Initialize an empty array of the specified size using the provided - * allocation strategy. - */ - ACE_Array (size_t size = 0, - ACE_Allocator* alloc = 0); - - /// Dynamically initialize the entire array to the {default_value}. - /** - * Initialize an array the given size placing the default_value in each index. - */ - ACE_Array (size_t size, - const T &default_value, - ACE_Allocator* alloc = 0); - - ///Copy constructor. - /** - * The copy constructor performs initialization by making an exact - * copy of the contents of parameter {s}, i.e., *this == s will - * return true. - */ - ACE_Array (const ACE_Array &s); - - ///Assignment operator - /** - * Assignment operator performs an assignment by making an exact - * copy of the contents of parameter {s}, i.e., *this == s will - * return true. Note that if the {max_size_} of {array_} is >= than - * {s.max_size_} we can copy it without reallocating. However, if - * {max_size_} is < {s.max_size_} we must delete the {array_}, - * reallocate a new {array_}, and then copy the contents of {s}. - */ - void operator= (const ACE_Array &s); - - // = Compare operators - - ///Equality comparison operator. - /** - * Compare this array with {s} for equality. Two arrays are equal - * if their {size}'s are equal and all the elements from 0 .. {size} - * are equal. - */ - bool operator== (const ACE_Array &s) const; - - ///Inequality comparison operator. - /** - * Compare this array with {s} for inequality such that {*this} != - * {s} is always the complement of the boolean return value of - * {*this} == {s}. - */ - bool operator!= (const ACE_Array &s) const; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Containers_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Containers_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Containers_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_CONTAINERS_T_H */ diff --git a/dep/acelite/ace/Containers_T.inl b/dep/acelite/ace/Containers_T.inl deleted file mode 100644 index 912c9df8bb8..00000000000 --- a/dep/acelite/ace/Containers_T.inl +++ /dev/null @@ -1,479 +0,0 @@ -// -*- C++ -*- -// -// $Id: Containers_T.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE int -ACE_Bounded_Stack::is_empty (void) const -{ - ACE_TRACE ("ACE_Bounded_Stack::is_empty"); - return this->top_ == 0; -} - -template ACE_INLINE int -ACE_Bounded_Stack::is_full (void) const -{ - ACE_TRACE ("ACE_Bounded_Stack::is_full"); - return this->top_ >= this->size_; -} - -template ACE_INLINE int -ACE_Bounded_Stack::push (const T &new_item) -{ - ACE_TRACE ("ACE_Bounded_Stack::push"); - if (this->is_full () == 0) - { - this->stack_[this->top_++] = new_item; - return 0; - } - else - return -1; -} - -template ACE_INLINE int -ACE_Bounded_Stack::pop (T &item) -{ - ACE_TRACE ("ACE_Bounded_Stack::pop"); - if (this->is_empty () == 0) - { - item = this->stack_[--this->top_]; - return 0; - } - else - return -1; -} - -template ACE_INLINE int -ACE_Bounded_Stack::top (T &item) const -{ - ACE_TRACE ("ACE_Bounded_Stack::top"); - if (this->is_empty () == 0) - { - item = this->stack_[this->top_ - 1]; - return 0; - } - else - return -1; -} - -template ACE_INLINE size_t -ACE_Bounded_Stack::size (void) const -{ - return this->size_; -} - -//---------------------------------------- - -template ACE_INLINE int -ACE_Fixed_Stack::is_empty (void) const -{ - ACE_TRACE ("ACE_Fixed_Stack::is_empty"); - return this->top_ == 0; -} - -template ACE_INLINE int -ACE_Fixed_Stack::is_full (void) const -{ - ACE_TRACE ("ACE_Fixed_Stack::is_full"); - return this->top_ >= this->size_; -} - -template ACE_INLINE int -ACE_Fixed_Stack::push (const T &new_item) -{ - ACE_TRACE ("ACE_Fixed_Stack::push"); - if (this->is_full () == 0) - { - this->stack_[this->top_++] = new_item; - return 0; - } - else - return -1; -} - -template ACE_INLINE int -ACE_Fixed_Stack::pop (T &item) -{ - ACE_TRACE ("ACE_Fixed_Stack::pop"); - if (this->is_empty () == 0) - { - item = this->stack_[--this->top_]; - return 0; - } - else - return -1; -} - -template ACE_INLINE int -ACE_Fixed_Stack::top (T &item) const -{ - ACE_TRACE ("ACE_Fixed_Stack::top"); - if (this->is_empty () == 0) - { - item = this->stack_[this->top_ - 1]; - return 0; - } - else - return -1; -} - -template ACE_INLINE size_t -ACE_Fixed_Stack::size (void) const -{ - return this->size_; -} - -template ACE_INLINE int -ACE_Unbounded_Stack::is_empty (void) const -{ - // ACE_TRACE ("ACE_Unbounded_Stack::is_empty"); - return this->head_ == this->head_->next_; -} - -template ACE_INLINE int -ACE_Unbounded_Stack::top (T &item) const -{ - ACE_TRACE ("ACE_Unbounded_Stack::top"); - if (this->is_empty () == 0) - { - item = this->head_->next_->item_; - return 0; - } - else - return -1; -} - -template ACE_INLINE int -ACE_Unbounded_Stack::is_full (void) const -{ - ACE_TRACE ("ACE_Unbounded_Stack::is_full"); - return 0; // ??? -} - -template ACE_INLINE size_t -ACE_Unbounded_Stack::size (void) const -{ - return this->cur_size_; -} - -// --- - - -// --- - -template ACE_INLINE int -ACE_Fixed_Set::is_empty (void) const -{ - ACE_TRACE ("ACE_Fixed_Set::is_empty"); - return this->cur_size_ == 0; -} - -template ACE_INLINE int -ACE_Fixed_Set::is_full (void) const -{ - ACE_TRACE ("ACE_Fixed_Set::is_full"); - return this->cur_size_ == this->max_size_; -} - -// --- - -template ACE_INLINE int -ACE_Bounded_Set::is_empty (void) const -{ - ACE_TRACE ("ACE_Bounded_Set::is_empty"); - return this->cur_size_ == 0; -} - -template ACE_INLINE int -ACE_Bounded_Set::is_full (void) const -{ - ACE_TRACE ("ACE_Bounded_Set::is_full"); - return this->cur_size_ == this->max_size_; -} - -// -- - -template ACE_INLINE int -ACE_Ordered_MultiSet_Iterator::first (void) -{ - ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::first"); - current_ = set_.head_; - - return (current_ ? 1 : 0); -} - -template ACE_INLINE int -ACE_Ordered_MultiSet_Iterator::last (void) -{ - ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::last"); - current_ = set_.tail_; - - return (current_ ? 1 : 0); -} - -template ACE_INLINE int -ACE_Ordered_MultiSet_Iterator::advance (void) -{ - ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::advance"); - - current_ = current_ ? current_->next_ : 0; - - return (current_ ? 1 : 0); -} - -template ACE_INLINE int -ACE_Ordered_MultiSet_Iterator::retreat (void) -{ - ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::retreat"); - - current_ = current_ ? current_->prev_ : 0; - - return (current_ ? 1 : 0); -} - -template ACE_INLINE int -ACE_Ordered_MultiSet_Iterator::done (void) const -{ - ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::done"); - - return (current_ ? 0 : 1); -} - -template ACE_INLINE void -ACE_Ordered_MultiSet_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::dump"); -#endif /* ACE_HAS_DUMP */ -} - - - -// -- - -template ACE_INLINE int -ACE_Ordered_MultiSet::is_empty (void) const -{ - ACE_TRACE ("ACE_Ordered_MultiSet::is_empty"); - return this->cur_size_ > 0 ? 0 : 1; -} - -template ACE_INLINE size_t -ACE_Ordered_MultiSet::size (void) const -{ -// ACE_TRACE ("ACE_Ordered_MultiSet::size"); - return this->cur_size_; -} - -// **************************************************************** - -template ACE_INLINE -ACE_Array::ACE_Array (size_t size, - ACE_Allocator *alloc) - : ACE_Array_Base (size, alloc) -{ -} - -template ACE_INLINE -ACE_Array::ACE_Array (size_t size, - const T &default_value, - ACE_Allocator *alloc) - : ACE_Array_Base (size, default_value, alloc) -{ -} - -// The copy constructor (performs initialization). - -template ACE_INLINE -ACE_Array::ACE_Array (const ACE_Array &s) - : ACE_Array_Base (s) -{ -} - -// Assignment operator (performs assignment). - -template ACE_INLINE void -ACE_Array::operator= (const ACE_Array &s) -{ - // Check for "self-assignment". - - if (this != &s) - this->ACE_Array_Base::operator= (s); -} - -// Compare this array with for inequality. - -template ACE_INLINE bool -ACE_Array::operator!= (const ACE_Array &s) const -{ - return !(*this == s); -} - -// **************************************************************** - - -// **************************************************************** - -template ACE_INLINE void -ACE_DLList::operator= (const ACE_DLList &l) -{ - *(ACE_DLList_Base *) this = l; -} - -template ACE_INLINE int -ACE_DLList::get (T *&item, size_t index) -{ - ACE_DLList_Node *node; - int result = ACE_DLList_Base::get (node, index); - if (result != -1) - item = (T *) node->item_; - return result; -} - -template ACE_INLINE void -ACE_DLList::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_DLList_Base::dump (); -#endif /* ACE_HAS_DUMP */ -} - -template ACE_INLINE int -ACE_DLList::remove (ACE_DLList_Node *n) -{ - int result = ACE_DLList_Base::remove (n); - ACE_DES_FREE (n, - this->allocator_->free, - ACE_DLList_Node); - return result; -} - -template ACE_INLINE -ACE_DLList::ACE_DLList (ACE_Allocator *alloc) - : ACE_DLList_Base (alloc) -{ -} - -template ACE_INLINE -ACE_DLList::ACE_DLList (const ACE_DLList &l) - : ACE_DLList_Base ((ACE_DLList &) l) -{ -} - -template ACE_INLINE -ACE_DLList::~ACE_DLList (void) -{ - while (this->delete_head ()) ; -} - -template ACE_INLINE int -ACE_DLList_Iterator::remove (void) -{ - ACE_DLList_Node *temp = this->ACE_Double_Linked_List_Iterator ::next (); - this->ACE_Double_Linked_List_Iterator ::advance (); - return list_->remove (temp); -} - -template ACE_INLINE -ACE_DLList_Iterator::ACE_DLList_Iterator (ACE_DLList &l) - : ACE_Double_Linked_List_Iterator ((ACE_DLList_Base &)l), - list_ (&l) -{ -} - -template ACE_INLINE void -ACE_DLList_Iterator::reset (ACE_DLList &l) -{ - list_ = &l; - this->ACE_Double_Linked_List_Iterator ::reset ((ACE_DLList_Base &)l); -} - -template ACE_INLINE int -ACE_DLList_Iterator::next (T *&ptr) -{ - ACE_DLList_Node *temp = - ACE_Double_Linked_List_Iterator ::next (); - if (temp) - ptr = (T *) temp->item_; - return temp ? 1 : 0; -} - -template ACE_INLINE T * -ACE_DLList_Iterator::next (void) const -{ - ACE_DLList_Node *temp = ACE_Double_Linked_List_Iterator ::next (); - return (T *) (temp ? temp->item_ : 0); -} - -template ACE_INLINE int -ACE_DLList_Iterator::advance (void) -{ - return this->ACE_Double_Linked_List_Iterator ::advance (); -} - -template ACE_INLINE void -ACE_DLList_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_Double_Linked_List_Iterator ::dump (); -#endif /* ACE_HAS_DUMP */ -} - - -template ACE_INLINE int -ACE_DLList_Reverse_Iterator::remove (void) -{ - ACE_DLList_Node *temp = ACE_Double_Linked_List_Reverse_Iterator ::next (); - this->ACE_Double_Linked_List_Reverse_Iterator ::advance (); - return list_->remove (temp); -} - -template ACE_INLINE -ACE_DLList_Reverse_Iterator::ACE_DLList_Reverse_Iterator (ACE_DLList &l) - : ACE_Double_Linked_List_Reverse_Iterator ((ACE_DLList_Base &)l), - list_ (&l) -{ -} - -template ACE_INLINE void -ACE_DLList_Reverse_Iterator::reset (ACE_DLList &l) -{ - list_ = &l; - this->ACE_Double_Linked_List_Reverse_Iterator ::reset ((ACE_DLList_Base &)l); -} - -template ACE_INLINE int -ACE_DLList_Reverse_Iterator::advance (void) -{ - return ACE_Double_Linked_List_Reverse_Iterator ::advance (); -} - -template ACE_INLINE int -ACE_DLList_Reverse_Iterator::next (T *&ptr) -{ - ACE_DLList_Node *temp = - ACE_Double_Linked_List_Reverse_Iterator ::next (); - if (temp == 0) - return 0; - ptr = (T *) temp->item_; - return 1; -} - -template ACE_INLINE T * -ACE_DLList_Reverse_Iterator::next (void) const -{ - ACE_DLList_Node *temp = ACE_Double_Linked_List_Reverse_Iterator ::next (); - return (T *) (temp ? temp->item_ : 0); -} - - -template ACE_INLINE void -ACE_DLList_Reverse_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_Double_Linked_List_Reverse_Iterator ::dump (); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Copy_Disabled.cpp b/dep/acelite/ace/Copy_Disabled.cpp deleted file mode 100644 index f3fdfb71b93..00000000000 --- a/dep/acelite/ace/Copy_Disabled.cpp +++ /dev/null @@ -1,17 +0,0 @@ -/** - * @file Copy_Disabled.cpp - * - * $Id: Copy_Disabled.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - * - * @author Carlos O'Ryan - */ - -#include "ace/Copy_Disabled.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Copy_Disabled::ACE_Copy_Disabled (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Copy_Disabled.h b/dep/acelite/ace/Copy_Disabled.h deleted file mode 100644 index f7b40e26422..00000000000 --- a/dep/acelite/ace/Copy_Disabled.h +++ /dev/null @@ -1,65 +0,0 @@ -// -*- C++ -*- - -//=========================================================================== -/** - * @file Copy_Disabled.h - * - * $Id: Copy_Disabled.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Carlos O'Ryan - */ -//=========================================================================== - -#ifndef ACE_COPY_DISABLED_H -#define ACE_COPY_DISABLED_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Copy_Disabled - * - * @brief Helper class to disable copy construction and assignment - * - * Classes used to control OS and other resources are not "canonical", - * i.e. they have their copy constructor and assignment operators - * disabled. - * This is often done by making the copy constructor and assignment - * operators private, effectively disallowing copying by clients of - * the class (including derived classes). If the copy constructor and - * assingment operators are left unimplemented then the class itself - * cannot make any copies of its instances, because it would result in - * link errors. - * - * To use this class simply use private inheritance: - * - * class Foo : private ACE_Copy_Disabled - * { - * // code here - * }; - * - */ -class ACE_Export ACE_Copy_Disabled -{ -public: - - /// Default constructor - ACE_Copy_Disabled (void); - -private: - ACE_Copy_Disabled (const ACE_Copy_Disabled &); - ACE_Copy_Disabled &operator= (const ACE_Copy_Disabled &); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_COPY_DISABLED_H */ diff --git a/dep/acelite/ace/Countdown_Time.h b/dep/acelite/ace/Countdown_Time.h deleted file mode 100644 index b63228d606f..00000000000 --- a/dep/acelite/ace/Countdown_Time.h +++ /dev/null @@ -1,36 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Countdown_Time.h - * - * $Id: Countdown_Time.h 95332 2011-12-15 11:09:41Z mcorino $ - * - * @author Douglas C. Schmidt - * @author Irfan Pyarali - */ -//============================================================================= - -#ifndef ACE_COUNTDOWN_TIME_H -#define ACE_COUNTDOWN_TIME_H - -#include /**/ "ace/pre.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Countdown_Time_T.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// The following typedef is here for ease of use and backward -// compatibility. -typedef ACE_Countdown_Time_T - ACE_Countdown_Time; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_COUNTDOWN_TIME_H */ diff --git a/dep/acelite/ace/Countdown_Time_T.cpp b/dep/acelite/ace/Countdown_Time_T.cpp deleted file mode 100644 index fd9a466625f..00000000000 --- a/dep/acelite/ace/Countdown_Time_T.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// $Id: Countdown_Time_T.cpp 95332 2011-12-15 11:09:41Z mcorino $ - -#ifndef ACE_COUNTDOWN_TIME_T_CPP -#define ACE_COUNTDOWN_TIME_T_CPP - -#include "ace/Countdown_Time_T.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Countdown_Time_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE -ACE_Countdown_Time_T::ACE_Countdown_Time_T (ACE_Time_Value *max_wait_time, - TIME_POLICY const & time_policy) - : time_policy_ (time_policy), - max_wait_time_ (max_wait_time), - stopped_ (false) -{ - this->start (); -} - -template ACE_INLINE -ACE_Countdown_Time_T::~ACE_Countdown_Time_T (void) -{ - this->stop (); -} - -template ACE_INLINE void -ACE_Countdown_Time_T::start (void) -{ - if (this->max_wait_time_ != 0) - { - this->start_time_ = this->time_policy_ (); - this->stopped_ = false; - } -} - -template ACE_INLINE void -ACE_Countdown_Time_T::stop (void) -{ - if (this->max_wait_time_ != 0 && !this->stopped_) - { - ACE_Time_Value const elapsed_time = - this->time_policy_ () - this->start_time_; - - if (elapsed_time >= ACE_Time_Value::zero && - *this->max_wait_time_ > elapsed_time) - { - *this->max_wait_time_ -= elapsed_time; - } - else - { - // Used all of timeout. - *this->max_wait_time_ = ACE_Time_Value::zero; - // errno = ETIME; - } - this->stopped_ = true; - } -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_COUNTDOWN_TIME_T_CPP */ diff --git a/dep/acelite/ace/Countdown_Time_T.h b/dep/acelite/ace/Countdown_Time_T.h deleted file mode 100644 index 74de8f27e1c..00000000000 --- a/dep/acelite/ace/Countdown_Time_T.h +++ /dev/null @@ -1,100 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Countdown_Time_T.h - * - * $Id: Countdown_Time_T.h 95345 2011-12-15 19:46:06Z johnnyw $ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_COUNTDOWN_TIME_T_H -#define ACE_COUNTDOWN_TIME_T_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Time_Value.h" -#include "ace/Time_Policy.h" -#include "ace/Copy_Disabled.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Countdown_Time - * - * @brief Keeps track of the amount of elapsed time. - * - * This class has a side-effect on the @c max_wait_time -- every - * time the stop() method is called the @c max_wait_time is - * updated. - */ -template -class ACE_Countdown_Time_T : private ACE_Copy_Disabled -{ -public: - /// Cache the @a max_wait_time and call @c start(). - ACE_Countdown_Time_T (ACE_Time_Value *max_wait_time, - TIME_POLICY const & time_policy = TIME_POLICY()); - - /// Destructor, makes sure the max_wait_time that got passed as pointer - /// to the constructor is updated with the time elapsed. - ~ACE_Countdown_Time_T (void); - - /// Cache the current time and enter a start state. - void start (void); - - /// Subtract the elapsed time from max_wait_time_ and enter a stopped - /// state. - void stop (void); - - /// Calls stop and then start. max_wait_time_ is modified by the - /// call to stop. - void update (void); - - /// Returns true if we've already been stopped, else false. - bool stopped (void) const; - - /// Allows applications to control how the timer queue gets the time - /// of day. - void set_time_policy(TIME_POLICY const & time_policy); - -private: - /// The policy to return the current time of day - TIME_POLICY time_policy_; - - /// Maximum time we were willing to wait. - ACE_Time_Value *max_wait_time_; - - /// Beginning of the start time. - ACE_Time_Value start_time_; - - /// Keeps track of whether we've already been stopped. - bool stopped_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#if defined (__ACE_INLINE__) -#include "ace/Countdown_Time_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Countdown_Time_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Countdown_Time_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - - -#endif /* ACE_COUNTDOWN_TIME_T_H */ diff --git a/dep/acelite/ace/Countdown_Time_T.inl b/dep/acelite/ace/Countdown_Time_T.inl deleted file mode 100644 index 3d6e7a2f73d..00000000000 --- a/dep/acelite/ace/Countdown_Time_T.inl +++ /dev/null @@ -1,26 +0,0 @@ -// -*- C++ -*- -// -// $Id: Countdown_Time_T.inl 95332 2011-12-15 11:09:41Z mcorino $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE bool -ACE_Countdown_Time_T::stopped (void) const -{ - return stopped_; -} - -template ACE_INLINE void -ACE_Countdown_Time_T::update (void) -{ - this->stop (); - this->start (); -} - -template ACE_INLINE void -ACE_Countdown_Time_T::set_time_policy(TIME_POLICY const & time_policy) -{ - this->time_policy_ = time_policy; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/DEV.cpp b/dep/acelite/ace/DEV.cpp deleted file mode 100644 index c95bb7f90a2..00000000000 --- a/dep/acelite/ace/DEV.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// $Id: DEV.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/DEV.h" - -#include "ace/OS_NS_unistd.h" - -#if !defined (__ACE_INLINE__) -#include "ace/DEV.inl" -#endif /* __ACE_INLINE__ */ - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_DEV) - -void -ACE_DEV::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_DEV::dump"); -#endif /* ACE_HAS_DUMP */ -} - -// This is the do-nothing constructor. - -ACE_DEV::ACE_DEV (void) -{ - ACE_TRACE ("ACE_DEV::ACE_DEV"); -} - -// Close the device - -int -ACE_DEV::close (void) -{ - ACE_TRACE ("ACE_DEV::close"); - int result = ACE_OS::close (this->get_handle ()); - this->set_handle (ACE_INVALID_HANDLE); - return result; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/DEV.h b/dep/acelite/ace/DEV.h deleted file mode 100644 index d8ce8628ecf..00000000000 --- a/dep/acelite/ace/DEV.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file DEV.h - * - * $Id: DEV.h 91685 2010-09-09 09:35:14Z johnnyw $ - * - * @author Gerhard Lenzer - */ -//============================================================================= - - -#ifndef ACE_DEV_H -#define ACE_DEV_H -#include /**/ "ace/pre.h" - -#include "ace/IO_SAP.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/DEV_Addr.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_DEV - * - * @brief Defines the member functions for the base class of the - * ACE_DEV abstraction. - */ -class ACE_Export ACE_DEV : public ACE_IO_SAP -{ -public: - /// Close down the DEVICE - int close (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - /** - * Disable signal @a signum - * This is here to prevent Win32 from - * disabling SPIPE using socket calls - */ - int disable (int signum) const ; - -protected: - /// Ensure that this class is an abstract base class - ACE_DEV (void); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/DEV.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_DEV_H */ diff --git a/dep/acelite/ace/DEV.inl b/dep/acelite/ace/DEV.inl deleted file mode 100644 index 4d97a73d8e8..00000000000 --- a/dep/acelite/ace/DEV.inl +++ /dev/null @@ -1,18 +0,0 @@ -// -*- C++ -*- -// -// $Id: DEV.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -ACE_DEV::disable (int signum) const -{ -#if defined (ACE_WIN32) - ACE_UNUSED_ARG (signum) ; - return 0 ; -#else /* ACE_WIN32 */ - return ACE_IO_SAP::disable (signum) ; -#endif /* ACE_WIN32 */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/DEV_Addr.cpp b/dep/acelite/ace/DEV_Addr.cpp deleted file mode 100644 index 90bfe0a5752..00000000000 --- a/dep/acelite/ace/DEV_Addr.cpp +++ /dev/null @@ -1,104 +0,0 @@ -// $Id: DEV_Addr.cpp 91368 2010-08-16 13:03:34Z mhengstmengel $ - -#include "ace/DEV_Addr.h" -#if !defined (__ACE_INLINE__) -#include "ace/DEV_Addr.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Log_Msg.h" -#include "ace/OS_NS_string.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_DEV_Addr) - -// Transform the current address into string format. - -int -ACE_DEV_Addr::addr_to_string (ACE_TCHAR *s, size_t len) const -{ - ACE_TRACE ("ACE_DEV_Addr::addr_to_string"); - - ACE_OS::strsncpy (s, this->devname_, len); - return 0; -} - -// Return a pointer to the address. - -void * -ACE_DEV_Addr::get_addr (void) const -{ - ACE_TRACE ("ACE_DEV_Addr::get_addr"); - - return (void *) &this->devname_; -} - -void -ACE_DEV_Addr::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_DEV_Addr::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("devname_ = %s"), this->devname_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -// Do nothing constructor. - -ACE_DEV_Addr::ACE_DEV_Addr (void) - : ACE_Addr (AF_DEV, sizeof this->devname_) -{ - ACE_TRACE ("ACE_DEV_Addr::ACE_DEV_Addr"); - - (void) ACE_OS::memset ((void *) &this->devname_, - 0, sizeof this->devname_); -} - -int -ACE_DEV_Addr::set (const ACE_DEV_Addr &sa) -{ - this->base_set (sa.get_type (), sa.get_size ()); - - if (sa.get_type () == AF_ANY) - (void) ACE_OS::memset ((void *) &this->devname_, - 0, - sizeof this->devname_); - else - (void) ACE_OS::strsncpy (this->devname_, - sa.devname_, - ACE_DEV_Addr::DEVNAME_LENGTH); - return 0; -} - -// Copy constructor. - -ACE_DEV_Addr::ACE_DEV_Addr (const ACE_DEV_Addr &sa) - : ACE_Addr (AF_DEV, sizeof this->devname_) -{ - ACE_TRACE ("ACE_DEV_Addr::ACE_DEV_Addr"); - - this->set (sa); -} - -ACE_DEV_Addr::ACE_DEV_Addr (const ACE_TCHAR *devname) - : ACE_Addr (AF_DEV, sizeof this->devname_) -{ - ACE_TRACE ("ACE_DEV_Addr::ACE_DEV_Addr"); - - this->set (devname); -} - -ACE_DEV_Addr & -ACE_DEV_Addr::operator= (const ACE_DEV_Addr &sa) -{ - ACE_TRACE ("ACE_DEV_Addr::operator="); - - if (this != &sa) - this->set (sa); - - return *this; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/DEV_Addr.h b/dep/acelite/ace/DEV_Addr.h deleted file mode 100644 index 49ec5023a7c..00000000000 --- a/dep/acelite/ace/DEV_Addr.h +++ /dev/null @@ -1,90 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file DEV_Addr.h - * - * $Id: DEV_Addr.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Gerhard Lenzer and Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_DEV_ADDR_H -#define ACE_DEV_ADDR_H - -#include /**/ "ace/pre.h" - -#include "ace/Addr.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_dirent.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_DEV_Addr - * - * @brief Defines device address family address format. - */ -class ACE_Export ACE_DEV_Addr : public ACE_Addr -{ -public: - // = Initialization methods. - /// Default constructor. - ACE_DEV_Addr (void); - - /// Copy constructor. - ACE_DEV_Addr (const ACE_DEV_Addr &sa); - - /// Acts like a copy constructor. - int set (const ACE_DEV_Addr &sa); - - /// Create a ACE_DEV_Addr from a device name. - explicit ACE_DEV_Addr (const ACE_TCHAR *devname); - - /// Create a ACE_Addr from a ACE_DEV pathname. - void set (const ACE_TCHAR *devname); - - /// Assignment operator. - ACE_DEV_Addr &operator= (const ACE_DEV_Addr &); - - /// Return a pointer to the address. - virtual void *get_addr (void) const; - - /// Transform the current address into string format. - virtual int addr_to_string (ACE_TCHAR *addr, size_t) const; - - /// Compare two addresses for equality. - bool operator == (const ACE_DEV_Addr &SAP) const; - - /// Compare two addresses for inequality. - bool operator != (const ACE_DEV_Addr &SAP) const; - - /// Return the path name used for the rendezvous point. - const ACE_TCHAR *get_path_name (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - enum { DEVNAME_LENGTH = MAXPATHLEN + 1 }; - /// Name of the device. - ACE_TCHAR devname_[DEVNAME_LENGTH]; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/DEV_Addr.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_DEV_ADDR_H */ diff --git a/dep/acelite/ace/DEV_Addr.inl b/dep/acelite/ace/DEV_Addr.inl deleted file mode 100644 index 5c1da68d7e7..00000000000 --- a/dep/acelite/ace/DEV_Addr.inl +++ /dev/null @@ -1,51 +0,0 @@ -// -*- C++ -*- -// -// $Id: DEV_Addr.inl 80826 2008-03-04 14:51:23Z wotte $ - -#include "ace/OS_NS_string.h" -#include "ace/Global_Macros.h" -#include "ace/os_include/sys/os_socket.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE void -ACE_DEV_Addr::set (const ACE_TCHAR *devname) -{ - ACE_TRACE ("ACE_DEV_Addr::set"); - - this->ACE_Addr::base_set - (AF_DEV, static_cast (ACE_OS::strlen (devname))); - ACE_OS::strsncpy (this->devname_, devname, ACE_DEV_Addr::DEVNAME_LENGTH); -} - -// Compare two addresses for equality. - -ACE_INLINE bool -ACE_DEV_Addr::operator == (const ACE_DEV_Addr &sap) const -{ - ACE_TRACE ("ACE_DEV_Addr::operator =="); - - return ACE_OS::strcmp (this->devname_, sap.devname_) == 0; -} - -// Compare two addresses for inequality. - -ACE_INLINE bool -ACE_DEV_Addr::operator != (const ACE_DEV_Addr &sap) const -{ - ACE_TRACE ("ACE_DEV_Addr::operator !="); - - return !((*this) == sap); // This is lazy, of course... ;-). -} - -// Return the path name used for the rendezvous point. - -ACE_INLINE const ACE_TCHAR * -ACE_DEV_Addr::get_path_name (void) const -{ - ACE_TRACE ("ACE_DEV_Addr::get_path_name"); - - return this->devname_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/DEV_Connector.cpp b/dep/acelite/ace/DEV_Connector.cpp deleted file mode 100644 index 6251dc670aa..00000000000 --- a/dep/acelite/ace/DEV_Connector.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// $Id: DEV_Connector.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/DEV_Connector.h" - -#include "ace/Handle_Ops.h" - -#if !defined (__ACE_INLINE__) -#include "ace/DEV_Connector.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_DEV_Connector) - -void -ACE_DEV_Connector::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_DEV_Connector::dump"); -#endif /* ACE_HAS_DUMP */ -} - -ACE_DEV_Connector::ACE_DEV_Connector (void) -{ - ACE_TRACE ("ACE_DEV_Connector::ACE_DEV_Connector"); -} - -int -ACE_DEV_Connector::connect (ACE_DEV_IO &new_io, - const ACE_DEV_Addr &remote_sap, - ACE_Time_Value *timeout, - const ACE_Addr &, - int, - int flags, - int perms) -{ - ACE_TRACE ("ACE_DEV_Connector::connect"); - - ACE_HANDLE handle = ACE::handle_timed_open (timeout, - remote_sap.get_path_name (), - flags, perms); - new_io.set_handle (handle); - new_io.addr_ = remote_sap; // class copy. - return handle == ACE_INVALID_HANDLE ? -1 : 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/DEV_Connector.h b/dep/acelite/ace/DEV_Connector.h deleted file mode 100644 index 2f71f608882..00000000000 --- a/dep/acelite/ace/DEV_Connector.h +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file DEV_Connector.h - * - * $Id: DEV_Connector.h 82723 2008-09-16 09:35:44Z johnnyw $ - * - * @author Gerhard Lenzer and Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_DEV_CONNECTOR_H -#define ACE_DEV_CONNECTOR_H -#include /**/ "ace/pre.h" - -#include "ace/DEV_IO.h" -#include "ace/Log_Msg.h" -#include "ace/os_include/os_fcntl.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_DEV_Connector - * - * @brief Defines an active connection factory for the ACE_DEV wrappers. - */ -class ACE_Export ACE_DEV_Connector -{ -public: - /// Default constructor. - ACE_DEV_Connector (void); - - /** - * Actively connect and produce a @a new_io if things go well. - * The @a remote_sap is the address that we are trying to connect - * with. The @a timeout is the amount of time to wait to connect. - * If it's 0 then we block indefinitely. If *timeout == {0, 0} then - * the connection is done using non-blocking mode. In this case, if - * the connection can't be made immediately the value of -1 is - * returned with @c errno == EWOULDBLOCK. If *timeout > {0, 0} then - * this is the maximum amount of time to wait before timing out. If the - * time expires before the connection is made @c errno == ETIME. The - * @a local_sap is the value of local address to bind to. If it's - * the default value of ACE_Addr::sap_any then the user is letting - * the OS do the binding. If @a reuse_addr == 1 then the - * is reused, even if it hasn't been cleanedup yet. - * The @a flags and @a perms arguments are passed down to the - * method. - */ - ACE_DEV_Connector (ACE_DEV_IO &new_io, - const ACE_DEV_Addr &remote_sap, - ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = O_RDWR, - int perms = 0); - - /** - * Actively connect and produce a @a new_io if things go well. - * The @a remote_sap is the address that we are trying to connect - * with. The @a timeout is the amount of time to wait to connect. - * If it's 0 then we block indefinitely. If *timeout == {0, 0} then - * the connection is done using non-blocking mode. In this case, if - * the connection can't be made immediately the value of -1 is - * returned with @c errno == EWOULDBLOCK. If *timeout > {0, 0} then - * this is the maximum amount of time to wait before timing out. If the - * time expires before the connection is made @c errno == ETIME. The - * @a local_sap is the value of local address to bind to. If it's - * the default value of ACE_Addr::sap_any then the user is letting - * the OS do the binding. If @a reuse_addr == 1 then the - * is reused, even if it hasn't been cleanedup yet. - * The @a flags and @a perms arguments are passed down to the - * method. - */ - int connect (ACE_DEV_IO &new_io, - const ACE_DEV_Addr &remote_sap, - ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = O_RDWR, - int perms = 0); - - /// Resets any event associations on this handle - bool reset_new_handle (ACE_HANDLE handle); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - // = Meta-type info - typedef ACE_DEV_Addr PEER_ADDR; - typedef ACE_DEV_IO PEER_STREAM; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/DEV_Connector.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_DEV_CONNECTOR_H */ diff --git a/dep/acelite/ace/DEV_Connector.inl b/dep/acelite/ace/DEV_Connector.inl deleted file mode 100644 index a57a38b71f4..00000000000 --- a/dep/acelite/ace/DEV_Connector.inl +++ /dev/null @@ -1,33 +0,0 @@ -// -*- C++ -*- -// -// $Id: DEV_Connector.inl 82723 2008-09-16 09:35:44Z johnnyw $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Creates a Local ACE_DEV. - -ACE_INLINE -ACE_DEV_Connector::ACE_DEV_Connector (ACE_DEV_IO &new_io, - const ACE_DEV_Addr &remote_sap, - ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - int reuse_addr, - int flags, - int perms) -{ - ACE_TRACE ("ACE_DEV_Connector::ACE_DEV_Connector"); - if (this->connect (new_io, remote_sap, timeout, local_sap, - reuse_addr, flags, perms) == ACE_IO_SAP::INVALID_HANDLE - && timeout != 0 && !(errno == EWOULDBLOCK || errno == ETIME)) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("address %s, %p\n"), - remote_sap.get_path_name (), ACE_TEXT ("ACE_DEV_IO"))); -} - -ACE_INLINE bool -ACE_DEV_Connector::reset_new_handle (ACE_HANDLE) -{ - // Nothing to do here since the handle is not a socket - return false; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/DEV_IO.cpp b/dep/acelite/ace/DEV_IO.cpp deleted file mode 100644 index a16aca006ab..00000000000 --- a/dep/acelite/ace/DEV_IO.cpp +++ /dev/null @@ -1,131 +0,0 @@ -// $Id: DEV_IO.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/DEV_IO.h" -#include "ace/Log_Msg.h" - -#if !defined (__ACE_INLINE__) -#include "ace/DEV_IO.inl" -#endif /* __ACE_INLINE__ */ - - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_DEV_IO) - -// Return the local endpoint address. - -int -ACE_DEV_IO::get_local_addr (ACE_DEV_Addr &addr) const -{ - ACE_TRACE ("ACE_DEV_IO::get_local_addr"); - - addr = this->addr_; - return 0; -} - -// Return the address of the remotely connected peer (if there is -// one). - -int -ACE_DEV_IO::get_remote_addr (ACE_DEV_Addr &addr) const -{ - ACE_TRACE ("ACE_DEV_IO::get_remote_addr"); - addr = this->addr_; - return 0; -} - -void -ACE_DEV_IO::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_DEV_IO::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - this->addr_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -// Simple-minded do nothing constructor. - -ACE_DEV_IO::ACE_DEV_IO (void) -{ - ACE_TRACE ("ACE_DEV_IO::ACE_DEV_IO"); -} - -// Send N char *ptrs and int lengths. Note that the char *'s precede -// the ints (basically, an varargs version of writev). The count N is -// the *total* number of trailing arguments, *not* a couple of the -// number of tuple pairs! - -ssize_t -ACE_DEV_IO::send (size_t n, ...) const -{ - ACE_TRACE ("ACE_DEV_IO::send"); - va_list argp; - int total_tuples = static_cast (n / 2); - iovec *iovp; -#if defined (ACE_HAS_ALLOCA) - iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); -#else - ACE_NEW_RETURN (iovp, - iovec[total_tuples], - -1); -#endif /* !defined (ACE_HAS_ALLOCA) */ - - va_start (argp, n); - - for (int i = 0; i < total_tuples; i++) - { - iovp[i].iov_base = va_arg (argp, char *); - iovp[i].iov_len = va_arg (argp, int); - } - - ssize_t result = ACE_OS::writev (this->get_handle (), iovp, total_tuples); -#if !defined (ACE_HAS_ALLOCA) - delete [] iovp; -#endif /* !defined (ACE_HAS_ALLOCA) */ - va_end (argp); - return result; -} - -// This is basically an interface to ACE_OS::readv, that doesn't use the -// struct iovec explicitly. The ... can be passed as an arbitrary -// number of (char *ptr, int len) tuples. However, the count N is the -// *total* number of trailing arguments, *not* a couple of the number -// of tuple pairs! - -ssize_t -ACE_DEV_IO::recv (size_t n, ...) const -{ - ACE_TRACE ("ACE_DEV_IO::recv"); - va_list argp; - int total_tuples = static_cast (n / 2); - iovec *iovp; -#if defined (ACE_HAS_ALLOCA) - iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); -#else - ACE_NEW_RETURN (iovp, - iovec[total_tuples], - -1); -#endif /* !defined (ACE_HAS_ALLOCA) */ - - va_start (argp, n); - - for (int i = 0; i < total_tuples; i++) - { - iovp[i].iov_base = va_arg (argp, char *); - iovp[i].iov_len = va_arg (argp, int); - } - - ssize_t result = ACE_OS::readv (this->get_handle (), iovp, total_tuples); -#if !defined (ACE_HAS_ALLOCA) - delete [] iovp; -#endif /* !defined (ACE_HAS_ALLOCA) */ - va_end (argp); - return result; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/DEV_IO.h b/dep/acelite/ace/DEV_IO.h deleted file mode 100644 index 3b1c3deb334..00000000000 --- a/dep/acelite/ace/DEV_IO.h +++ /dev/null @@ -1,185 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file DEV_IO.h - * - * $Id: DEV_IO.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Gerhard Lenzer - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_DEV_IO_H -#define ACE_DEV_IO_H -#include /**/ "ace/pre.h" - -#include "ace/DEV.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_STREAM_PIPES) -# include "ace/OS_NS_stropts.h" -#endif /* ACE_HAS_STREAM_PIPES */ - -#include "ace/os_include/os_stdio.h" -#include "ace/os_include/sys/os_uio.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Time_Value; - -/** - * @class ACE_DEV_IO - * - * @brief Read/Write operations on Devices. - */ -class ACE_Export ACE_DEV_IO : public ACE_DEV -{ -public: - friend class ACE_DEV_Connector; - - /// Default constructor. - ACE_DEV_IO (void); - - // = Various send operations. - /// send upto @a n bytes in @a buf. - ssize_t send (const void *buf, size_t n) const; - - /// Recv upto @a n bytes in @a buf. - ssize_t recv (void *buf, size_t n) const; - - /// Send n bytes, keep trying until n are sent. - ssize_t send_n (const void *buf, - size_t n) const; - - /** - * @name I/O operations - * - * Notes on common parameters: - * - * @a buf is the buffer to write from or receive into. - * - * @a len is the number of bytes to transfer. - * - * The @a timeout parameter in the following methods indicates how - * long to blocking trying to transfer data. If @a timeout == 0, - * then the call behaves as a normal send/recv call, i.e., for - * blocking sockets, the call will block until action is possible; - * for non-blocking sockets, EWOULDBLOCK will be returned if no - * action is immediately possible. - * - * If @a timeout != 0, the call will wait until the relative time - * specified in *@a timeout elapses. - * - * The "_n()" I/O methods keep looping until all the data has been - * transferred. These methods also work for sockets in non-blocking - * mode i.e., they keep looping on EWOULDBLOCK. @a timeout is used - * to make sure we keep making progress, i.e., the same timeout - * value is used for every I/O operation in the loop and the timeout - * is not counted down. - * - * The return values for the "*_n()" methods match the return values - * from the non "_n()" methods and are specified as follows: - * - * - On complete transfer, the number of bytes transferred is returned. - * - On timeout, -1 is returned, errno == ETIME. - * - On error, -1 is returned, errno is set to appropriate error. - * - On EOF, 0 is returned, errno is irrelevant. - * - * On partial transfers, i.e., if any data is transferred before - * timeout/error/EOF, @a bytes_transferred will contain the number of - * bytes transferred. - */ - ssize_t recv_n (void *buf, - size_t n, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0) const; - -#if defined (ACE_HAS_STREAM_PIPES) - /// Recv bytes via STREAM pipes using "band" mode. - ssize_t recv (ACE_Str_Buf *cntl, - ACE_Str_Buf *data, - int *band, - int *flags) const; - - /// Send bytes via STREAM pipes using "band" mode. - ssize_t send (const ACE_Str_Buf *cntl, - const ACE_Str_Buf *data, - int band, - int flags) const; - - /// Recv @a cntl and @a data via STREAM pipes. - ssize_t recv (ACE_Str_Buf *cntl, - ACE_Str_Buf *data, - int *flags) const; - - /// Send @a cntl and @a data via STREAM pipes. - ssize_t send (const ACE_Str_Buf *cntl, - const ACE_Str_Buf *data, - int flags = 0) const; -#endif /* ACE_HAS_STREAM_PIPES */ - - /// Send iovecs via <::writev>. - ssize_t send (const iovec iov[], size_t n) const; - - /// Recv iovecs via <::readv>. - ssize_t recv (iovec iov[], size_t n) const; - - /** - * Send N char *ptrs and int lengths. Note that the char *'s - * precede the ints (basically, an varargs version of writev). The - * count N is the *total* number of trailing arguments, *not* a - * couple of the number of tuple pairs! - */ - ssize_t send (size_t n, ...) const; - - /** - * This is an interface to ::readv, that doesn't use the struct - * iovec explicitly. The ... can be passed as an arbitrary number - * of (char *ptr, int len) tuples. However, the count N is the - * *total* number of trailing arguments, *not* a couple of the - * number of tuple pairs! - */ - ssize_t recv (size_t n, ...) const; - - /// Send @a n bytes via Win32 WriteFile using overlapped I/O. - ssize_t send (const void *buf, size_t n, ACE_OVERLAPPED *overlapped) const; - - /// Recv @a n bytes via Win32 ReadFile using overlapped I/O. - ssize_t recv (void *buf, size_t n, ACE_OVERLAPPED *overlapped) const; - - /// Dump the state of an object. - void dump (void) const; - - // = The following two methods are no-ops to keep the - // ACE_Connector happy. - /// Return the local endpoint address. - int get_local_addr (ACE_DEV_Addr &) const; - - /// Return the address of the remotely connected peer (if there is - /// one). - int get_remote_addr (ACE_DEV_Addr &) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - // = Meta-type info - typedef ACE_DEV_Addr PEER_ADDR; - -private: - /// Address of device we are connected to. - ACE_DEV_Addr addr_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/DEV_IO.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_DEV_IO_H */ diff --git a/dep/acelite/ace/DEV_IO.inl b/dep/acelite/ace/DEV_IO.inl deleted file mode 100644 index 796d24e114a..00000000000 --- a/dep/acelite/ace/DEV_IO.inl +++ /dev/null @@ -1,126 +0,0 @@ -// -*- C++ -*- -// -// $Id: DEV_IO.inl 80826 2008-03-04 14:51:23Z wotte $ - -#include "ace/OS_NS_sys_uio.h" -#include "ace/OS_NS_unistd.h" -#include "ace/OS_Memory.h" - -#include "ace/ACE.h" - -// Send exactly N bytes from BUF to this device. Keeping trying until -// this many bytes are sent. - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE ssize_t -ACE_DEV_IO::send_n (const void *buf, size_t n) const -{ - ACE_TRACE ("ACE_DEV_IO::send_n"); - return ACE::write_n (this->get_handle (), buf, n); -} - -// Receive exactly N bytes from this file into BUF. Keep trying until -// this many bytes are received. - -ACE_INLINE ssize_t -ACE_DEV_IO::recv_n (void *buf, - size_t n, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) const -{ - ACE_TRACE ("ACE_DEV_IO::recv_n"); -#if defined (ACE_WIN32) - ACE_UNUSED_ARG (timeout); - - return ACE::read_n (this->get_handle (), - buf, - n, - bytes_transferred); -#else - return ACE::recv_n (this->get_handle (), - buf, - n, - timeout, - bytes_transferred); -#endif /*ACE_WIN32*/ -} - -ACE_INLINE ssize_t -ACE_DEV_IO::send (const void *buf, size_t n) const -{ - ACE_TRACE ("ACE_DEV_IO::send"); - return ACE_OS::write (this->get_handle (), (const char *) buf, n); -} - -ACE_INLINE ssize_t -ACE_DEV_IO::recv (void *buf, size_t n) const -{ - ACE_TRACE ("ACE_DEV_IO::recv"); - return ACE_OS::read (this->get_handle (), (char *) buf, n); -} - -ACE_INLINE ssize_t -ACE_DEV_IO::send (const iovec iov[], size_t n) const -{ - ACE_TRACE ("ACE_DEV_IO::send"); - return ACE_OS::writev (this->get_handle (), iov, static_cast (n)); -} - -ACE_INLINE ssize_t -ACE_DEV_IO::recv (iovec iov[], size_t n) const -{ - ACE_TRACE ("ACE_DEV_IO::recv"); - return ACE_OS::readv (this->get_handle (), iov, static_cast (n)); -} - -ACE_INLINE ssize_t -ACE_DEV_IO::send (const void *buf, size_t n, - ACE_OVERLAPPED *overlapped) const -{ - ACE_TRACE ("ACE_DEV_IO::send"); - return ACE_OS::write (this->get_handle (), - (const char *) buf, n, - overlapped); -} - -ACE_INLINE ssize_t -ACE_DEV_IO::recv (void *buf, size_t n, - ACE_OVERLAPPED *overlapped) const -{ - ACE_TRACE ("ACE_DEV_IO::recv"); - return ACE_OS::read (this->get_handle (), (char *) buf, n, - overlapped); -} - -#if defined (ACE_HAS_STREAM_PIPES) -ACE_INLINE ssize_t -ACE_DEV_IO::recv (ACE_Str_Buf *cntl, ACE_Str_Buf *data, int *band, int *flags) const -{ - ACE_TRACE ("ACE_DEV_IO::recv"); - return ACE_OS::getpmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, band, flags); -} - -ACE_INLINE ssize_t -ACE_DEV_IO::send (const ACE_Str_Buf *cntl, const ACE_Str_Buf *data, int band, int flags) const -{ - ACE_TRACE ("ACE_DEV_IO::send"); - return ACE_OS::putpmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, band, flags); -} - -ACE_INLINE ssize_t -ACE_DEV_IO::recv (ACE_Str_Buf *cntl, ACE_Str_Buf *data, int *flags) const -{ - ACE_TRACE ("ACE_DEV_IO::recv"); - return ACE_OS::getmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, flags); -} - -ACE_INLINE ssize_t -ACE_DEV_IO::send (const ACE_Str_Buf *cntl, const ACE_Str_Buf *data, int flags) const -{ - ACE_TRACE ("ACE_DEV_IO::send"); - return ACE_OS::putmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, flags); -} -#endif /* ACE_HAS_STREAM_PIPES */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/DLL.cpp b/dep/acelite/ace/DLL.cpp deleted file mode 100644 index 1f9604678d9..00000000000 --- a/dep/acelite/ace/DLL.cpp +++ /dev/null @@ -1,267 +0,0 @@ -// $Id: DLL.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/DLL.h" - -#include "ace/Log_Msg.h" -#include "ace/ACE.h" -#include "ace/DLL_Manager.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_dlfcn.h" -#include "ace/OS_NS_Thread.h" - -#include - - - - ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Default constructor. Also, by default, the object will be closed -// before it is destroyed. - -ACE_DLL::ACE_DLL (bool close_handle_on_destruction) - : open_mode_ (0), - dll_name_ (0), - close_handle_on_destruction_ (close_handle_on_destruction), - dll_handle_ (0), - error_ (0) -{ - ACE_TRACE ("ACE_DLL::ACE_DLL (int)"); -} - -ACE_DLL::ACE_DLL (const ACE_DLL &rhs) - : open_mode_ (0), - dll_name_ (0), - close_handle_on_destruction_ (false), - dll_handle_ (0), - error_ (0) -{ - ACE_TRACE ("ACE_DLL::ACE_DLL (const ACE_DLL &)"); - - if (rhs.dll_name_ - // This will automatically up the refcount. - && this->open (rhs.dll_name_, - rhs.open_mode_, - rhs.close_handle_on_destruction_) != 0 - && ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE_DLL::copy_ctor: error: %s\n"), - this->error ())); -} - -// Assignment operator - -ACE_DLL & -ACE_DLL::operator= (const ACE_DLL &rhs) -{ - ACE_TRACE ("ACE_DLL::operator= (const ACE_DLL &)"); - - ACE_DLL tmp (rhs); - - std::swap (this->open_mode_, tmp.open_mode_); - std::swap (this->dll_name_, tmp.dll_name_); - std::swap (this->close_handle_on_destruction_, - tmp.close_handle_on_destruction_); - std::swap (this->dll_handle_, tmp.dll_handle_); - std::swap (this->error_, tmp.error_); - - return *this; -} - - -// If the library name and the opening mode are specified than on -// object creation the library is implicitly opened. - -ACE_DLL::ACE_DLL (const ACE_TCHAR *dll_name, - int open_mode, - bool close_handle_on_destruction) - : open_mode_ (open_mode), - dll_name_ (0), - close_handle_on_destruction_ (close_handle_on_destruction), - dll_handle_ (0), - error_ (0) -{ - ACE_TRACE ("ACE_DLL::ACE_DLL"); - - if (this->open (dll_name, this->open_mode_, close_handle_on_destruction) != 0 - && ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE_DLL::open: error calling open: %s\n"), - this->error ())); -} - -// The library is closed before the class gets destroyed depending on -// the close_handle_on_destruction value specified which is stored in -// close_handle_on_destruction_. - -ACE_DLL::~ACE_DLL (void) -{ - ACE_TRACE ("ACE_DLL::~ACE_DLL"); - - this->close (); - - // Normally delete()d in ACE_DLL::close(). However, that may not - // occur if full ACE_DLL initialization is interrupted due to errors - // (e.g. attempting to open a DSO/DLL that does not exist). Make - // sure this->dll_name_ is deallocated. - delete [] this->dll_name_; -} - -// This method opens the library based on the mode specified using the -// ACE_SHLIB_HANDLE which is obtained on making the ACE_OS::dlopen call. -// The default mode is: -// RTLD_LAZY Only references to data symbols are relocate when the -// object is first loaded. -// The other modes include: -// RTLD_NOW All necessary relocations are performed when the -// object is first loaded. -// RTLD_GLOBAL The object symbols are made available for the -// relocation processing of any other object. - -int -ACE_DLL::open (const ACE_TCHAR *dll_filename, - int open_mode, - bool close_handle_on_destruction) -{ - ACE_TRACE ("ACE_DLL::open"); - - return open_i (dll_filename, open_mode, close_handle_on_destruction); -} - -int -ACE_DLL::open_i (const ACE_TCHAR *dll_filename, - int open_mode, - bool close_handle_on_destruction, - ACE_SHLIB_HANDLE handle) -{ - ACE_TRACE ("ACE_DLL::open_i"); - - this->error_ = 0; - - if (!dll_filename) - { - if (ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE_DLL::open_i: dll_name is %s\n"), - this->dll_name_ == 0 ? ACE_TEXT ("(null)") - : this->dll_name_)); - return -1; - } - - if (this->dll_handle_) - { - // If we have a good handle and its the same name, just return. - if (ACE_OS::strcmp (this->dll_name_, dll_filename) == 0) - return 0; - else - this->close (); - } - - if (!this->dll_name_) - this->dll_name_ = ACE::strnew (dll_filename); - - this->open_mode_ = open_mode; - this->close_handle_on_destruction_ = close_handle_on_destruction; - - this->dll_handle_ = ACE_DLL_Manager::instance()->open_dll (this->dll_name_, - this->open_mode_, - handle); - - if (!this->dll_handle_) - this->error_ = 1; - - return this->error_ ? -1 : 0; -} - -// The symbol refernce of the name specified is obtained. - -void * -ACE_DLL::symbol (const ACE_TCHAR *sym_name, int ignore_errors) -{ - ACE_TRACE ("ACE_DLL::symbol"); - - this->error_ = 0; - - void *sym = 0; - if (this->dll_handle_) - sym = this->dll_handle_->symbol (sym_name, ignore_errors); - - if (!sym) - this->error_ = 1; - - return sym; -} - -// The library is closed using the ACE_SHLIB_HANDLE object, i.e., the -// shared object is now disassociated form the current process. - -int -ACE_DLL::close (void) -{ - ACE_TRACE ("ACE_DLL::close"); - - int retval = 0; - - if (this->dll_handle_ - && this->close_handle_on_destruction_ - && this->dll_name_ - && (retval = ACE_DLL_Manager::instance ()->close_dll (this->dll_name_)) != 0) - this->error_ = 1; - - // Even if close_dll() failed, go ahead and cleanup. - this->dll_handle_ = 0; - delete [] this->dll_name_; - this->dll_name_ = 0; - this->close_handle_on_destruction_ = false; - - return retval; -} - -// This method is used return the last error of a library operation. - -ACE_TCHAR * -ACE_DLL::error (void) const -{ - ACE_TRACE ("ACE_DLL::error"); - if (this->error_) - { - return ACE_OS::dlerror (); - } - - return 0; -} - -// Return the handle to the user either temporarily or forever, thus -// orphaning it. If 0 means the user wants the handle forever and if 1 -// means the user temporarily wants to take the handle. - -ACE_SHLIB_HANDLE -ACE_DLL::get_handle (int become_owner) const -{ - ACE_TRACE ("ACE_DLL::get_handle"); - - ACE_SHLIB_HANDLE handle = ACE_SHLIB_INVALID_HANDLE; - - if (this->dll_handle_) - handle = this->dll_handle_->get_handle (become_owner); - - return handle; -} - -// Set the handle for the DLL. By default, the object will be closed -// before it is destroyed. - -int -ACE_DLL::set_handle (ACE_SHLIB_HANDLE handle, - bool close_handle_on_destruction) -{ - ACE_TRACE ("ACE_DLL::set_handle"); - - // Create a unique name. Note that this name is only quaranteed - // to be unique for the life of this object. - ACE_TCHAR temp[ACE_UNIQUE_NAME_LEN]; - ACE_OS::unique_name (this, temp, ACE_UNIQUE_NAME_LEN); - - return this->open_i (temp, 1, close_handle_on_destruction, handle); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/DLL.h b/dep/acelite/ace/DLL.h deleted file mode 100644 index 4b1251eb704..00000000000 --- a/dep/acelite/ace/DLL.h +++ /dev/null @@ -1,209 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file DLL.h - * - * $Id: DLL.h 95913 2012-06-21 17:14:36Z johnnyw $ - * - * @author Kirthika Parameswaran - */ -//============================================================================= - -#ifndef ACE_DLL_H -#define ACE_DLL_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Global_Macros.h" -#include "ace/os_include/os_dlfcn.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_DLL_Handle; - -/** - * @class ACE_DLL - * - * @brief Provides an abstract interface for handling various DLL - * operations. - * - * This class is a wrapper over the various methods for utilizing - * a dynamically linked library (DLL), which is called a shared - * library on some platforms. Operations @c open(), @c close(), and - * @c symbol() have been implemented to help opening/closing and - * extracting symbol information from a DLL, respectively. - */ -class ACE_Export ACE_DLL -{ -public: - // = Initialization and termination methods. - - /** - * Default constructor. By default, the close() operation on the - * object will be invoked before it is destroyed. - * @param close_handle_on_destruction Indicates whether or not the - * close() method will be called to close an open DLL when this - * object is destroyed. By default, close() will be called. - * Set this parameter to 0 for situations where the DLL's lifetime - * is controlled in a scope other than that of this ACE_DLL object. - * For example, termination by ACE_DLL_Manager via ACE::fini(). - */ - explicit ACE_DLL (bool close_handle_on_destruction = true); - - /// Allow assignment - ACE_DLL& operator= (const ACE_DLL &rhs); - - - /** - * This constructor performs the actions of open() during construction. - * @param dll_name The name or path of the DLL to load. - * @param open_mode Flags to alter the actions taken when loading the DLL. - * The possible values are: - * @li @c RTLD_LAZY (this the default): loads identifier symbols but - * not the symbols for functions, which are loaded dynamically - * on-demand. - * @li @c RTLD_NOW: performs all necessary relocations when - * @a dll_name is first loaded - * @li RTLD_GLOBAL: makes symbols available for relocation - * processing of any other DLLs. - * @param close_handle_on_destruction Indicates whether or not the - * close() method will be called to close an open DLL when this - * object is destroyed. By default, close() will be called. - * Set this parameter to 0 for situations where the DLL's lifetime - * is controlled in a scope other than that of this ACE_DLL object. - * For example, termination by ACE_DLL_Manager via ACE::fini(). - */ - explicit ACE_DLL (const ACE_TCHAR *dll_name, - int open_mode = ACE_DEFAULT_SHLIB_MODE, - bool close_handle_on_destruction = true); - - /// Copy constructor. - ACE_DLL (const ACE_DLL &); - - /** - * This method opens and dynamically links a specified DLL. - * @param dll_name The filename or path of the DLL to load. ACE will - * attempt to apply the platform's standard library/DLL prefixes - * and suffixes, allowing a simple, unadorned name to be passed - * regardless of platform. The set of name transforms is listed - * below. A @i decorator is a platform's name designator for a debug - * vs release build. For example, on Windows it is usually "d". - * @li Prefix + name + decorator + suffix - * @li Prefix + name + suffix - * @li Name + decorator + suffix - * @li Name + suffix - * @li Name - * Note that the transforms with @i decorator will be avoided if - * ACE is built with the @c ACE_DISABLE_DEBUG_DLL_CHECK config macro. - * - * @Note There is another mode for locating library/DLL files that - * was used in old versions of ACE. The alternate method builds - * more combinations of pathname by combining the names transforms - * above with locations listed in the platform's standard "path" - * locations (e.g., @c LD_LIBRARY_PATH). It can be enabled by building - * ACE with the @c ACE_MUST_HELP_DLOPEN_SEARCH_PATH config macro. - * Use of this option is discouraged since it avoids the standard - * platform search options and security mechanisms. - * - * @param open_mode Flags to alter the actions taken when loading the DLL. - * The possible values are: - * @li @c RTLD_LAZY (this the default): loads identifier symbols but - * not the symbols for functions, which are loaded dynamically - * on demand. - * @li @c RTLD_NOW: performs all necessary relocations when - * @a dll_name is first loaded - * @li @c RTLD_GLOBAL: makes symbols available for relocation - * processing of any other DLLs. - * @param close_handle_on_destruction Indicates whether or not the - * close() method will be called to close an open DLL when this - * object is destroyed. By default, close() will be called. - * Set this parameter to 0 for situations where the DLL's lifetime - * is controlled in a scope other than that of this ACE_DLL object. - * For example, termination by ACE_DLL_Manager via ACE::fini(). - * @retval -1 On failure - * @retval 0 On success. - */ - int open (const ACE_TCHAR *dll_name, - int open_mode = ACE_DEFAULT_SHLIB_MODE, - bool close_handle_on_destruction = true); - - /// Call to close the DLL object. - int close (void); - - /** - * Called when the DLL object is destroyed -- invokes close() if the - * @a close_handle_on_destruction flag was set to non-zero in the - * constructor or open() method. - */ - ~ACE_DLL (void); - - /** - * Look up a named symbol in the DLL. DLL must be successfully opened - * before calling symbol(). - * @param symbol_name The symbol name to look up. - * @param ignore_errors If set to 1, allows you to probe a dll without - * generating error messages in the log. Handy for determining - * the capabilities of a library. - * @return Returns the value of @a symbol_name if it is a valid symbol - * in the DLL. Otherwise, returns 0. - */ - void *symbol (const ACE_TCHAR *symbol_name, int ignore_errors = 0); - - /// Returns a pointer to a string explaining that an error occured. You - /// will need to consult the error log for the actual error string - /// returned by the OS. - ACE_TCHAR *error (void) const; - - /** - * Return the handle to the caller. If @a become_owner is non-0 then - * caller assumes ownership of the handle and the ACE_DLL object - * won't call close() when it goes out of scope, even if - * @c close_handle_on_destruction is set. - */ - ACE_SHLIB_HANDLE get_handle (int become_owner = 0) const; - - /// Set the handle for the DLL object. By default, the close() - /// operation on / the object will be invoked before it is destroyed. - int set_handle (ACE_SHLIB_HANDLE handle, - bool close_handle_on_destruction = true); - -private: - - int open_i (const ACE_TCHAR *dll_name, - int open_mode = ACE_DEFAULT_SHLIB_MODE, - bool close_handle_on_destruction = true, - ACE_SHLIB_HANDLE handle = 0); - - - //private: -public: - - /// Open mode. - int open_mode_; - - /// Keep track of the name of the loaded dll, so it can be used - /// to remove framework components, singletons that live in the dll, - /// prior to unloading the dll in the close() method. - ACE_TCHAR *dll_name_; - - /// This flag keeps track of whether we should close the handle - /// automatically when the object is destroyed. - bool close_handle_on_destruction_; - - ACE_DLL_Handle *dll_handle_; - - /// Flag to record if the last operation had an error. - bool error_; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_DLL_H */ diff --git a/dep/acelite/ace/DLL_Manager.cpp b/dep/acelite/ace/DLL_Manager.cpp deleted file mode 100644 index ebba7d64add..00000000000 --- a/dep/acelite/ace/DLL_Manager.cpp +++ /dev/null @@ -1,781 +0,0 @@ -// $Id: DLL_Manager.cpp 95913 2012-06-21 17:14:36Z johnnyw $ - -#include "ace/DLL_Manager.h" - -#include "ace/Log_Msg.h" -#include "ace/ACE.h" -#include "ace/Framework_Component.h" - -#include "ace/Lib_Find.h" -#include "ace/Object_Manager.h" -#include "ace/SString.h" -#include "ace/Recursive_Thread_Mutex.h" -#include "ace/Guard_T.h" -#include "ace/OS_NS_dlfcn.h" -#include "ace/OS_NS_string.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -sig_atomic_t ACE_DLL_Handle::open_called_ = 0; - -ACE_DLL_Handle::ACE_DLL_Handle (void) - : refcount_ (0), - dll_name_ (0), - handle_ (ACE_SHLIB_INVALID_HANDLE) -{ - ACE_TRACE ("ACE_DLL_Handle::ACE_DLL_Handle"); -} - -ACE_DLL_Handle::~ACE_DLL_Handle (void) -{ - ACE_TRACE ("ACE_DLL_Handle::~ACE_DLL_Handle"); - this->close (1); - delete[] this->dll_name_; -} - -const ACE_TCHAR * -ACE_DLL_Handle::dll_name (void) const -{ - ACE_TRACE ("ACE_DLL_Handle::dll_name"); - return this->dll_name_; -} - -int -ACE_DLL_Handle::open (const ACE_TCHAR *dll_name, - int open_mode, - ACE_SHLIB_HANDLE handle) -{ - ACE_TRACE ("ACE_DLL_Handle::open"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); - - if (this->dll_name_) - { - // Once dll_name_ has been set, it can't be changed.. - if (ACE_OS::strcmp (this->dll_name_, dll_name) != 0) - { - if (ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE (%P|%t) DLL_Handle::open: error, ") - ACE_TEXT ("tried to reopen %s with name %s\n"), - this->dll_name_, - dll_name)); - - return -1; - } - } - else - this->dll_name_ = ACE::strnew (dll_name); - - if (!this->open_called_) - this->open_called_ = 1; - - // If it hasn't been loaded yet, go ahead and do that now. - if (this->handle_ == ACE_SHLIB_INVALID_HANDLE) - { - if (handle) - this->handle_ = handle; - else - { - /* - ** Get the set of names to try loading. We need to do this to - ** properly support the ability for a user to specify a simple, - ** unadorned name (for example, "ACE") that will work across - ** platforms. We apply platform specifics to get a name that will - ** work (e.g. libACE, ACEd.dll, ACE.dll, etc.) We rely on the - ** underlying dlopen() implementation to "Do The Right Thing" in - ** terms of using relative paths, LD_LIBRARY_PATH, system security - ** rules, etc. except when ACE_MUST_HELP_DLOPEN_SEARCH_PATH is set. - ** If it is set, then ACE::ldfind() scans the configured path - ** looking for a match on the name and prefix/suffix applications. - ** NOTE: having ACE scan for a file and then pass a fully-qualified - ** pathname to dlopen() is a potential security hole; therefore, - ** do not use ACE_MUST_HELP_DLOPEN_SEARCH_PATH unless necessary - ** and only after considering the risks. - */ - ACE_Array dll_names; - dll_names.max_size (10); // Decent guess to avoid realloc later - -#if defined (ACE_MUST_HELP_DLOPEN_SEARCH_PATH) - // Find out where the library is - ACE_TCHAR dll_pathname[MAXPATHLEN + 1]; - - // Transform the pathname into the appropriate dynamic link library - // by searching the ACE_LD_SEARCH_PATH. - ACE::ldfind (dll_name, - dll_pathname, - (sizeof dll_pathname / sizeof (ACE_TCHAR))); - ACE_TString dll_str (dll_pathname); - dll_names.size (1); - dll_names.set (dll_str, 0); -#else - this->get_dll_names (dll_name, dll_names); -#endif - - ACE_Array_Iterator name_iter (dll_names); - ACE_TString *name = 0; - while (name_iter.next (name)) - { - // The ACE_SHLIB_HANDLE object is obtained. - this->handle_ = ACE_OS::dlopen (name->c_str (), - open_mode); - - if (ACE::debug ()) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("ACE (%P|%t) DLL_Handle::open ") - ACE_TEXT ("(\"%s\", 0x%x) -> %s: %s\n"), - name->c_str (), - open_mode, - ((this->handle_ != ACE_SHLIB_INVALID_HANDLE) - ? ACE_TEXT ("succeeded") - : ACE_TEXT ("failed")), - this->error()->c_str())); - } - - if (this->handle_ != ACE_SHLIB_INVALID_HANDLE) // Good one? - break; - - // If errno is ENOENT we just skip over this one, - // anything else - like an undefined symbol, for - // instance must be flagged here or the next error will - // mask it. - // @TODO: If we've found our DLL _and_ it's - // broken, should we continue at all? - if ((errno != 0) && (errno != ENOENT) && ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE (%P|%t) DLL_Handle::open ") - ACE_TEXT ("(\'%s\') failed, errno=") - ACE_TEXT ("%d: <%s>\n"), - name->c_str (), - ACE_ERRNO_GET, - this->error ()->c_str ())); - -#if defined (AIX) - // AIX often puts the shared library file (most often named - // shr.o) inside an archive library. If this is an archive - // library name, then try appending [shr.o] and retry. - if (ACE_TString::npos != name->strstr (ACE_TEXT (".a"))) - { - ACE_TCHAR aix_pathname[MAXPATHLEN + 1]; - ACE_OS::strncpy (aix_pathname, - name->c_str (), - name->length ()); - aix_pathname[name->length ()] = '\0'; - ACE_OS::strcat (aix_pathname, ACE_TEXT ("(shr.o)")); - open_mode |= RTLD_MEMBER; - - if (ACE::debug ()) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("ACE (%P|%t) DLL_Handle::open ") - ACE_TEXT ("(\"%s\", 0x%x) -> %s: %s\n"), - aix_pathname, - open_mode, - (this->handle_ != ACE_SHLIB_INVALID_HANDLE - ? ACE_TEXT ("succeeded") - : ACE_TEXT ("failed")), - this->error()->c_str())); - } - - this->handle_ = ACE_OS::dlopen (aix_pathname, open_mode); - if (this->handle_ != ACE_SHLIB_INVALID_HANDLE) - break; - - // If errno is ENOENT we just skip over this one, anything - // else - like an undefined symbol, for instance - // must be flagged here or the next error will mask it. - // - // @TODO: If we've found our DLL _and_ it's broken, - // should we continue at all? - if (ACE::debug () && (errno != 0) && (errno != ENOENT)) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE (%P|%t) DLL_Handle::open ") - ACE_TEXT ("(\'%s\') failed, errno=") - ACE_TEXT ("%d: %s\n"), - name->c_str (), - errno, - this->error ()->c_str ())); - - } -#endif /* AIX */ - - name_iter.advance (); - } - - if (this->handle_ == ACE_SHLIB_INVALID_HANDLE) - { - if (ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE (%P|%t) DLL_Handle::open (\"%s\"): ") - ACE_TEXT ("Invalid handle error: %s\n"), - this->dll_name_, - this->error ()->c_str ())); - - return -1; - } - } - } - - ++this->refcount_; - - if (ACE::debug ()) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("ACE (%P|%t) DLL_Handle::open - %s (%d), refcount=%d\n"), - this->dll_name_, - this->handle_, - this->refcount_)); - return 0; -} - - -int -ACE_DLL_Handle::close (int unload) -{ - ACE_TRACE ("ACE_DLL_Handle::close"); - - int retval = 0; - ACE_SHLIB_HANDLE h = ACE_SHLIB_INVALID_HANDLE; - - // Only hold the lock until it comes time to dlclose() the DLL. Closing - // the DLL can cause further shutdowns as DLLs and their dependents are - // unloaded. - { - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); - - // Since we don't actually unload the dll as soon as the refcount - // reaches zero, we need to make sure we don't decrement it below - // zero. - if (this->refcount_ > 0) - --this->refcount_; - else - this->refcount_ = 0; - - if (ACE::debug ()) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("ACE (%P|%t) DLL_Handle::close - ") - ACE_TEXT ("%s (handle=%d, refcount=%d)\n"), - this->dll_name_, - this->handle_, - this->refcount_)); - - if (this->refcount_ == 0 && - this->handle_ != ACE_SHLIB_INVALID_HANDLE && - unload == 1) - { - if (ACE::debug ()) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("ACE (%P|%t) DLL_Handle::close: ") - ACE_TEXT ("Unloading %s (handle=%d)\n"), - this->dll_name_, - this->handle_)); - - // First remove any associated Framework Components. - ACE_Framework_Repository *frPtr= ACE_Framework_Repository::instance (); - if (frPtr) - { - frPtr->remove_dll_components (this->dll_name_); - } - - h = this->handle_; - this->handle_ = ACE_SHLIB_INVALID_HANDLE; - } - } // Release lock_ here - - if (h != ACE_SHLIB_INVALID_HANDLE) - { - retval = ACE_OS::dlclose (h); - - if (retval != 0 && ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE (%P|%t) DLL_Handle::close - ") - ACE_TEXT ("Failed with: \"%s\".\n"), - this->error ()->c_str ())); - } - - return retval; -} - -sig_atomic_t -ACE_DLL_Handle::refcount (void) const -{ - return this->refcount_; -} - -void * -ACE_DLL_Handle::symbol (const ACE_TCHAR *sym_name, int ignore_errors) -{ - ACE_TRACE ("ACE_DLL_Handle::symbol"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); - - ACE_Auto_Array_Ptr auto_name (ACE::ldname (sym_name)); - // handle_ can be invalid especially when ACE_DLL_Handle resigned ownership - // BTW. Handle lifecycle management is a little crazy in ACE - if (this->handle_ != ACE_SHLIB_INVALID_HANDLE) - { -#if defined (ACE_OPENVMS) - void *sym = ACE::ldsymbol (this->handle_, auto_name.get ()); -#else - void *sym = ACE_OS::dlsym (this->handle_, auto_name.get ()); -#endif - - // Linux says that the symbol could be null and that it isn't an - // error. So you should check the error message also, but since - // null symbols won't do us much good anyway, let's still report - // an error. - if (!sym && ignore_errors != 1) - { - if (ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE (%P|%t) DLL_Handle::symbol (\"%s\") ") - ACE_TEXT (" failed with \"%s\".\n"), - auto_name.get (), - this->error ()->c_str ())); - - return 0; - } - return sym; - } - return 0; -} - -ACE_SHLIB_HANDLE -ACE_DLL_Handle::get_handle (int become_owner) -{ - ACE_TRACE ("ACE_DLL_Handle::get_handle"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); - - if (this->refcount_ == 0 && become_owner != 0) - { - if (ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE (%P|%t) DLL_Handle::get_handle: ") - ACE_TEXT ("cannot become owner, refcount == 0.\n"))); - - return ACE_SHLIB_INVALID_HANDLE; - } - - ACE_SHLIB_HANDLE handle = this->handle_; - - if (become_owner != 0) - { - if (--this->refcount_ == 0) - this->handle_ = ACE_SHLIB_INVALID_HANDLE; - } - - if (ACE::debug ()) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("ACE (%P|%t) DLL_Handle::get_handle: ") - ACE_TEXT ("post call: handle %s, refcount %d\n"), - this->handle_ == ACE_SHLIB_INVALID_HANDLE ? - ACE_TEXT ("invalid") : ACE_TEXT ("valid"), - this->refcount_)); - - return handle; -} - -// This method is used return the last error of a library operation. - -auto_ptr -ACE_DLL_Handle::error (void) -{ - ACE_TRACE ("ACE_DLL_Handle::error"); - const ACE_TCHAR *error = ACE_OS::dlerror (); - auto_ptr str - (new ACE_TString (error ? error : ACE_TEXT ("no error"))); - return str; -} - -void -ACE_DLL_Handle::get_dll_names (const ACE_TCHAR *dll_name, - ACE_Array &try_names) -{ - // Build the array of DLL names to try on this platform by applying the - // proper prefixes and/or suffixes to the specified dll_name. - ACE_TString base (dll_name); - ACE_TString base_dir, base_file, base_suffix; - - // 1. Separate the dll_name into the dir part and the file part. We - // only decorate the file part to determine the names to try loading. - ACE_TString::size_type pos = base.rfind (ACE_DIRECTORY_SEPARATOR_CHAR); - if (pos != ACE_TString::npos) - { - base_dir = base.substr (0, pos + 1); - base_file = base.substr (pos + 1); - } - else - base_file = base; - - // 2. Locate the file suffix, if there is one. Move the '.' and the - // suffix to base_suffix. - if ((pos = base_file.rfind (ACE_TEXT ('.'))) != ACE_TString::npos) - { - base_suffix = base_file.substr (pos); - base_file = base_file.substr (0, pos); - } - - // 3. Build the combinations to try for this platform. - // Try these combinations: - // - name with platform's dll prefix (if it has one) and suffix - // - name with platform's dll prefix, decorator, and suffix. - // - name with decorator and platform's suffix appended (if not supplied) - // - name with platform's suffix appended (if not supplied) - // - name as originally given - // We first try to find the file using the decorator so that when a - // filename with and without decorator is used, we get the file with - // the same decorator as the ACE dll has and then as last resort - // the one without. For example with msvc, the debug build has a "d" - // decorator, but the release build has none and we really want to get - // the debug version of the library in a debug application instead - // of the release one. - // So we need room for 5 entries in try_names. - try_names.size (0); - if ((try_names.max_size () - try_names.size ()) < 5) - try_names.max_size (try_names.max_size () + 5); -#if defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK) - ACE_TString decorator (ACE_LD_DECORATOR_STR); -#endif - ACE_TString suffix (ACE_DLL_SUFFIX); - ACE_TString prefix (ACE_DLL_PREFIX); - - for (size_t i = 0; i < 5 && try_names.size () < try_names.max_size (); ++i) - { - ACE_TString try_this; - size_t const j = try_names.size (); - switch (i) - { - case 0: // Prefix + name + decorator + suffix - case 1: // Prefix + name + suffix - case 2: // Name + decorator + suffix - case 3: // Name + suffix - if ( - base_suffix.length () > 0 -#if !(defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK)) - || (i == 1 || i == 3) // No decorator desired; skip -#endif - ) - break; - try_this = base_dir; - if (i < 2) - try_this += prefix; - try_this += base_file; - if (base_suffix.length () > 0) - try_this += base_suffix; - else - { -#if defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK) - try_this += decorator; -#endif - try_this += suffix; - } - break; - case 4: - try_this = dll_name; - break; - } - - if (try_this.length ()) - { - try_names.size (j + 1); - try_names.set (try_this, j); - } - } - return; -} - -/******************************************************************/ - -// Pointer to the Singleton instance. -ACE_DLL_Manager *ACE_DLL_Manager::instance_ = 0; - - -ACE_DLL_Manager * -ACE_DLL_Manager::instance (int size) -{ - ACE_TRACE ("ACE_DLL_Manager::instance"); - - if (ACE_DLL_Manager::instance_ == 0) - { - // Perform Double-Checked Locking Optimization. - ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, - *ACE_Static_Object_Lock::instance (), 0)); - if (ACE_DLL_Manager::instance_ == 0) - { - ACE_NEW_RETURN (ACE_DLL_Manager::instance_, - ACE_DLL_Manager (size), - 0); - } - } - - return ACE_DLL_Manager::instance_; -} - -void -ACE_DLL_Manager::close_singleton (void) -{ - ACE_TRACE ("ACE_DLL_Manager::close_singleton"); - - ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, - *ACE_Static_Object_Lock::instance ())); - - delete ACE_DLL_Manager::instance_; - ACE_DLL_Manager::instance_ = 0; -} - -ACE_DLL_Manager::ACE_DLL_Manager (int size) - : handle_vector_ (0), - current_size_ (0), - total_size_ (0), - unload_policy_ (ACE_DLL_UNLOAD_POLICY_PER_DLL) -{ - ACE_TRACE ("ACE_DLL_Manager::ACE_DLL_Manager"); - - if (this->open (size) != 0 && ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE (%P|%t) DLL_Manager ctor failed to allocate ") - ACE_TEXT ("handle_vector_.\n"))); -} - -ACE_DLL_Manager::~ACE_DLL_Manager (void) -{ - ACE_TRACE ("ACE_DLL_Manager::~ACE_DLL_Manager"); - - if (this->close () != 0 && ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE (%P|%t) DLL_Manager dtor failed to close ") - ACE_TEXT ("properly.\n"))); -} - -ACE_DLL_Handle * -ACE_DLL_Manager::open_dll (const ACE_TCHAR *dll_name, - int open_mode, - ACE_SHLIB_HANDLE handle) -{ - ACE_TRACE ("ACE_DLL_Manager::open_dll"); - - ACE_DLL_Handle *temp_handle = 0; - ACE_DLL_Handle *dll_handle = 0; - { - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); - dll_handle = this->find_dll (dll_name); - if (!dll_handle) - { - if (this->current_size_ < this->total_size_) - { - ACE_NEW_RETURN (temp_handle, - ACE_DLL_Handle, - 0); - - dll_handle = temp_handle; - } - } - } - - if (dll_handle) - { - if (dll_handle->open (dll_name, open_mode, handle) != 0) - { - // Error while opening dll. Free temp handle - if (ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE (%P|%t) DLL_Manager::open_dll: Could not ") - ACE_TEXT ("open dll %s.\n"), - dll_name)); - - delete temp_handle; - return 0; - } - - // Add the handle to the vector only if the dll is successfully - // opened. - if (temp_handle != 0) - { - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); - this->handle_vector_[this->current_size_] = dll_handle; - ++this->current_size_; - } - } - - return dll_handle; -} - -int -ACE_DLL_Manager::close_dll (const ACE_TCHAR *dll_name) -{ - ACE_TRACE ("ACE_DLL_Manager::close_dll"); - ACE_DLL_Handle *handle = 0; - - { - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); - handle = this->find_dll (dll_name); - } - - if (handle) - { - return this->unload_dll (handle, 0); - } - - return -1; -} - -u_long -ACE_DLL_Manager::unload_policy (void) const -{ - ACE_TRACE ("ACE_DLL_Manager::unload_policy"); - return this->unload_policy_; -} - -void -ACE_DLL_Manager::unload_policy (u_long unload_policy) -{ - ACE_TRACE ("ACE_DLL_Manager::unload_policy"); - ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, this->lock_)); - - u_long old_policy = this->unload_policy_; - this->unload_policy_ = unload_policy; - - // If going from LAZY to EAGER or from PER_DLL to PER_PROCESS|EAGER, - // call close(1) on all the ACE_DLL_Handle objects with refcount == 0 - // which will force those that are still loaded to be unloaded. - if (this->handle_vector_) - if (( ACE_BIT_ENABLED (old_policy, ACE_DLL_UNLOAD_POLICY_LAZY) && - ACE_BIT_DISABLED (this->unload_policy_, ACE_DLL_UNLOAD_POLICY_LAZY) ) || - ( ACE_BIT_DISABLED (this->unload_policy_, ACE_DLL_UNLOAD_POLICY_LAZY) && - ACE_BIT_ENABLED (old_policy, ACE_DLL_UNLOAD_POLICY_PER_DLL) && - ACE_BIT_DISABLED (this->unload_policy_, ACE_DLL_UNLOAD_POLICY_PER_DLL) )) - { - for (int i = this->current_size_ - 1; i >= 0; i--) - { - if (this->handle_vector_[i] && - this->handle_vector_[i]->refcount () == 0) - this->handle_vector_[i]->close (1); - } - } -} - -int -ACE_DLL_Manager::open (int size) -{ - ACE_TRACE ("ACE_DLL_Manager::open"); - - ACE_DLL_Handle **temp = 0; - - ACE_NEW_RETURN (temp, - ACE_DLL_Handle *[size], - -1); - - this->handle_vector_ = temp; - this->total_size_ = size; - return 0; -} - -int -ACE_DLL_Manager::close (void) -{ - ACE_TRACE ("ACE_DLL_Manager::close"); - - int force_close = 1; - - if (this->handle_vector_ != 0) - { - // Delete components in reverse order. - for (int i = this->current_size_ - 1; i >= 0; i--) - { - if (this->handle_vector_[i]) - { - ACE_DLL_Handle *s = - const_cast (this->handle_vector_[i]); - this->handle_vector_[i] = 0; - this->unload_dll (s, force_close); - delete s; - } - } - - delete [] this->handle_vector_; - this->handle_vector_ = 0; - this->current_size_ = 0; - } - return 0; -} - -ACE_DLL_Handle * -ACE_DLL_Manager::find_dll (const ACE_TCHAR *dll_name) const -{ - ACE_TRACE ("ACE_DLL_Manager::find_dll"); - - for (int i = 0; i < this->current_size_; i++) - if (this->handle_vector_[i] && - ACE_OS::strcmp (this->handle_vector_[i]->dll_name (), dll_name) == 0) - { - return this->handle_vector_[i]; - } - - return 0; -} - -int -ACE_DLL_Manager::unload_dll (ACE_DLL_Handle *dll_handle, int force_unload) -{ - ACE_TRACE ("ACE_DLL_Manager::unload_dll"); - - if (dll_handle) - { - int unload = force_unload; - if (unload == 0) - { - // apply strategy - if (ACE_BIT_DISABLED (this->unload_policy_, - ACE_DLL_UNLOAD_POLICY_PER_DLL)) - { - unload = ACE_BIT_DISABLED (this->unload_policy_, - ACE_DLL_UNLOAD_POLICY_LAZY); - } - else - { - // Declare the type of the symbol: - typedef int (*dll_unload_policy)(void); - - void * const unload_policy_ptr = - dll_handle->symbol (ACE_TEXT ("_get_dll_unload_policy"), 1); -#if defined (ACE_OPENVMS) && (!defined (__INITIAL_POINTER_SIZE) || (__INITIAL_POINTER_SIZE < 64)) - int const temp_p = - reinterpret_cast (unload_policy_ptr); -#else - intptr_t const temp_p = - reinterpret_cast (unload_policy_ptr); -#endif - - dll_unload_policy const the_policy = - reinterpret_cast (temp_p); - - if (the_policy != 0) - unload = ACE_BIT_DISABLED (the_policy (), - ACE_DLL_UNLOAD_POLICY_LAZY); - else - unload = ACE_BIT_DISABLED (this->unload_policy_, - ACE_DLL_UNLOAD_POLICY_LAZY); - } - } - - if (dll_handle->close (unload) != 0) - { - if (ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE (%P|%t) DLL_Manager::unload error.\n"))); - - return -1; - } - } - else - { - if (ACE::debug ()) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE (%P|%t) DLL_Manager::unload_dll called with ") - ACE_TEXT ("null pointer.\n"))); - - return -1; - } - - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/DLL_Manager.h b/dep/acelite/ace/DLL_Manager.h deleted file mode 100644 index 71d8f13c579..00000000000 --- a/dep/acelite/ace/DLL_Manager.h +++ /dev/null @@ -1,299 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file DLL_Manager.h - * - * $Id: DLL_Manager.h 95913 2012-06-21 17:14:36Z johnnyw $ - * - * @author Don Hinton - */ -//============================================================================= - -#ifndef ACE_DLL_MANAGER_H -#define ACE_DLL_MANAGER_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Auto_Ptr.h" -#include "ace/Containers_T.h" -#include "ace/SStringfwd.h" -#include "ace/os_include/os_dlfcn.h" - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) -# include "ace/Thread_Mutex.h" -#endif /* ACE_MT_SAFE */ - -#define ACE_DEFAULT_DLL_MANAGER_SIZE 1024 - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_DLL_Handle - * - * @brief Provides an abstract interface for handling various DLL - * operations. - * - * This class is an wrapper over the various methods for utilizing a - * dynamically linked library (DLL), which is called a shared library - * on some platforms. It is refcounted and managed by - * ACE_DLL_Manager, so there will only be a single instance of this - * class for each dll loaded, no matter how many instances of ACE_DLL - * an application has open. Operations open(), close(), and symbol() - * have been implemented to help opening/closing and extracting symbol - * information from a DLL, respectively. - * - * Most of this class came from the original ACE_DLL class. ACE_DLL - * is now just an interface that passed all it's calls either directly - * or via ACE_DLL_Manager to this class for execution. - * - */ -class ACE_Export ACE_DLL_Handle -{ -public: - - /// Default construtor. - ACE_DLL_Handle (void); - - /// Destructor. - ~ACE_DLL_Handle (void); - - /// Returns the name of the shared library (without prefixes or suffixes). - const ACE_TCHAR *dll_name () const; - - /** - * This method opens and dynamically links a library/DLL. - * @param dll_name The filename or path of the DLL to load. ACE will - * attempt to apply the platform's standard library/DLL prefixes - * and suffixes, allowing a simple, unadorned name to be passed - * regardless of platform. The set of name transforms is listed - * below. A @i decorator is a platform's name designator for a debug - * vs release build. For example, on Windows it is usually "d". - * @li Prefix + name + decorator + suffix - * @li Prefix + name + suffix - * @li Name + decorator + suffix - * @li Name + suffix - * @li Name - * Note that the transforms with @i decorator will be avoided if - * ACE is built with the @c ACE_DISABLE_DEBUG_DLL_CHECK config macro. - * - * @Note There is another mode for locating library/DLL files that - * was used in old versions of ACE. The alternate method builds - * more combinations of pathname by combining the names transforms - * above with locations listed in the platform's standard "path" - * locations (e.g., @c LD_LIBRARY_PATH). It can be enabled by building - * ACE with the @c ACE_MUST_HELP_DLOPEN_SEARCH_PATH config macro. - * Use of this option is discouraged since it avoids the standard - * platform search options and security mechanisms. - * - * @param open_mode Flags to alter the actions taken when loading the DLL. - * The possible values are: - * @li @c RTLD_LAZY (this the default): loads identifier symbols but - * not the symbols for functions, which are loaded dynamically - * on demand. - * @li @c RTLD_NOW: performs all necessary relocations when - * @a dll_name is first loaded - * @li @c RTLD_GLOBAL: makes symbols available for relocation - * processing of any other DLLs. - * @param handle If a value other than @c ACE_INVALID_HANDLE is supplied, - * this object is assigned the specified handle instead of attempting - * to open the specified @a dll_name. - * @retval -1 On failure - * @retval 0 On success. - */ - int open (const ACE_TCHAR *dll_name, - int open_mode, - ACE_SHLIB_HANDLE handle); - - /// Call to close the DLL object. If unload = 0, it only decrements - /// the refcount, but if unload = 1, then it will actually unload - /// the library when the refcount == 0; - int close (int unload = 0); - - /// Return the current refcount. - sig_atomic_t refcount (void) const; - - /// If @a symbol_name is in the symbol table of the DLL a pointer to - /// the @a symbol_name is returned. Otherwise, returns 0. Set the - /// ignore_errors flag to supress logging errors if symbol_name isn't - /// found. This is nice if you just want to probe a dll to see what's - /// available, since missing functions in that case aren't really errors. - void *symbol (const ACE_TCHAR *symbol_name, int ignore_errors = 0); - - /** - * Return the handle to the caller. If @a become_owner is non-0 then - * caller assumes ownership of the handle so we decrement the retcount. - */ - ACE_SHLIB_HANDLE get_handle (int become_owner = 0); - -private: - - /// Returns a pointer to a string explaining why or - /// failed. This is used internal to print out the error to the log, - /// but since this object is shared, we can't store or return the error - /// to the caller. - auto_ptr error (void); - - /// Builds array of DLL names to try to dlopen, based on platform - /// and configured DLL prefixes/suffixes. - /// Returns the array of names to try in try_names. - void get_dll_names (const ACE_TCHAR *dll_name, - ACE_Array &try_names); - - /// Disallow copying and assignment since we don't handle them. - ACE_DLL_Handle (const ACE_DLL_Handle &); - void operator= (const ACE_DLL_Handle &); - -private: - - /// Keep track of how many ACE_DLL objects have a reference to this - /// dll. - sig_atomic_t refcount_; - - /// Name of the shared library. - ACE_TCHAR *dll_name_; - - /// Handle to the actual library loaded by the OS. - ACE_SHLIB_HANDLE handle_; - - /// Keeps track of whether or not open() has ever been called. This - /// helps get around problem on Linux, and perhaps other OS's, that - /// seg-fault if dlerror() is called before the ld library has been - /// initialized by a call to dlopen(). - static sig_atomic_t open_called_; - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - /// Synchronization variable for the MT_SAFE Repository - ACE_Thread_Mutex lock_; -#endif /* ACE_MT_SAFE */ -}; - -class ACE_Framework_Repository; - -/** - * @class ACE_DLL_Manager - * - * @brief This class is a singleton and serves as a factory and - * repository for instances of ACE_DLL_Handle. - * - * This class is a singleton whose lifetime is managed by the - * ACE_Framework_Repository. Although it is normally meant to be - * used directly only by ACE_DLL, applications can call the unload_policy() - * methods in order get/set the the dll unload policy. Unload policies include - * per_process/per-dll and eager/lazy. Dlls can export set their own policy - * by using the ACE_DLL_UNLOAD_POLICY macro found in config-all.h. If a dll - * choses to set an unload policy, it will be used when the per-dll policy - * (the default) is in effect. If the per-dll policy is in effect and a dll - * has not chosen to set a policy, the current per-process policy will be - * used. - * - * The following policy macros are provided in config-all.h: - * - * ACE_DLL_UNLOAD_POLICY_PER_PROCESS - Per-process policy that unloads dlls - * eagerly. - * - * ACE_DLL_UNLOAD_POLICY_PER_DLL - Apply policy on a per-dll basis. If the - * dll doesn't use one of the macros below, the current per-process policy - * will be used. - * - * ACE_DLL_UNLOAD_POLICY_LAZY - Don't unload dll when refcount reaches - * zero, i.e., wait for either an explicit unload request or program exit. - * - * ACE_DLL_UNLOAD_POLICY_DEFAULT - Default policy allows dlls to control - * their own destinies, but will unload those that don't make a choice eagerly. - * - */ -class ACE_Export ACE_DLL_Manager -{ -public: - friend class ACE_Framework_Repository; - friend class ACE_Object_Manager; - - enum - { - DEFAULT_SIZE = ACE_DEFAULT_DLL_MANAGER_SIZE - }; - - /// Return a unique instance - static ACE_DLL_Manager *instance (int size = ACE_DLL_Manager::DEFAULT_SIZE); - - /// Factory for ACE_DLL_Handle objects. If one already exits, - /// its refcount is incremented. - ACE_DLL_Handle *open_dll (const ACE_TCHAR *dll_name, - int openmode, - ACE_SHLIB_HANDLE handle); - - /// Close the underlying dll. Decrements the refcount. - int close_dll (const ACE_TCHAR *dll_name); - - /// Returns the current per-process UNLOAD_POLICY. - u_long unload_policy (void) const; - - /// Set the per-process UNLOAD_POLICY. If the policy is changed from - /// LAZY to EAGER, then it will also unload any dlls with zero - /// refcounts. - void unload_policy (u_long unload_policy); - -protected: - - /// Default constructor. - ACE_DLL_Manager (int size = ACE_DLL_Manager::DEFAULT_SIZE); - - /// Destructor. - ~ACE_DLL_Manager (void); - - /// Allocate handle_vector_. - int open (int size); - - /// Close all open dlls and deallocate memory. - int close (void); - - /// Find dll in handle_vector_. - ACE_DLL_Handle *find_dll (const ACE_TCHAR *dll_name) const; - - /// Applies strategy for unloading dll. - int unload_dll (ACE_DLL_Handle *dll_handle, int force_unload = 0); - -private: - - /// Close the singleton instance. - static void close_singleton (void); - - /// Disallow copying and assignment since we don't handle these. - ACE_DLL_Manager (const ACE_DLL_Manager &); - void operator= (const ACE_DLL_Manager &); - -private: - - /// Vector containing all loaded handle objects. - ACE_DLL_Handle **handle_vector_; - - /// Current number of handles. - int current_size_; - - /// Maximum number of handles. - int total_size_; - - /// Unload strategy. - u_long unload_policy_; - - /// Pointer to a process-wide ACE_DLL_Manager. - static ACE_DLL_Manager *instance_; - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - /// Synchronization variable for the MT_SAFE Repository - ACE_Thread_Mutex lock_; -#endif /* ACE_MT_SAFE */ - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_DLL_MANAGER_H */ diff --git a/dep/acelite/ace/Date_Time.cpp b/dep/acelite/ace/Date_Time.cpp deleted file mode 100644 index 2cc6b69f3f8..00000000000 --- a/dep/acelite/ace/Date_Time.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// Date_Time.cpp -// $Id: Date_Time.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/Date_Time.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Date_Time.inl" -#endif /* __ACE_INLINE__ */ - - diff --git a/dep/acelite/ace/Date_Time.h b/dep/acelite/ace/Date_Time.h deleted file mode 100644 index a15d435eeb8..00000000000 --- a/dep/acelite/ace/Date_Time.h +++ /dev/null @@ -1,125 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Date_Time.h - * - * $Id: Date_Time.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Tim Harrison (harrison@cs.wustl.edu) (and he's darn proud of this ;-)) - * - */ -//========================================================================== - -#ifndef ACE_DATE_TIME_H -#define ACE_DATE_TIME_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Time_Value; - -/** - * @class ACE_Date_Time - * - * @brief System independent representation of date and time. - */ -class ACE_Export ACE_Date_Time -{ -public: - /// Constructor initializes current time/date info. - ACE_Date_Time (void); - - /// Constructor initializes with the given ACE_Time_Value - explicit ACE_Date_Time (const ACE_Time_Value& timevalue); - - /// Constructor with init values, no check for validy - /// Set/get portions of ACE_Date_Time, no check for validity. - ACE_Date_Time (long day, - long month = 0, - long year = 0, - long hour = 0, - long minute = 0, - long second = 0, - long microsec = 0, - long wday = 0); - - /// Update to the current time/date. - void update (void); - - /// Update to the given ACE_Time_Value - void update (const ACE_Time_Value& timevalue); - - /// Get day. - long day (void) const; - - /// Set day. - void day (long day); - - /// Get month. - long month (void) const; - - /// Set month. - void month (long month); - - /// Get year. - long year (void) const; - - /// Set year. - void year (long year); - - /// Get hour. - long hour (void) const; - - /// Set hour. - void hour (long hour); - - /// Get minute. - long minute (void) const; - - /// Set minute. - void minute (long minute); - - /// Get second. - long second (void) const; - - /// Set second. - void second (long second); - - /// Get microsec. - long microsec (void) const; - - /// Set microsec. - void microsec (long microsec); - - /// Get weekday. - long weekday (void) const; - - /// Set weekday. - void weekday (long wday); - -private: - long day_; - long month_; - long year_; - long hour_; - long minute_; - long second_; - long microsec_; - long wday_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Date_Time.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_DATE_TIME_H */ diff --git a/dep/acelite/ace/Date_Time.inl b/dep/acelite/ace/Date_Time.inl deleted file mode 100644 index d34807d83a4..00000000000 --- a/dep/acelite/ace/Date_Time.inl +++ /dev/null @@ -1,219 +0,0 @@ -// -*- C++ -*- -// -// $Id: Date_Time.inl 80826 2008-03-04 14:51:23Z wotte $ - -#include "ace/Global_Macros.h" -#include "ace/Time_Value.h" -#include "ace/OS_NS_sys_time.h" -#include "ace/OS_NS_time.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE void -ACE_Date_Time::update (const ACE_Time_Value& timevalue) -{ -#if defined (ACE_HAS_WINCE) - // CE doesn't do localtime(). - FILETIME file_time = timevalue; - FILETIME local_file_time; - SYSTEMTIME sys_time; - ::FileTimeToLocalFileTime (&file_time, &local_file_time); - ::FileTimeToSystemTime (&local_file_time, &sys_time); - this->day_ = sys_time.wDay; - this->month_ = sys_time.wMonth; - this->year_ = sys_time.wYear; - this->hour_ = sys_time.wHour; - this->minute_ = sys_time.wMinute; - this->second_ = sys_time.wSecond; - this->microsec_ = sys_time.wMilliseconds * 1000; - this->wday_ = sys_time.wDayOfWeek; -#else - time_t time = timevalue.sec (); - struct tm tm_time; - ACE_OS::localtime_r (&time, &tm_time); - this->day_ = tm_time.tm_mday; - this->month_ = tm_time.tm_mon + 1; // localtime's months are 0-11 - this->year_ = tm_time.tm_year + 1900; // localtime reports years since 1900 - this->hour_ = tm_time.tm_hour; - this->minute_ = tm_time.tm_min; - this->second_ = tm_time.tm_sec; - this->microsec_ = timevalue.usec (); - this->wday_ = tm_time.tm_wday; -#endif /* ACE_HAS_WINCE */ -} - -ACE_INLINE void -ACE_Date_Time::update (void) -{ - ACE_TRACE ("ACE_Date_Time::update"); - - update(ACE_OS::gettimeofday ()); -} - -ACE_INLINE -ACE_Date_Time::ACE_Date_Time (void) -{ - ACE_TRACE ("ACE_Date_Time::ACE_Date_Time"); - this->update (); -} - -ACE_INLINE -ACE_Date_Time::ACE_Date_Time (const ACE_Time_Value& timevalue) -{ - ACE_TRACE ("ACE_Date_Time::ACE_Date_Time: timevalue"); - this->update (timevalue); -} - -// Constructor with init values, no check for validy -ACE_INLINE -ACE_Date_Time::ACE_Date_Time (long day, - long month, - long year, - long hour, - long minute, - long second, - long microsec, - long wday) - : day_ (day), - month_ (month), - year_ (year), - hour_ (hour), - minute_ (minute), - second_ (second), - microsec_ (microsec), - wday_ (wday) -{ - ACE_TRACE ("ACE_Date_Time::ACE_Date_Time"); -} - -// set/get portions of ACE_Date_Time, no check for validy - -// get day -ACE_INLINE long -ACE_Date_Time::day (void) const -{ - ACE_TRACE ("ACE_Date_Time::day"); - return day_; -} - -// set day -ACE_INLINE void -ACE_Date_Time::day (long day) -{ - ACE_TRACE ("ACE_Date_Time::day"); - day_ = day; -} - -// get month -ACE_INLINE long -ACE_Date_Time::month (void) const -{ - ACE_TRACE ("ACE_Date_Time::month"); - return month_; -} - -// set month -ACE_INLINE void -ACE_Date_Time::month (long month) -{ - ACE_TRACE ("ACE_Date_Time::month"); - month_ = month; -} - -// get year -ACE_INLINE long -ACE_Date_Time::year (void) const -{ - ACE_TRACE ("ACE_Date_Time::year"); - return year_; -} - -// set year -ACE_INLINE void -ACE_Date_Time::year (long year) -{ - ACE_TRACE ("ACE_Date_Time::year"); - year_ = year; -} - -// get hour -ACE_INLINE long -ACE_Date_Time::hour (void) const -{ - ACE_TRACE ("ACE_Date_Time::hour"); - return hour_; -} - -// set hour -ACE_INLINE void -ACE_Date_Time::hour (long hour) -{ - ACE_TRACE ("ACE_Date_Time::hour"); - hour_ = hour; -} - -// get minute -ACE_INLINE long -ACE_Date_Time::minute (void) const -{ - ACE_TRACE ("ACE_Date_Time::minute"); - return minute_; -} - -// set minute -ACE_INLINE void -ACE_Date_Time::minute (long minute) -{ - ACE_TRACE ("ACE_Date_Time::minute"); - minute_ = minute; -} - -// get second -ACE_INLINE long -ACE_Date_Time::second (void) const -{ - ACE_TRACE ("ACE_Date_Time::second"); - return second_; -} - -// set second -ACE_INLINE void -ACE_Date_Time::second (long second) -{ - ACE_TRACE ("ACE_Date_Time::second"); - second_ = second; -} - -// get microsec -ACE_INLINE long -ACE_Date_Time::microsec (void) const -{ - ACE_TRACE ("ACE_Date_Time::microsec"); - return microsec_; -} - -// set microsec -ACE_INLINE void -ACE_Date_Time::microsec (long microsec) -{ - ACE_TRACE ("ACE_Date_Time::microsec"); - microsec_ = microsec; -} - -// get wday -ACE_INLINE long -ACE_Date_Time::weekday (void) const -{ - ACE_TRACE ("ACE_Date_Time::weekday"); - return wday_; -} - -// set wday -ACE_INLINE void -ACE_Date_Time::weekday (long wday) -{ - ACE_TRACE ("ACE_Date_Time::weekday"); - wday_ = wday; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Default_Constants.h b/dep/acelite/ace/Default_Constants.h deleted file mode 100644 index c15b7f9f40b..00000000000 --- a/dep/acelite/ace/Default_Constants.h +++ /dev/null @@ -1,590 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Default_Constants.h - * - * $Id: Default_Constants.h 95517 2012-01-30 10:05:01Z sma $ - * - * @author Douglas C. Schmidt - * @author Jesper S. M|ller - * @author and a cast of thousands... - * - * This one is split from the famous OS.h - */ -//============================================================================= - -#ifndef ACE_DEFAULT_CONSTANTS_H -#define ACE_DEFAULT_CONSTANTS_H -#include /**/ "ace/pre.h" - -// Included just keep compilers that see #pragma directive first -// happy. -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// For _POSIX_TIMER_MAX -#include "ace/os_include/os_limits.h" - -// Define the default constants for ACE. Many of these are used for -// the ACE tests and applications. You can change these values by -// defining the macros in your config.h file. -# if !defined (ACE_DEFAULT_CLOSE_ALL_HANDLES) -# define ACE_DEFAULT_CLOSE_ALL_HANDLES true -# endif /* ACE_DEFAULT_CLOSE_ALL_HANDLES */ - -// The maximum length for a fully qualified Internet name. -# if !defined(ACE_MAX_FULLY_QUALIFIED_NAME_LEN) -# define ACE_MAX_FULLY_QUALIFIED_NAME_LEN 256 -# endif /* ACE_MAX_FULLY_QUALIFIED_NAME_LEN */ - -#if !defined (ACE_DEFAULT_PAGEFILE_POOL_BASE) -#define ACE_DEFAULT_PAGEFILE_POOL_BASE (void *) 0 -#endif /* ACE_DEFAULT_PAGEFILE_POOL_BASE */ - -#if !defined (ACE_DEFAULT_PAGEFILE_POOL_SIZE) -#define ACE_DEFAULT_PAGEFILE_POOL_SIZE (size_t) 0x01000000 -#endif /* ACE_DEFAULT_PAGEFILE_POOL_SIZE */ - -#if !defined (ACE_DEFAULT_PAGEFILE_POOL_CHUNK) -#define ACE_DEFAULT_PAGEFILE_POOL_CHUNK (size_t) 0x00010000 -#endif /* ACE_DEFAULT_PAGEFILE_POOL_CHUNK */ - -#if !defined (ACE_DEFAULT_PAGEFILE_POOL_NAME) -#define ACE_DEFAULT_PAGEFILE_POOL_NAME ACE_TEXT ("Default_ACE_Pagefile_Memory_Pool") -#endif /* ACE_DEFAULT_PAGEFILE_POOL_NAME */ - -#if !defined (ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY) -#define ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY 0 -#endif /* ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY */ - -#if !defined (ACE_DEFAULT_SERVICE_REPOSITORY_SIZE) -#define ACE_DEFAULT_SERVICE_REPOSITORY_SIZE 1024 -#endif /* ACE_DEFAULT_SERVICE_REPOSITORY_SIZE */ - -#if !defined (ACE_DEFAULT_SERVICE_GESTALT_SIZE) -#define ACE_DEFAULT_SERVICE_GESTALT_SIZE 1024 -#endif /* ACE_DEFAULT_SERVICE_GESTALT_SIZE */ - -#if !defined (ACE_REACTOR_NOTIFICATION_ARRAY_SIZE) -#define ACE_REACTOR_NOTIFICATION_ARRAY_SIZE 1024 -#endif /* ACE_REACTOR_NOTIFICATION_ARRAY_SIZE */ - -# if !defined (ACE_DEFAULT_TIMEOUT) -# define ACE_DEFAULT_TIMEOUT 5 -# endif /* ACE_DEFAULT_TIMEOUT */ - -# if !defined (ACE_DEFAULT_BACKLOG) -# define ACE_DEFAULT_BACKLOG 5 -# endif /* ACE_DEFAULT_BACKLOG */ - -# if !defined (ACE_DEFAULT_ASYNCH_BACKLOG) -# define ACE_DEFAULT_ASYNCH_BACKLOG 5 -# endif /* ACE_DEFAULT_ASYNCH_BACKLOG */ - -# if !defined (ACE_DEFAULT_THREADS) -# define ACE_DEFAULT_THREADS 1 -# endif /* ACE_DEFAULT_THREADS */ - -// The following 3 defines are used in the IP multicast and broadcast tests. -# if !defined (ACE_DEFAULT_BROADCAST_PORT) -# define ACE_DEFAULT_BROADCAST_PORT 20000 -# endif /* ACE_DEFAULT_BROADCAST_PORT */ - -# if !defined (ACE_DEFAULT_MULTICAST_PORT) -# define ACE_DEFAULT_MULTICAST_PORT 20001 -# endif /* ACE_DEFAULT_MULTICAST_PORT */ - -# if !defined (ACE_DEFAULT_MULTICAST_ADDR) -// This address MUST be within the range for host group addresses: -// 224.0.0.0 to 239.255.255.255. -# define ACE_DEFAULT_MULTICAST_ADDR "224.9.9.2" -# endif /* ACE_DEFAULT_MULTICAST_ADDR */ - -# if defined (ACE_HAS_IPV6) -# if !defined (ACE_DEFAULT_MULTICASTV6_ADDR) -// This address should be within the range for site-local addresses: -// ff05::0/16 . -# define ACE_DEFAULT_MULTICASTV6_ADDR "ff05:0::ff01:1" -# endif /* ACE_DEFAULT_MULTICASTV6_ADDR */ -# endif - -// Default port number for HTTP. -# if !defined (ACE_DEFAULT_HTTP_SERVER_PORT) -# define ACE_DEFAULT_HTTP_SERVER_PORT 80 -# endif /* ACE_DEFAULT_HTTP_SERVER_PORT */ - -// Used in many IPC_SAP tests -# if !defined (ACE_DEFAULT_SERVER_PORT) -# define ACE_DEFAULT_SERVER_PORT 20002 -# endif /* ACE_DEFAULT_SERVER_PORT */ - -# if !defined (ACE_DEFAULT_HTTP_PORT) -# define ACE_DEFAULT_HTTP_PORT 80 -# endif /* ACE_DEFAULT_HTTP_PORT */ - -# if !defined (ACE_DEFAULT_MAX_SOCKET_BUFSIZ) -# define ACE_DEFAULT_MAX_SOCKET_BUFSIZ 65536 -# endif /* ACE_DEFAULT_MAX_SOCKET_BUFSIZ */ - -# if !defined (ACE_DEFAULT_SERVER_PORT_STR) -# define ACE_DEFAULT_SERVER_PORT_STR ACE_TEXT("20002") -# endif /* ACE_DEFAULT_SERVER_PORT_STR */ - -// Used for the Service_Directory test -# if !defined (ACE_DEFAULT_SERVICE_PORT) -# define ACE_DEFAULT_SERVICE_PORT 20003 -# endif /* ACE_DEFAULT_SERVICE_PORT */ - -// Used for the ACE_Thread_Spawn test -# if !defined (ACE_DEFAULT_THR_PORT ) -# define ACE_DEFAULT_THR_PORT 20004 -# endif /* ACE_DEFAULT_THR_PORT */ - -// Used for tests -# if !defined (ACE_DEFAULT_LOCAL_PORT) -# define ACE_DEFAULT_LOCAL_PORT 20005 -# endif /* ACE_DEFAULT_LOCAL_PORT */ - -// Used for Connector tests -# if !defined (ACE_DEFAULT_LOCAL_PORT_STR) -# define ACE_DEFAULT_LOCAL_PORT_STR "20005" -# endif /* ACE_DEFAULT_LOCAL_PORT_STR */ - -// Used for the name server. -# if !defined (ACE_DEFAULT_NAME_SERVER_PORT) -# define ACE_DEFAULT_NAME_SERVER_PORT 20006 -# endif /* ACE_DEFAULT_NAME_SERVER_PORT */ - -# if !defined (ACE_DEFAULT_NAME_SERVER_PORT_STR) -# define ACE_DEFAULT_NAME_SERVER_PORT_STR "20006" -# endif /* ACE_DEFAULT_NAME_SERVER_PORT_STR */ - -// Used for the token server. -# if !defined (ACE_DEFAULT_TOKEN_SERVER_PORT) -# define ACE_DEFAULT_TOKEN_SERVER_PORT 20007 -# endif /* ACE_DEFAULT_TOKEN_SERVER_PORT */ - -# if !defined (ACE_DEFAULT_TOKEN_SERVER_PORT_STR) -# define ACE_DEFAULT_TOKEN_SERVER_PORT_STR "20007" -# endif /* ACE_DEFAULT_TOKEN_SERVER_PORT_STR */ - -// Used for the logging server. -# if !defined (ACE_DEFAULT_LOGGING_SERVER_PORT) -# define ACE_DEFAULT_LOGGING_SERVER_PORT 20008 -# endif /* ACE_DEFAULT_LOGGING_SERVER_PORT */ - -# if !defined (ACE_DEFAULT_LOGGING_SERVER_PORT_STR) -# define ACE_DEFAULT_LOGGING_SERVER_PORT_STR "20008" -# endif /* ACE_DEFAULT_LOGGING_SERVER_PORT_STR */ - -// Used for the logging server. -# if !defined (ACE_DEFAULT_THR_LOGGING_SERVER_PORT) -# define ACE_DEFAULT_THR_LOGGING_SERVER_PORT 20008 -# endif /* ACE_DEFAULT_THR_LOGGING_SERVER_PORT */ - -# if !defined (ACE_DEFAULT_THR_LOGGING_SERVER_PORT_STR) -# define ACE_DEFAULT_THR_LOGGING_SERVER_PORT_STR "20008" -# endif /* ACE_DEFAULT_THR_LOGGING_SERVER_PORT_STR */ - -// Used for the time server. -# if !defined (ACE_DEFAULT_TIME_SERVER_PORT) -# define ACE_DEFAULT_TIME_SERVER_PORT 20009 -# endif /* ACE_DEFAULT_TIME_SERVER_PORT */ - -# if !defined (ACE_DEFAULT_TIME_SERVER_PORT_STR) -# define ACE_DEFAULT_TIME_SERVER_PORT_STR "20009" -# endif /* ACE_DEFAULT_TIME_SERVER_PORT_STR */ - -# if !defined (ACE_DEFAULT_TIME_SERVER_STR) -# define ACE_DEFAULT_TIME_SERVER_STR "ACE_TS_TIME" -# endif /* ACE_DEFAULT_TIME_SERVER_STR */ - -// Used by the FIFO tests -# if !defined (ACE_DEFAULT_RENDEZVOUS) -# if defined (ACE_HAS_STREAM_PIPES) -# define ACE_DEFAULT_RENDEZVOUS ACE_TEXT("/tmp/fifo.ace") -# else -# define ACE_DEFAULT_RENDEZVOUS ACE_TEXT("localhost:20010") -# endif /* ACE_HAS_STREAM_PIPES */ -# endif /* ACE_DEFAULT_RENDEZVOUS */ - -// Used for the UNIX syslog logging interface to ACE_Log_Msg. -# ifndef ACE_DEFAULT_SYSLOG_FACILITY -# define ACE_DEFAULT_SYSLOG_FACILITY LOG_USER -# endif /* ACE_DEFAULT_SYSLOG_FACILITY */ - -# if !defined (ACE_HAS_STREAM_LOG_MSG_IPC) -# if defined (ACE_HAS_STREAM_PIPES) -# define ACE_HAS_STREAM_LOG_MSG_IPC 1 -# else -# define ACE_HAS_STREAM_LOG_MSG_IPC 0 -# endif /* ACE_HAS_STREAM_PIPES */ -# endif /* !ACE_HAS_STREAM_LOG_MSG_IPC */ - -# if !defined (ACE_DEFAULT_LOGGER_KEY) -# if (ACE_HAS_STREAM_LOG_MSG_IPC == 1) -# define ACE_DEFAULT_LOGGER_KEY ACE_TEXT ("/tmp/server_daemon") -# else -# define ACE_DEFAULT_LOGGER_KEY ACE_TEXT ("localhost:20012") -# endif /* ACE_HAS_STREAM_LOG_MSG_IPC==1 */ -# endif /* ACE_DEFAULT_LOGGER_KEY */ - -// The way to specify the local host for loopback IP. This is usually -// "localhost" but it may need changing on some platforms. -# if !defined (ACE_LOCALHOST) -# define ACE_LOCALHOST ACE_TEXT ("localhost") -# endif - -// This specification for an IPv6 localhost should work on all platforms -// supporting IPv6 -# if defined (ACE_HAS_IPV6) -# if !defined (ACE_IPV6_LOCALHOST) -# define ACE_IPV6_LOCALHOST ACE_TEXT ("::1") -# endif /* ACE_IPV6_LOCALHOST*/ -#endif /* ACE_HAS_IPV6 */ - -// This specification for an IPv6 ANY address should work on all platforms -// supporting IPv6 -# if defined (ACE_HAS_IPV6) -# if !defined (ACE_IPV6_ANY) -# define ACE_IPV6_ANY ACE_TEXT ("::") -# endif /* ACE_IPV6_ANY*/ -#endif /* ACE_HAS_IPV6 */ - -# if !defined (ACE_DEFAULT_SERVER_HOST) -# if defined (ACE_HAS_IPV6) -# define ACE_DEFAULT_SERVER_HOST ACE_IPV6_LOCALHOST -# else /*ACE_HAS_IPV6*/ -# define ACE_DEFAULT_SERVER_HOST ACE_LOCALHOST -# endif /*ACE_HAS_IPV6*/ -# endif /* ACE_DEFAULT_SERVER_HOST */ - -// Default shared memory key -# if !defined (ACE_DEFAULT_SHM_KEY) -# define ACE_DEFAULT_SHM_KEY 1234 -# endif /* ACE_DEFAULT_SHM_KEY */ - -// Default address for shared memory mapped files and SYSV shared memory -// (defaults to 64 M). -# if !defined (ACE_DEFAULT_BASE_ADDR) -# define ACE_DEFAULT_BASE_ADDR ((char *) (64 * 1024 * 1024)) -# endif /* ACE_DEFAULT_BASE_ADDR */ - -// Default segment size used by SYSV shared memory (128 K) -# if !defined (ACE_DEFAULT_SEGMENT_SIZE) -# define ACE_DEFAULT_SEGMENT_SIZE 1024 * 128 -# endif /* ACE_DEFAULT_SEGMENT_SIZE */ - -// Maximum number of SYSV shared memory segments -// (does anyone know how to figure out the right values?!) -# if !defined (ACE_DEFAULT_MAX_SEGMENTS) -# define ACE_DEFAULT_MAX_SEGMENTS 6 -# endif /* ACE_DEFAULT_MAX_SEGMENTS */ - -// Name of the map that's stored in shared memory. -# if !defined (ACE_NAME_SERVER_MAP) -# define ACE_NAME_SERVER_MAP "Name Server Map" -# endif /* ACE_NAME_SERVER_MAP */ - -// Default file permissions. -# if !defined (ACE_DEFAULT_FILE_PERMS) -# if defined (ACE_VXWORKS) -# define ACE_DEFAULT_FILE_PERMS (S_IRUSR | S_IWUSR| S_IRGRP| S_IROTH) -# else -# define ACE_DEFAULT_FILE_PERMS 0644 -# endif /* ACE_VXWORKS */ -# endif /* ACE_DEFAULT_FILE_PERMS */ - -// Default directory permissions. -# if !defined (ACE_DEFAULT_DIR_PERMS) -# define ACE_DEFAULT_DIR_PERMS 0755 -# endif /* ACE_DEFAULT_DIR_PERMS */ - -# if !defined (ACE_DEFAULT_TIMEPROBE_TABLE_SIZE) -# define ACE_DEFAULT_TIMEPROBE_TABLE_SIZE 8 * 1024 -# endif /* ACE_DEFAULT_TIMEPROBE_TABLE_SIZE */ - -// Default size of the ACE Map_Manager. -# if !defined (ACE_DEFAULT_MAP_SIZE) -# define ACE_DEFAULT_MAP_SIZE 1024 -# endif /* ACE_DEFAULT_MAP_SIZE */ - -# if defined (ACE_DEFAULT_MAP_SIZE) && (ACE_DEFAULT_MAP_SIZE == 0) -# error ACE_DEFAULT_MAP_SIZE should not be zero -# endif /* ACE_DEFAULT_MAP_SIZE */ - -// Defaults for ACE Timer Wheel -# if !defined (ACE_DEFAULT_TIMER_WHEEL_SIZE) -# define ACE_DEFAULT_TIMER_WHEEL_SIZE 1024 -# endif /* ACE_DEFAULT_TIMER_WHEEL_SIZE */ - -# if !defined (ACE_DEFAULT_TIMER_WHEEL_RESOLUTION) -# define ACE_DEFAULT_TIMER_WHEEL_RESOLUTION 100 -# endif /* ACE_DEFAULT_TIMER_WHEEL_RESOLUTION */ - -// Default size for ACE Timer Hash table -# if !defined (ACE_DEFAULT_TIMER_HASH_TABLE_SIZE) -# define ACE_DEFAULT_TIMER_HASH_TABLE_SIZE 1024 -# endif /* ACE_DEFAULT_TIMER_HASH_TABLE_SIZE */ - -// Defaults for the ACE Free List -# if !defined (ACE_DEFAULT_FREE_LIST_PREALLOC) -# define ACE_DEFAULT_FREE_LIST_PREALLOC 0 -# endif /* ACE_DEFAULT_FREE_LIST_PREALLOC */ - -# if !defined (ACE_DEFAULT_FREE_LIST_LWM) -# define ACE_DEFAULT_FREE_LIST_LWM 0 -# endif /* ACE_DEFAULT_FREE_LIST_LWM */ - -# if !defined (ACE_DEFAULT_FREE_LIST_HWM) -# define ACE_DEFAULT_FREE_LIST_HWM 25000 -# endif /* ACE_DEFAULT_FREE_LIST_HWM */ - -# if !defined (ACE_DEFAULT_FREE_LIST_INC) -# define ACE_DEFAULT_FREE_LIST_INC 100 -# endif /* ACE_DEFAULT_FREE_LIST_INC */ - -# if !defined (ACE_UNIQUE_NAME_LEN) -# define ACE_UNIQUE_NAME_LEN 100 -# endif /* ACE_UNIQUE_NAME_LEN */ - -# if !defined (ACE_MAX_DGRAM_SIZE) - // This is just a guess. 8k is the normal limit on - // most machines because that's what NFS expects. -# define ACE_MAX_DGRAM_SIZE 8192 -# endif /* ACE_MAX_DGRAM_SIZE */ - -# if !defined (ACE_DEFAULT_ARGV_BUFSIZ) -# define ACE_DEFAULT_ARGV_BUFSIZ 1024 * 4 -# endif /* ACE_DEFAULT_ARGV_BUFSIZ */ - -// A free list which create more elements when there aren't enough -// elements. -# define ACE_FREE_LIST_WITH_POOL 1 - -// A simple free list which doen't allocate/deallocate elements. -# define ACE_PURE_FREE_LIST 2 - -# if defined (ACE_WIN32) - -// This is necessary to work around bugs with Win32 non-blocking -// connects... -# if !defined (ACE_NON_BLOCKING_BUG_DELAY) -# define ACE_NON_BLOCKING_BUG_DELAY 35000 -# endif /* ACE_NON_BLOCKING_BUG_DELAY */ -# endif /*ACE_WIN32*/ - -// Max size of an ACE Log Record data buffer. This can be reset in -// the config.h file if you'd like to increase or decrease the size. -# if !defined (ACE_MAXLOGMSGLEN) -# define ACE_MAXLOGMSGLEN 4 * 1024 -# endif /* ACE_MAXLOGMSGLEN */ - -// Max size of an ACE Token. -# define ACE_MAXTOKENNAMELEN 40 - -// Max size of an ACE Token client ID. -# define ACE_MAXCLIENTIDLEN MAXHOSTNAMELEN + 20 - -/// Max udp packet size -#if !defined (ACE_MAX_UDP_PACKET_SIZE) -#define ACE_MAX_UDP_PACKET_SIZE 65507 -#endif - -/** - * @name Default values to control CDR classes memory allocation strategies - */ -//@{ - -/// Control the initial size of all CDR buffers, application -/// developers may want to optimize this value to fit their request -/// size -#if !defined (ACE_DEFAULT_CDR_BUFSIZE) -# define ACE_DEFAULT_CDR_BUFSIZE 512 -#endif /* ACE_DEFAULT_CDR_BUFSIZE */ - -#if (ACE_DEFAULT_CDR_BUFSIZE == 0) -# error: ACE_DEFAULT_CDR_BUFSIZE should be bigger then 0 -#endif - -/// Stop exponential growth of CDR buffers to avoid overallocation -#if !defined (ACE_DEFAULT_CDR_EXP_GROWTH_MAX) -# define ACE_DEFAULT_CDR_EXP_GROWTH_MAX 65536 -#endif /* ACE_DEFAULT_CDR_EXP_GROWTH_MAX */ - -/// Control CDR buffer growth after maximum exponential growth is -/// reached -#if !defined (ACE_DEFAULT_CDR_LINEAR_GROWTH_CHUNK) -# define ACE_DEFAULT_CDR_LINEAR_GROWTH_CHUNK 65536 -#endif /* ACE_DEFAULT_CDR_LINEAR_GROWTH_CHUNK */ -//@} - -/// Control the zero-copy optimizations for octet sequences -/** - * Large octet sequences can be sent without any copies by chaining - * them in the list of message blocks that represent a single CDR - * stream. However, if the octet sequence is too small the zero copy - * optimizations actually hurt performance. Octet sequences smaller - * than this value will be copied. - */ -#if !defined (ACE_DEFAULT_CDR_MEMCPY_TRADEOFF) -#define ACE_DEFAULT_CDR_MEMCPY_TRADEOFF 256 -#endif /* ACE_DEFAULT_CDR_MEMCPY_TRADEOFF */ - -#if defined (ACE_WIN32) - // Define the pathname separator characters for Win32 (ugh). -# define ACE_DIRECTORY_SEPARATOR_STR_A "\\" -# define ACE_DIRECTORY_SEPARATOR_CHAR_A '\\' -#else - // Define the pathname separator characters for UNIX. -# define ACE_DIRECTORY_SEPARATOR_STR_A "/" -# define ACE_DIRECTORY_SEPARATOR_CHAR_A '/' -#endif /* ACE_WIN32 */ - -// Define the Wide character and normal versions of some of the string macros -#if defined (ACE_HAS_WCHAR) -# define ACE_DIRECTORY_SEPARATOR_STR_W ACE_TEXT_WIDE(ACE_DIRECTORY_SEPARATOR_STR_A) -# define ACE_DIRECTORY_SEPARATOR_CHAR_W ACE_TEXT_WIDE(ACE_DIRECTORY_SEPARATOR_CHAR_A) -#endif /* ACE_HAS_WCHAR */ - -#define ACE_DIRECTORY_SEPARATOR_STR ACE_TEXT (ACE_DIRECTORY_SEPARATOR_STR_A) -#define ACE_DIRECTORY_SEPARATOR_CHAR ACE_TEXT (ACE_DIRECTORY_SEPARATOR_CHAR_A) - -#if !defined (ACE_DEFAULT_THREAD_PRIORITY) -# define ACE_DEFAULT_THREAD_PRIORITY (-0x7fffffffL - 1L) -#endif /* ACE_DEFAULT_THREAD_PRIORITY */ - -#if !defined (ACE_DEFAULT_THREAD_STACKSIZE) -# define ACE_DEFAULT_THREAD_STACKSIZE 0 -#endif /* ACE_DEFAULT_THREAD_STACKSIZE */ - -#if !defined (ACE_MAX_DEFAULT_PORT) -# define ACE_MAX_DEFAULT_PORT 65535 -#endif /* ACE_MAX_DEFAULT_PORT */ - -// Default number of ACE_Event_Handlers supported by -// ACE_Timer_Heap. -#if !defined (ACE_DEFAULT_TIMERS) && defined (_POSIX_TIMER_MAX) -# define ACE_DEFAULT_TIMERS _POSIX_TIMER_MAX -#endif /* ACE_DEFAULT_TIMERS */ - -#if !defined (ACE_DEFAULT_TIMERS) || (defined (ACE_DEFAULT_TIMERS) && (ACE_DEFAULT_TIMERS == 0)) -#error ACE_DEFAULT_TIMERS should be defined and not be zero -#endif /* ACE_DEFAULT_TIMERS */ - -#if defined (ACE_WIN32) -# define ACE_PLATFORM_A "Win32" -# define ACE_PLATFORM_EXE_SUFFIX_A ".exe" -#elif defined (ACE_VXWORKS) -# define ACE_PLATFORM_A "VxWorks" -# if defined (__RTP__) -# define ACE_PLATFORM_EXE_SUFFIX_A ".vxe" -# else -# define ACE_PLATFORM_EXE_SUFFIX_A ".out" -# endif -#else /* !ACE_WIN32 && !ACE_VXWORKS */ -# define ACE_PLATFORM_A "UNIX" -# define ACE_PLATFORM_EXE_SUFFIX_A "" -#endif /* ACE_WIN32 */ - -// Define the Wide character and normal versions of some of the string macros -#if defined (ACE_HAS_WCHAR) -# define ACE_PLATFORM_W ACE_TEXT_WIDE(ACE_PLATFORM_A) -# define ACE_PLATFORM_EXE_SUFFIX_W ACE_TEXT_WIDE(ACE_PLATFORM_EXE_SUFFIX_A) -#endif /* ACE_HAS_WCHAR */ - -#define ACE_PLATFORM ACE_TEXT (ACE_PLATFORM_A) -#define ACE_PLATFORM_EXE_SUFFIX ACE_TEXT (ACE_PLATFORM_EXE_SUFFIX_A) - -#if defined (ACE_WIN32) -# define ACE_LD_SEARCH_PATH ACE_TEXT ("PATH") -# define ACE_LD_SEARCH_PATH_SEPARATOR_STR ACE_TEXT (";") -# define ACE_DLL_SUFFIX ACE_TEXT (".dll") -# if !defined (ACE_DLL_PREFIX) -# define ACE_DLL_PREFIX ACE_TEXT ("") -# endif /* !ACE_DLL_PREFIX */ -#else /* !ACE_WIN32 */ -# if !defined (ACE_LD_SEARCH_PATH) -# define ACE_LD_SEARCH_PATH ACE_TEXT ("LD_LIBRARY_PATH") -# endif /* ACE_LD_SEARCH_PATH */ -# if !defined (ACE_LD_SEARCH_PATH_SEPARATOR_STR) -# define ACE_LD_SEARCH_PATH_SEPARATOR_STR ACE_TEXT (":") -# endif /* ACE_LD_SEARCH_PATH_SEPARATOR_STR */ -#endif /* ACE_WIN32 */ - -#if !defined (ACE_DLL_SUFFIX) -# define ACE_DLL_SUFFIX ACE_TEXT (".so") -#endif /* ACE_DLL_SUFFIX */ - -#if !defined (ACE_DLL_PREFIX) -# define ACE_DLL_PREFIX ACE_TEXT ("lib") -#endif /* ACE_DLL_PREFIX */ - -#if defined (ACE_WIN32) -// Used for dynamic linking -# if !defined (ACE_DEFAULT_SVC_CONF) -# if (ACE_USES_CLASSIC_SVC_CONF == 1) -# define ACE_DEFAULT_SVC_CONF ACE_TEXT (".\\svc.conf") -# else -# define ACE_DEFAULT_SVC_CONF ACE_TEXT (".\\svc.conf.xml") -# endif /* ACE_USES_CLASSIC_SVC_CONF ==1 */ -# endif /* ACE_DEFAULT_SVC_CONF */ -#endif /* ACE_WIN32 */ - - // Used for dynamic linking. -#if !defined (ACE_DEFAULT_SVC_CONF) -# if (ACE_USES_CLASSIC_SVC_CONF == 1) -# define ACE_DEFAULT_SVC_CONF ACE_TEXT ("./svc.conf") -# else -# define ACE_DEFAULT_SVC_CONF ACE_TEXT ("./svc.conf.xml") -# endif /* ACE_USES_CLASSIC_SVC_CONF ==1 */ -#endif /* ACE_DEFAULT_SVC_CONF */ - -#if !defined (ACE_LOGGER_KEY) -# define ACE_LOGGER_KEY ACE_TEXT ("/tmp/server_daemon") -#endif /* ACE_LOGGER_KEY */ - -// Theses defines are used by the ACE Name Server. -#if !defined (ACE_DEFAULT_LOCALNAME_A) -# define ACE_DEFAULT_LOCALNAME_A "localnames" -#endif /* ACE_DEFAULT_LOCALNAME_A */ -#if !defined (ACE_DEFAULT_GLOBALNAME_A) -# define ACE_DEFAULT_GLOBALNAME_A "globalnames" -#endif /* ACE_DEFAULT_GLOBALNAME_A */ - -#if defined (ACE_HAS_WCHAR) -# define ACE_DEFAULT_LOCALNAME_W ACE_TEXT_WIDE(ACE_DEFAULT_LOCALNAME_A) -# define ACE_DEFAULT_GLOBALNAME_W ACE_TEXT_WIDE(ACE_DEFAULT_GLOBALNAME_A) -#endif /* ACE_HAS_WCHAR */ - -#define ACE_DEFAULT_LOCALNAME ACE_TEXT (ACE_DEFAULT_LOCALNAME_A) -#define ACE_DEFAULT_GLOBALNAME ACE_TEXT (ACE_DEFAULT_GLOBALNAME_A) - -#if !defined (ACE_DEFAULT_OPEN_PERMS) -# define ACE_DEFAULT_OPEN_PERMS ACE_DEFAULT_FILE_PERMS -#endif /* ACE_DEFAULT_OPEN_PERMS */ - -#if !defined (ACE_DEFAULT_RW_PROCESS_MUTEX_PERMS) -# if defined (ACE_WIN32) -# define ACE_DEFAULT_RW_PROCESS_MUTEX_PERMS ACE_DEFAULT_OPEN_PERMS -# else -# define ACE_DEFAULT_RW_PROCESS_MUTEX_PERMS (S_IRUSR | S_IWUSR) -# endif /* ACE_WIN32 */ -#endif /* ACE_DEFAULT_RW_PROCESS_MUTEX_PERMS */ - -# if defined (ACE_WIN32) - // The "null" device on Win32. -# define ACE_DEV_NULL "nul" -# define ACE_SYSCALL_FAILED 0xFFFFFFFF -# else /* !ACE_WIN32 */ - // The "null" device on UNIX. -# define ACE_DEV_NULL "/dev/null" -# define ACE_SYSCALL_FAILED -1 -# endif /* ACE_WIN32 */ - -#include /**/ "ace/post.h" -#endif /*ACE_DEFAULT_CONSTANTS_H*/ diff --git a/dep/acelite/ace/Dev_Poll_Reactor.cpp b/dep/acelite/ace/Dev_Poll_Reactor.cpp deleted file mode 100644 index 011fe7883a2..00000000000 --- a/dep/acelite/ace/Dev_Poll_Reactor.cpp +++ /dev/null @@ -1,2583 +0,0 @@ -// $Id: Dev_Poll_Reactor.cpp 95738 2012-05-11 19:16:53Z shuston $ - -#include "ace/OS_NS_errno.h" -#include "ace/Dev_Poll_Reactor.h" -#include "ace/Signal.h" -#include "ace/Sig_Handler.h" - -#if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) - -# include "ace/OS_NS_unistd.h" -# include "ace/OS_NS_fcntl.h" -# include "ace/OS_NS_stropts.h" - -# if defined (ACE_HAS_DEV_POLL) -# if defined (ACE_LINUX) -# include /**/ -# elif defined (HPUX_VERS) && HPUX_VERS < 1123 -# include /**/ -# else -# include /**/ -# endif /* ACE_LINUX */ -# endif /* ACE_HAS_DEV_POLL */ - -#if !defined (__ACE_INLINE__) -# include "ace/Dev_Poll_Reactor.inl" -#endif /* __ACE_INLINE__ */ - - -#include "ace/Handle_Set.h" -#include "ace/Reactor.h" -#include "ace/Timer_Heap.h" -#include "ace/Timer_Queue.h" -#include "ace/ACE.h" -#include "ace/Reverse_Lock_T.h" -#include "ace/Recursive_Thread_Mutex.h" -#include "ace/Null_Mutex.h" -#include "ace/os_include/os_poll.h" -#include "ace/OS_NS_sys_mman.h" -#include "ace/Guard_T.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_sys_time.h" -#include "ace/Functor_T.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Dev_Poll_Reactor_Notify::ACE_Dev_Poll_Reactor_Notify (void) - : dp_reactor_ (0) - , notification_pipe_ () - , max_notify_iterations_ (-1) -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) - , notification_queue_ () -#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ -{ -} - -int -ACE_Dev_Poll_Reactor_Notify::open (ACE_Reactor_Impl *r, - ACE_Timer_Queue * /* timer_queue */, - int disable_notify_pipe) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::open"); - - if (disable_notify_pipe == 0) - { - this->dp_reactor_ = dynamic_cast (r); - - if (this->dp_reactor_ == 0) - { - errno = EINVAL; - return -1; - } - - if (this->notification_pipe_.open () == -1) - return -1; - -#if defined (F_SETFD) - // close-on-exec - ACE_OS::fcntl (this->notification_pipe_.read_handle (), F_SETFD, 1); - ACE_OS::fcntl (this->notification_pipe_.write_handle (), F_SETFD, 1); -#endif /* F_SETFD */ - -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) - if (notification_queue_.open () == -1) - { - return -1; - } - - if (ACE::set_flags (this->notification_pipe_.write_handle (), - ACE_NONBLOCK) == -1) - return -1; -#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ - - // Set the read handle into non-blocking mode since we need to - // perform a "speculative" read when determining if there are - // notifications to dispatch. - if (ACE::set_flags (this->notification_pipe_.read_handle (), - ACE_NONBLOCK) == -1) - return -1; - } - - return 0; -} - -int -ACE_Dev_Poll_Reactor_Notify::close (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::close"); - -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) - notification_queue_.reset (); -#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ - - return this->notification_pipe_.close (); -} - -int -ACE_Dev_Poll_Reactor_Notify::notify (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask, - ACE_Time_Value *timeout) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::notify"); - - // Just consider this method a "no-op" if there's no - // ACE_Dev_Poll_Reactor configured. - if (this->dp_reactor_ == 0) - return 0; - - ACE_Notification_Buffer buffer (eh, mask); - -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) - ACE_UNUSED_ARG (timeout); - ACE_Dev_Poll_Handler_Guard eh_guard (eh); - - // When using the queue, always try to write to the notify pipe. If it - // fills up, ignore it safely because the already-written bytes will - // eventually cause the notify handler to be dispatched. - if (-1 == this->notification_queue_.push_new_notification (buffer)) - return -1; // Also decrement eh's reference count - - // The notification has been queued, so it will be delivered at some - // point (and may have been already); release the refcnt guard. - eh_guard.release (); - - // Now pop the pipe to force the callback for dispatching when ready. If - // the send fails due to a full pipe, don't fail - assume the already-sent - // pipe bytes will cause the entire notification queue to be processed. - // Note that we don't need a timeout since the pipe is already in - // nonblocking mode and all we want is one attempt. - ssize_t n = ACE::send (this->notification_pipe_.write_handle (), - (char *) &buffer, - 1); // Only need one byte to pop the pipe - if (n == -1 && (errno != EAGAIN)) - return -1; - - return 0; -#else - - ACE_Dev_Poll_Handler_Guard eh_guard (eh); - - ssize_t n = ACE::send (this->notification_pipe_.write_handle (), - (char *) &buffer, - sizeof buffer, - timeout); - if (n == -1) - return -1; - - eh_guard.release (); - - return 0; -#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ -} - -int -ACE_Dev_Poll_Reactor_Notify::dispatch_notifications ( - int & /* number_of_active_handles */, - ACE_Handle_Set & /* rd_mask */) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::dispatch_notifications"); - - // This method is unimplemented in the ACE_Dev_Poll_Reactor. - // Instead, the notification handler is invoked as part of the IO - // event set. Doing so alters the some documented semantics that - // state that the notifications are handled before IO events. - // Enforcing such semantics does not appear to be beneficial, and - // also serves to slow down event dispatching particularly with this - // ACE_Dev_Poll_Reactor. - - ACE_NOTSUP_RETURN (-1); -} - -int -ACE_Dev_Poll_Reactor_Notify::read_notify_pipe (ACE_HANDLE handle, - ACE_Notification_Buffer &buffer) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::read_notify_pipe"); - - // This is a (non-blocking) "speculative" read, i.e., we attempt to - // read even if no event was polled on the read handle. A - // speculative read is necessary since notifications must be - // dispatched before IO events. We can avoid the speculative read - // by "walking" the array of pollfd structures returned from - // `/dev/poll' or `/dev/epoll' but that is potentially much more - // expensive than simply checking for an EWOULDBLOCK. - size_t to_read; - char *read_p; - -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) - // The idea in the queued case is to be sure we never end up with a notify - // queued but no byte in the pipe. If that happens, the notify won't be - // dispatched. So always try to empty the pipe, read the queue, then put - // a byte in if needed. The notify() method is enqueueing then writing the - // pipe, so be sure to do it in the reverse order here to avoid a race - // between removing the last notification from the queue and the notify - // side writing its byte. - char b[1024]; - read_p = b; - to_read = sizeof(b); - (void)ACE::recv (handle, read_p, to_read); - - bool more_messages_queued = false; - ACE_Notification_Buffer next; - int result = 1; - while (result == 1) - { - result = notification_queue_.pop_next_notification (buffer, - more_messages_queued, - next); - - if (result <= 0) // Nothing dequeued or error - return result; - - // If it's just a wake-up, toss it and see if there's anything else. - if (buffer.eh_ != 0) - break; - } - - // If there are more messages, ensure there's a byte in the pipe - // in case the notification limit stops dequeuing notifies before - // emptying the queue. - if (more_messages_queued) - (void) ACE::send (this->notification_pipe_.write_handle (), - (char *)&next, - 1); /* one byte is enough */ - return 1; -#else - to_read = sizeof buffer; - read_p = (char *)&buffer; - - ssize_t n = ACE::recv (handle, read_p, to_read); - - if (n > 0) - { - // Check to see if we've got a short read. - if (static_cast (n) != to_read) - { - size_t remainder = to_read - n; - - // If so, try to recover by reading the remainder. If this - // doesn't work we're in big trouble since the input stream - // won't be aligned correctly. I'm not sure quite what to - // do at this point. It's probably best just to return -1. - if (ACE::recv (handle, &read_p[n], remainder) <= 0) - return -1; - } - - return 1; - } - - // Return -1 if things have gone seriously wrong. - if (n <= 0 && (errno != EWOULDBLOCK && errno != EAGAIN)) - return -1; - - return 0; -#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ -} - - -int -ACE_Dev_Poll_Reactor_Notify::handle_input (ACE_HANDLE /*handle*/) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::handle_input"); - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("SHOULD NOT BE HERE.\n")), -1); -} - -ACE_HANDLE -ACE_Dev_Poll_Reactor_Notify::notify_handle (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::notify_handle"); - - return this->notification_pipe_.read_handle (); -} - -int -ACE_Dev_Poll_Reactor_Notify::is_dispatchable (ACE_Notification_Buffer &) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::is_dispatchable"); - - ACE_NOTSUP_RETURN (-1); -} - -int -ACE_Dev_Poll_Reactor_Notify::dispatch_notify (ACE_Notification_Buffer &buffer) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::dispatch_notify"); - - // If eh == 0 then another thread is unblocking the - // ACE_Dev_Poll_Reactor to update the ACE_Dev_Poll_Reactor's - // internal structures. Otherwise, we need to dispatch the - // appropriate handle_* method on the ACE_Event_Handler - // pointer we've been passed. - if (buffer.eh_ != 0) - { - int result = 0; - - // Guard the handler's refcount. Recall that when the notify - // was queued, the refcount was incremented, so it need not be - // now. The guard insures that it is decremented properly. - ACE_Dev_Poll_Handler_Guard eh_guard (buffer.eh_, false); - - switch (buffer.mask_) - { - case ACE_Event_Handler::READ_MASK: - case ACE_Event_Handler::ACCEPT_MASK: - result = buffer.eh_->handle_input (ACE_INVALID_HANDLE); - break; - case ACE_Event_Handler::WRITE_MASK: - result = buffer.eh_->handle_output (ACE_INVALID_HANDLE); - break; - case ACE_Event_Handler::EXCEPT_MASK: - result = buffer.eh_->handle_exception (ACE_INVALID_HANDLE); - break; - default: - // Should we bail out if we get an invalid mask? - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("dispatch_notify invalid mask = %d\n"), - buffer.mask_)); - } - if (result == -1) - buffer.eh_->handle_close (ACE_INVALID_HANDLE, buffer.mask_); - } - - return 1; -} - -void -ACE_Dev_Poll_Reactor_Notify::max_notify_iterations (int iterations) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::max_notify_iterations"); - - // Must always be > 0 or < 0 to optimize the loop exit condition. - if (iterations == 0) - iterations = 1; - - this->max_notify_iterations_ = iterations; -} - -int -ACE_Dev_Poll_Reactor_Notify::max_notify_iterations (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::max_notify_iterations"); - - return this->max_notify_iterations_; -} - -int -ACE_Dev_Poll_Reactor_Notify::purge_pending_notifications ( - ACE_Event_Handler *eh, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::purge_pending_notifications"); - -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) - - return notification_queue_.purge_pending_notifications (eh, mask); - -#else /* defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) */ - ACE_UNUSED_ARG (eh); - ACE_UNUSED_ARG (mask); - ACE_NOTSUP_RETURN (-1); -#endif /* defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) */ -} - -void -ACE_Dev_Poll_Reactor_Notify::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("dp_reactor_ = %@"), - this->dp_reactor_)); - this->notification_pipe_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -int -ACE_Dev_Poll_Reactor_Notify::dequeue_one (ACE_Notification_Buffer &nb) -{ - nb.eh_ = 0; - nb.mask_ = 0; - return this->read_notify_pipe (this->notify_handle (), nb); -} - - -// ----------------------------------------------------------------- - -ACE_Dev_Poll_Reactor::Handler_Repository::Handler_Repository (void) - : size_ (0), - max_size_ (0), - handlers_ (0) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::Handler_Repository::Handler_Repository"); -} - -bool -ACE_Dev_Poll_Reactor::Handler_Repository::invalid_handle ( - ACE_HANDLE handle) const -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::Handler_Repository::invalid_handle"); - - if (handle < 0 || handle >= this->max_size_) - { - errno = EINVAL; - return true; - } - else - return false; -} - -bool -ACE_Dev_Poll_Reactor::Handler_Repository::handle_in_range ( - ACE_HANDLE handle) const -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::Handler_Repository::handle_in_range"); - - if (handle >= 0 && handle < this->max_size_) - return true; - else - { - errno = EINVAL; - return false; - } -} - -int -ACE_Dev_Poll_Reactor::Handler_Repository::open (size_t size) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::Handler_Repository::open"); - - this->max_size_ = size; - - // Try to allocate the memory. - ACE_NEW_RETURN (this->handlers_, Event_Tuple[size], -1); - - // Try to increase the number of handles if is greater than - // the current limit. - return ACE::set_handle_limit (size); -} - -int -ACE_Dev_Poll_Reactor::Handler_Repository::unbind_all (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::Handler_Repository::unbind_all"); - - // Unbind all of the event handlers; similar to remove_handler() on all. - for (int handle = 0; - handle < this->max_size_; - ++handle) - { - Event_Tuple *entry = this->find (handle); - if (entry == 0) - continue; - - // Check for ref counting now - handle_close () may delete eh. - bool const requires_reference_counting = - entry->event_handler->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - - (void) entry->event_handler->handle_close (handle, entry->mask); - this->unbind (handle, requires_reference_counting); - } - - return 0; -} - -int -ACE_Dev_Poll_Reactor::Handler_Repository::close (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::Handler_Repository::close"); - - if (this->handlers_ != 0) - { - this->unbind_all (); - - delete [] this->handlers_; - this->handlers_ = 0; - } - - return 0; -} - -ACE_Dev_Poll_Reactor::Event_Tuple * -ACE_Dev_Poll_Reactor::Handler_Repository::find (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::Handler_Repository::find"); - - Event_Tuple *tuple = 0; - - // Only bother to search for the if it's in range. - if (!this->handle_in_range (handle)) - { - errno = ERANGE; - return 0; - } - - tuple = &(this->handlers_[handle]); - if (tuple->event_handler == 0) - { - errno = ENOENT; - tuple = 0; - } - - return tuple; -} - -int -ACE_Dev_Poll_Reactor::Handler_Repository::bind ( - ACE_HANDLE handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::Handler_Repository::bind"); - - if (event_handler == 0) - return -1; - - if (handle == ACE_INVALID_HANDLE) - handle = event_handler->get_handle (); - - if (this->invalid_handle (handle)) - return -1; - - this->handlers_[handle].event_handler = event_handler; - this->handlers_[handle].mask = mask; - event_handler->add_reference (); - ++this->size_; - - return 0; -} - -int -ACE_Dev_Poll_Reactor::Handler_Repository::unbind (ACE_HANDLE handle, - bool decr_refcnt) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::Handler_Repository::unbind"); - - Event_Tuple *entry = this->find (handle); - if (entry == 0) - return -1; - - if (decr_refcnt) - entry->event_handler->remove_reference (); - - entry->event_handler = 0; - entry->mask = ACE_Event_Handler::NULL_MASK; - entry->suspended = false; - entry->controlled = false; - --this->size_; - return 0; -} - -// ----------------------------------------------------------------- - -ACE_Dev_Poll_Reactor::ACE_Dev_Poll_Reactor (ACE_Sig_Handler *sh, - ACE_Timer_Queue *tq, - int disable_notify_pipe, - ACE_Reactor_Notify *notify, - int mask_signals, - int s_queue) - : initialized_ (false) - , poll_fd_ (ACE_INVALID_HANDLE) - // , ready_set_ () -#if defined (ACE_HAS_EVENT_POLL) - , epoll_wait_in_progress_ (false) -#endif /* ACE_HAS_EVENT_POLL */ -#if defined (ACE_HAS_DEV_POLL) - , dp_fds_ (0) - , start_pfds_ (0) - , end_pfds_ (0) -#endif /* ACE_HAS_DEV_POLL */ - , deactivated_ (0) - , token_ (*this, s_queue) - , lock_adapter_ (token_) - , timer_queue_ (0) - , delete_timer_queue_ (false) - , signal_handler_ (0) - , delete_signal_handler_ (false) - , notify_handler_ (0) - , delete_notify_handler_ (false) - , mask_signals_ (mask_signals) - , restart_ (0) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::ACE_Dev_Poll_Reactor"); - - if (this->open (ACE::max_handles (), - 0, - sh, - tq, - disable_notify_pipe, - notify) == -1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Dev_Poll_Reactor::open ") - ACE_TEXT ("failed inside ") - ACE_TEXT ("ACE_Dev_Poll_Reactor::CTOR"))); -} - -ACE_Dev_Poll_Reactor::ACE_Dev_Poll_Reactor (size_t size, - bool rs, - ACE_Sig_Handler *sh, - ACE_Timer_Queue *tq, - int disable_notify_pipe, - ACE_Reactor_Notify *notify, - int mask_signals, - int s_queue) - : initialized_ (false) - , poll_fd_ (ACE_INVALID_HANDLE) - // , ready_set_ () -#if defined (ACE_HAS_DEV_POLL) - , dp_fds_ (0) - , start_pfds_ (0) - , end_pfds_ (0) -#endif /* ACE_HAS_DEV_POLL */ - , deactivated_ (0) - , token_ (*this, s_queue) - , lock_adapter_ (token_) - , timer_queue_ (0) - , delete_timer_queue_ (false) - , signal_handler_ (0) - , delete_signal_handler_ (false) - , notify_handler_ (0) - , delete_notify_handler_ (false) - , mask_signals_ (mask_signals) - , restart_ (0) -{ - if (this->open (size, - rs, - sh, - tq, - disable_notify_pipe, - notify) == -1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Dev_Poll_Reactor::open ") - ACE_TEXT ("failed inside ACE_Dev_Poll_Reactor::CTOR"))); -} - -ACE_Dev_Poll_Reactor::~ACE_Dev_Poll_Reactor (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::~ACE_Dev_Poll_Reactor"); - - (void) this->close (); -} - -int -ACE_Dev_Poll_Reactor::open (size_t size, - bool restart, - ACE_Sig_Handler *sh, - ACE_Timer_Queue *tq, - int disable_notify_pipe, - ACE_Reactor_Notify *notify) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::open"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - // Can't initialize ourselves more than once. - if (this->initialized_) - return -1; - -#ifdef ACE_HAS_EVENT_POLL - ACE_OS::memset (&this->event_, 0, sizeof (this->event_)); - this->event_.data.fd = ACE_INVALID_HANDLE; -#endif /* ACE_HAS_EVENT_POLL */ - - this->restart_ = restart; - this->signal_handler_ = sh; - this->timer_queue_ = tq; - this->notify_handler_ = notify; - - int result = 0; - - // Allows the signal handler to be overridden. - if (this->signal_handler_ == 0) - { - ACE_NEW_RETURN (this->signal_handler_, - ACE_Sig_Handler, - -1); - - if (this->signal_handler_ == 0) - result = -1; - else - this->delete_signal_handler_ = true; - } - - // Allows the timer queue to be overridden. - if (result != -1 && this->timer_queue_ == 0) - { - ACE_NEW_RETURN (this->timer_queue_, - ACE_Timer_Heap, - -1); - - if (this->timer_queue_ == 0) - result = -1; - else - this->delete_timer_queue_ = true; - } - - // Allows the Notify_Handler to be overridden. - if (result != -1 && this->notify_handler_ == 0) - { - ACE_NEW_RETURN (this->notify_handler_, - ACE_Dev_Poll_Reactor_Notify, - -1); - - if (this->notify_handler_ == 0) - result = -1; - else - this->delete_notify_handler_ = true; - } - -#if defined (ACE_HAS_EVENT_POLL) - - // Initialize epoll: - this->poll_fd_ = ::epoll_create (size); - if (this->poll_fd_ == -1) - result = -1; - -#else - - // Allocate the array before opening the device to avoid a potential - // resource leak if allocation fails. - ACE_NEW_RETURN (this->dp_fds_, - pollfd[size], - -1); - - // Open the `/dev/poll' character device. - this->poll_fd_ = ACE_OS::open ("/dev/poll", O_RDWR); - if (this->poll_fd_ == ACE_INVALID_HANDLE) - result = -1; - -#endif /* ACE_HAS_EVENT_POLL */ - - if (result != -1 && this->handler_rep_.open (size) == -1) - result = -1; - - // Registration of the notification handler must be done after the - // /dev/poll device has been fully initialized. - else if (this->notify_handler_->open (this, - 0, - disable_notify_pipe) == -1 - || (disable_notify_pipe == 0 - && this->register_handler_i ( - this->notify_handler_->notify_handle (), - this->notify_handler_, - ACE_Event_Handler::READ_MASK) == -1)) - result = -1; - - if (result != -1) - // We're all set to go. - this->initialized_ = true; - else - // This will close down all the allocated resources properly. - (void) this->close (); - - return result; -} - -int -ACE_Dev_Poll_Reactor::current_info (ACE_HANDLE, size_t & /* size */) -{ - ACE_NOTSUP_RETURN (-1); -} - - -int -ACE_Dev_Poll_Reactor::set_sig_handler (ACE_Sig_Handler *signal_handler) -{ - if (this->delete_signal_handler_) - delete this->signal_handler_; - - this->signal_handler_ = signal_handler; - this->delete_signal_handler_ = false; - - return 0; -} - -int -ACE_Dev_Poll_Reactor::timer_queue (ACE_Timer_Queue *tq) -{ - if (this->delete_timer_queue_) - delete this->timer_queue_; - else if (this->timer_queue_) - this->timer_queue_->close (); - - this->timer_queue_ = tq; - this->delete_timer_queue_ = false; - - return 0; -} - -ACE_Timer_Queue * -ACE_Dev_Poll_Reactor::timer_queue (void) const -{ - return this->timer_queue_; -} - -int -ACE_Dev_Poll_Reactor::close (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::close"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - int result = 0; - - if (this->poll_fd_ != ACE_INVALID_HANDLE) - { - result = ACE_OS::close (this->poll_fd_); - } - -#if defined (ACE_HAS_EVENT_POLL) - - ACE_OS::memset (&this->event_, 0, sizeof (this->event_)); - this->event_.data.fd = ACE_INVALID_HANDLE; - -#else - - delete [] this->dp_fds_; - this->dp_fds_ = 0; - this->start_pfds_ = 0; - this->end_pfds_ = 0; - -#endif /* ACE_HAS_EVENT_POLL */ - - if (this->delete_signal_handler_) - { - delete this->signal_handler_; - this->signal_handler_ = 0; - this->delete_signal_handler_ = false; - } - - (void) this->handler_rep_.close (); - - if (this->delete_timer_queue_) - { - delete this->timer_queue_; - this->timer_queue_ = 0; - this->delete_timer_queue_ = false; - } - else if (this->timer_queue_) - { - this->timer_queue_->close (); - this->timer_queue_ = 0; - } - - if (this->notify_handler_ != 0) - this->notify_handler_->close (); - - if (this->delete_notify_handler_) - { - delete this->notify_handler_; - this->notify_handler_ = 0; - this->delete_notify_handler_ = false; - } - - this->poll_fd_ = ACE_INVALID_HANDLE; - - this->initialized_ = false; - - return result; -} - -int -ACE_Dev_Poll_Reactor::work_pending (const ACE_Time_Value & max_wait_time) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::work_pending"); - - // Stash the current time - // - // The destructor of this object will automatically compute how much - // time elapsed since this method was called. - ACE_Time_Value mwt (max_wait_time); - ACE_MT (ACE_Countdown_Time countdown (&mwt)); - - Token_Guard guard (this->token_); - int const result = guard.acquire_quietly (&mwt); - - // If the guard is NOT the owner just return the retval - if (!guard.is_owner ()) - return result; - - // Update the countdown to reflect time waiting for the mutex. - ACE_MT (countdown.update ()); - - return this->work_pending_i (&mwt); -} - -int -ACE_Dev_Poll_Reactor::work_pending_i (ACE_Time_Value * max_wait_time) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::work_pending_i"); - - if (this->deactivated_) - return 0; - -#if defined (ACE_HAS_EVENT_POLL) - if (this->event_.data.fd != ACE_INVALID_HANDLE) -#else - if (this->start_pfds_ != this->end_pfds_) -#endif /* ACE_HAS_EVENT_POLL */ - return 1; // We still have work_pending (). Do not poll for - // additional events. - - ACE_Time_Value timer_buf (0); - ACE_Time_Value *this_timeout = - this->timer_queue_->calculate_timeout (max_wait_time, &timer_buf); - - // Check if we have timers to fire. - int const timers_pending = - ((this_timeout != 0 && max_wait_time == 0) - || (this_timeout != 0 && max_wait_time != 0 - && *this_timeout != *max_wait_time) ? 1 : 0); - - long const timeout = - (this_timeout == 0 - ? -1 /* Infinity */ - : static_cast (this_timeout->msec ())); - -#if defined (ACE_HAS_EVENT_POLL) - - // See if there are handlers that have to be resumed before waiting. - { - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->to_be_resumed_lock_, -1); - this->epoll_wait_in_progress_ = true; - for (Resume_Map::iterator i = this->to_be_resumed_.begin (); - i != this->to_be_resumed_.end (); - ++i) - { - // Make sure that 1) the handle is still registered, - // 2) the registered handler is the one we're waiting to resume. - Event_Tuple *info = this->handler_rep_.find (i->first); - if (info != 0 && info->event_handler == i->second) - { - this->resume_handler_i (i->first); - } - } - this->to_be_resumed_.clear (); - } - - // Wait for an event. - int const nfds = ::epoll_wait (this->poll_fd_, - &this->event_, - 1, - static_cast (timeout)); - // Count on this being an atomic update; at worst, we may get an - // extraneous notify() from dispatch_io_event. - this->epoll_wait_in_progress_ = false; - -#else - - struct dvpoll dvp; - - dvp.dp_fds = this->dp_fds_; - dvp.dp_nfds = this->handler_rep_.size (); - dvp.dp_timeout = timeout; // Milliseconds - - // Poll for events - int const nfds = ACE_OS::ioctl (this->poll_fd_, DP_POLL, &dvp); - - // Retrieve the results from the pollfd array. - this->start_pfds_ = dvp.dp_fds; - - // If nfds == 0 then end_pfds_ == start_pfds_ meaning that there is - // no work pending. If nfds > 0 then there is work pending. - // Otherwise an error occurred. - if (nfds > -1) - this->end_pfds_ = this->start_pfds_ + nfds; -#endif /* ACE_HAS_EVENT_POLL */ - - // If timers are pending, override any timeout from the poll. - return (nfds == 0 && timers_pending != 0 ? 1 : nfds); -} - - -int -ACE_Dev_Poll_Reactor::handle_events (ACE_Time_Value *max_wait_time) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::handle_events"); - - // Stash the current time - // - // The destructor of this object will automatically compute how much - // time elapsed since this method was called. - ACE_Countdown_Time countdown (max_wait_time); - - Token_Guard guard (this->token_); - int const result = guard.acquire_quietly (max_wait_time); - - // If the guard is NOT the owner just return the retval - if (!guard.is_owner ()) - return result; - - if (this->deactivated_) - { - errno = ESHUTDOWN; - return -1; - } - - // Update the countdown to reflect time waiting for the mutex. - ACE_MT (countdown.update ()); - - return this->handle_events_i (max_wait_time, guard); -} - -int -ACE_Dev_Poll_Reactor::handle_events_i (ACE_Time_Value *max_wait_time, - Token_Guard &guard) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::handle_events_i"); - - int result = 0; - - // Poll for events - // - // If the underlying event wait call was interrupted via the interrupt - // signal (i.e. returned -1 with errno == EINTR) then the loop will - // be restarted if so desired. - do - { - result = this->work_pending_i (max_wait_time); - if (result == -1 && (this->restart_ == 0 || errno != EINTR)) - ACE_ERROR ((LM_ERROR, ACE_TEXT("%t: %p\n"), ACE_TEXT("work_pending_i"))); - } - while (result == -1 && this->restart_ != 0 && errno == EINTR); - - if (result == 0 || (result == -1 && errno == ETIME)) - return 0; - else if (result == -1) - { - if (errno != EINTR) - return -1; - - // Bail out -- we got here since the poll was interrupted. - // If it was due to a signal registered through our ACE_Sig_Handler, - // then it was dispatched, so we count it in the number of events - // handled rather than cause an error return. - if (ACE_Sig_Handler::sig_pending () != 0) - { - ACE_Sig_Handler::sig_pending (0); - return 1; - } - return -1; - } - - // Dispatch an event. - return this->dispatch (guard); -} - -// Dispatch an event. On entry, the token is held by the caller. If an -// event is found to dispatch, the token is released before dispatching it. -int -ACE_Dev_Poll_Reactor::dispatch (Token_Guard &guard) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::dispatch"); - - // Perform the Template Method for dispatching the first located event. - // We dispatch only one to effectively dispatch events concurrently. - // As soon as an event is located, the token is released, allowing the - // next waiter to begin getting an event while we dispatch one here. - int result = 0; - - // Handle timers early since they may have higher latency - // constraints than I/O handlers. Ideally, the order of - // dispatching should be a strategy... - if ((result = this->dispatch_timer_handler (guard)) != 0) - return result; - - // If no timer dispatched, check for an I/O event. - result = this->dispatch_io_event (guard); - - return result; -} - -int -ACE_Dev_Poll_Reactor::dispatch_timer_handler (Token_Guard &guard) -{ - typedef ACE_Member_Function_Command Guard_Release; - - Guard_Release release(guard, &Token_Guard::release_token); - return this->timer_queue_->expire_single(release); -} - -#if 0 -int -ACE_Dev_Poll_Reactor::dispatch_notification_handlers ( - ACE_Select_Reactor_Handle_Set &dispatch_set, - int &number_of_active_handles, - int &number_of_handlers_dispatched) -{ - // Check to see if the ACE_HANDLE associated with the - // Dev_Poll_Reactor's notify hook is enabled. If so, it means that - // one or more other threads are trying to update the - // ACE_Dev_Poll_Reactor's internal tables or the notify pipe is - // enabled. We'll handle all these threads and notifications, and - // then break out to continue the event loop. - - const int n = - this->notify_handler_->dispatch_notifications (number_of_active_handles, - dispatch_set.rd_mask_); - - if (n == -1) - return -1; - else - number_of_handlers_dispatched += n; - - return /* this->state_changed_ ? -1 : */ 0; -} -#endif /* 0 */ - -int -ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard) -{ - - // Dispatch a ready event. - - // Define bits to check for while dispatching. -#if defined (ACE_HAS_EVENT_POLL) - const __uint32_t out_event = EPOLLOUT; - const __uint32_t exc_event = EPOLLPRI; - const __uint32_t in_event = EPOLLIN; - const __uint32_t err_event = EPOLLHUP | EPOLLERR; -#else - const short out_event = POLLOUT; - const short exc_event = POLLPRI; - const short in_event = POLLIN; - const short err_event = 0; // No known bits for this -#endif /* ACE_HAS_EVENT_POLL */ - -#if defined (ACE_HAS_EVENT_POLL) - // epoll_wait() pulls one event which is stored in event_. If the handle - // is invalid, there's no event there. Else process it. In any event, we - // have the event, so clear event_ for the next thread. - const ACE_HANDLE handle = this->event_.data.fd; - __uint32_t revents = this->event_.events; - this->event_.data.fd = ACE_INVALID_HANDLE; - this->event_.events = 0; - if (handle != ACE_INVALID_HANDLE) - -#else - // Since the underlying event demultiplexing mechansim (`/dev/poll' - // or '/dev/epoll') is stateful, and since only one result buffer is - // used, all pending events (i.e. those retrieved from a previous - // poll) must be dispatched before any additional event can be - // polled. As such, the Dev_Poll_Reactor keeps track of the - // progress of events that have been dispatched. - - // Select the first available handle with event (s) pending. Check for - // event type in defined order of dispatch: output, exception, input. - // When an event is located, clear its bit in the dispatch set. If there - // are no more events for the handle, also increment the pfds pointer - // to move to the next handle ready. - // - // Notice that pfds only contains file descriptors that have - // received events. - struct pollfd *& pfds = this->start_pfds_; - const ACE_HANDLE handle = pfds->fd; - short &revents = pfds->revents; - if (pfds < this->end_pfds_) -#endif /* ACE_HAS_EVENT_POLL */ - - { - /* When using sys_epoll, we can attach arbitrary user - data to the descriptor, so it can be delivered when - activity is detected. Perhaps we should store event - handler together with descriptor, instead of looking - it up in a repository ? Could it boost performance ? - */ - Event_Tuple *info = this->handler_rep_.find (handle); - if (info == 0) // No registered handler any longer - { -#ifdef ACE_HAS_EVENT_POLL - this->event_.data.fd = ACE_INVALID_HANDLE; // Dump the event -#endif /* ACE_HAS_EVENT_POLL */ - return 0; - } - - // Figure out what to do first in order to make it easier to manage - // the bit twiddling and possible pfds increment before releasing - // the token for dispatch. - // Note that if there's an error (such as the handle was closed - // without being removed from the event set) the EPOLLHUP and/or - // EPOLLERR bits will be set in revents. - ACE_Reactor_Mask disp_mask = 0; - ACE_Event_Handler *eh = info->event_handler; - int (ACE_Event_Handler::*callback)(ACE_HANDLE) = 0; - if (ACE_BIT_ENABLED (revents, out_event)) - { - disp_mask = ACE_Event_Handler::WRITE_MASK; - callback = &ACE_Event_Handler::handle_output; - ACE_CLR_BITS (revents, out_event); - } - else if (ACE_BIT_ENABLED (revents, exc_event)) - { - disp_mask = ACE_Event_Handler::EXCEPT_MASK; - callback = &ACE_Event_Handler::handle_exception; - ACE_CLR_BITS (revents, exc_event); - } - else if (ACE_BIT_ENABLED (revents, in_event)) - { - disp_mask = ACE_Event_Handler::READ_MASK; - callback = &ACE_Event_Handler::handle_input; - ACE_CLR_BITS (revents, in_event); - } - else if (ACE_BIT_ENABLED (revents, err_event)) - { - this->remove_handler_i (handle, - ACE_Event_Handler::ALL_EVENTS_MASK, - info->event_handler); -#ifdef ACE_HAS_DEV_POLL - ++pfds; -#endif /* ACE_HAS_DEV_POLL */ - return 1; - } - else - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%t) dispatch_io h %d unknown events 0x%x\n"), - handle, revents)); - } - -#ifdef ACE_HAS_DEV_POLL - // Increment the pointer to the next element before we - // release the token. Otherwise event handlers end up being - // dispatched multiple times for the same poll. - if (revents == 0) - ++pfds; -#else - // With epoll, events are registered with oneshot, so the handle is - // effectively suspended; future calls to epoll_wait() will select - // the next event, so they're not managed here. - // The hitch to this is that the notify handler is always registered - // WITHOUT oneshot and is never suspended/resumed. This avoids endless - // notify loops caused by the notify handler requiring a resumption - // which requires the token, which requires a notify, etc. described - // in Bugzilla 3714. So, never suspend the notify handler. - - bool reactor_resumes_eh = false; - if (eh != this->notify_handler_) - { - info->suspended = true; - - reactor_resumes_eh = - eh->resume_handler () == - ACE_Event_Handler::ACE_REACTOR_RESUMES_HANDLER; - } -#endif /* ACE_HAS_DEV_POLL */ - - int status = 0; // gets callback status, below. - - // Dispatch notifies directly. The notify dispatcher locates a - // notification then releases the token prior to dispatching it. - // NOTE: If notify_handler_->dispatch_one() returns a fail condition - // it has not releases the guard. Else, it has. - if (eh == this->notify_handler_) - { - ACE_Notification_Buffer b; - status = - dynamic_cast(notify_handler_)->dequeue_one (b); - if (status == -1) - return status; - guard.release_token (); - return notify_handler_->dispatch_notify (b); - } - - { - // Modify the reference count in an exception-safe way. - // Note that eh could be the notify handler. It's not strictly - // necessary to manage its refcount, but since we don't enable - // the counting policy, it won't do much. Management of the - // notified handlers themselves is done in the notify handler. - ACE_Dev_Poll_Handler_Guard eh_guard (eh); - - // Release the reactor token before upcall. - guard.release_token (); - - // Dispatch the detected event; will do the repeated upcalls - // if callback returns > 0, unless it's the notify handler (which - // returns the number of notfies dispatched, not an indication of - // re-callback requested). If anything other than the notify, come - // back with either 0 or < 0. - status = this->upcall (eh, callback, handle); - - // If the callback returned 0, epoll-based needs to resume the - // suspended handler but dev/poll doesn't. - // The epoll case is optimized to not acquire the token in order - // to resume the handler; the handler is added to a list of those - // that need to be resumed and is handled by the next leader - // that does an epoll_wait(). - // In both epoll and dev/poll cases, if the callback returns <0, - // the token needs to be acquired and the handler checked and - // removed if it hasn't already been. - if (status == 0) - { -#ifdef ACE_HAS_EVENT_POLL - // epoll-based effectively suspends handlers around the upcall. - // If the handler must be resumed, add it to the list. - if (reactor_resumes_eh) - { - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, - grd, - this->to_be_resumed_lock_, - -1); - bool map_was_empty = this->to_be_resumed_.empty(); - this->to_be_resumed_.insert - (Resume_Map::value_type (handle, eh)); - if (this->epoll_wait_in_progress_ && map_was_empty) - this->notify(); - } -#endif /* ACE_HAS_EVENT_POLL */ - return 1; - } - - // All state in the handler repository may have changed during the - // upcall while other threads had the token. Thus, reacquire the - // token and evaluate what's needed. If the upcalled handler is still - // the handler of record for handle, continue with checking whether - // or not to remove or resume the handler. - guard.acquire (); - info = this->handler_rep_.find (handle); - if (info != 0 && info->event_handler == eh) - { - if (status < 0) - this->remove_handler_i (handle, disp_mask); - } - } - // Scope close handles eh ref count decrement, if needed. - - return 1; - } - - return 0; -} - -int -ACE_Dev_Poll_Reactor::alertable_handle_events (ACE_Time_Value *max_wait_time) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::alertable_handle_events"); - - return this->handle_events (max_wait_time); -} - -int -ACE_Dev_Poll_Reactor::handle_events (ACE_Time_Value &max_wait_time) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::handle_events"); - - return this->handle_events (&max_wait_time); -} - -int -ACE_Dev_Poll_Reactor::alertable_handle_events (ACE_Time_Value &max_wait_time) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::alertable_handle_events"); - - return this->handle_events (max_wait_time); -} - -int -ACE_Dev_Poll_Reactor::deactivated (void) -{ - return this->deactivated_; -} - -void -ACE_Dev_Poll_Reactor::deactivate (int do_stop) -{ - this->deactivated_ = do_stop; - this->wakeup_all_threads (); -} - -int -ACE_Dev_Poll_Reactor::register_handler (ACE_Event_Handler *handler, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return this->register_handler_i (handler->get_handle (), - handler, - mask); -} - -int -ACE_Dev_Poll_Reactor::register_handler (ACE_HANDLE handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return this->register_handler_i (handle, - event_handler, - mask); -} - -int -ACE_Dev_Poll_Reactor::register_handler_i (ACE_HANDLE handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler_i"); - - if (handle == ACE_INVALID_HANDLE - || mask == ACE_Event_Handler::NULL_MASK) - { - errno = EINVAL; - return -1; - } - - if (this->handler_rep_.find (handle) == 0) - { - // Handler not present in the repository. Bind it. - if (this->handler_rep_.bind (handle, event_handler, mask) != 0) - return -1; - -#if defined (ACE_HAS_EVENT_POLL) - - Event_Tuple *info = this->handler_rep_.find (handle); - - struct epoll_event epev; - ACE_OS::memset (&epev, 0, sizeof (epev)); - static const int op = EPOLL_CTL_ADD; - - epev.data.fd = handle; - epev.events = this->reactor_mask_to_poll_event (mask); - // All but the notify handler get registered with oneshot to facilitate - // auto suspend before the upcall. See dispatch_io_event for more - // information. - if (event_handler != this->notify_handler_) - epev.events |= EPOLLONESHOT; - - if (::epoll_ctl (this->poll_fd_, op, handle, &epev) == -1) - { - ACE_ERROR ((LM_ERROR, ACE_TEXT("%p\n"), ACE_TEXT("epoll_ctl"))); - (void) this->handler_rep_.unbind (handle); - return -1; - } - info->controlled = true; - -#endif /* ACE_HAS_EVENT_POLL */ - } - else - { - // Handler is already present in the repository, so register it - // again, possibly for different event. Add new mask to the - // current one. - if (this->mask_ops_i (handle, mask, ACE_Reactor::ADD_MASK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT("%p\n"), ACE_TEXT("mask_ops_i")), - -1); - } - -#ifdef ACE_HAS_DEV_POLL - - struct pollfd pfd; - - pfd.fd = handle; - pfd.events = this->reactor_mask_to_poll_event (mask); - pfd.revents = 0; - - // Add file descriptor to the "interest set." - if (ACE_OS::write (this->poll_fd_, &pfd, sizeof (pfd)) != sizeof (pfd)) - { - (void) this->handler_rep_.unbind (handle); - return -1; - } -#endif /*ACE_HAS_DEV_POLL*/ - - // Note the fact that we've changed the state of the wait_set_, - // which is used by the dispatching loop to determine whether it can - // keep going or if it needs to reconsult select (). - // this->state_changed_ = 1; - - return 0; -} - -int -ACE_Dev_Poll_Reactor::register_handler ( - ACE_HANDLE /* event_handle */, - ACE_HANDLE /* io_handle */, - ACE_Event_Handler * /* event_handler */, - ACE_Reactor_Mask /* mask */) -{ - ACE_NOTSUP_RETURN (-1); -} - -int -ACE_Dev_Poll_Reactor::register_handler (const ACE_Handle_Set &handle_set, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler"); - - ACE_Handle_Set_Iterator handle_iter (handle_set); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - // @@ It might be more efficient to construct a pollfd array and - // pass it to the write () call in register_handler_i () only once, - // instead of calling write () (a system call) once for each file - // descriptor. - - for (ACE_HANDLE h = handle_iter (); - h != ACE_INVALID_HANDLE; - h = handle_iter ()) - if (this->register_handler_i (h, event_handler, mask) == -1) - return -1; - - return 0; -} - -int -ACE_Dev_Poll_Reactor::register_handler (int signum, - ACE_Event_Handler *new_sh, - ACE_Sig_Action *new_disp, - ACE_Event_Handler **old_sh, - ACE_Sig_Action *old_disp) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler"); - - return this->signal_handler_->register_handler (signum, - new_sh, - new_disp, - old_sh, - old_disp); -} - -int -ACE_Dev_Poll_Reactor::register_handler (const ACE_Sig_Set &sigset, - ACE_Event_Handler *new_sh, - ACE_Sig_Action *new_disp) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler"); - - int result = 0; - -#if (ACE_NSIG > 0) - - for (int s = 1; s < ACE_NSIG; ++s) - if ((sigset.is_member (s) == 1) - && this->signal_handler_->register_handler (s, - new_sh, - new_disp) == -1) - result = -1; - -#else /* ACE_NSIG <= 0 */ - - ACE_UNUSED_ARG (sigset); - ACE_UNUSED_ARG (new_sh); - ACE_UNUSED_ARG (new_disp); - -#endif /* ACE_NSIG <= 0 */ - - return result; -} - -int -ACE_Dev_Poll_Reactor::remove_handler (ACE_Event_Handler *handler, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return this->remove_handler_i (handler->get_handle (), mask); -} - -int -ACE_Dev_Poll_Reactor::remove_handler (ACE_HANDLE handle, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return this->remove_handler_i (handle, mask); -} - -int -ACE_Dev_Poll_Reactor::remove_handler_i (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - ACE_Event_Handler *eh) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler_i"); - - // If registered event handler not the same as eh, don't mess with - // the mask, but do the proper callback and refcount when needed. - bool handle_reg_changed = true; - Event_Tuple *info = this->handler_rep_.find (handle); - if (info == 0 && eh == 0) // Nothing to work with - return -1; - if (info != 0 && (eh == 0 || info->event_handler == eh)) - { - if (this->mask_ops_i (handle, mask, ACE_Reactor::CLR_MASK) == -1) - return -1; - handle_reg_changed = false; - eh = info->event_handler; - } - - // Check for ref counting now - handle_close () may delete eh. - bool const requires_reference_counting = - eh->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - - if (ACE_BIT_DISABLED (mask, ACE_Event_Handler::DONT_CALL)) - (void) eh->handle_close (handle, mask); - - // If there are no longer any outstanding events on the given handle - // then remove it from the handler repository. - if (!handle_reg_changed && info->mask == ACE_Event_Handler::NULL_MASK) - this->handler_rep_.unbind (handle, requires_reference_counting); - - return 0; -} - -int -ACE_Dev_Poll_Reactor::remove_handler (const ACE_Handle_Set &handle_set, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler"); - - ACE_Handle_Set_Iterator handle_iter (handle_set); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - // @@ It might be more efficient to construct a pollfd array and - // pass it to the write () call in register_handler_i () only once, - // instead of calling write () (a system call) once for each file - // descriptor. - - for (ACE_HANDLE h = handle_iter (); - h != ACE_INVALID_HANDLE; - h = handle_iter ()) - if (this->remove_handler_i (h, mask) == -1) - return -1; - - return 0; -} - -int -ACE_Dev_Poll_Reactor::remove_handler (int signum, - ACE_Sig_Action *new_disp, - ACE_Sig_Action *old_disp, - int sigkey) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler"); - - return this->signal_handler_->remove_handler (signum, - new_disp, - old_disp, - sigkey); -} - -int -ACE_Dev_Poll_Reactor::remove_handler (const ACE_Sig_Set &sigset) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler"); - - int result = 0; - -#if (ACE_NSIG > 0) - - for (int s = 1; s < ACE_NSIG; ++s) - if ((sigset.is_member (s) == 1) - && this->signal_handler_->remove_handler (s) == -1) - result = -1; - -#else /* ACE_NSIG <= 0 */ - - ACE_UNUSED_ARG (sigset); - -#endif /* ACE_NSIG <= 0 */ - - return result; -} - -int -ACE_Dev_Poll_Reactor::suspend_handler (ACE_Event_Handler *event_handler) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::suspend_handler"); - - if (event_handler == 0) - { - errno = EINVAL; - return -1; - } - - ACE_HANDLE handle = event_handler->get_handle (); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return this->suspend_handler_i (handle); -} - -int -ACE_Dev_Poll_Reactor::suspend_handler (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::suspend_handler"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return this->suspend_handler_i (handle); -} - -int -ACE_Dev_Poll_Reactor::suspend_handler (const ACE_Handle_Set &handles) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::suspend_handler"); - - ACE_Handle_Set_Iterator handle_iter (handles); - ACE_HANDLE h; - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - while ((h = handle_iter ()) != ACE_INVALID_HANDLE) - if (this->suspend_handler_i (h) == -1) - return -1; - - return 0; -} - -int -ACE_Dev_Poll_Reactor::suspend_handlers (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::suspend_handlers"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - size_t const len = this->handler_rep_.max_size (); - - for (size_t i = 0; i < len; ++i) - { - Event_Tuple *info = this->handler_rep_.find (i); - if (info != 0 && !info->suspended && this->suspend_handler_i (i) != 0) - return -1; - } - return 0; -} - -int -ACE_Dev_Poll_Reactor::suspend_handler_i (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::suspend_handler_i"); - - Event_Tuple *info = this->handler_rep_.find (handle); - if (info == 0) - return -1; - - if (info->suspended) - return 0; // Already suspended. @@ Should this be an error? - - // Remove the handle from the "interest set." - // - // Note that the associated event handler is still in the handler - // repository, but no events will be polled on the given handle thus - // no event will be dispatched to the event handler. - -#if defined (ACE_HAS_EVENT_POLL) - - struct epoll_event epev; - ACE_OS::memset (&epev, 0, sizeof (epev)); - static const int op = EPOLL_CTL_DEL; - - epev.events = 0; - epev.data.fd = handle; - - if (::epoll_ctl (this->poll_fd_, op, handle, &epev) == -1) - return -1; - info->controlled = false; -#else - - struct pollfd pfd[1]; - - pfd[0].fd = handle; - pfd[0].events = POLLREMOVE; - pfd[0].revents = 0; - - if (ACE_OS::write (this->poll_fd_, pfd, sizeof (pfd)) != sizeof (pfd)) - return -1; - -#endif /* ACE_HAS_EVENT_POLL */ - - info->suspended = true; - - return 0; -} - -int -ACE_Dev_Poll_Reactor::resume_handler (ACE_Event_Handler *event_handler) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::resume_handler"); - - if (event_handler == 0) - { - errno = EINVAL; - return -1; - } - - ACE_HANDLE handle = event_handler->get_handle (); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return this->resume_handler_i (handle); -} - -int -ACE_Dev_Poll_Reactor::resume_handler (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::resume_handler"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return this->resume_handler_i (handle); -} - -int -ACE_Dev_Poll_Reactor::resume_handler (const ACE_Handle_Set &handles) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::resume_handler"); - - ACE_Handle_Set_Iterator handle_iter (handles); - ACE_HANDLE h; - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - while ((h = handle_iter ()) != ACE_INVALID_HANDLE) - if (this->resume_handler_i (h) == -1) - return -1; - - return 0; -} - -int -ACE_Dev_Poll_Reactor::resume_handlers (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::resume_handlers"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - size_t const len = this->handler_rep_.max_size (); - - for (size_t i = 0; i < len; ++i) - { - Event_Tuple *info = this->handler_rep_.find (i); - if (info != 0 && info->suspended && this->resume_handler_i (i) != 0) - return -1; - } - - return 0; -} - -int -ACE_Dev_Poll_Reactor::resume_handler_i (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::resume_handler_i"); - - Event_Tuple *info = this->handler_rep_.find (handle); - if (info == 0) - return -1; - - if (!info->suspended) - return 0; - - ACE_Reactor_Mask mask = info->mask; - if (mask == ACE_Event_Handler::NULL_MASK) - { - info->suspended = false; - return 0; - } - - // Place the handle back in to the "interest set." - // - // Events for the given handle will once again be polled. - -#if defined (ACE_HAS_EVENT_POLL) - - struct epoll_event epev; - ACE_OS::memset (&epev, 0, sizeof (epev)); - int op = EPOLL_CTL_ADD; - if (info->controlled) - op = EPOLL_CTL_MOD; - epev.events = this->reactor_mask_to_poll_event (mask) | EPOLLONESHOT; - epev.data.fd = handle; - - if (::epoll_ctl (this->poll_fd_, op, handle, &epev) == -1) - return -1; - info->controlled = true; - -#else - - struct pollfd pfd[1]; - - pfd[0].fd = handle; - pfd[0].events = this->reactor_mask_to_poll_event (mask); - pfd[0].revents = 0; - - if (ACE_OS::write (this->poll_fd_, pfd, sizeof (pfd)) != sizeof (pfd)) - return -1; - -#endif /* ACE_HAS_EVENT_POLL */ - - info->suspended = false; - - return 0; -} - -int -ACE_Dev_Poll_Reactor::resumable_handler (void) -{ - // @@ Is this correct? - - return 1; -} - -bool -ACE_Dev_Poll_Reactor::uses_event_associations (void) -{ - // Since the Dev_Poll_Reactor does not do any event associations, - // this method always return false. - return false; -} - -long -ACE_Dev_Poll_Reactor::schedule_timer (ACE_Event_Handler *event_handler, - const void *arg, - const ACE_Time_Value &delay, - const ACE_Time_Value &interval) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::schedule_timer"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - if (0 != this->timer_queue_) - return this->timer_queue_->schedule - (event_handler, - arg, - this->timer_queue_->gettimeofday () + delay, - interval); - - errno = ESHUTDOWN; - return -1; -} - -int -ACE_Dev_Poll_Reactor::reset_timer_interval (long timer_id, - const ACE_Time_Value &interval) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::reset_timer_interval"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - if (0 != this->timer_queue_) - return this->timer_queue_->reset_interval (timer_id, interval); - - errno = ESHUTDOWN; - return -1; -} - -int -ACE_Dev_Poll_Reactor::cancel_timer (ACE_Event_Handler *event_handler, - int dont_call_handle_close) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::cancel_timer"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return (this->timer_queue_ == 0 - ? 0 - : this->timer_queue_->cancel (event_handler, - dont_call_handle_close)); -} - -int -ACE_Dev_Poll_Reactor::cancel_timer (long timer_id, - const void **arg, - int dont_call_handle_close) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::cancel_timer"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return (this->timer_queue_ == 0 - ? 0 - : this->timer_queue_->cancel (timer_id, - arg, - dont_call_handle_close)); -} - -int -ACE_Dev_Poll_Reactor::schedule_wakeup (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::schedule_wakeup"); - - return this->mask_ops (eh->get_handle (), mask, ACE_Reactor::ADD_MASK); -} - -int -ACE_Dev_Poll_Reactor::schedule_wakeup (ACE_HANDLE handle, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::schedule_wakeup"); - - return this->mask_ops (handle, mask, ACE_Reactor::ADD_MASK); -} - -int -ACE_Dev_Poll_Reactor::cancel_wakeup (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::cancel_wakeup"); - - return this->mask_ops (eh->get_handle (), mask, ACE_Reactor::CLR_MASK); -} - -int -ACE_Dev_Poll_Reactor::cancel_wakeup (ACE_HANDLE handle, - ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::cancel_wakeup"); - - return this->mask_ops (handle, mask, ACE_Reactor::CLR_MASK); -} - -int -ACE_Dev_Poll_Reactor::notify (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask, - ACE_Time_Value *timeout) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::notify"); - - ssize_t n = 0; - - // Pass over both the Event_Handler *and* the mask to allow the - // caller to dictate which Event_Handler method the receiver - // invokes. Note that this call can timeout. - - n = this->notify_handler_->notify (eh, mask, timeout); - - return n == -1 ? -1 : 0; -} - -void -ACE_Dev_Poll_Reactor::max_notify_iterations (int iterations) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::max_notify_iterations"); - - ACE_MT (ACE_GUARD (ACE_Dev_Poll_Reactor_Token, mon, this->token_)); - - this->notify_handler_->max_notify_iterations (iterations); -} - -int -ACE_Dev_Poll_Reactor::max_notify_iterations (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::max_notify_iterations"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return this->notify_handler_->max_notify_iterations (); -} - -int -ACE_Dev_Poll_Reactor::purge_pending_notifications (ACE_Event_Handler * eh, - ACE_Reactor_Mask mask) -{ - if (this->notify_handler_ == 0) - return 0; - - return this->notify_handler_->purge_pending_notifications (eh, mask); -} - -ACE_Event_Handler * -ACE_Dev_Poll_Reactor::find_handler (ACE_HANDLE handle) -{ - ACE_MT (ACE_READ_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, 0)); - - Event_Tuple *info = this->handler_rep_.find (handle); - if (info) - { - info->event_handler->add_reference (); - return info->event_handler; - } - else - { - return 0; - } -} - -int -ACE_Dev_Poll_Reactor::handler (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - ACE_Event_Handler **event_handler) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::handler"); - - ACE_MT (ACE_READ_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - Event_Tuple *info = this->handler_rep_.find (handle); - - if (info != 0 - && ACE_BIT_CMP_MASK (info->mask, - mask, // Compare all bits in the mask - mask)) - { - if (event_handler != 0) - *event_handler = info->event_handler; - - return 0; - } - - return -1; -} - -int -ACE_Dev_Poll_Reactor::handler (int signum, - ACE_Event_Handler **eh) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::handler"); - - ACE_Event_Handler *handler = this->signal_handler_->handler (signum); - - if (handler == 0) - return -1; - else if (eh != 0) - *eh = handler; - - return 0; -} - -bool -ACE_Dev_Poll_Reactor::initialized (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::initialized"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, false)); - - return this->initialized_; -} - -size_t -ACE_Dev_Poll_Reactor::size (void) const -{ - return this->handler_rep_.size (); -} - -ACE_Lock & -ACE_Dev_Poll_Reactor::lock (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::lock"); - - return this->lock_adapter_; -} - -void -ACE_Dev_Poll_Reactor::wakeup_all_threads (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::wakeup_all_threads"); - - // Send a notification, but don't block if there's no one to receive - // it. - this->notify (0, - ACE_Event_Handler::NULL_MASK, - (ACE_Time_Value *) &ACE_Time_Value::zero); -} - -int -ACE_Dev_Poll_Reactor::owner (ACE_thread_t /* new_owner */, - ACE_thread_t * /* old_owner */) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::owner"); - - // There is no need to set the owner of the event loop. Multiple - // threads may invoke the event loop simulataneously. - - return 0; -} - -int -ACE_Dev_Poll_Reactor::owner (ACE_thread_t * /* owner */) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::owner"); - - // There is no need to set the owner of the event loop. Multiple - // threads may invoke the event loop simulataneously. - - return 0; -} - -bool -ACE_Dev_Poll_Reactor::restart (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::restart"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, false)); - - return this->restart_; -} - -bool -ACE_Dev_Poll_Reactor::restart (bool r) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::restart"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, false)); - - bool current_value = this->restart_; - this->restart_ = r; - return current_value; -} - -void -ACE_Dev_Poll_Reactor::requeue_position (int) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::requeue_position"); -} - -int -ACE_Dev_Poll_Reactor::requeue_position (void) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::requeue_position"); - - ACE_NOTSUP_RETURN (-1); -} - -int -ACE_Dev_Poll_Reactor::mask_ops (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask, - int ops) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::mask_ops"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return this->mask_ops_i (event_handler->get_handle (), mask, ops); -} - -int -ACE_Dev_Poll_Reactor::mask_ops (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - int ops) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::mask_ops"); - - ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); - - return this->mask_ops_i (handle, mask, ops); -} - -int -ACE_Dev_Poll_Reactor::mask_ops_i (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - int ops) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::mask_ops_i"); - - Event_Tuple *info = this->handler_rep_.find (handle); - if (info == 0) - return -1; - - // Block out all signals until method returns. - ACE_Sig_Guard sb; - - ACE_Reactor_Mask const old_mask = info->mask; - ACE_Reactor_Mask new_mask = old_mask; - - // Perform GET, CLR, SET, and ADD operations on the interest/wait - // set and the suspend set (if necessary). - // - // GET = 1, Retrieve current value - // SET = 2, Set value of bits to new mask (changes the entire mask) - // ADD = 3, Bitwise "or" the value into the mask (only changes - // enabled bits) - // CLR = 4 Bitwise "and" the negation of the value out of the mask - // (only changes enabled bits) - // - // Returns the original mask. - - switch (ops) - { - case ACE_Reactor::GET_MASK: - // The work for this operation is done in all cases at the - // begining of the function. - return old_mask; - - case ACE_Reactor::CLR_MASK: - ACE_CLR_BITS (new_mask, mask); - break; - - case ACE_Reactor::SET_MASK: - new_mask = mask; - break; - - case ACE_Reactor::ADD_MASK: - ACE_SET_BITS (new_mask, mask); - break; - - default: - return -1; - } - - /// Reset the mask for the given handle. - info->mask = new_mask; - - // Only attempt to alter events for the handle from the - // "interest set" if it hasn't been suspended. If it has been - // suspended, the revised mask will take affect when the - // handle is resumed. The exception is if all the mask bits are - // cleared, we can un-control the fd now. - if (!info->suspended || (info->controlled && new_mask == 0)) - { - - short const events = this->reactor_mask_to_poll_event (new_mask); - -#if defined (sun) - // Apparently events cannot be updated on-the-fly on Solaris so - // remove the existing events, and then add the new ones. - struct pollfd pfd[2]; - - pfd[0].fd = handle; - pfd[0].events = POLLREMOVE; - pfd[0].revents = 0; - pfd[1].fd = (events == POLLREMOVE ? ACE_INVALID_HANDLE : handle); - pfd[1].events = events; - pfd[1].revents = 0; - - // Change the events associated with the given file descriptor. - if (ACE_OS::write (this->poll_fd_, - pfd, - sizeof (pfd)) != sizeof (pfd)) - return -1; -#elif defined (ACE_HAS_EVENT_POLL) - - struct epoll_event epev; - ACE_OS::memset (&epev, 0, sizeof (epev)); - int op; - - // ACE_Event_Handler::NULL_MASK ??? - if (new_mask == 0) - { - op = EPOLL_CTL_DEL; - epev.events = 0; - } - else - { - op = EPOLL_CTL_MOD; - epev.events = events | EPOLLONESHOT; - } - - epev.data.fd = handle; - - if (::epoll_ctl (this->poll_fd_, op, handle, &epev) == -1) - { - // If a handle is closed, epoll removes it from the poll set - // automatically - we may not know about it yet. If that's the - // case, a mod operation will fail with ENOENT. Retry it as - // an add. If it's any other failure, just fail outright. - if (op != EPOLL_CTL_MOD || errno != ENOENT || - ::epoll_ctl (this->poll_fd_, EPOLL_CTL_ADD, handle, &epev) == -1) - return -1; - } - info->controlled = (op != EPOLL_CTL_DEL); -#else - pollfd pfd[1]; - - pfd[0].fd = handle; - pfd[0].events = events; - pfd[0].revents = 0; - - // Change the events associated with the given file descriptor. - if (ACE_OS::write (this->poll_fd_, - pfd, - sizeof (pfd)) != sizeof (pfd)) - return -1; -#endif /*ACE_HAS_EVENT_POLL */ - } - - return old_mask; -} - -int -ACE_Dev_Poll_Reactor::ready_ops (ACE_Event_Handler * /* event_handler */, - ACE_Reactor_Mask /* mask */, - int /* ops */) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::ready_ops"); - - // Since the Dev_Poll_Reactor uses the poll result buffer, the - // ready_set cannot be directly manipulated outside of the event - // loop. - ACE_NOTSUP_RETURN (-1); -} - -int -ACE_Dev_Poll_Reactor::ready_ops (ACE_HANDLE /* handle */, - ACE_Reactor_Mask /* mask */, - int /* ops */) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::ready_ops"); - - // Since the Dev_Poll_Reactor uses the poll result buffer, the - // ready_set cannot be directly manipulated outside of the event - // loop. - ACE_NOTSUP_RETURN (-1); -} - -void -ACE_Dev_Poll_Reactor::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Dev_Poll_Reactor::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("restart_ = %d\n"), this->restart_)); - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("initialized_ = %d"), - this->initialized_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("poll_fd_ = %d"), this->poll_fd_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("size_ = %u"), this->handler_rep_.size ())); - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("deactivated_ = %d"), - this->deactivated_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -short -ACE_Dev_Poll_Reactor::reactor_mask_to_poll_event (ACE_Reactor_Mask mask) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::reactor_mask_to_poll_event"); - - if (mask == ACE_Event_Handler::NULL_MASK) - // No event. Remove from interest set. -#if defined (ACE_HAS_EVENT_POLL) - return EPOLL_CTL_DEL; -#else - return POLLREMOVE; -#endif /* ACE_HAS_EVENT_POLL */ - - short events = 0; - - // READ, ACCEPT, and CONNECT flag will place the handle in the - // read set. - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK) - || ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK) - || ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK)) - { -#if defined (ACE_HAS_EVENT_POLL) - ACE_SET_BITS (events, EPOLLIN); -#else - ACE_SET_BITS (events, POLLIN); -#endif /*ACE_HAS_EVENT_POLL*/ - } - - // WRITE and CONNECT flag will place the handle in the write set. - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK) - || ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK)) - { -#if defined (ACE_HAS_EVENT_POLL) - ACE_SET_BITS (events, EPOLLOUT); -#else - ACE_SET_BITS (events, POLLOUT); -#endif /*ACE_HAS_EVENT_POLL*/ - } - - // EXCEPT flag will place the handle in the except set. - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK)) - { -#if defined (ACE_HAS_EVENT_POLL) - ACE_SET_BITS (events, EPOLLPRI); -#else - ACE_SET_BITS (events, POLLPRI); -#endif /*ACE_HAS_EVENT_POLL*/ - } - - return events; -} - -namespace { - void polite_sleep_hook (void *) { } -} - -int -ACE_Dev_Poll_Reactor::Token_Guard::acquire_quietly (ACE_Time_Value *max_wait) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::Token_Guard::acquire_quietly"); - - // Acquire the token but don't ping any waiters; just queue up politely. - int result = 0; - if (max_wait) - { - ACE_Time_Value tv = ACE_OS::gettimeofday (); - tv += *max_wait; - - ACE_MT (result = this->token_.acquire_read (&polite_sleep_hook, - 0, - &tv)); - } - else - { - ACE_MT (result = this->token_.acquire_read (&polite_sleep_hook)); - } - - // Check for timeouts and errors. - if (result == -1) - { - if (errno == ETIME) - return 0; - else - { - ACE_ERROR ((LM_ERROR, ACE_TEXT("%t: %p\n"), ACE_TEXT("token acquire_read"))); - return -1; - } - } - - // We got the token and so let us mark ourselves as owner - this->owner_ = 1; - - return result; -} - -int -ACE_Dev_Poll_Reactor::Token_Guard::acquire (ACE_Time_Value *max_wait) -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::Token_Guard::acquire"); - - // Try to grab the token. If someone if already there, don't wake - // them up, just queue up in the thread pool. - int result = 0; - if (max_wait) - { - ACE_Time_Value tv = ACE_OS::gettimeofday (); - tv += *max_wait; - - ACE_MT (result = this->token_.acquire (0, 0, &tv)); - } - else - { - ACE_MT (result = this->token_.acquire ()); - } - - // Check for timeouts and errors. - if (result == -1) - { - if (errno == ETIME) - return 0; - else - return -1; - } - - // We got the token and so let us mark ourseleves as owner - this->owner_ = 1; - - return result; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_EVENT_POLL || ACE_HAS_DEV_POLL */ diff --git a/dep/acelite/ace/Dev_Poll_Reactor.h b/dep/acelite/ace/Dev_Poll_Reactor.h deleted file mode 100644 index b77d8b16a10..00000000000 --- a/dep/acelite/ace/Dev_Poll_Reactor.h +++ /dev/null @@ -1,1211 +0,0 @@ -// -*- C++ -*- - -// ========================================================================= -/** - * @file Dev_Poll_Reactor.h - * - * $Id: Dev_Poll_Reactor.h 94549 2011-10-03 06:31:27Z johnnyw $ - * - * @c /dev/poll (or Linux @c sys_epoll) based Reactor implementation. - * - * @author Ossama Othman - */ -// ========================================================================= - - -#ifndef ACE_DEV_POLL_REACTOR_H -#define ACE_DEV_POLL_REACTOR_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_EVENT_POLL) && defined (ACE_HAS_DEV_POLL) -# error ACE_HAS_EVENT_POLL and ACE_HAS_DEV_POLL are mutually exclusive. -#endif /* ACE_HAS_EVENT_POLL && defined ACE_HAS_DEV_POLL */ - -#if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) - -#include "ace/Pipe.h" -#include "ace/Lock_Adapter_T.h" -#include "ace/Reactor_Impl.h" -#include "ace/Reactor_Token_T.h" -#include "ace/Token.h" - -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) -# include "ace/Notification_Queue.h" -#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ - -#if defined (ACE_HAS_DEV_POLL) -struct pollfd; -#elif defined (ACE_HAS_EVENT_POLL) -# include "ace/Array_Map.h" -# include /**/ -#endif - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declarations -class ACE_Sig_Handler; -class ACE_Dev_Poll_Reactor; - - -// --------------------------------------------------------------------- - -/** - * @class ACE_Dev_Poll_Reactor_Notify - * - * @brief Event handler used for unblocking the ACE_Dev_Poll_Reactor - * from its event loop. - * - * This event handler is used internally by the ACE_Dev_Poll_Reactor - * as a means to allow a thread other then the one running the event - * loop to unblock the event loop. - */ -class ACE_Dev_Poll_Reactor_Notify : public ACE_Reactor_Notify -{ -public: - - /// Constructor - ACE_Dev_Poll_Reactor_Notify (void); - - /** - * @name Initialization and Termination Methods - * - * Methods called when initializing and terminating this event - * handler. - */ - virtual int open (ACE_Reactor_Impl *, - ACE_Timer_Queue *timer_queue = 0, - int disable_notify = 0); - virtual int close (void); - - /** - * Called by a thread when it wants to unblock the Reactor_Impl. - * This wakes up the Reactor_Impl if currently blocked. Pass over - * both the Event_Handler and the mask to allow the caller to - * dictate which Event_Handler method the Reactor_Impl will - * invoke. The ACE_Time_Value indicates how long to block - * trying to notify the Reactor_Impl. If timeout == 0, the - * caller will block until action is possible, else will wait until - * the relative time specified in *timeout elapses). - */ - virtual int notify (ACE_Event_Handler *eh = 0, - ACE_Reactor_Mask mask = ACE_Event_Handler::EXCEPT_MASK, - ACE_Time_Value *timeout = 0); - - /// Unimplemented method required by pure virtual method in abstract - /// base class. - /** - * This method's interface is not very compatibile with this - * Reactor's design. It's not clear why this method is pure virtual - * either. - */ - virtual int dispatch_notifications (int &number_of_active_handles, - ACE_Handle_Set &rd_mask); - - /// Returns the ACE_HANDLE of the notify pipe on which the reactor - /// is listening for notifications so that other threads can unblock - /// the Reactor_Impl. - virtual ACE_HANDLE notify_handle (void); - - /// Verify whether the buffer has dispatchable info or not. - virtual int is_dispatchable (ACE_Notification_Buffer &buffer); - - /// Handle one notify call represented in @a buffer. This could be - /// because of a thread trying to unblock the Reactor_Impl. - virtual int dispatch_notify (ACE_Notification_Buffer &buffer); - - /// Read one notify call on the handle into @a buffer. - /// This could be because of a thread trying to unblock the Reactor_Impl. - virtual int read_notify_pipe (ACE_HANDLE handle, - ACE_Notification_Buffer &buffer); - - /// Called back by the ACE_Dev_Poll_Reactor when a thread wants to - /// unblock us. - virtual int handle_input (ACE_HANDLE handle); - - /** - * Set the maximum number of times that the handle_input method - * will iterate and dispatch the ACE_Event_Handlers that are - * passed in via the notify queue before breaking out of the event - * loop. By default, this is set to -1, which means "iterate until - * the queue is empty." Setting this to a value like "1 or 2" will - * increase "fairness" (and thus prevent starvation) at the expense - * of slightly higher dispatching overhead. - */ - virtual void max_notify_iterations (int); - - /** - * Get the maximum number of times that the handle_input method - * will iterate and dispatch the ACE_Event_Handlers that are - * passed in via the notify queue before breaking out of its event - * loop. - */ - virtual int max_notify_iterations (void); - - /** - * Purge any notifications pending in this reactor for the specified - * ACE_Event_Handler object. Returns the number of notifications - * purged. Returns -1 on error. - */ - virtual int purge_pending_notifications ( - ACE_Event_Handler * = 0, - ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); - - /// Dump the state of an object. - virtual void dump (void) const; - - /// Method called by ACE_Dev_Poll_Reactor to obtain one notification. - /// THIS METHOD MUST BE CALLED WITH THE REACTOR TOKEN HELD! - /// - /// @return -1 on error, else 0 and @arg nb has the notify to - /// dispatch. Note that the contained event handler may be - /// 0 if there were only wake-ups (no handlers to dispatch). - int dequeue_one (ACE_Notification_Buffer &nb); - -protected: - - /** - * Keep a back pointer to the ACE_Dev_Poll_Reactor. If this value - * if NULL then the ACE_Dev_Poll_Reactor has been initialized with - * disable_notify_pipe. - */ - ACE_Dev_Poll_Reactor *dp_reactor_; - - /** - * Contains the ACE_HANDLE the ACE_Dev_Poll_Reactor is listening - * on, as well as the ACE_HANDLE that threads wanting the attention - * of the ACE_Dev_Poll_Reactor will write to. - */ - ACE_Pipe notification_pipe_; - - /** - * Keeps track of the maximum number of times that the - * ACE_Dev_Poll_Reactor_Notify::handle_input method will iterate and - * dispatch the ACE_Event_Handlers that are passed in via the - * notify pipe before breaking out of its recv loop. By default, - * this is set to -1, which means "iterate until the pipe is empty." - */ - int max_notify_iterations_; - -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) - /** - * @brief A user-space queue to store the notifications. - * - * The notification pipe has OS-specific size restrictions. That - * is, no more than a certain number of bytes may be stored in the - * pipe without blocking. This limit may be too small for certain - * applications. In this case, ACE can be configured to store all - * the events in user-space. The pipe is still needed to wake up - * the reactor thread, but only one event is sent through the pipe - * at a time. - */ - ACE_Notification_Queue notification_queue_; -#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ -}; - -// --------------------------------------------------------------------- - -/** - * @class ACE_Dev_Poll_Reactor - * - * @brief A `/dev/poll' or `/dev/epoll' based Reactor implemenatation. - * - * @attention The Linux epoll implementation works quite well and is - * fully supported; however, the /dev/poll implementation is @em experimental. - * - * The ACE_Dev_Poll_Reactor uses the `/dev/poll' or '/dev/epoll' - * character devices to demultiplex events on a given set of file - * descriptors. Unlike @c select(), `/dev/poll' and `/dev/epoll' have - * no hard-coded limit on the number of file descriptors that may be - * handled at any given time. As such, the ACE_Dev_Poll_Reactor can - * generally handle a much larger number of file descriptors than - * @c select() -based reactors. Furthermore, since `/dev/poll' and - * `/dev/epoll' both return a set of file descriptors that are active, - * there is no need to "walk" the set of file descriptors to determine - * which ones are active, such as what is done with the @c select() and - * @c poll() system calls. All returned file descriptors are active. - * This makes event dispatching very efficient. - * - * @note In general, this reactor may only be used to demultiplex - * events on sockets. Demultiplexing events on pipes, for - * example may not work. This is due to a limitation in the - * underlying `/dev/poll' device driver. - * - * @note It is only possible to achieve millisecond timeout - * resolutions with the @c ACE_Dev_Poll_Reactor. However, the - * timeout resolution for timers is independent of the reactors - * timeout resolution. As such, it may be possible to achieve - * sub-millisecond timeout resolutions for timers but that is - * entirely platform dependent. - */ - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) -typedef ACE_Token ACE_DEV_POLL_TOKEN; -#else -typedef ACE_Noop_Token ACE_DEV_POLL_TOKEN; -#endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */ -typedef ACE_Reactor_Token_T ACE_Dev_Poll_Reactor_Token; - -class ACE_Export ACE_Dev_Poll_Reactor : public ACE_Reactor_Impl -{ - - /** - * @struct Event_Tuple - * - * @brief Struct that collects event registration information for a handle. - * - * @internal Internal use only - * - * This struct merely provides a means to associate an event mask - * with an event handler. Such an association is needed since it is - * not possible to retrieve the event mask from the "interest set" - * stored in the `/dev/poll' or `/dev/epoll' driver. Without this - * external association, it would not be possible keep track of the - * event mask for a given event handler when suspending it or resuming - * it. - * - * @note An ACE_Handle_Set is not used since the number of handles may - * exceed its capacity (ACE_DEFAULT_SELECT_REACTOR_SIZE). - */ - struct Event_Tuple - { - /// Constructor to set up defaults. - Event_Tuple (ACE_Event_Handler *eh = 0, - ACE_Reactor_Mask m = ACE_Event_Handler::NULL_MASK, - bool is_suspended = false, - bool is_controlled = false); - - /// The event handler. - ACE_Event_Handler *event_handler; - - /// The event mask for the above event handler. - ACE_Reactor_Mask mask; - - /// Flag that states whether or not the event handler is suspended. - bool suspended; - - /// Flag to say whether or not this handle is registered with epoll. - bool controlled; - }; - - - // --------------------------------------------------------------------- - - /** - * @class Handler_Repository - * - * @internal - * - * @brief Used to map ACE_HANDLEs onto the appropriate Event_Tuple. - * - * This class is simply a container that maps a handle to its - * corresponding event tuple. It is not meant for use outside of - * the Dev_Poll_Reactor. - * - * @note Calls to any method in this class, and any modification to a - * Event_Tuple returned from this class's methods, must be made - * while holding the reactor token. - */ - class Handler_Repository - { - public: - - /// Constructor. - Handler_Repository (void); - - /// Initialize a repository that can map handles up to the value @a size. - /// Since the event tuples are accessed directly using the handle as - /// an index, @a size sets the maximum handle value, minus 1. - int open (size_t size); - - /// Close down the repository. - int close (void); - - /** - * @name Repository Manipulation Operations - * - * Methods used to search and modify the handler repository. - */ - //@{ - - /// Return a pointer to the Event_Tuple associated with @a handle. - /// If there is none associated, returns 0 and sets errno. - Event_Tuple *find (ACE_HANDLE handle); - - - /// Bind the ACE_Event_Handler to the @c ACE_HANDLE with the - /// appropriate ACE_Reactor_Mask settings. - int bind (ACE_HANDLE handle, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask); - - /// Remove the binding for @a handle; optionally decrement the associated - /// handler's reference count. - int unbind (ACE_HANDLE handle, bool decr_refcnt = true); - - /// Remove all the registered tuples. - int unbind_all (void); - - //@} - - /** - * @name Sanity Checking - * - * Methods used to prevent "out-of-range" errors when indexing the - * underlying handler array. - */ - //@{ - - // Check the @a handle to make sure it's a valid @c ACE_HANDLE that - // within the range of legal handles (i.e., greater than or equal to - // zero and less than @c max_size_). - bool invalid_handle (ACE_HANDLE handle) const; - - // Check the handle to make sure it's a valid @c ACE_HANDLE that is - // within the range of currently registered handles (i.e., greater - // than or equal to zero and less than @c max_handlep1_). - bool handle_in_range (ACE_HANDLE handle) const; - - //@} - - /// Returns the current table size. - size_t size (void) const; - - /// Returns the current table size. - size_t max_size (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - private: - - /// Current number of handles. - int size_; - - /// Maximum number of handles. - int max_size_; - - /// The underlying array of event handlers. - /** - * The array of event handlers is directly indexed directly using - * an @c ACE_HANDLE value. This is Unix-specific. - */ - Event_Tuple *handlers_; - - }; - -public: - - /// Initialize @c ACE_Dev_Poll_Reactor with the default size. - /** - * The default size for the @c ACE_Dev_Poll_Reactor is the maximum - * number of open file descriptors for the process. - */ - ACE_Dev_Poll_Reactor (ACE_Sig_Handler * = 0, - ACE_Timer_Queue * = 0, - int disable_notify_pipe = 0, - ACE_Reactor_Notify *notify = 0, - int mask_signals = 1, - int s_queue = ACE_DEV_POLL_TOKEN::FIFO); - - /// Initialize ACE_Dev_Poll_Reactor with size @a size. - /** - * @note On Unix platforms, the @a size parameter should be as large - * as the maximum number of file descriptors allowed for a - * given process. This is necessary since a file descriptor - * is used to directly index the array of event handlers - * maintained by the Reactor's handler repository. Direct - * indexing is used for efficiency reasons. If the size - * parameter is less than the process maximum, the process - * maximum will be decreased in order to prevent potential - * access violations. - */ - ACE_Dev_Poll_Reactor (size_t size, - bool restart = false, - ACE_Sig_Handler * = 0, - ACE_Timer_Queue * = 0, - int disable_notify_pipe = 0, - ACE_Reactor_Notify *notify = 0, - int mask_signals = 1, - int s_queue = ACE_DEV_POLL_TOKEN::FIFO); - - /// Close down and release all resources. - virtual ~ACE_Dev_Poll_Reactor (void); - - /// Initialization. - virtual int open (size_t size, - bool restart = false, - ACE_Sig_Handler * = 0, - ACE_Timer_Queue * = 0, - int disable_notify_pipe = 0, - ACE_Reactor_Notify * = 0); - - /** - * @param handle allows the reactor to check if the caller is - * valid. - * - * @return 0 if the size of the current message has been put in - * size. -1 if not. - */ - virtual int current_info (ACE_HANDLE handle, size_t & /* size */); - - /// Use a user specified signal handler instead. - virtual int set_sig_handler (ACE_Sig_Handler *signal_handler); - - /// Set a user-specified timer queue. - virtual int timer_queue (ACE_Timer_Queue *tq); - - /// Get the timer queue - /// @return The current @c ACE_Timer_Queue. - virtual ACE_Timer_Queue *timer_queue (void) const; - - /// Close down and release all resources. - virtual int close (void); - - // = Event loop drivers. - /** - * Returns non-zero if there are I/O events "ready" for dispatching, - * but does not actually dispatch the event handlers. By default, - * don't block while checking this, i.e., "poll". - * - * @note It is only possible to achieve millisecond timeout - * resolutions with the @c ACE_Dev_Poll_Reactor. - */ - virtual int work_pending ( - const ACE_Time_Value &max_wait_time = ACE_Time_Value::zero); - - /** - * This event loop driver blocks for up to @a max_wait_time before - * returning. It will return earlier if events occur. Note that - * @a max_wait_time can be 0, in which case this method blocks - * indefinitely until events occur. - * @par - * @a max_wait_time is decremented to reflect how much time this - * call took. For instance, if a time value of 3 seconds is passed - * to @c handle_events() and an event occurs after 2 seconds, - * @a max_wait_time will equal 1 second. This can be used if an - * application wishes to handle events for some fixed amount of - * time. - * @par - * The only difference between @c alertable_handle_events() and - * handle_events() is that in the alertable case, the event loop - * will return when the system queues an I/O completion routine or - * an Asynchronous Procedure Call. - * - * @return The total number of @c ACE_Event_Handlers that were - * dispatched, 0 if the @a max_wait_time elapsed without - * dispatching any handlers, or -1 if an error occurs. - - * @note It is only possible to achieve millisecond timeout - * resolutions with the @c ACE_Dev_Poll_Reactor. - */ - virtual int handle_events (ACE_Time_Value *max_wait_time = 0); - virtual int alertable_handle_events (ACE_Time_Value *max_wait_time = 0); - - /** - * This method is just like the one above, except the - * @a max_wait_time value is a reference and can therefore never be - * @c NULL. - * - * @note It is only possible to achieve millisecond timeout - * resolutions with the @c ACE_Dev_Poll_Reactor. - */ - virtual int handle_events (ACE_Time_Value &max_wait_time); - virtual int alertable_handle_events (ACE_Time_Value &max_wait_time); - - // = Event handling control. - - /** - * @return The status of Reactor. If this function returns 0, the - * reactor is actively handling events. If it returns - * non-zero, @c handle_events() and - * @c handle_alertable_events() return -1 immediately. - */ - virtual int deactivated (void); - - /** - * Control whether the Reactor will handle any more incoming events - * or not. If @a do_stop == 1, the Reactor will be disabled. By - * default, a reactor is in active state and can be - * deactivated/reactived as desired. - */ - virtual void deactivate (int do_stop); - - // = Register and remove Handlers. - - /// Register @a event_handler with @a mask. The I/O handle will - /// always come from get_handle on the event_handler. - virtual int register_handler (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask); - - /// Register @a event_handler with @a mask. The I/O handle is - /// provided through the @a io_handle parameter. - virtual int register_handler (ACE_HANDLE io_handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask); - - /** - * Register an @a event_handler that will be notified when - * @a event_handle is signaled. @a mask specifies the network - * events that the @a event_handler is interested in. - */ - virtual int register_handler (ACE_HANDLE event_handle, - ACE_HANDLE io_handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask); - - /// Register @a event_handler with all the @a handles in the @c - /// Handle_Set. - virtual int register_handler (const ACE_Handle_Set &handles, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask); - - /** - * Register @a new_sh to handle the signal @a signum using the - * @a new_disp. Returns the @a old_sh that was previously - * registered (if any), along with the @a old_disp of the signal - * handler. - */ - virtual int register_handler (int signum, - ACE_Event_Handler *new_sh, - ACE_Sig_Action *new_disp = 0, - ACE_Event_Handler **old_sh = 0, - ACE_Sig_Action *old_disp = 0); - - /// Registers @a new_sh to handle a set of signals @a sigset using the - /// @a new_disp. - virtual int register_handler (const ACE_Sig_Set &sigset, - ACE_Event_Handler *new_sh, - ACE_Sig_Action *new_disp = 0); - - /// Removes @a event_handler. - /** - * @note The I/O handle will be obtained using @c get_handle() - * method of @a event_handler . If @a mask == - * @c ACE_Event_Handler::DONT_CALL then the @c handle_close() - * method of the @a event_handler is not invoked. - */ - virtual int remove_handler (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask); - - /** - * Removes @a handle. If @a mask == ACE_Event_Handler::DONT_CALL - * then the method of the associated - * is not invoked. - */ - virtual int remove_handler (ACE_HANDLE handle, - ACE_Reactor_Mask mask); - - /** - * Removes all handles in @a handle_set. If @a mask == - * ACE_Event_Handler::DONT_CALL then the method of - * the associated s is not invoked. - */ - virtual int remove_handler (const ACE_Handle_Set &handle_set, - ACE_Reactor_Mask mask); - - /** - * Remove the ACE_Event_Handler currently associated with @a signum. - * Install the new disposition (if given) and return the previous - * disposition (if desired by the caller). Returns 0 on success and - * -1 if @a signum is invalid. - */ - virtual int remove_handler (int signum, - ACE_Sig_Action *new_disp, - ACE_Sig_Action *old_disp = 0, - int sigkey = -1); - - /// Calls for every signal in @a sigset. - virtual int remove_handler (const ACE_Sig_Set &sigset); - - // = Suspend and resume Handlers. - - /// Suspend event_handler temporarily. Use - /// ACE_Event_Handler::get_handle() to get the handle. - virtual int suspend_handler (ACE_Event_Handler *event_handler); - - /// Suspend handle temporarily. - virtual int suspend_handler (ACE_HANDLE handle); - - /// Suspend all handles in handle set temporarily. - virtual int suspend_handler (const ACE_Handle_Set &handles); - - /// Suspend all handles temporarily. - virtual int suspend_handlers (void); - - /// Resume event_handler. Use ACE_Event_Handler::get_handle() to - /// get the handle. - virtual int resume_handler (ACE_Event_Handler *event_handler); - - /// Resume handle. - virtual int resume_handler (ACE_HANDLE handle); - - /// Resume all handles in handle set. - virtual int resume_handler (const ACE_Handle_Set &handles); - - /// Resume all handles. - virtual int resume_handlers (void); - - /// Does the reactor allow the application to resume the handle on - /// its own, i.e., can it pass on the control of handle resumption to - /// the application. - virtual int resumable_handler (void); - - /// Return true if we any event associations were made by the reactor - /// for the handles that it waits on, false otherwise. - virtual bool uses_event_associations (void); - - // = Timer management. - - /** - * Schedule an ACE_Event_Handler that will expire after an amount - * of time. The return value of this method, a timer_id value, - * uniquely identifies the event_handler in the ACE_Reactor's - * internal list of timers. - * This timer_id value can be used to cancel the timer - * with the cancel_timer() call. - * - * @see cancel_timer() - * @see reset_timer_interval() - * - * @param event_handler event handler to schedule on reactor - * @param arg argument passed to the handle_timeout() method of - * event_handler. - * @param delay time interval after which the timer will expire. - * @param interval time interval for which the timer will be - * automatically rescheduled. - * @return -1 on failure, a timer_id value on success - */ - virtual long schedule_timer (ACE_Event_Handler *event_handler, - const void *arg, - const ACE_Time_Value &delay, - const ACE_Time_Value &interval = ACE_Time_Value::zero); - - /** - * Resets the interval of the timer represented by @a timer_id to - * @a interval, which is specified in relative time to the current - * . If @a interval is equal to - * ACE_Time_Value::zero, the timer will become a non-rescheduling - * timer. Returns 0 if successful, -1 if not. - */ - virtual int reset_timer_interval (long timer_id, - const ACE_Time_Value &interval); - - /// Cancel all Event_Handlers that match the address of - /// @a event_handler. Returns number of handlers cancelled. - virtual int cancel_timer (ACE_Event_Handler *event_handler, - int dont_call_handle_close = 1); - - /** - * Cancel the single event handler that matches the @a timer_id value - * (which was returned from the schedule method). If @a arg is - * non-NULL then it will be set to point to the ``magic cookie'' - * argument passed in when the event handler was registered. This - * makes it possible to free up the memory and avoid memory leaks. - * Returns 1 if cancellation succeeded and 0 if the @a timer_id - * wasn't found. - */ - virtual int cancel_timer (long timer_id, - const void **arg = 0, - int dont_call_handle_close = 1); - - // = High-level event handler scheduling operations - - /// Add @a masks_to_be_added to the @a event_handler's entry. - /// @a event_handler must already have been registered. - virtual int schedule_wakeup (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask masks_to_be_added); - - /// Add @a masks_to_be_added to the @a handle's entry. - /// associated with @a handle must already have been registered. - virtual int schedule_wakeup (ACE_HANDLE handle, - ACE_Reactor_Mask masks_to_be_added); - - /// Clear @a masks_to_be_cleared from the @a event_handler's entry. - virtual int cancel_wakeup (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask masks_to_be_cleared); - - /// Clear @a masks_to_be_cleared from the @a handle's entry. - virtual int cancel_wakeup (ACE_HANDLE handle, - ACE_Reactor_Mask masks_to_be_cleared); - - // = Notification methods. - - /** - * Notify @a event_handler of @a mask event. The ACE_Time_Value - * indicates how long to blocking trying to notify. If @a timeout == - * 0, the caller will block until action is possible, else will wait - * until the relative time specified in @a timeout elapses). - */ - virtual int notify (ACE_Event_Handler *event_handler = 0, - ACE_Reactor_Mask mask = ACE_Event_Handler::EXCEPT_MASK, - ACE_Time_Value * = 0); - - /** - * Set the maximum number of times that ACE_Reactor_Impl will - * iterate and dispatch the ACE_Event_Handlers that are passed in - * via the notify queue before breaking out of its - * loop. By default, this is set to - * -1, which means "iterate until the queue is empty." Setting this - * to a value like "1 or 2" will increase "fairness" (and thus - * prevent starvation) at the expense of slightly higher dispatching - * overhead. - */ - virtual void max_notify_iterations (int); - - /** - * Get the maximum number of times that the ACE_Reactor_Impl will - * iterate and dispatch the ACE_Event_Handlers that are passed in - * via the notify queue before breaking out of its - * loop. - */ - virtual int max_notify_iterations (void); - - /** - * Purge any notifications pending in this reactor for the specified - * ACE_Event_Handler object. Returns the number of notifications - * purged. Returns -1 on error. - */ - virtual int purge_pending_notifications (ACE_Event_Handler * = 0, - ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); - - /** - * Return the Event_Handler associated with @a handle. Return 0 if - * @a handle is not registered. - */ - virtual ACE_Event_Handler *find_handler (ACE_HANDLE handle); - - /** - * Check to see if @a handle is associated with a valid Event_Handler - * bound to @a mask. Return the @a event_handler associated with this - * @c handler if @a event_handler != 0. - */ - virtual int handler (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - ACE_Event_Handler **event_handler = 0); - - /** - * Check to see if @a signum is associated with a valid Event_Handler - * bound to a signal. Return the @a event_handler associated with - * this @c handler if @a event_handler != 0. - */ - virtual int handler (int signum, - ACE_Event_Handler ** = 0); - - /// Returns true if Reactor has been successfully initialized, else - /// false. - virtual bool initialized (void); - - /// Returns the current size of the Reactor's internal descriptor - /// table. - virtual size_t size (void) const; - - /// Returns a reference to the Reactor's internal lock. - virtual ACE_Lock &lock (void); - - /// Wake up all threads waiting in the event loop. - virtual void wakeup_all_threads (void); - - /// Transfers ownership of Reactor_Impl to the @a new_owner. - /** - * @note There is no need to set the owner of the event loop for the - * ACE_Dev_Poll_Reactor. Multiple threads may invoke the - * event loop simulataneously. As such, this method is a - * no-op. - */ - virtual int owner (ACE_thread_t new_owner, ACE_thread_t *old_owner = 0); - - /// Return the ID of the "owner" thread. - /** - * @note There is no need to set the owner of the event loop for the - * ACE_Dev_Poll_Reactor. Multiple threads may invoke the - * event loop simultaneously. As such, this method is a - * no-op. - */ - virtual int owner (ACE_thread_t *owner); - - /// Get the existing restart value. - virtual bool restart (void); - - /// Set a new value for restart and return the original value. - /** - * @param r If zero, then the event loop will not be automatically - * restarted if the underlying poll is interrupted via the - * INTR (interrupt) signal. - * - * @return Returns the previous "restart" value. - */ - virtual bool restart (bool r); - - /// Set position of the owner thread. - /** - * @note This is currently a no-op. - */ - virtual void requeue_position (int); - - /// Get position of the owner thread. - /** - * @note This is currently a no-op. - */ - virtual int requeue_position (void); - - /** - * @name Low-level wait_set mask manipulation methods - * - * Low-level methods to manipulate the event/reactor mask associated - * with a handle and event handler when polling for events. - * @par - * The "interest set," i.e. the wait set, can be directly - * manipulated with these methods. - */ - //@{ - - /// GET/SET/ADD/CLR the dispatch mask "bit" bound with the - /// event_handler and mask. - /** - * @return Old mask on success, -1 on error. - */ - virtual int mask_ops (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask, - int ops); - - /// GET/SET/ADD/CLR the dispatch MASK "bit" bound with the handle - /// and mask. - /** - * @return Old mask on success, -1 on error. - */ - virtual int mask_ops (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - int ops); - - //@} - - /** - * @name Low-level ready_set mask manipulation methods - * - * These methods are unimplemented. - */ - //@{ - - /// GET/SET/ADD/CLR the ready "bit" bound with the event_handler - /// and mask. - virtual int ready_ops (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask, - int ops); - - /// GET/SET/ADD/CLR the ready "bit" bound with the handle and mask. - virtual int ready_ops (ACE_HANDLE handle, - ACE_Reactor_Mask, - int ops); - - //@} - - /// Dump the state of an object. - virtual void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - - class Token_Guard; - - /// Non-locking version of wait_pending(). - /** - * Returns non-zero if there are I/O events "ready" for dispatching, - * but does not actually dispatch the event handlers. By default, - * don't block while checking this, i.e., "poll". - * - * @note It is only possible to achieve millisecond timeout - * resolutions with the ACE_Dev_Poll_Reactor. - */ - int work_pending_i (ACE_Time_Value *max_wait_time); - - /// Poll for events and return the number of event handlers that - /// were dispatched. - /** - * This is a helper method called by all handle_events() methods. - */ - int handle_events_i (ACE_Time_Value *max_wait_time, Token_Guard &guard); - - /// Perform the upcall with the given event handler method. - int upcall (ACE_Event_Handler *event_handler, - int (ACE_Event_Handler::*callback)(ACE_HANDLE), - ACE_HANDLE handle); - - /** - * Dispatch ACE_Event_Handlers for time events, I/O events, and - * signal events. Returns the total number of ACE_Event_Handlers - * that were dispatched or -1 if something goes wrong. - */ - int dispatch (Token_Guard &guard); - - /// Dispatch a single timer, if ready. - /// Returns: 0 if no timers ready (token still held), - /// 1 if a timer was expired (token released), - /// -1 on error (token still held). - int dispatch_timer_handler (Token_Guard &guard); - - /// Dispatch an IO event to the corresponding event handler. Returns - /// Returns: 0 if no events ready (token still held), - /// 1 if an event was expired (token released), - /// -1 on error (token still held). - int dispatch_io_event (Token_Guard &guard); - - /// Register the given event handler with the reactor. - int register_handler_i (ACE_HANDLE handle, - ACE_Event_Handler *eh, - ACE_Reactor_Mask mask); - - /// Remove the event handler associated with the given handle and - /// event mask from the "interest set." If @a eh is supplied, only - /// do the remove if @eh matches the event handler that's registered - /// for @a handle. - int remove_handler_i (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - ACE_Event_Handler *eh = 0); - - /// Temporarily remove the given handle from the "interest set." - int suspend_handler_i (ACE_HANDLE handle); - - /// Place the given handle that was temporarily removed from the - /// "interest set," i.e that was suspended, back in to the interest - /// set. The given handle will once again be polled for events. - int resume_handler_i (ACE_HANDLE handle); - - /// GET/SET/ADD/CLR the dispatch MASK "bit" bound with the handle - /// and mask. This internal helper method acquires no lock. - /** - * @return Old mask on success, -1 on error. - */ - int mask_ops_i (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - int ops); - - /// Convert a reactor mask to its corresponding poll() event mask. - short reactor_mask_to_poll_event (ACE_Reactor_Mask mask); - -protected: - - /// Has the reactor been initialized. - bool initialized_; - - /// The file descriptor associated with the open `/dev/poll' or - /// `/dev/epoll' device. - /** - * All interactions with the `/dev/poll' or `/dev/epoll' device are - * done through this file descriptor. - */ - ACE_HANDLE poll_fd_; - -#if defined (ACE_HAS_EVENT_POLL) - /// Event structure to be filled by epoll_wait. epoll_wait() only gets - /// one event at a time and we rely on it's internals for fairness. - /// If this struct's fd is ACE_INVALID_HANDLE, the rest is indeterminate. - /// If the fd is good, the event is one that's been retrieved by - /// epoll_wait() but not yet processed. - struct epoll_event event_; - - /// Event handlers that are suspended/resumed around upcalls are not - /// immediately resumed; they're added to this list for resumption at - /// the next epoll_wait() call. This avoids always needing to acquire the - /// token just to resume a handler. Of course, if there are no other - /// handlers in the to-be-resumed list and an epoll_wait is already in - /// progress, the reactor needs to be notified to force another run around - /// the epoll_wait() call. - typedef ACE_Array_Map Resume_Map; - Resume_Map to_be_resumed_; - volatile bool epoll_wait_in_progress_; - ACE_SYNCH_MUTEX to_be_resumed_lock_; -#else - /// The pollfd array that `/dev/poll' will feed its results to. - struct pollfd *dp_fds_; - - - /// Pointer to the next pollfd array element that contains the next - /// event to be dispatched. - struct pollfd *start_pfds_; - - /// The last element in the pollfd array plus one. - /** - * The loop that dispatches IO events stops when this->start_pfds == - * this->end_pfds_. - */ - struct pollfd *end_pfds_; -#endif /* ACE_HAS_EVENT_POLL */ - - /// This flag is used to keep track of whether we are actively handling - /// events or not. - sig_atomic_t deactivated_; - - /// Lock used for synchronization of reactor state. - ACE_Dev_Poll_Reactor_Token token_; - - /// Adapter used to return internal lock to outside world. - ACE_Lock_Adapter lock_adapter_; - - /// The repository that contains all registered event handlers. - Handler_Repository handler_rep_; - - /// Defined as a pointer to allow overriding by derived classes... - ACE_Timer_Queue *timer_queue_; - - /// Keeps track of whether we should delete the timer queue (if we - /// didn't create it, then we don't delete it). - bool delete_timer_queue_; - - /// Handle signals without requiring global/static variables. - ACE_Sig_Handler *signal_handler_; - - /// Keeps track of whether we should delete the signal handler (if we - /// didn't create it, then we don't delete it). - bool delete_signal_handler_; - - /// Callback object that unblocks the if it's - /// sleeping. - ACE_Reactor_Notify *notify_handler_; - - /// Keeps track of whether we need to delete the notify handler (if - /// we didn't create it, then we don't delete it). - bool delete_notify_handler_; - - /// Flag that determines if signals are masked during event - /// dispatching. - /** - * If 0 then the Reactor will not mask the signals during the event - * dispatching. This is useful for applications that do not - * register any signal handlers and want to reduce the overhead - * introduce by the kernel level locks required to change the mask. - */ - int mask_signals_; - - /// Restart the handle_events event loop method automatically when - /// polling function in use (ioctl() in this case) is interrupted - /// via an EINTR signal. - bool restart_; - -protected: - - /** - * @class Token_Guard - * - * @brief A helper class that helps grabbing, releasing and waiting - * on tokens for a thread that needs access to the reactor's token. - */ - class ACE_Export Token_Guard - { - public: - - /// Constructor that will grab the token for us - Token_Guard (ACE_Dev_Poll_Reactor_Token &token); - - /// Destructor. This will release the token if it hasn't been - /// released till this point - ~Token_Guard (void); - - /// Release the token .. - void release_token (void); - - /// Returns whether the thread that created this object owns the - /// token or not. - int is_owner (void); - - /// A helper method that acquires the token 1) at a low priority, and - /// 2) wait quietly for the token, not waking another thread. This - /// is appropriate for cases where a thread wants to wait for and - /// dispatch an event, not causing an existing waiter to relinquish the - /// token, and also queuing up behind other threads waiting to modify - /// event records. - int acquire_quietly (ACE_Time_Value *max_wait = 0); - - /// A helper method that acquires the token at a high priority, and - /// does wake the current token holder. - int acquire (ACE_Time_Value *max_wait = 0); - - private: - - Token_Guard (void); - - private: - - /// The Reactor token. - ACE_Dev_Poll_Reactor_Token &token_; - - /// Flag that indicate whether the thread that created this object - /// owns the token or not. A value of 0 indicates that this class - /// hasn't got the token (and hence the thread) and a value of 1 - /// vice-versa. - int owner_; - - }; - -}; - - -/** - * @class ACE_Dev_Poll_Handler_Guard - * - * @brief Class used to make event handler reference count - * manipulation exception-safe. - * - * This class makes the reference count manipulation that occurs - * during an upcall exception-safe. Prior to dispatching the event - * handler, the reference count is increased. Once the upcall for the - * given event handler is complete, its reference count will be decreased. - */ -class ACE_Dev_Poll_Handler_Guard -{ -public: - - /// Constructor - /** - * The constructor checks to see if @a eh is a reference-counted handler and - * remember that for later. If @a eh is reference counted, its reference - * count is incremented unless @a do_incr is false. - * @a do_incr should be false if the reference count was incremented - * independently of this guard, for example, on a notify handler since - * the reference count is incremented when the notify is queued. - */ - ACE_Dev_Poll_Handler_Guard (ACE_Event_Handler *eh, bool do_incr = true); - - /// Destructor - /** - * The destructor decrements the reference count on the event - * handler corresponding to the given handle. - */ - ~ACE_Dev_Poll_Handler_Guard (void); - - /// Release the event handler from this guard; when the destructor is - /// called, the handler's reference count will not be decremented. - void release (void); - -private: - - /// The event handler being managed. - ACE_Event_Handler *eh_; - - /// true if eh_ is a reference-counted handler. - bool refcounted_; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -# include "ace/Dev_Poll_Reactor.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_EVENT_POLL || ACE_HAS_DEV_POLL */ - -#include /**/ "ace/post.h" - -#endif /* ACE_DEV_POLL_REACTOR_H */ diff --git a/dep/acelite/ace/Dev_Poll_Reactor.inl b/dep/acelite/ace/Dev_Poll_Reactor.inl deleted file mode 100644 index 0e72b305c62..00000000000 --- a/dep/acelite/ace/Dev_Poll_Reactor.inl +++ /dev/null @@ -1,134 +0,0 @@ -// -*- C++ -*- -// $Id: Dev_Poll_Reactor.inl 91066 2010-07-12 11:05:04Z johnnyw $ - -#include "ace/Log_Msg.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Dev_Poll_Reactor::Event_Tuple::Event_Tuple (ACE_Event_Handler *eh, - ACE_Reactor_Mask m, - bool is_suspended, - bool is_controlled) - : event_handler (eh), - mask (m), - suspended (is_suspended), - controlled (is_controlled) -{ -} - -// --------------------------------------------------------------------- - -ACE_INLINE size_t -ACE_Dev_Poll_Reactor::Handler_Repository::size (void) const -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::Handler_Repository::size"); - - return this->size_; -} - -ACE_INLINE size_t -ACE_Dev_Poll_Reactor::Handler_Repository::max_size (void) const -{ - ACE_TRACE ("ACE_Dev_Poll_Reactor::Handler_Repository::max_size"); - - return this->max_size_; -} - -// ----------------------------------------------------------------- - -ACE_INLINE -ACE_Dev_Poll_Handler_Guard::ACE_Dev_Poll_Handler_Guard - (ACE_Event_Handler *eh, - bool do_incr) - : eh_ (eh), - refcounted_ (false) -{ - if (eh == 0) - return; - - this->refcounted_ = - eh->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - - if (do_incr && this->refcounted_) - eh->add_reference (); -} - -ACE_INLINE -ACE_Dev_Poll_Handler_Guard::~ACE_Dev_Poll_Handler_Guard (void) -{ - if (this->refcounted_ && this->eh_ != 0) - this->eh_->remove_reference (); -} - -ACE_INLINE void -ACE_Dev_Poll_Handler_Guard::release (void) -{ - this->eh_ = 0; -} - -// --------------------------------------------------------------------- - -ACE_INLINE int -ACE_Dev_Poll_Reactor::upcall (ACE_Event_Handler *event_handler, - int (ACE_Event_Handler::*callback)(ACE_HANDLE), - ACE_HANDLE handle) -{ - // If the handler returns positive value (requesting a reactor - // callback) just call back as many times as the handler requests - // it. The handler is suspended internally and other threads are off - // handling other things. - int status = 0; - - do - { - status = (event_handler->*callback) (handle); - } - while (status > 0 && event_handler != this->notify_handler_); - - return status; -} - - -/************************************************************************/ -// Methods for ACE_Dev_Poll_Reactor::Token_Guard -/************************************************************************/ - -ACE_INLINE -ACE_Dev_Poll_Reactor::Token_Guard::Token_Guard (ACE_Dev_Poll_Reactor_Token &token) - - : token_ (token), - owner_ (0) -{ -} - -ACE_INLINE -ACE_Dev_Poll_Reactor::Token_Guard::~Token_Guard (void) -{ - if (this->owner_ == 1) - { - ACE_MT (this->token_.release ()); - this->owner_ = 0; - } -} - -ACE_INLINE void -ACE_Dev_Poll_Reactor::Token_Guard::release_token (void) -{ - if (this->owner_) - { - ACE_MT (this->token_.release ()); - - // We are not the owner anymore.. - this->owner_ = 0; - } -} - -ACE_INLINE int -ACE_Dev_Poll_Reactor::Token_Guard::is_owner (void) -{ - return this->owner_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Dirent.cpp b/dep/acelite/ace/Dirent.cpp deleted file mode 100644 index df1290e1e53..00000000000 --- a/dep/acelite/ace/Dirent.cpp +++ /dev/null @@ -1,7 +0,0 @@ -// $Id: Dirent.cpp 80826 2008-03-04 14:51:23Z wotte $ - -#include "ace/Dirent.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Dirent.inl" -#endif /* __ACE_INLINE__ */ diff --git a/dep/acelite/ace/Dirent.h b/dep/acelite/ace/Dirent.h deleted file mode 100644 index 7735fb1f293..00000000000 --- a/dep/acelite/ace/Dirent.h +++ /dev/null @@ -1,122 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Dirent.h - * - * $Id: Dirent.h 91064 2010-07-12 10:11:24Z johnnyw $ - * - * Define a portable C++ interface to ACE_OS_Dirent directory-entry - * manipulation. - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_DIRENT_H -#define ACE_DIRENT_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/OS_NS_dirent.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Dirent - * - * @brief Define a portable C++ directory-entry iterator based on the POSIX API. - */ -class ACE_Export ACE_Dirent -{ -public: - // = Initialization and termination methods. - /// Default constructor. - ACE_Dirent (void); - - /// Constructor calls @c opendir() - explicit ACE_Dirent (const ACE_TCHAR *dirname); - - /// Opens the directory named by filename and associates a directory - /// stream with it. - int open (const ACE_TCHAR *filename); - - /// Destructor calls @c closedir(). - ~ACE_Dirent (void); - - /// Closes the directory stream and frees the ACE_DIR structure. - void close (void); - - // = Iterator methods. - /** - * Returns a pointer to a structure representing the directory entry - * at the current position in the directory stream to which dirp - * refers, and positions the directory stream at the next entry, - * except on read-only filesystems. It returns a NULL pointer upon - * reaching the end of the directory stream, or upon detecting an - * invalid location in the directory. @c read() shall not return - * directory entries containing empty names. It is unspecified - * whether entries are returned for dot or dot-dot. The pointer - * returned by @c read() points to data that may be overwritten by - * another call to @c read() on the same directory stream. This - * data shall not be overwritten by another call to @c read() on a - * different directory stream. @c read() may buffer several - * directory entries per actual read operation; @c read() marks for - * update the st_atime field of the directory each time the - * directory is actually read. - */ - ACE_DIRENT *read (void); - - /** - * Has the equivalent functionality as @c read() except that an - * @a entry and @a result buffer must be supplied by the caller to - * store the result. - */ - int read (struct ACE_DIRENT *entry, - struct ACE_DIRENT **result); - - // = Manipulators. - /// Returns the current location associated with the directory - /// stream. - long tell (void); - - /** - * Sets the position of the next @c read() operation on the - * directory stream. The new position reverts to the position - * associated with the directory stream at the time the @c tell() - * operation that provides loc was performed. Values returned by - * @c tell() are good only for the lifetime of the ACE_DIR pointer from - * which they are derived. If the directory is closed and then - * reopened, the @c telldir() value may be invalidated due to - * undetected directory compaction. It is safe to use a previous - * @c telldir() value immediately after a call to @c opendir() and before - * any calls to readdir. - */ - void seek (long loc); - - /** - * Resets the position of the directory stream to the beginning of - * the directory. It also causes the directory stream to refer to - * the current state of the corresponding directory, as a call to - * @c opendir() would. - */ - void rewind (void); - -private: - /// Pointer to the directory stream. - ACE_DIR *dirp_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Dirent.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_DIRENT_H */ diff --git a/dep/acelite/ace/Dirent.inl b/dep/acelite/ace/Dirent.inl deleted file mode 100644 index 01ce3a96c4b..00000000000 --- a/dep/acelite/ace/Dirent.inl +++ /dev/null @@ -1,99 +0,0 @@ -// -*- C++ -*- -// -// $Id: Dirent.inl 80826 2008-03-04 14:51:23Z wotte $ - -#include "ace/Log_Msg.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -ACE_Dirent::open (const ACE_TCHAR *dirname) -{ - // If the directory stream is already open, close it to prevent - // possible resource leaks. - - if (this->dirp_ != 0) - { - ACE_OS::closedir (this->dirp_); - this->dirp_ = 0; - } - - this->dirp_ = ACE_OS::opendir (dirname); - - if (this->dirp_ == 0) - return -1; - else - return 0; -} - -ACE_INLINE -ACE_Dirent::ACE_Dirent (void) - : dirp_ (0) -{ -} - -ACE_INLINE -ACE_Dirent::ACE_Dirent (const ACE_TCHAR *dirname) - : dirp_ (0) -{ - if (this->open (dirname) == -1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Dirent::ACE_Dirent"))); -} - -ACE_INLINE -ACE_Dirent::~ACE_Dirent (void) -{ - if (this->dirp_ != 0) - ACE_OS::closedir (this->dirp_); -} - -ACE_INLINE ACE_DIRENT * -ACE_Dirent::read (void) -{ - return this->dirp_ ? ACE_OS::readdir (this->dirp_) : 0; -} - -ACE_INLINE int -ACE_Dirent::read (struct ACE_DIRENT *entry, - struct ACE_DIRENT **result) -{ - return this->dirp_ - ? ACE_OS::readdir_r (this->dirp_, entry, result) - : 0; -} - -ACE_INLINE void -ACE_Dirent::close (void) -{ - if (this->dirp_ != 0) - { - ACE_OS::closedir (this->dirp_); - - // Prevent double closure - this->dirp_ = 0; - } -} - -ACE_INLINE void -ACE_Dirent::rewind (void) -{ - if (this->dirp_) - ACE_OS::rewinddir (this->dirp_); -} - -ACE_INLINE void -ACE_Dirent::seek (long loc) -{ - if (this->dirp_) - ACE_OS::seekdir (this->dirp_, loc); -} - -ACE_INLINE long -ACE_Dirent::tell (void) -{ - return this->dirp_ ? ACE_OS::telldir (this->dirp_) : 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Dirent_Selector.cpp b/dep/acelite/ace/Dirent_Selector.cpp deleted file mode 100644 index c1f480061d7..00000000000 --- a/dep/acelite/ace/Dirent_Selector.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// $Id: Dirent_Selector.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/Dirent_Selector.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Dirent_Selector.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/OS_NS_dirent.h" -#include "ace/OS_NS_stdlib.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Construction/Destruction - -ACE_Dirent_Selector::ACE_Dirent_Selector (void) - : namelist_ (0), - n_ (0) -{ -} - -ACE_Dirent_Selector::~ACE_Dirent_Selector (void) -{ - // Free up any allocated resources. - this->close(); -} - -int -ACE_Dirent_Selector::open (const ACE_TCHAR *dir, - ACE_SCANDIR_SELECTOR sel, - ACE_SCANDIR_COMPARATOR cmp) -{ - n_ = ACE_OS::scandir (dir, &this->namelist_, sel, cmp); - return n_; -} - -int -ACE_Dirent_Selector::close (void) -{ - for (--n_; n_ >= 0; --n_) - { -#if defined (ACE_LACKS_STRUCT_DIR) - // Only the lacking-struct-dir emulation allocates this. Native - // scandir includes d_name in the dirent struct itself. - ACE_OS::free (this->namelist_[n_]->d_name); -#endif - ACE_OS::free (this->namelist_[n_]); - } - - ACE_OS::free (this->namelist_); - this->namelist_ = 0; - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Dirent_Selector.h b/dep/acelite/ace/Dirent_Selector.h deleted file mode 100644 index 20673c473a9..00000000000 --- a/dep/acelite/ace/Dirent_Selector.h +++ /dev/null @@ -1,75 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Dirent_Selector.h - * - * $Id: Dirent_Selector.h 80826 2008-03-04 14:51:23Z wotte $ - * - * Define a portable C++ interface to the method. - * - * @author Rich Newman - */ -//============================================================================= - -#ifndef ACE_DIRENT_SELECTOR_H -#define ACE_DIRENT_SELECTOR_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/OS_NS_dirent.h" /* Need ACE_SCANDIR_SELECTOR, COMPARATOR */ -#include "ace/os_include/os_dirent.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Dirent_Selector - * - * @brief Define a portable C++ directory-entry iterator based on the - * POSIX scandir API. - */ -class ACE_Export ACE_Dirent_Selector -{ -public: - /// Constructor - ACE_Dirent_Selector (void); - - /// Destructor. - virtual ~ACE_Dirent_Selector (void); - - /// Return the length of the list of matching directory entries. - int length (void) const; - - /// Return the entry at @a index. - ACE_DIRENT *operator[] (const int index) const; - - /// Free up resources. - int close (void); - - /// Open the directory @a dir and populate the current list of names with - /// directory entries that match the @a selector and @a comparator. - int open (const ACE_TCHAR *dir, - ACE_SCANDIR_SELECTOR selector = 0, - ACE_SCANDIR_COMPARATOR comparator = 0); - -protected: - /// Ptr to the namelist array. - ACE_DIRENT **namelist_; - - /// Number of entries in the array. - int n_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Dirent_Selector.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_DIRENT_SELECTOR_H */ diff --git a/dep/acelite/ace/Dirent_Selector.inl b/dep/acelite/ace/Dirent_Selector.inl deleted file mode 100644 index 15f804704bf..00000000000 --- a/dep/acelite/ace/Dirent_Selector.inl +++ /dev/null @@ -1,19 +0,0 @@ -// -*- C++ -*- -// -// $Id: Dirent_Selector.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -ACE_Dirent_Selector::length (void) const -{ - return n_; -} - -ACE_INLINE ACE_DIRENT * -ACE_Dirent_Selector::operator[] (const int n) const -{ - return this->namelist_[n]; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Dump.cpp b/dep/acelite/ace/Dump.cpp deleted file mode 100644 index 09ae92600b7..00000000000 --- a/dep/acelite/ace/Dump.cpp +++ /dev/null @@ -1,141 +0,0 @@ -// $Id: Dump.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/Dump.h" -#include "ace/Guard_T.h" -#include "ace/Thread_Mutex.h" -#include "ace/Object_Manager.h" -#include "ace/Log_Msg.h" - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Implementations (very simple for now...) - -ACE_Dumpable::~ACE_Dumpable (void) -{ - ACE_TRACE ("ACE_Dumpable::~ACE_Dumpable"); -} - -ACE_Dumpable::ACE_Dumpable (const void *this_ptr) - : this_ (this_ptr) -{ - ACE_TRACE ("ACE_Dumpable::ACE_Dumpable"); -} - -ACE_Dumpable_Ptr::ACE_Dumpable_Ptr (const ACE_Dumpable *dumper) - : dumper_ (dumper) -{ - ACE_TRACE ("ACE_Dumpable_Ptr::ACE_Dumpable_Ptr"); -} - -const ACE_Dumpable * -ACE_Dumpable_Ptr::operator->() const -{ - ACE_TRACE ("ACE_Dumpable_Ptr::operator->"); - return this->dumper_; -} - -void -ACE_Dumpable_Ptr::operator= (const ACE_Dumpable *dumper) const -{ - ACE_TRACE ("ACE_Dumpable_Ptr::operator="); - if (this->dumper_ != dumper) - { - delete const_cast (this->dumper_); - (const_cast (this))->dumper_ = dumper; - } -} - -ACE_ODB::ACE_ODB (void) - // Let the Tuple default constructor initialize object_table_ - : current_size_ (0) -{ - ACE_TRACE ("ACE_ODB::ACE_ODB"); -} - -ACE_ODB * -ACE_ODB::instance (void) -{ - ACE_TRACE ("ACE_ODB::instance"); - - if (ACE_ODB::instance_ == 0) - { - ACE_MT (ACE_Thread_Mutex *lock = - ACE_Managed_Object::get_preallocated_object - (ACE_Object_Manager::ACE_DUMP_LOCK); - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, 0)); - - if (ACE_ODB::instance_ == 0) - ACE_NEW_RETURN (ACE_ODB::instance_, - ACE_ODB, - 0); - } - - return ACE_ODB::instance_; -} - -void -ACE_ODB::dump_objects (void) -{ - ACE_TRACE ("ACE_ODB::dump_objects"); - for (int i = 0; i < this->current_size_; i++) - { - if (this->object_table_[i].this_ != 0) - // Dump the state of the object. - this->object_table_[i].dumper_->dump (); - } -} - -// This method registers a new . It detects -// duplicates and simply overwrites them. - -void -ACE_ODB::register_object (const ACE_Dumpable *dumper) -{ - ACE_TRACE ("ACE_ODB::register_object"); - int i; - int slot = 0; - - for (i = 0; i < this->current_size_; i++) - { - if (this->object_table_[i].this_ == 0) - slot = i; - else if (this->object_table_[i].this_ == dumper->this_) - { - slot = i; - break; - } - } - - if (i == this->current_size_) - { - slot = this->current_size_++; - ACE_ASSERT (this->current_size_ < ACE_ODB::MAX_TABLE_SIZE); - } - this->object_table_[slot].this_ = dumper->this_; - this->object_table_[slot].dumper_ = dumper; -} - -void -ACE_ODB::remove_object (const void *this_ptr) -{ - ACE_TRACE ("ACE_ODB::remove_object"); - int i; - - for (i = 0; i < this->current_size_; i++) - { - if (this->object_table_[i].this_ == this_ptr) - break; - } - - if (i < this->current_size_) - { - this->object_table_[i].this_ = 0; - this->object_table_[i].dumper_ = 0; - } -} - -ACE_ODB *ACE_ODB::instance_ = 0; - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Dump.h b/dep/acelite/ace/Dump.h deleted file mode 100644 index fc1eca06dcd..00000000000 --- a/dep/acelite/ace/Dump.h +++ /dev/null @@ -1,172 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Dump.h - * - * $Id: Dump.h 94034 2011-05-09 19:11:03Z johnnyw $ - * - * - * A prototype mechanism that allow all ACE objects to be registered - * with a central in-memory "database" that can dump the state of all - * live ACE objects (e.g., from within a debugger). - * - * The macros which allow easy registration and removal of objects to be - * dumped (ACE_REGISTER_OBJECT and ACE_REMOVE_OBJECT) are turned into - * no-ops by compiling with the ACE_NDEBUG macro defined. This allows - * usage to be removed in "release mode" builds without changing code. - * - * There are several interesting aspects to this design: - * - * 1. It uses the External Polymorphism pattern to avoid having to - * derive all ACE classes from a common base class that has virtual - * methods (this is crucial to avoid unnecessary overhead). In - * addition, there is no additional space added to ACE objects - * (this is crucial to maintain binary layout compatibility). - * - * 2. This mechanism can be conditionally compiled in order to - * completely disable this feature entirely. Moreover, by - * using macros there are relatively few changes to ACE code. - * - * 3. This mechanism copes with single-inheritance hierarchies of - * dumpable classes. In such cases we typically want only one - * dump, corresponding to the most derived instance. Thanks to - * Christian Millour (chris@etca.fr) for illustrating how to do - * this. Note, however, that this scheme doesn't generalize to - * work with multiple-inheritance or virtual base classes. - * - * Future work includes: - * - * 1. Using a dynamic object table rather than a static table - * - * 2. Adding support to allow particular classes of objects to - * be selectively dumped. - * - * - * @author Doug Schmidt - */ -//============================================================================= - - -#ifndef ACE_DUMP_H -#define ACE_DUMP_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Dumpable - * - * @brief Base class that defines a uniform interface for all object - * dumping. - */ -class ACE_Export ACE_Dumpable -{ -public: - friend class ACE_ODB; - friend class ACE_Dumpable_Ptr; - - /// Constructor. - ACE_Dumpable (const void *); - - /// This pure virtual method must be filled in by a subclass. - virtual void dump (void) const = 0; - -protected: - virtual ~ACE_Dumpable (void); - -private: - /// Pointer to the object that is being stored. - const void *this_; -}; - -/** - * @class ACE_Dumpable_Ptr - * - * @brief A smart pointer stored in the in-memory object database - * ACE_ODB. The pointee (if any) is deleted when reassigned. - */ -class ACE_Export ACE_Dumpable_Ptr -{ -public: - ACE_Dumpable_Ptr (const ACE_Dumpable *dumper = 0); - const ACE_Dumpable *operator->() const; - void operator= (const ACE_Dumpable *dumper) const; - -private: - /// "Real" pointer to the underlying abstract base class - /// pointer that does the real work. - const ACE_Dumpable *dumper_; -}; - -/** - * @class ACE_ODB - * - * @brief This is the object database (ODB) that keeps track of all - * live ACE objects. - */ -class ACE_Export ACE_ODB -{ -public: - /// @todo This is clearly inadequate and should be dynamic... - enum {MAX_TABLE_SIZE = 100000}; - - /// Iterates through the entire set of registered objects and - /// dumps their state. - void dump_objects (void); - - /// Add the tuple to the list of registered ACE objects. - void register_object (const ACE_Dumpable *dumper); - - /// Use to locate and remove the associated from the - /// list of registered ACE objects. - void remove_object (const void *this_); - - /// Interface to the Singleton instance of the object database. - static ACE_ODB *instance (void); - -private: - ACE_ODB (void); // Ensure we have a Singleton... - - struct Tuple - { - /// Pointer to the object that is registered. - const void *this_; - - /// Smart pointer to the ACE_Dumpable object associated with this_. - /// This uses an ACE_Dumpable_Ptr, instead of a bare pointer, to - /// cope with hierarchies of dumpable classes. In such cases we - /// typically want only one dump, corresponding to the most derived - /// instance. To achieve this, the handle registered for the - /// subobject corresponding to the base class is destroyed (hence - /// on destruction of the subobject its handle won't exist anymore - /// and we'll have to check for that). - const ACE_Dumpable_Ptr dumper_; - - Tuple (void) : this_ (0), dumper_(0) {} - }; - - /// Singleton instance of this class. - static ACE_ODB *instance_; - - /// The current implementation is very simple-minded and will be - /// changed to be dynamic. - Tuple object_table_[ACE_ODB::MAX_TABLE_SIZE]; - - /// Current size of . - int current_size_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -// Include the templates classes at this point. -#include "ace/Dump_T.h" - -#include /**/ "ace/post.h" -#endif /* ACE_DUMP_H */ diff --git a/dep/acelite/ace/Dump_T.cpp b/dep/acelite/ace/Dump_T.cpp deleted file mode 100644 index da2b62a6fa3..00000000000 --- a/dep/acelite/ace/Dump_T.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// Dump_T.cpp -// -// $Id: Dump_T.cpp 80826 2008-03-04 14:51:23Z wotte $ - -#ifndef ACE_DUMP_T_CPP -#define ACE_DUMP_T_CPP - -#include "ace/Dump_T.h" -#include "ace/Global_Macros.h" -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Dumpable_Adapter::~ACE_Dumpable_Adapter (void) -{ - ACE_TRACE ("ACE_Dumpable_Adapter::~ACE_Dumpable_Adapter"); -} - -template -ACE_Dumpable_Adapter::ACE_Dumpable_Adapter (const Concrete *t) - : ACE_Dumpable ((const void *) t), this_ (t) -{ - ACE_TRACE ("ACE_Dumpable_Adapter::ACE_Dumpable_Adapter"); -} - -template Concrete * -ACE_Dumpable_Adapter::operator->() const -{ - return (Concrete *) this->this_; -} - -template void -ACE_Dumpable_Adapter::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Dumpable_Adapter::dump"); - this->this_->dump (); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_DUMP_T_CPP */ diff --git a/dep/acelite/ace/Dump_T.h b/dep/acelite/ace/Dump_T.h deleted file mode 100644 index 69d86718b56..00000000000 --- a/dep/acelite/ace/Dump_T.h +++ /dev/null @@ -1,83 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Dump_T.h - * - * $Id: Dump_T.h 91626 2010-09-07 10:59:20Z johnnyw $ - * - * @author Doug Schmidt - */ -//============================================================================= - - -#ifndef ACE_DUMP_T_H -#define ACE_DUMP_T_H -#include /**/ "ace/pre.h" - -#include "ace/Dump.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Dumpable_Adapter - * - * @brief - * This class inherits the interface of the abstract ACE_Dumpable - * class and is instantiated with the implementation of the - * concrete component class . - * - * This design is similar to the Adapter and Decorator patterns - * from the ``Gang of Four'' book. Note that - * need not inherit from a common class since ACE_Dumpable - * provides the uniform virtual interface! - */ -template -class ACE_Dumpable_Adapter : public ACE_Dumpable -{ -public: - // = Initialization and termination methods. - ACE_Dumpable_Adapter (const Concrete *t); - ~ACE_Dumpable_Adapter (void); - - /// Concrete dump method (simply delegates to the dump() method of - /// ). - virtual void dump (void) const; - - /// Delegate to methods in the Concrete class. - Concrete *operator->() const; - -private: - /// Pointer to @c this of . - const Concrete *this_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -// Some useful macros for conditionally compiling this feature... -#if defined (ACE_NDEBUG) -#define ACE_REGISTER_OBJECT(CLASS) -#define ACE_REMOVE_OBJECT -#else -#define ACE_REGISTER_OBJECT(CLASS) \ - ACE_ODB::instance ()->register_object \ - (new ACE_Dumpable_Adapter (this)); -#define ACE_REMOVE_OBJECT \ - ACE_ODB::instance ()->remove_object \ - ((void *) this); -#endif /* ACE_NDEBUG */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Dump_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Dump_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_DUMP_T_H */ diff --git a/dep/acelite/ace/Dynamic.cpp b/dep/acelite/ace/Dynamic.cpp deleted file mode 100644 index 40c1eeec581..00000000000 --- a/dep/acelite/ace/Dynamic.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// $Id: Dynamic.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/Dynamic.h" -#include "ace/Singleton.h" -#include "ace/TSS_T.h" -#include "ace/Synch_Traits.h" -#include "ace/Null_Mutex.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Dynamic.inl" -#endif /* __ACE_INLINE__ */ - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Dynamic::ACE_Dynamic (void) - : is_dynamic_ (false) -{ - ACE_TRACE ("ACE_Dynamic::ACE_Dynamic"); -} - -/* static */ ACE_Dynamic * -ACE_Dynamic::instance (void) -{ - return ACE_TSS_Singleton::instance (); -} - -#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION) -template ACE_TSS_Singleton * - ACE_TSS_Singleton::singleton_; -#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Dynamic.h b/dep/acelite/ace/Dynamic.h deleted file mode 100644 index 70dfcd8d90a..00000000000 --- a/dep/acelite/ace/Dynamic.h +++ /dev/null @@ -1,75 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Dynamic.h - * - * $Id: Dynamic.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Doug Schmidt - * @author Irfan Pyarali. - */ -//========================================================================== - -#ifndef ACE_DYNAMIC_H -#define ACE_DYNAMIC_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Dynamic - * - * @brief Checks to see if an object was dynamically allocated. - * - * This class holds the pointer in a thread-safe manner between - * the call to operator new and the call to the constructor. - */ -class ACE_Export ACE_Dynamic -{ -public: - // = Initialization and termination method. - /// Constructor. - ACE_Dynamic (void); - - /// Destructor. - ~ACE_Dynamic (void); - - /** - * Sets a flag that indicates that the object was dynamically - * created. This method is usually called in operator new and then - * checked and reset in the constructor. - */ - void set (void); - - /// @c true if we were allocated dynamically, else @c false. - bool is_dynamic (void); - - /// Resets state flag. - void reset (void); - - static ACE_Dynamic *instance (void); - -private: - /** - * Flag that indicates that the object was dynamically created. This - * method is usually called in operator new and then checked and - * reset in the constructor. - */ - bool is_dynamic_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Dynamic.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_DYNAMIC_H */ diff --git a/dep/acelite/ace/Dynamic.inl b/dep/acelite/ace/Dynamic.inl deleted file mode 100644 index 1e8e968f898..00000000000 --- a/dep/acelite/ace/Dynamic.inl +++ /dev/null @@ -1,34 +0,0 @@ -// -*- C++ -*- -// -// $Id: Dynamic.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Dynamic::~ACE_Dynamic (void) -{ - // ACE_TRACE ("ACE_Dynamic::~ACE_Dynamic"); -} - -ACE_INLINE void -ACE_Dynamic::set (void) -{ - // ACE_TRACE ("ACE_Dynamic::set"); - this->is_dynamic_ = true; -} - -ACE_INLINE bool -ACE_Dynamic::is_dynamic (void) -{ - // ACE_TRACE ("ACE_Dynamic::is_dynamic"); - return this->is_dynamic_; -} - -ACE_INLINE void -ACE_Dynamic::reset (void) -{ - // ACE_TRACE ("ACE_Dynamic::reset"); - this->is_dynamic_ = false; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Dynamic_Message_Strategy.cpp b/dep/acelite/ace/Dynamic_Message_Strategy.cpp deleted file mode 100644 index b661ca1a718..00000000000 --- a/dep/acelite/ace/Dynamic_Message_Strategy.cpp +++ /dev/null @@ -1,203 +0,0 @@ -// $Id: Dynamic_Message_Strategy.cpp 91287 2010-08-05 10:30:49Z johnnyw $ - -#include "ace/Dynamic_Message_Strategy.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Dynamic_Message_Strategy.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Guard_T.h" -#include "ace/Log_Msg.h" -#include "ace/Malloc_Base.h" -#include "ace/OS_NS_string.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// ctor - -ACE_Dynamic_Message_Strategy::ACE_Dynamic_Message_Strategy (unsigned long static_bit_field_mask, - unsigned long static_bit_field_shift, - unsigned long dynamic_priority_max, - unsigned long dynamic_priority_offset) - : static_bit_field_mask_ (static_bit_field_mask), - static_bit_field_shift_ (static_bit_field_shift), - dynamic_priority_max_ (dynamic_priority_max), - dynamic_priority_offset_ (dynamic_priority_offset), - max_late_ (0, dynamic_priority_offset - 1), - min_pending_ (0, dynamic_priority_offset), - pending_shift_ (0, dynamic_priority_max) -{ -} - -// dtor - -ACE_Dynamic_Message_Strategy::~ACE_Dynamic_Message_Strategy (void) -{ -} - -ACE_Dynamic_Message_Strategy::Priority_Status -ACE_Dynamic_Message_Strategy::priority_status (ACE_Message_Block & mb, - const ACE_Time_Value & tv) -{ - // default the message to have pending priority status - Priority_Status status = ACE_Dynamic_Message_Strategy::PENDING; - - // start with the passed absolute time as the message's priority, then - // call the polymorphic hook method to (at least partially) convert - // the absolute time and message attributes into the message's priority - ACE_Time_Value priority (tv); - convert_priority (priority, mb); - - // if the priority is negative, the message is pending - if (priority < ACE_Time_Value::zero) - { - // priority for pending messages must be shifted - // upward above the late priority range - priority += pending_shift_; - if (priority < min_pending_) - priority = min_pending_; - } - // otherwise, if the priority is greater than the maximum late - // priority value that can be represented, it is beyond late - else if (priority > max_late_) - { - // all messages that are beyond late are assigned lowest priority (zero) - mb.msg_priority (0); - return ACE_Dynamic_Message_Strategy::BEYOND_LATE; - } - // otherwise, the message is late, but its priority is correct - else - status = ACE_Dynamic_Message_Strategy::LATE; - - // use (fast) bitwise operators to isolate and replace - // the dynamic portion of the message's priority - mb.msg_priority((mb.msg_priority() & static_bit_field_mask_) | - ((priority.usec () + - ACE_ONE_SECOND_IN_USECS * (suseconds_t)(priority.sec())) << - static_bit_field_shift_)); - - // returns the priority status of the message - return status; -} - - -// Dump the state of the strategy. - -void -ACE_Dynamic_Message_Strategy::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Dynamic_Message_Strategy::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("static_bit_field_mask_ = %u\n") - ACE_TEXT ("static_bit_field_shift_ = %u\n") - ACE_TEXT ("dynamic_priority_max_ = %u\n") - ACE_TEXT ("dynamic_priority_offset_ = %u\n") - ACE_TEXT ("max_late_ = [%d sec, %d usec]\n") - ACE_TEXT ("min_pending_ = [%d sec, %d usec]\n") - ACE_TEXT ("pending_shift_ = [%d sec, %d usec]\n"), - this->static_bit_field_mask_, - this->static_bit_field_shift_, - this->dynamic_priority_max_, - this->dynamic_priority_offset_, - this->max_late_.sec (), - this->max_late_.usec (), - this->min_pending_.sec (), - this->min_pending_.usec (), - this->pending_shift_.sec (), - this->pending_shift_.usec ())); - - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Deadline_Message_Strategy::ACE_Deadline_Message_Strategy (unsigned long static_bit_field_mask, - unsigned long static_bit_field_shift, - unsigned long dynamic_priority_max, - unsigned long dynamic_priority_offset) - : ACE_Dynamic_Message_Strategy (static_bit_field_mask, - static_bit_field_shift, - dynamic_priority_max, - dynamic_priority_offset) -{ -} - -ACE_Deadline_Message_Strategy::~ACE_Deadline_Message_Strategy (void) -{ -} - -void -ACE_Deadline_Message_Strategy::convert_priority (ACE_Time_Value & priority, - const ACE_Message_Block & mb) -{ - // Convert absolute time passed in tv to negative time - // to deadline of mb with respect to that absolute time. - priority -= mb.msg_deadline_time (); -} - // dynamic priority conversion function based on time to deadline - -void -ACE_Deadline_Message_Strategy::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Deadline_Message_Strategy::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Dynamic_Message_Strategy base class:\n"))); - this->ACE_Dynamic_Message_Strategy::dump (); - - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nderived class: ACE_Deadline_Message_Strategy\n"))); - - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Laxity_Message_Strategy::ACE_Laxity_Message_Strategy (unsigned long static_bit_field_mask, - unsigned long static_bit_field_shift, - unsigned long dynamic_priority_max, - unsigned long dynamic_priority_offset) - : ACE_Dynamic_Message_Strategy (static_bit_field_mask, - static_bit_field_shift, - dynamic_priority_max, - dynamic_priority_offset) -{ -} - -ACE_Laxity_Message_Strategy::~ACE_Laxity_Message_Strategy (void) -{ -} - -void -ACE_Laxity_Message_Strategy::convert_priority (ACE_Time_Value & priority, - const ACE_Message_Block & mb) -{ - // Convert absolute time passed in tv to negative - // laxity of mb with respect to that absolute time. - priority += mb.msg_execution_time (); - priority -= mb.msg_deadline_time (); -} - // dynamic priority conversion function based on laxity - -void -ACE_Laxity_Message_Strategy::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Laxity_Message_Strategy::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Dynamic_Message_Strategy base class:\n"))); - this->ACE_Dynamic_Message_Strategy::dump (); - - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nderived class: ACE_Laxity_Message_Strategy\n"))); - - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - // Dump the state of the strategy. - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Dynamic_Message_Strategy.h b/dep/acelite/ace/Dynamic_Message_Strategy.h deleted file mode 100644 index 5ff102ef6ce..00000000000 --- a/dep/acelite/ace/Dynamic_Message_Strategy.h +++ /dev/null @@ -1,215 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Dynamic_Message_Strategy.h - * - * $Id: Dynamic_Message_Strategy.h 95839 2012-06-07 10:13:33Z johnnyw $ - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_DYNAMIC_MESSAGE_STRATEGY_H -#define ACE_DYNAMIC_MESSAGE_STRATEGY_H - -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Message_Block.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Dynamic_Message_Strategy - * - * @brief An abstract base class which provides dynamic priority - * evaluation methods for use by the ACE_Dynamic_Message_Queue - * class or any other class which needs to manage the priorities - * of a collection of ACE_Message_Blocks dynamically. - * - * Methods for deadline and laxity based priority evaluation are - * provided. These methods assume a specific partitioning of - * the message priority number into a higher order dynamic bit - * field and a lower order static priority bit field. The - * default partitioning assumes an unsigned dynamic message - * priority field of 22 bits and an unsigned static message - * priority field of 10 bits. This corresponds to the initial - * values of the static class members. To provide a different - * partitioning, assign a different set of values to the static - * class members before using the static member functions. - */ -class ACE_Export ACE_Dynamic_Message_Strategy -{ -public: - - /// Message priority status - /// Values are defined as bit flags so that status combinations may - /// be specified easily. - enum Priority_Status - { - /// Message can still make its deadline - PENDING = 0x01, - /// Message cannot make its deadline - LATE = 0x02, - /// Message is so late its priority is undefined - BEYOND_LATE = 0x04, - /// Mask to match any priority status - ANY_STATUS = 0x07 - }; - - /// Constructor. - ACE_Dynamic_Message_Strategy (unsigned long static_bit_field_mask, - unsigned long static_bit_field_shift, - unsigned long dynamic_priority_max, - unsigned long dynamic_priority_offset); - - /// Virtual destructor. - virtual ~ACE_Dynamic_Message_Strategy (void); - - /// Updates the message's priority and returns its priority status. - Priority_Status priority_status (ACE_Message_Block &mb, - const ACE_Time_Value &tv); - - /// Get static bit field mask. - unsigned long static_bit_field_mask (void) const; - - /// Set static bit field mask. - void static_bit_field_mask (unsigned long); - - /// Get left shift value to make room for static bit field. - unsigned long static_bit_field_shift (void) const; - - /// Set left shift value to make room for static bit field. - void static_bit_field_shift (unsigned long); - - /// Get maximum supported priority value. - unsigned long dynamic_priority_max (void) const; - - /// Set maximum supported priority value. - void dynamic_priority_max (unsigned long); - - /// Get offset to boundary between signed range and unsigned range. - unsigned long dynamic_priority_offset (void) const; - - /// Set offset to boundary between signed range and unsigned range. - void dynamic_priority_offset (unsigned long); - - /// Dump the state of the strategy. - virtual void dump (void) const; - -protected: - /// Hook method for dynamic priority conversion. - virtual void convert_priority (ACE_Time_Value &priority, - const ACE_Message_Block &mb) = 0; - - /// This is a bit mask with all ones in the static bit field. - unsigned long static_bit_field_mask_; - - /** - * This is a left shift value to make room for static bit field: - * this value should be the logarithm base 2 of - * (static_bit_field_mask_ + 1). - */ - unsigned long static_bit_field_shift_; - - /// Maximum supported priority value. - unsigned long dynamic_priority_max_; - - /// Offset to boundary between signed range and unsigned range. - unsigned long dynamic_priority_offset_; - - /// Maximum late time value that can be represented. - ACE_Time_Value max_late_; - - /// Minimum pending time value that can be represented. - ACE_Time_Value min_pending_; - - /// Time value by which to shift pending priority. - ACE_Time_Value pending_shift_; -}; - -/** - * @class ACE_Deadline_Message_Strategy - * - * @brief Deadline based message priority strategy. - * - * Assigns dynamic message priority according to time to deadline. The - * message priority is divided into high and low order bit fields. The - * high order bit field is used for dynamic message priority, which is - * updated whenever the convert_priority() method is called. The - * low order bit field is used for static message priority and is left - * unchanged. The partitioning of the priority value into high and low - * order bit fields is done according to the arguments passed to the - * strategy object's constructor. - */ -class ACE_Export ACE_Deadline_Message_Strategy : public ACE_Dynamic_Message_Strategy -{ -public: - /// Constructor with all arguments defaulted. - ACE_Deadline_Message_Strategy (unsigned long static_bit_field_mask = 0x3FFUL, // 2^(10) - 1 - unsigned long static_bit_field_shift = 10, // 10 low order bits - unsigned long dynamic_priority_max = 0x3FFFFFUL, // 2^(22)-1 - unsigned long dynamic_priority_offset = 0x200000UL); // 2^(22-1) - - /// Virtual destructor. - virtual ~ACE_Deadline_Message_Strategy (void); - - /// Dynamic priority conversion function based on time to deadline. - virtual void convert_priority (ACE_Time_Value &priority, - const ACE_Message_Block &mb); - - /// Dump the state of the strategy. - virtual void dump (void) const; -}; - -/** - * @class ACE_Laxity_Message_Strategy - * - * @brief Laxity based message priority strategy. - * - * Assigns dynamic message priority according to laxity (time to - * deadline minus worst case execution time). The message priority is - * divided into high and low order bit fields. The high order - * bit field is used for dynamic message priority, which is - * updated whenever the convert_priority() method is called. The - * low order bit field is used for static message priority and is left - * unchanged. The partitioning of the priority value into high and low - * order bit fields is done according to the arguments passed to the - * strategy object's constructor. - */ -class ACE_Export ACE_Laxity_Message_Strategy : public ACE_Dynamic_Message_Strategy -{ -public: - /// Ctor, with all arguments defaulted. - ACE_Laxity_Message_Strategy (unsigned long static_bit_field_mask = 0x3FFUL, // 2^(10) - 1 - unsigned long static_bit_field_shift = 10, // 10 low order bits - unsigned long dynamic_priority_max = 0x3FFFFFUL, // 2^(22)-1 - unsigned long dynamic_priority_offset = 0x200000UL); // 2^(22-1) - - /// virtual dtor. - virtual ~ACE_Laxity_Message_Strategy (void); - - /// Dynamic priority conversion function based on laxity. - virtual void convert_priority (ACE_Time_Value &priority, - const ACE_Message_Block &mb); - - /// Dump the state of the strategy. - virtual void dump (void) const; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Dynamic_Message_Strategy.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_DYNAMIC_MESSAGE_STRATEGY_H */ diff --git a/dep/acelite/ace/Dynamic_Message_Strategy.inl b/dep/acelite/ace/Dynamic_Message_Strategy.inl deleted file mode 100644 index 9742a07fd88..00000000000 --- a/dep/acelite/ace/Dynamic_Message_Strategy.inl +++ /dev/null @@ -1,75 +0,0 @@ -// -*- C++ -*- -// -// $Id: Dynamic_Message_Strategy.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE unsigned long -ACE_Dynamic_Message_Strategy::static_bit_field_mask (void) const -{ - return static_bit_field_mask_; -} - // get static bit field mask - -ACE_INLINE void -ACE_Dynamic_Message_Strategy::static_bit_field_mask (unsigned long ul) -{ - static_bit_field_mask_ = ul; -} - // set static bit field mask - -ACE_INLINE unsigned long -ACE_Dynamic_Message_Strategy::static_bit_field_shift (void) const -{ - return static_bit_field_shift_; -} - // get left shift value to make room for static bit field - -ACE_INLINE void -ACE_Dynamic_Message_Strategy::static_bit_field_shift (unsigned long ul) -{ - static_bit_field_shift_ = ul; -} - // set left shift value to make room for static bit field - -ACE_INLINE unsigned long -ACE_Dynamic_Message_Strategy::dynamic_priority_max (void) const -{ - return dynamic_priority_max_; -} - // get maximum supported priority value - -ACE_INLINE void -ACE_Dynamic_Message_Strategy::dynamic_priority_max (unsigned long ul) -{ - // pending_shift_ depends on dynamic_priority_max_: for performance - // reasons, the value in pending_shift_ is (re)calculated only when - // dynamic_priority_max_ is initialized or changes, and is stored - // as a class member rather than being a derived value. - dynamic_priority_max_ = ul; - pending_shift_ = ACE_Time_Value (0, ul); -} - // set maximum supported priority value - -ACE_INLINE unsigned long -ACE_Dynamic_Message_Strategy::dynamic_priority_offset (void) const -{ - return dynamic_priority_offset_; -} - // get offset for boundary between signed range and unsigned range - -ACE_INLINE void -ACE_Dynamic_Message_Strategy::dynamic_priority_offset (unsigned long ul) -{ - // max_late_ and min_pending_ depend on dynamic_priority_offset_: - // for performance reasons, the values in max_late_ and min_pending_ - // are (re)calculated only when dynamic_priority_offset_ is - // initialized or changes, and are stored as a class member rather - // than being derived each time one of their values is needed. - dynamic_priority_offset_ = ul; - max_late_ = ACE_Time_Value (0, ul - 1); - min_pending_ = ACE_Time_Value (0, ul); -} - // set offset for boundary between signed range and unsigned range - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Dynamic_Service.cpp b/dep/acelite/ace/Dynamic_Service.cpp deleted file mode 100644 index 28d6e4526f2..00000000000 --- a/dep/acelite/ace/Dynamic_Service.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// $Id: Dynamic_Service.cpp 80826 2008-03-04 14:51:23Z wotte $ - -#ifndef ACE_DYNAMIC_SERVICE_CPP -#define ACE_DYNAMIC_SERVICE_CPP - -#include "ace/Dynamic_Service.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Service_Object.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Dynamic_Service.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - - -template TYPE * -ACE_Dynamic_Service::instance (const ACE_TCHAR *name) -{ - ACE_Service_Object * svc_obj = - static_cast - (ACE_Dynamic_Service_Base::instance (name,false)); - return dynamic_cast (svc_obj); -} - -template TYPE * -ACE_Dynamic_Service::instance (const ACE_TCHAR *name, - bool no_global) -{ - ACE_Service_Object * svc_obj = - static_cast - (ACE_Dynamic_Service_Base::instance (name, no_global)); - return dynamic_cast (svc_obj); -} - -template TYPE * -ACE_Dynamic_Service::instance (const ACE_Service_Gestalt* conf, - const ACE_TCHAR *name) -{ - ACE_Service_Object * svc_obj = - static_cast - (ACE_Dynamic_Service_Base::instance (conf, name, false)); - return dynamic_cast (svc_obj); -} - -template TYPE * -ACE_Dynamic_Service::instance (const ACE_Service_Gestalt* conf, - const ACE_TCHAR *name, - bool no_global) -{ - ACE_Service_Object * svc_obj = - static_cast - (ACE_Dynamic_Service_Base::instance (conf, name, no_global)); - return dynamic_cast (svc_obj); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_DYNAMIC_SERVICE_CPP */ diff --git a/dep/acelite/ace/Dynamic_Service.h b/dep/acelite/ace/Dynamic_Service.h deleted file mode 100644 index b90095c766d..00000000000 --- a/dep/acelite/ace/Dynamic_Service.h +++ /dev/null @@ -1,89 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Dynamic_Service.h - * - * $Id: Dynamic_Service.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Prashant Jain - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_DYNAMIC_SERVICE_H -#define ACE_DYNAMIC_SERVICE_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" -#include "ace/Global_Macros.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Dynamic_Service_Base.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Service_Object; - -/** - * @class ACE_Dynamic_Service - * - * @brief Provides a general interface to retrieve arbitrary objects - * from the ACE service repository. - * - * Uses "name" for lookup in the ACE service repository. Obtains - * the object and returns it as the appropriate type. - */ -template -class ACE_Dynamic_Service : public ACE_Dynamic_Service_Base -{ -public: - /// Return instance using @a name to search the Service_Repository. - static TYPE* instance (const ACE_TCHAR *name); - static TYPE* instance (const ACE_TCHAR *name, bool no_global); - - static TYPE* instance (const ACE_Service_Gestalt* repo, - const ACE_TCHAR *name); - static TYPE* instance (const ACE_Service_Gestalt* repo, - const ACE_TCHAR *name, bool no_global); - -#if defined (ACE_USES_WCHAR) - - /// Return instance using @a name to search the Service_Repository. - static TYPE* instance (const ACE_ANTI_TCHAR *name); - - static TYPE* instance (const ACE_ANTI_TCHAR *name, bool no_global); - - static TYPE* instance (const ACE_Service_Gestalt* repo, - const ACE_ANTI_TCHAR *name); - static TYPE* instance (const ACE_Service_Gestalt* repo, - const ACE_ANTI_TCHAR *name, bool no_global); -#endif // ACE_USES_WCHAR - -private: - ACE_UNIMPLEMENTED_FUNC (ACE_Dynamic_Service ()) - ACE_UNIMPLEMENTED_FUNC (ACE_Dynamic_Service (const ACE_Dynamic_Service&)) - ACE_UNIMPLEMENTED_FUNC (ACE_Dynamic_Service& operator= (const ACE_Dynamic_Service&)) -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Dynamic_Service.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -# include "ace/Dynamic_Service.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -# pragma implementation ("Dynamic_Service.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_DYNAMIC_SERVICE_H */ diff --git a/dep/acelite/ace/Dynamic_Service.inl b/dep/acelite/ace/Dynamic_Service.inl deleted file mode 100644 index 31324bf535b..00000000000 --- a/dep/acelite/ace/Dynamic_Service.inl +++ /dev/null @@ -1,39 +0,0 @@ -// -*- C++ -*- -// -// $Id: Dynamic_Service.inl 81318 2008-04-10 10:12:05Z johnnyw $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_USES_WCHAR) - -template ACE_INLINE TYPE * -ACE_Dynamic_Service::instance (const ACE_ANTI_TCHAR *name) -{ - return instance (ACE_TEXT_CHAR_TO_TCHAR (name),false); -} - -template ACE_INLINE TYPE * -ACE_Dynamic_Service::instance (const ACE_ANTI_TCHAR *name, - bool no_global) -{ - return instance (ACE_TEXT_CHAR_TO_TCHAR (name),no_global); -} - -template ACE_INLINE TYPE * -ACE_Dynamic_Service::instance (const ACE_Service_Gestalt* repo, - const ACE_ANTI_TCHAR *name) -{ - return instance (repo, ACE_TEXT_CHAR_TO_TCHAR (name),false); -} - -template ACE_INLINE TYPE * -ACE_Dynamic_Service::instance (const ACE_Service_Gestalt* repo, - const ACE_ANTI_TCHAR *name, - bool no_global) -{ - return instance (repo, ACE_TEXT_CHAR_TO_TCHAR (name),no_global); -} - -#endif // ACE_USES_WCHAR - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Dynamic_Service_Base.cpp b/dep/acelite/ace/Dynamic_Service_Base.cpp deleted file mode 100644 index b13e686125c..00000000000 --- a/dep/acelite/ace/Dynamic_Service_Base.cpp +++ /dev/null @@ -1,104 +0,0 @@ -// $Id: Dynamic_Service_Base.cpp 91813 2010-09-17 07:52:52Z johnnyw $ - -#include "ace/Dynamic_Service_Base.h" -#include "ace/ACE.h" -#include "ace/Service_Config.h" -#include "ace/Service_Repository.h" -#include "ace/Service_Types.h" -#include "ace/Log_Msg.h" - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - - -void -ACE_Dynamic_Service_Base::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Dynamic_Service_Base::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -// Get the instance using for the current global -// service configuration repository. - -void * -ACE_Dynamic_Service_Base::instance (const ACE_TCHAR *name, bool no_global) -{ - ACE_TRACE ("ACE_Dynamic_Service_Base::instance"); - return instance (ACE_Service_Config::current (), name, no_global); -} - -// Find a service registration - -const ACE_Service_Type * -ACE_Dynamic_Service_Base::find_i (const ACE_Service_Gestalt* &repo, - const ACE_TCHAR *name, - bool no_global) -{ - ACE_TRACE ("ACE_Dynamic_Service_Base::find_i"); - const ACE_Service_Type *svc_rec = 0; - - ACE_Service_Gestalt* global = ACE_Service_Config::global (); - - for ( ; (repo->find (name, &svc_rec) == -1) && !no_global; repo = global) - { - // Check the static repo, too if different - if (repo == global) - break; - } - - return svc_rec; -} - - -// Get the instance using for specific configuration repository. -void * -ACE_Dynamic_Service_Base::instance (const ACE_Service_Gestalt* repo, - const ACE_TCHAR *name, - bool no_global) -{ - ACE_TRACE ("ACE_Dynamic_Service_Base::instance"); - - void *obj = 0; - const ACE_Service_Type_Impl *type = 0; - - const ACE_Service_Gestalt* repo_found = repo; - const ACE_Service_Type *svc_rec = find_i (repo_found, name, no_global); - if (svc_rec != 0) - { - type = svc_rec->type (); - if (type != 0) - obj = type->object (); - } - - if (ACE::debug ()) - { - ACE_GUARD_RETURN (ACE_Log_Msg, log_guard, *ACE_Log_Msg::instance (), 0); - - if (repo->repo_ != repo_found->repo_) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("ACE (%P|%t) DSB::instance, repo=%@, name=%s") - ACE_TEXT (" type=%@ => %@") - ACE_TEXT (" [in repo=%@]\n"), - repo->repo_, name, type, obj, - repo_found->repo_)); - } - else - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("ACE (%P|%t) DSB::instance, repo=%@, name=%s") - ACE_TEXT (" type=%@ => %@\n"), - repo->repo_, name, type, obj)); - } - } - - return obj; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Dynamic_Service_Base.h b/dep/acelite/ace/Dynamic_Service_Base.h deleted file mode 100644 index 31fdadaa152..00000000000 --- a/dep/acelite/ace/Dynamic_Service_Base.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Dynamic_Service_Base.h - * - * $Id: Dynamic_Service_Base.h 89454 2010-03-11 09:35:25Z johnnyw $ - * - * @author Prashant Jain - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_DYNAMIC_SERVICE_BASE_H -#define ACE_DYNAMIC_SERVICE_BASE_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Service_Gestalt; -class ACE_Service_Type; - -/** - * @class ACE_Dynamic_Service_Base - * - * @brief Base class for all ACE_Dynamic_Service instantiations. - * - * Factors out common code shared by all ACE_Dynamic_Service - * instantiations, this avoid code bloat. - */ -class ACE_Export ACE_Dynamic_Service_Base -{ -public: - /// Dump the current static of the object - void dump (void) const; - -protected: - /// Perform the default repo search, but optionally skip searching the global - /// repo. - static void* instance (const ACE_TCHAR *name, bool no_global = false); - - static void* instance (const ACE_Service_Gestalt* repo, - const ACE_TCHAR *name, - bool no_global = false); - - /// No need to create, or assign instances of this class - ACE_Dynamic_Service_Base (void); - ~ACE_Dynamic_Service_Base (void); - const ACE_Dynamic_Service_Base& operator= (const ACE_Dynamic_Service_Base&); - -private: - /// Implement the service search policy, i.e. "look for the service first - /// locally and then globally" - static const ACE_Service_Type *find_i (const ACE_Service_Gestalt* &repo, - const ACE_TCHAR *name, - bool no_global); - - /// The dependency declaration class needs access to the service search - /// policy, implemented by find_i() - friend class ACE_Dynamic_Service_Dependency; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_DYNAMIC_SERVICE_BASE_H */ diff --git a/dep/acelite/ace/Dynamic_Service_Dependency.cpp b/dep/acelite/ace/Dynamic_Service_Dependency.cpp deleted file mode 100644 index 32b1a275ff5..00000000000 --- a/dep/acelite/ace/Dynamic_Service_Dependency.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// $Id: Dynamic_Service_Dependency.cpp 91287 2010-08-05 10:30:49Z johnnyw $ - -#include "ace/ACE.h" -#include "ace/DLL_Manager.h" -#include "ace/Dynamic_Service_Dependency.h" -#include "ace/Service_Config.h" -#include "ace/Log_Msg.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Dynamic_Service_Dependency::ACE_Dynamic_Service_Dependency (const ACE_TCHAR *principal) -{ - this->init (ACE_Service_Config::current (), principal); -} - -ACE_Dynamic_Service_Dependency::ACE_Dynamic_Service_Dependency (const ACE_Service_Gestalt *cfg, - const ACE_TCHAR *principal) -{ - this->init (cfg, principal); -} - - -ACE_Dynamic_Service_Dependency::~ACE_Dynamic_Service_Dependency (void) -{ - if (ACE::debug ()) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) DSD, this=%@ - destroying\n"), - this)); -} - -void -ACE_Dynamic_Service_Dependency::init (const ACE_Service_Gestalt *cfg, - const ACE_TCHAR *principal) -{ - const ACE_Service_Type* st = - ACE_Dynamic_Service_Base::find_i (cfg, principal,false); - if (ACE::debug ()) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) DSD, this=%@ - creating dependency on "), this)); - st->dump (); - } - this->tracker_ = st->dll (); -} - - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Dynamic_Service_Dependency.h b/dep/acelite/ace/Dynamic_Service_Dependency.h deleted file mode 100644 index 0f187d0037a..00000000000 --- a/dep/acelite/ace/Dynamic_Service_Dependency.h +++ /dev/null @@ -1,70 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Dynamic_Service_Dependency.h - * - * $Id: Dynamic_Service_Dependency.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Iliyan Jeliazkov - */ -//============================================================================= - -#ifndef ACE_DYNAMIC_SERVICE_DEPENDENCY_H -#define ACE_DYNAMIC_SERVICE_DEPENDENCY_H - -#include /**/ "ace/pre.h" - - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Dynamic_Service_Base.h" -#include "ace/Service_Object.h" -#include "ace/DLL.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Dynamic_Service_Dependency - * - * @brief Provides a way to declare dependency on specific service, - * thus helping to avoid order of initialization issues with instances - * of an objects whose implementation code resides in dynamically loaded - * services. - * - * It is disastrous to have dynamically loadable services create and give away - * ownership of objects and then ending up being unloaded before all those - * instances have been deleted. Normally the code for such objects classes - * resides within the TEXT segment of the DLL, which implements the service. - * If a service gets removed, its DLL may be unmapped from memory and then - * any attempt to invoke a method on the said objects will cause SEGV. - * - * Such instances must contain a member of ACE_Dynamic_Service_Dependency - * initialized with the service they depend on. - * ACE_Dynamic_Service_Dependency's constructor and destructor are - * "magical" - they work by maintaining the underlying dynamic service's - * DLL reference count. - */ -class ACE_Export ACE_Dynamic_Service_Dependency -{ -public: - ACE_Dynamic_Service_Dependency (const ACE_Service_Gestalt *cfg, - const ACE_TCHAR *principal); - ACE_Dynamic_Service_Dependency (const ACE_TCHAR *principal); - ~ACE_Dynamic_Service_Dependency (void); - -private: - void init (const ACE_Service_Gestalt *cfg, const ACE_TCHAR *principal); - -private: - ACE_DLL tracker_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - - -#include /**/ "ace/post.h" - -#endif /* ACE_DYNAMIC_SERVICE_DEPENDENCY_H */ diff --git a/dep/acelite/ace/ETCL/ETCL_Constraint.cpp b/dep/acelite/ace/ETCL/ETCL_Constraint.cpp deleted file mode 100644 index 638f7c50984..00000000000 --- a/dep/acelite/ace/ETCL/ETCL_Constraint.cpp +++ /dev/null @@ -1,655 +0,0 @@ -// -*- C++ -*- -// $Id: ETCL_Constraint.cpp 92173 2010-10-07 12:36:17Z olli $ - -#include "ace/ACE.h" - -#include "ace/ETCL/ETCL_Constraint.h" -#include "ace/ETCL/ETCL_Constraint_Visitor.h" - -#if ! defined (__ACE_INLINE__) -#include "ace/ETCL/ETCL_Constraint.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ETCL_Constraint::ETCL_Constraint (void) -{ -} - -ETCL_Constraint::~ETCL_Constraint (void) -{ -} - -int -ETCL_Constraint::accept (ETCL_Constraint_Visitor * /* visitor */) -{ - return 0; -} - -// **************************************************************** - -ETCL_Literal_Constraint::ETCL_Literal_Constraint ( - const ETCL_Literal_Constraint & lit - ) - : ETCL_Constraint(), - type_ (ACE_ETCL_UNKNOWN) -{ - this->copy (lit); -} - -ETCL_Literal_Constraint::ETCL_Literal_Constraint ( - ACE_CDR::ULong uinteger) : type_ (ACE_ETCL_UNSIGNED) -{ - this->op_.uinteger_ = uinteger; -} - -ETCL_Literal_Constraint::ETCL_Literal_Constraint ( - ACE_CDR::Long integer) : type_ (ACE_ETCL_SIGNED) -{ - this->op_.integer_ = integer; -} - -ETCL_Literal_Constraint::ETCL_Literal_Constraint ( - ACE_CDR::Boolean boolean - ) - : type_ (ACE_ETCL_BOOLEAN) -{ - this->op_.bool_ = boolean; -} - -ETCL_Literal_Constraint::ETCL_Literal_Constraint ( - ACE_CDR::Double doub) : type_ (ACE_ETCL_DOUBLE) -{ - this->op_.double_ = doub; -} - -ETCL_Literal_Constraint::ETCL_Literal_Constraint ( - const char* str) : type_ (ACE_ETCL_STRING) -{ - this->op_.str_ = ACE::strnew (str); -} - -ETCL_Literal_Constraint::~ETCL_Literal_Constraint (void) -{ - if (this->type_ == ACE_ETCL_STRING) - { - ACE::strdelete (this->op_.str_); - } -} - -int -ETCL_Literal_Constraint::accept (ETCL_Constraint_Visitor* visitor) -{ - return visitor->visit_literal (this); -} - -Literal_Type -ETCL_Literal_Constraint::expr_type (void) const -{ - return this->type_; -} - -void -ETCL_Literal_Constraint::operator= (const ETCL_Literal_Constraint& co) -{ - this->copy (co); -} - -ETCL_Literal_Constraint::operator ACE_CDR::Boolean (void) const -{ - return (this->type_ == ACE_ETCL_BOOLEAN) ? this->op_.bool_ : false; -} - -ETCL_Literal_Constraint::operator ACE_CDR::ULong (void) const -{ - switch (this->type_) - { - case ACE_ETCL_UNSIGNED: - return this->op_.uinteger_; - case ACE_ETCL_SIGNED: - case ACE_ETCL_INTEGER: - return - (this->op_.integer_ > 0) ? (ACE_CDR::ULong) this->op_.integer_ : 0; - case ACE_ETCL_DOUBLE: - return - (this->op_.double_ > 0) ? - ((this->op_.double_ > ACE_UINT32_MAX) ? - ACE_UINT32_MAX : - (ACE_CDR::ULong) this->op_.double_) - : 0; - default: - return 0; - } -} - -ETCL_Literal_Constraint::operator ACE_CDR::Long (void) const -{ - switch (this->type_) - { - case ACE_ETCL_SIGNED: - case ACE_ETCL_INTEGER: - return this->op_.integer_; - case ACE_ETCL_UNSIGNED: - return - (this->op_.uinteger_ > (ACE_CDR::ULong) ACE_INT32_MAX) ? - ACE_INT32_MAX : (ACE_CDR::Long) this->op_.uinteger_; - case ACE_ETCL_DOUBLE: - return - (this->op_.double_ > 0) ? - ((this->op_.double_ > ACE_INT32_MAX) ? - ACE_INT32_MAX : - (ACE_CDR::Long) this->op_.double_) : - ((this->op_.double_ < ACE_INT32_MIN) ? - ACE_INT32_MIN : - (ACE_CDR::Long) this->op_.double_); - default: - return 0; - } -} - -ETCL_Literal_Constraint::operator ACE_CDR::Double (void) const -{ - switch (this->type_) - { - case ACE_ETCL_DOUBLE: - return this->op_.double_; - case ACE_ETCL_SIGNED: - case ACE_ETCL_INTEGER: - return (ACE_CDR::Double) this->op_.integer_; - case ACE_ETCL_UNSIGNED: - return (ACE_CDR::Double) this->op_.uinteger_; - default: - return 0.0; - } -} - -ETCL_Literal_Constraint::operator const char* (void) const -{ - switch (this->type_) - { - case ACE_ETCL_STRING: - return this->op_.str_; - default: - return 0; - } -} - -bool -ETCL_Literal_Constraint::operator== (const ETCL_Literal_Constraint & rhs) -{ - bool return_value = false; - Literal_Type widest_type = this->widest_type (rhs); - - switch (widest_type) - { - case ACE_ETCL_STRING: - return_value = (ACE_OS::strcmp ((const char*) *this, (const char*) rhs) == 0); - break; - case ACE_ETCL_DOUBLE: - return_value = ACE::is_equal ((ACE_CDR::Double) *this, (ACE_CDR::Double) rhs); - break; - case ACE_ETCL_INTEGER: - case ACE_ETCL_SIGNED: - return_value = (ACE_CDR::Long) *this == (ACE_CDR::Long) rhs; - break; - case ACE_ETCL_UNSIGNED: - return_value = (ACE_CDR::ULong) *this == (ACE_CDR::ULong) rhs; - break; - case ACE_ETCL_BOOLEAN: - return_value = (ACE_CDR::Boolean) *this == (ACE_CDR::Boolean) rhs; - break; - default: - break; - } - - return return_value; -} - -bool -ETCL_Literal_Constraint::operator< (const ETCL_Literal_Constraint & rhs) -{ - bool return_value = false; - Literal_Type widest_type = this->widest_type (rhs); - - switch (widest_type) - { - case ACE_ETCL_STRING: - return_value = (ACE_OS::strcmp ((const char*) *this, (const char*) rhs) < 0); - break; - case ACE_ETCL_DOUBLE: - return_value = (ACE_CDR::Double) *this < (ACE_CDR::Double) rhs; - break; - case ACE_ETCL_INTEGER: - case ACE_ETCL_SIGNED: - return_value = (ACE_CDR::Long) *this < (ACE_CDR::Long) rhs; - break; - case ACE_ETCL_UNSIGNED: - return_value = (ACE_CDR::ULong) *this < (ACE_CDR::ULong) rhs; - break; - case ACE_ETCL_BOOLEAN: - return_value = (ACE_CDR::Boolean) *this < (ACE_CDR::Boolean) rhs; - break; - default: - break; - } - - return return_value; -} - -bool -ETCL_Literal_Constraint::operator> (const ETCL_Literal_Constraint & rhs) -{ - bool return_value = false; - Literal_Type widest_type = this->widest_type (rhs); - - switch (widest_type) - { - case ACE_ETCL_STRING: - return_value = (ACE_OS::strcmp ((const char*) *this, (const char*) rhs) > 0); - break; - case ACE_ETCL_DOUBLE: - return_value = (ACE_CDR::Double) *this > (ACE_CDR::Double) rhs; - break; - case ACE_ETCL_INTEGER: - case ACE_ETCL_SIGNED: - return_value = (ACE_CDR::Long) *this > (ACE_CDR::Long) rhs; - break; - case ACE_ETCL_UNSIGNED: - return_value = (ACE_CDR::ULong) *this > (ACE_CDR::ULong) rhs; - break; - default: - break; - } - - return return_value; -} - -ETCL_Literal_Constraint -ETCL_Literal_Constraint::operator+ (const ETCL_Literal_Constraint & rhs) -{ - Literal_Type widest_type = this->widest_type (rhs); - - switch (widest_type) - { - case ACE_ETCL_DOUBLE: - { - ACE_CDR::Double result = (ACE_CDR::Double) *this + (ACE_CDR::Double) rhs; - return ETCL_Literal_Constraint ((ACE_CDR::Double) result); - } - case ACE_ETCL_INTEGER: - case ACE_ETCL_SIGNED: - { - ACE_CDR::Long result = (ACE_CDR::Long) *this + (ACE_CDR::Long) rhs; - return ETCL_Literal_Constraint ((ACE_CDR::Long) result); - } - case ACE_ETCL_UNSIGNED: - { - ACE_CDR::ULong result = (ACE_CDR::ULong) *this + (ACE_CDR::ULong) rhs; - return ETCL_Literal_Constraint ((ACE_CDR::ULong) result); - } - default: - return ETCL_Literal_Constraint ((ACE_CDR::Long) 0); - } -} - -ETCL_Literal_Constraint -ETCL_Literal_Constraint::operator- (const ETCL_Literal_Constraint & rhs) -{ - Literal_Type widest_type = this->widest_type (rhs); - - switch (widest_type) - { - case ACE_ETCL_DOUBLE: - { - ACE_CDR::Double result = (ACE_CDR::Double) *this - (ACE_CDR::Double) rhs; - return ETCL_Literal_Constraint ((ACE_CDR::Double) result); - } - case ACE_ETCL_INTEGER: - case ACE_ETCL_SIGNED: - { - ACE_CDR::Long result = (ACE_CDR::Long) *this - (ACE_CDR::Long) rhs; - return ETCL_Literal_Constraint ((ACE_CDR::Long) result); - } - case ACE_ETCL_UNSIGNED: - { - ACE_CDR::ULong result = (ACE_CDR::ULong) *this - (ACE_CDR::ULong) rhs; - return ETCL_Literal_Constraint ((ACE_CDR::ULong) result); - } - default: - return ETCL_Literal_Constraint ((ACE_CDR::Long) 0); - } -} - -ETCL_Literal_Constraint -ETCL_Literal_Constraint::operator* (const ETCL_Literal_Constraint & rhs) -{ - Literal_Type widest_type = this->widest_type (rhs); - - switch (widest_type) - { - case ACE_ETCL_DOUBLE: - { - ACE_CDR::Double result = (ACE_CDR::Double) *this * (ACE_CDR::Double) rhs; - return ETCL_Literal_Constraint ((ACE_CDR::Double) result); - } - case ACE_ETCL_INTEGER: - case ACE_ETCL_SIGNED: - { - ACE_CDR::Long result = (ACE_CDR::Long) *this * (ACE_CDR::Long) rhs; - return ETCL_Literal_Constraint ((ACE_CDR::Long) result); - } - case ACE_ETCL_UNSIGNED: - { - ACE_CDR::ULong result = (ACE_CDR::ULong) *this * (ACE_CDR::ULong) rhs; - return ETCL_Literal_Constraint ((ACE_CDR::ULong) result); - } - default: - return ETCL_Literal_Constraint ((ACE_CDR::Long) 0); - } -} - -ETCL_Literal_Constraint -ETCL_Literal_Constraint::operator/ (const ETCL_Literal_Constraint & rhs) -{ - Literal_Type widest_type = this->widest_type (rhs); - - switch (widest_type) - { - case ACE_ETCL_DOUBLE: - { - if (ACE::is_equal ((ACE_CDR::Double) rhs, 0.0)) - return ETCL_Literal_Constraint ((ACE_CDR::Double) 0.0); - - ACE_CDR::Double result = (ACE_CDR::Double) *this / (ACE_CDR::Double) rhs; - return ETCL_Literal_Constraint ((ACE_CDR::Double) result); - } - case ACE_ETCL_INTEGER: - case ACE_ETCL_SIGNED: - { - if ((ACE_CDR::Long) rhs == 0) - return ETCL_Literal_Constraint ((ACE_CDR::Long) 0); - - ACE_CDR::Long result = (ACE_CDR::Long) *this / (ACE_CDR::Long) rhs; - return ETCL_Literal_Constraint ((ACE_CDR::Long) result); - } - case ACE_ETCL_UNSIGNED: - { - if ((ACE_CDR::ULong) rhs == 0) - return ETCL_Literal_Constraint ((ACE_CDR::ULong) 0); - - ACE_CDR::ULong result = (ACE_CDR::ULong) *this / (ACE_CDR::ULong) rhs; - return ETCL_Literal_Constraint ((ACE_CDR::ULong) result); - } - default: - return ETCL_Literal_Constraint ((ACE_CDR::Long) 0); - } -} - -ETCL_Literal_Constraint -ETCL_Literal_Constraint::operator- (void) -{ - switch (this->type_) - { - case ACE_ETCL_DOUBLE: - return ETCL_Literal_Constraint (- this->op_.double_); - case ACE_ETCL_INTEGER: - case ACE_ETCL_SIGNED: - return ETCL_Literal_Constraint (- this->op_.integer_); - case ACE_ETCL_UNSIGNED: - return ETCL_Literal_Constraint (- (ACE_CDR::Long) this->op_.uinteger_); - default: - return ETCL_Literal_Constraint ((ACE_CDR::Long) 0); - } -} - -Literal_Type -ETCL_Literal_Constraint::widest_type (const ETCL_Literal_Constraint & rhs) -{ - Literal_Type rhs_type = rhs.expr_type (); - Literal_Type return_value = rhs_type; - - if (rhs_type != this->type_) - { - if (rhs_type > this->type_) - { - return_value = rhs_type; - } - else - { - return_value = this->type_; - } - } - - return return_value; -} - -void -ETCL_Literal_Constraint::copy (const ETCL_Literal_Constraint &lit) -{ - if (this->type_ == ACE_ETCL_STRING) - { - ACE::strdelete (this->op_.str_); - } - - this->type_ = lit.type_; - - switch (this->type_) - { - case ACE_ETCL_STRING: - this->op_.str_ = ACE::strnew (lit.op_.str_); - break; - case ACE_ETCL_DOUBLE: - this->op_.double_ = lit.op_.double_; - break; - case ACE_ETCL_UNSIGNED: - this->op_.uinteger_ = lit.op_.uinteger_; - break; - case ACE_ETCL_INTEGER: - case ACE_ETCL_SIGNED: - this->op_.integer_ = lit.op_.integer_; - break; - case ACE_ETCL_BOOLEAN: - this->op_.bool_ = lit.op_.bool_; - break; - default: - this->type_ = ACE_ETCL_UNKNOWN; - break; - } -} - -// **************************************************************** - -int -ETCL_Identifier::accept (ETCL_Constraint_Visitor *visitor) -{ - return visitor->visit_identifier (this); -} - -// **************************************************************** - -ETCL_Union_Value::~ETCL_Union_Value (void) -{ - delete this->string_; - delete this->integer_; -} - -int -ETCL_Union_Value::accept (ETCL_Constraint_Visitor *visitor) -{ - return visitor->visit_union_value (this); -} - -// **************************************************************** - -ETCL_Union_Pos::~ETCL_Union_Pos (void) -{ - delete this->component_; - delete this->union_value_; -} - -int -ETCL_Union_Pos::accept (ETCL_Constraint_Visitor *visitor) -{ - return visitor->visit_union_pos (this); -} - -// **************************************************************** - -ETCL_Component_Pos::~ETCL_Component_Pos (void) -{ - delete this->component_; - delete this->integer_; -} - -int -ETCL_Component_Pos::accept (ETCL_Constraint_Visitor *visitor) -{ - return visitor->visit_component_pos (this); -} - -// **************************************************************** - -ETCL_Component_Assoc::~ETCL_Component_Assoc (void) -{ - delete this->component_; - delete this->identifier_; -} - -int -ETCL_Component_Assoc::accept (ETCL_Constraint_Visitor *visitor) -{ - return visitor->visit_component_assoc (this); -} - -// **************************************************************** - -ETCL_Component_Array::~ETCL_Component_Array (void) -{ - delete this->component_; - delete this->integer_; -} - -int -ETCL_Component_Array::accept (ETCL_Constraint_Visitor *visitor) -{ - return visitor->visit_component_array (this); -} - -// **************************************************************** - -ETCL_Special::~ETCL_Special (void) -{} - -int -ETCL_Special::accept (ETCL_Constraint_Visitor *visitor) -{ - return visitor->visit_special (this); -} - -// **************************************************************** - -ETCL_Component::~ETCL_Component (void) -{ - delete this->component_; - delete this->identifier_; -} - -int -ETCL_Component::accept (ETCL_Constraint_Visitor *visitor) -{ - return visitor->visit_component (this); -} - -// **************************************************************** - -ETCL_Dot::~ETCL_Dot (void) -{ - delete this->component_; -} - -int -ETCL_Dot::accept (ETCL_Constraint_Visitor *visitor) -{ - return visitor->visit_dot (this); -} - -// **************************************************************** - -ETCL_Eval::~ETCL_Eval (void) -{ - delete this->component_; -} - -int -ETCL_Eval::accept (ETCL_Constraint_Visitor *visitor) -{ - return visitor->visit_eval (this); -} - -// **************************************************************** - -ETCL_Default::~ETCL_Default (void) -{ - delete this->component_; -} - -int -ETCL_Default::accept (ETCL_Constraint_Visitor *visitor) -{ - return visitor->visit_default (this); -} - -// **************************************************************** - -ETCL_Exist::~ETCL_Exist (void) -{ - delete this->component_; -} - -int -ETCL_Exist::accept (ETCL_Constraint_Visitor *visitor) -{ - return visitor->visit_exist (this); -} - -// **************************************************************** - -ETCL_Unary_Expr::~ETCL_Unary_Expr (void) -{ - delete this->subexpr_; -} - -int -ETCL_Unary_Expr::accept (ETCL_Constraint_Visitor *visitor) -{ - return visitor->visit_unary_expr (this); -} - -// **************************************************************** - -ETCL_Binary_Expr::~ETCL_Binary_Expr (void) -{ - delete this->lhs_; - delete this->rhs_; -} - -int -ETCL_Binary_Expr::accept (ETCL_Constraint_Visitor *visitor) -{ - return visitor->visit_binary_expr (this); -} - -// **************************************************************** - -ETCL_Preference::~ETCL_Preference (void) -{ - delete this->subexpr_; -} - -int -ETCL_Preference::accept (ETCL_Constraint_Visitor *visitor) -{ - return visitor->visit_preference (this); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/ETCL/ETCL_Constraint.h b/dep/acelite/ace/ETCL/ETCL_Constraint.h deleted file mode 100644 index 0762d190880..00000000000 --- a/dep/acelite/ace/ETCL/ETCL_Constraint.h +++ /dev/null @@ -1,416 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file ETCL_Constraint.h - * - * $Id: ETCL_Constraint.h 94030 2011-05-08 17:58:47Z johnnyw $ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - * @author Jeff Parsons (j.parsons@vanderbilt.edu) - */ -//============================================================================= - -#ifndef ACE_ETCL_CONSTRAINT_H -#define ACE_ETCL_CONSTRAINT_H - -#include /**/ "ace/pre.h" - -#include "ace/SString.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/CDR_Base.h" - -#include "ace/ETCL/ace_etcl_export.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -typedef unsigned long Literal_Type; - -class ETCL_Constraint_Visitor; - -class ACE_ETCL_Export ETCL_Constraint -{ -public: - /// Constructor and destructor - ETCL_Constraint (void); - virtual ~ETCL_Constraint (void); - - virtual int accept (ETCL_Constraint_Visitor *visitor); - -protected: - enum - { - ACE_ETCL_STRING, - ACE_ETCL_DOUBLE, - ACE_ETCL_UNSIGNED, - ACE_ETCL_SIGNED, - ACE_ETCL_INTEGER, - ACE_ETCL_BOOLEAN, - ACE_ETCL_COMPONENT, - ACE_ETCL_UNKNOWN - }; -}; - -// **************************************************************** - -class ACE_ETCL_Export ETCL_Literal_Constraint - : public ETCL_Constraint -{ -public: - ETCL_Literal_Constraint (void); - - // = Constructors for each of the various types of literals. - - explicit ETCL_Literal_Constraint (ACE_CDR::ULong uinteger); - explicit ETCL_Literal_Constraint (ACE_CDR::Long integer); - explicit ETCL_Literal_Constraint (ACE_CDR::Boolean boolean); - explicit ETCL_Literal_Constraint (ACE_CDR::Double doub); - explicit ETCL_Literal_Constraint (const char* str); - - /// Copy constructor - ETCL_Literal_Constraint (const ETCL_Literal_Constraint& lit); - - /// Destructor. - virtual ~ETCL_Literal_Constraint(void); - - /// Visitor accept method. - virtual int accept (ETCL_Constraint_Visitor* visitor); - - Literal_Type expr_type (void) const; - - /// Assignment operator. - void operator= (const ETCL_Literal_Constraint& co); - - // Conversion routines. - operator ACE_CDR::Boolean (void) const; - operator ACE_CDR::ULong (void) const; - operator ACE_CDR::Long (void) const; - operator ACE_CDR::Double (void) const; - operator const char* (void) const; - - // Return the type represented by this MysteryOperand. - - // = Boolean operators. - - bool - operator< (const ETCL_Literal_Constraint& rhs); - - bool - operator<= (const ETCL_Literal_Constraint& rhs); - - bool - operator> (const ETCL_Literal_Constraint& rhs); - - bool - operator>= (const ETCL_Literal_Constraint& rhs); - - bool - operator== (const ETCL_Literal_Constraint& rhs); - - bool - operator!= (const ETCL_Literal_Constraint& rhs); - - // = Arithmetic operators. - - ETCL_Literal_Constraint - operator+ (const ETCL_Literal_Constraint& rhs); - - ETCL_Literal_Constraint - operator- (const ETCL_Literal_Constraint& rhs); - - ETCL_Literal_Constraint - operator* (const ETCL_Literal_Constraint& rhs); - - ETCL_Literal_Constraint - operator/ (const ETCL_Literal_Constraint& rhs); - - // Unary minus. - ETCL_Literal_Constraint - operator- (void); - - /// Ensure both operands are of the same simple numeric type. - virtual Literal_Type - widest_type (const ETCL_Literal_Constraint& rhs); - -protected: - /// Private copy method. - void copy (const ETCL_Literal_Constraint& co); - - /// Union of the possible literal types. - union - { - char* str_; - ACE_CDR::ULong uinteger_; - ACE_CDR::Long integer_; - ACE_CDR::Boolean bool_; - ACE_CDR::Double double_; - } op_; - - /// The actual types of the ETCL_Literal_Constraint. - Literal_Type type_; -}; - -// **************************************************************** - -class ACE_ETCL_Export ETCL_Identifier : public ETCL_Constraint -{ -public: - ETCL_Identifier (const char *value); - - /// Get the value - const char *value (void) const; - - // = The Constraint methods. - int accept (ETCL_Constraint_Visitor *visitor); - -private: - /// The value - ACE_CString string_; -}; - -// **************************************************************** - -class ACE_ETCL_Export ETCL_Union_Value : public ETCL_Constraint -{ -public: - ETCL_Union_Value (int sign, - ETCL_Constraint *integer); - explicit ETCL_Union_Value (ETCL_Constraint *string = 0); - virtual ~ETCL_Union_Value (void); - - int sign (void) const; - ETCL_Literal_Constraint *integer (void) const; - ETCL_Literal_Constraint *string (void) const; - - virtual int accept (ETCL_Constraint_Visitor *visitor); - -private: - int sign_; - ETCL_Literal_Constraint *integer_; - ETCL_Literal_Constraint *string_; -}; - -class ACE_ETCL_Export ETCL_Union_Pos : public ETCL_Constraint -{ -public: - ETCL_Union_Pos (ETCL_Constraint *union_value = 0, - ETCL_Constraint *component = 0); - virtual ~ETCL_Union_Pos (void); - - ETCL_Union_Value *union_value (void) const; - ETCL_Constraint *component (void) const; - - virtual int accept (ETCL_Constraint_Visitor *visitor); - -private: - ETCL_Union_Value *union_value_; - ETCL_Constraint *component_; -}; - -class ACE_ETCL_Export ETCL_Component_Pos : public ETCL_Constraint -{ -public: - ETCL_Component_Pos (ETCL_Constraint *integer = 0, - ETCL_Constraint *component = 0); - virtual ~ETCL_Component_Pos (void); - - ETCL_Literal_Constraint *integer (void) const; - ETCL_Constraint *component (void) const; - - virtual int accept (ETCL_Constraint_Visitor *visitor); - -private: - ETCL_Literal_Constraint *integer_; - ETCL_Constraint *component_; -}; - -class ACE_ETCL_Export ETCL_Component_Assoc : public ETCL_Constraint -{ -public: - ETCL_Component_Assoc (ETCL_Constraint *identifier = 0, - ETCL_Constraint *component = 0); - virtual ~ETCL_Component_Assoc (void); - - ETCL_Identifier *identifier (void) const; - ETCL_Constraint *component (void) const; - - virtual int accept (ETCL_Constraint_Visitor *visitor); - -private: - ETCL_Identifier *identifier_; - ETCL_Constraint *component_; -}; - -class ACE_ETCL_Export ETCL_Component_Array : public ETCL_Constraint -{ -public: - ETCL_Component_Array (ETCL_Constraint *integer = 0, - ETCL_Constraint *component = 0); - virtual ~ETCL_Component_Array (void); - - ETCL_Literal_Constraint *integer (void) const; - ETCL_Constraint *component (void) const; - - virtual int accept (ETCL_Constraint_Visitor *visitor); - -private: - ETCL_Literal_Constraint *integer_; - ETCL_Constraint *component_; -}; - -class ACE_ETCL_Export ETCL_Special : public ETCL_Constraint -{ -public: - ETCL_Special (void); - ETCL_Special (int type); - virtual ~ETCL_Special (void); - - int type (void) const; - - virtual int accept (ETCL_Constraint_Visitor *visitor); - -private: - int type_; -}; - -class ACE_ETCL_Export ETCL_Component : public ETCL_Constraint -{ -public: - ETCL_Component (ETCL_Constraint *identifier = 0, - ETCL_Constraint *component = 0); - virtual ~ETCL_Component (void); - - ETCL_Identifier *identifier (void) const; - ETCL_Constraint *component (void) const; - - virtual int accept (ETCL_Constraint_Visitor *visitor); - -private: - ETCL_Identifier *identifier_; - ETCL_Constraint *component_; -}; - -class ACE_ETCL_Export ETCL_Dot : public ETCL_Constraint -{ -public: - explicit ETCL_Dot (ETCL_Constraint *component = 0); - virtual ~ETCL_Dot (void); - - ETCL_Constraint *component (void) const; - - virtual int accept (ETCL_Constraint_Visitor *visitor); - -private: - ETCL_Constraint *component_; -}; - -class ACE_ETCL_Export ETCL_Eval : public ETCL_Constraint -{ -public: - explicit ETCL_Eval (ETCL_Constraint *component = 0); - virtual ~ETCL_Eval (void); - - ETCL_Constraint *component (void) const; - - virtual int accept (ETCL_Constraint_Visitor *visitor); - -private: - ETCL_Constraint *component_; -}; - -class ACE_ETCL_Export ETCL_Default : public ETCL_Constraint -{ -public: - explicit ETCL_Default (ETCL_Constraint *component = 0); - virtual ~ETCL_Default (void); - - ETCL_Constraint *component (void) const; - - virtual int accept (ETCL_Constraint_Visitor *visitor); - -private: - ETCL_Constraint *component_; -}; - -class ACE_ETCL_Export ETCL_Exist : public ETCL_Constraint -{ -public: - explicit ETCL_Exist (ETCL_Constraint *component = 0); - virtual ~ETCL_Exist (void); - - ETCL_Constraint *component (void) const; - - virtual int accept (ETCL_Constraint_Visitor *visitor); - -private: - ETCL_Constraint *component_; -}; - -class ACE_ETCL_Export ETCL_Unary_Expr : public ETCL_Constraint -{ -public: - ETCL_Unary_Expr (int type, - ETCL_Constraint *subexpr); - virtual ~ETCL_Unary_Expr (void); - - int type (void) const; - ETCL_Constraint *subexpr (void) const; - - int accept (ETCL_Constraint_Visitor *visitor); - -private: - int type_; - ETCL_Constraint *subexpr_; -}; - -class ACE_ETCL_Export ETCL_Binary_Expr : public ETCL_Constraint -{ -public: - ETCL_Binary_Expr (int type, - ETCL_Constraint *lhs, - ETCL_Constraint *rhs); - virtual ~ETCL_Binary_Expr (void); - - int type (void) const; - ETCL_Constraint *rhs (void) const; - ETCL_Constraint *lhs (void) const; - - int accept (ETCL_Constraint_Visitor *visitor); - -private: - int type_; - ETCL_Constraint *lhs_; - ETCL_Constraint *rhs_; -}; - -class ACE_ETCL_Export ETCL_Preference : public ETCL_Constraint -{ -public: - ETCL_Preference (void); - ETCL_Preference (int type, - ETCL_Constraint *subexpr = 0); - virtual ~ETCL_Preference (void); - - int type (void) const; - ETCL_Constraint *subexpr (void) const; - - virtual int accept (ETCL_Constraint_Visitor *visitor); - -private: - int type_; - ETCL_Constraint *subexpr_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/ETCL/ETCL_Constraint.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif // ACE_ETCL_CONSTRAINT_H diff --git a/dep/acelite/ace/ETCL/ETCL_Constraint.inl b/dep/acelite/ace/ETCL/ETCL_Constraint.inl deleted file mode 100644 index a56cf39aa46..00000000000 --- a/dep/acelite/ace/ETCL/ETCL_Constraint.inl +++ /dev/null @@ -1,349 +0,0 @@ -// -*- C++ -*- -// $Id: ETCL_Constraint.inl 95595 2012-03-07 13:33:25Z johnnyw $ - -// **************************************************************** - -ACE_INLINE -ETCL_Literal_Constraint::ETCL_Literal_Constraint (void) - : type_ (ACE_ETCL_UNKNOWN) -{ -} - -// **************************************************************** - -ACE_INLINE -ETCL_Identifier::ETCL_Identifier (const char *value) - : string_ (value) -{ -} - -ACE_INLINE const char * -ETCL_Identifier::value (void) const -{ - return this->string_.c_str (); -} - - -// **************************************************************** - -ACE_INLINE -ETCL_Union_Value::ETCL_Union_Value (int sign, - ETCL_Constraint *integer) - : sign_ (sign), - string_ (0) -{ - this->integer_ = - dynamic_cast (integer); -} - -ACE_INLINE -ETCL_Union_Value::ETCL_Union_Value (ETCL_Constraint *string) - : sign_ (0), - integer_ (0) -{ - this->string_ = - dynamic_cast (string); -} - -ACE_INLINE int -ETCL_Union_Value::sign (void) const -{ - return this->sign_; -} - -ACE_INLINE ETCL_Literal_Constraint * -ETCL_Union_Value::integer (void) const -{ - return this->integer_; -} - -ACE_INLINE ETCL_Literal_Constraint * -ETCL_Union_Value::string (void) const -{ - return this->string_; -} - -// **************************************************************** - -ACE_INLINE -ETCL_Union_Pos::ETCL_Union_Pos (ETCL_Constraint *union_value, - ETCL_Constraint *component) - : component_ (component) -{ - this->union_value_ = - dynamic_cast (union_value); -} - -ACE_INLINE ETCL_Union_Value * -ETCL_Union_Pos::union_value (void) const -{ - return this->union_value_; -} - -ACE_INLINE ETCL_Constraint * -ETCL_Union_Pos::component (void) const -{ - return this->component_; -} - -// **************************************************************** - -ACE_INLINE -ETCL_Component_Pos::ETCL_Component_Pos ( - ETCL_Constraint *integer, - ETCL_Constraint *component) - : component_ (component) -{ - this->integer_ = - dynamic_cast (integer); -} - -ACE_INLINE ETCL_Literal_Constraint * -ETCL_Component_Pos::integer (void) const -{ - return this->integer_; -} - -ACE_INLINE ETCL_Constraint * -ETCL_Component_Pos::component (void) const -{ - return this->component_; -} - -// **************************************************************** - -ACE_INLINE -ETCL_Component_Assoc::ETCL_Component_Assoc ( - ETCL_Constraint *identifier, - ETCL_Constraint *component) - : component_ (component) -{ - this->identifier_ = - dynamic_cast (identifier); -} - -ACE_INLINE ETCL_Identifier * -ETCL_Component_Assoc::identifier (void) const -{ - return this->identifier_; -} - -ACE_INLINE ETCL_Constraint * -ETCL_Component_Assoc::component (void) const -{ - return this->component_; -} - -// **************************************************************** - -ACE_INLINE -ETCL_Component_Array::ETCL_Component_Array ( - ETCL_Constraint *integer, - ETCL_Constraint *component) - : component_ (component) -{ - this->integer_ = - dynamic_cast (integer); -} - -ACE_INLINE ETCL_Literal_Constraint * -ETCL_Component_Array::integer (void) const -{ - return this->integer_; -} - -ACE_INLINE ETCL_Constraint * -ETCL_Component_Array::component (void) const -{ - return this->component_; -} - -// **************************************************************** - -ACE_INLINE -ETCL_Special::ETCL_Special (void) - : type_ (0) -{} - -ACE_INLINE -ETCL_Special::ETCL_Special (int type) - : type_ (type) -{} - -ACE_INLINE int -ETCL_Special::type (void) const -{ - return this->type_; -} - -// **************************************************************** - -ACE_INLINE -ETCL_Component::ETCL_Component (ETCL_Constraint *identifier, - ETCL_Constraint *component) - : component_ (component) -{ - this->identifier_ = - dynamic_cast (identifier); -} - -ACE_INLINE ETCL_Identifier * -ETCL_Component::identifier (void) const -{ - return this->identifier_; -} - -ACE_INLINE ETCL_Constraint * -ETCL_Component::component (void) const -{ - return this->component_; -} - -// **************************************************************** - -ACE_INLINE -ETCL_Dot::ETCL_Dot (ETCL_Constraint *component) - : component_ (component) -{ -} - -ACE_INLINE ETCL_Constraint * -ETCL_Dot::component (void) const -{ - return this->component_; -} - -// **************************************************************** - -ACE_INLINE -ETCL_Eval::ETCL_Eval (ETCL_Constraint *component) - : component_ (component) -{ -} - -ACE_INLINE ETCL_Constraint * -ETCL_Eval::component (void) const -{ - return this->component_; -} - -// **************************************************************** - -ACE_INLINE -ETCL_Default::ETCL_Default (ETCL_Constraint *component) - : component_ (component) -{ -} - -ACE_INLINE ETCL_Constraint * -ETCL_Default::component (void) const -{ - return this->component_; -} - -// **************************************************************** - -ACE_INLINE -ETCL_Exist::ETCL_Exist (ETCL_Constraint *component) - : component_ (component) -{ -} - -ACE_INLINE ETCL_Constraint * -ETCL_Exist::component (void) const -{ - return this->component_; -} - -// **************************************************************** - -ACE_INLINE -ETCL_Unary_Expr::ETCL_Unary_Expr (int type, - ETCL_Constraint *subexpr) - : type_ (type), - subexpr_ (subexpr) -{} - -ACE_INLINE int -ETCL_Unary_Expr::type (void) const -{ - return this->type_; -} - -ACE_INLINE ETCL_Constraint * -ETCL_Unary_Expr::subexpr (void) const -{ - return this->subexpr_; -} - -// **************************************************************** - -ACE_INLINE -ETCL_Binary_Expr::ETCL_Binary_Expr (int type, - ETCL_Constraint *lhs, - ETCL_Constraint *rhs) - : type_ (type), - lhs_ (lhs), - rhs_ (rhs) -{} - -ACE_INLINE int -ETCL_Binary_Expr::type (void) const -{ - return this->type_; -} - -ACE_INLINE ETCL_Constraint * -ETCL_Binary_Expr::rhs (void) const -{ - return this->rhs_; -} - -ACE_INLINE ETCL_Constraint * -ETCL_Binary_Expr::lhs (void) const -{ - return this->lhs_; -} - -// **************************************************************** - -ACE_INLINE -ETCL_Preference::ETCL_Preference (void) -{} - -ACE_INLINE -ETCL_Preference::ETCL_Preference (int type, - ETCL_Constraint *subexpr) - : type_ (type), - subexpr_ (subexpr) -{} - -ACE_INLINE int -ETCL_Preference::type (void) const -{ - return this->type_; -} - -ACE_INLINE ETCL_Constraint * -ETCL_Preference::subexpr (void) const -{ - return this->subexpr_; -} - -ACE_INLINE bool -ETCL_Literal_Constraint::operator!= (const ETCL_Literal_Constraint & rhs) -{ - return !(*this == rhs); -} - -ACE_INLINE bool -ETCL_Literal_Constraint::operator<= (const ETCL_Literal_Constraint & rhs) -{ - return !(*this > rhs); -} - -ACE_INLINE bool -ETCL_Literal_Constraint::operator>= (const ETCL_Literal_Constraint & rhs) -{ - return !(*this < rhs); -} diff --git a/dep/acelite/ace/ETCL/ETCL_Constraint_Visitor.cpp b/dep/acelite/ace/ETCL/ETCL_Constraint_Visitor.cpp deleted file mode 100644 index 66dbd8d09b8..00000000000 --- a/dep/acelite/ace/ETCL/ETCL_Constraint_Visitor.cpp +++ /dev/null @@ -1,117 +0,0 @@ -// -*- C++ -*- -//============================================================================= -/** - * @file ETCL_Constraint_Visitor.cpp - * - * $Id: ETCL_Constraint_Visitor.cpp 81653 2008-05-08 21:08:49Z parsons $ - * - * @author Jeff Parsons - */ -//============================================================================= - -#include "ace/ETCL/ETCL_Constraint_Visitor.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ETCL_Constraint_Visitor::~ETCL_Constraint_Visitor (void) -{ -} - -int -ETCL_Constraint_Visitor::visit_literal (ETCL_Literal_Constraint *) -{ - return 0; -} - -int -ETCL_Constraint_Visitor::visit_identifier (ETCL_Identifier *) -{ - return 0; -} - -int -ETCL_Constraint_Visitor::visit_union_value (ETCL_Union_Value *) -{ - return 0; -} - -int -ETCL_Constraint_Visitor::visit_union_pos (ETCL_Union_Pos *) -{ - return 0; -} - -int -ETCL_Constraint_Visitor::visit_component_pos (ETCL_Component_Pos *) -{ - return 0; -} - -int -ETCL_Constraint_Visitor::visit_component_assoc (ETCL_Component_Assoc *) -{ - return 0; -} - -int -ETCL_Constraint_Visitor::visit_component_array (ETCL_Component_Array *) -{ - return 0; -} - -int -ETCL_Constraint_Visitor::visit_special (ETCL_Special *) -{ - return 0; -} - -int -ETCL_Constraint_Visitor::visit_component (ETCL_Component *) -{ - return 0; -} - -int -ETCL_Constraint_Visitor::visit_dot (ETCL_Dot *) -{ - return 0; -} - -int -ETCL_Constraint_Visitor::visit_eval (ETCL_Eval *) -{ - return 0; -} - -int -ETCL_Constraint_Visitor::visit_default (ETCL_Default *) -{ - return 0; -} - -int -ETCL_Constraint_Visitor::visit_exist (ETCL_Exist *) -{ - return 0; -} - -int -ETCL_Constraint_Visitor::visit_unary_expr (ETCL_Unary_Expr *) -{ - return 0; -} - -int -ETCL_Constraint_Visitor::visit_binary_expr (ETCL_Binary_Expr *) -{ - return 0; -} - -int -ETCL_Constraint_Visitor::visit_preference (ETCL_Preference *) -{ - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - diff --git a/dep/acelite/ace/ETCL/ETCL_Constraint_Visitor.h b/dep/acelite/ace/ETCL/ETCL_Constraint_Visitor.h deleted file mode 100644 index 2337f60e8c4..00000000000 --- a/dep/acelite/ace/ETCL/ETCL_Constraint_Visitor.h +++ /dev/null @@ -1,70 +0,0 @@ -// -*- C++ -*- -//============================================================================= -/** - * @file ETCL_Constraint_Visitor.h - * - * $Id: ETCL_Constraint_Visitor.h 81653 2008-05-08 21:08:49Z parsons $ - * - * @author Carlos O'Ryan - * @author Jeff Parsons - */ -//============================================================================= - -#ifndef ACE_ETCL_CONSTRAINT_VISITOR_H -#define ACE_ETCL_CONSTRAINT_VISITOR_H - -#include /**/ "ace/pre.h" - -#include "ace/ETCL/ace_etcl_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ETCL_Literal_Constraint; -class ETCL_Identifier; -class ETCL_Union_Value; -class ETCL_Union_Pos; -class ETCL_Component_Pos; -class ETCL_Component_Assoc; -class ETCL_Component_Array; -class ETCL_Special; -class ETCL_Component; -class ETCL_Dot; -class ETCL_Eval; -class ETCL_Default; -class ETCL_Exist; -class ETCL_Unary_Expr; -class ETCL_Binary_Expr; -class ETCL_Preference; - -class ACE_ETCL_Export ETCL_Constraint_Visitor -{ -public: - virtual ~ETCL_Constraint_Visitor (void); - - virtual int visit_literal (ETCL_Literal_Constraint *); - virtual int visit_identifier (ETCL_Identifier *); - virtual int visit_union_value (ETCL_Union_Value *); - virtual int visit_union_pos (ETCL_Union_Pos *); - virtual int visit_component_pos (ETCL_Component_Pos *); - virtual int visit_component_assoc (ETCL_Component_Assoc *); - virtual int visit_component_array (ETCL_Component_Array *); - virtual int visit_special (ETCL_Special *); - virtual int visit_component (ETCL_Component *); - virtual int visit_dot (ETCL_Dot *); - virtual int visit_eval (ETCL_Eval *); - virtual int visit_default (ETCL_Default *); - virtual int visit_exist (ETCL_Exist *); - virtual int visit_unary_expr (ETCL_Unary_Expr *); - virtual int visit_binary_expr (ETCL_Binary_Expr *); - virtual int visit_preference (ETCL_Preference *); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif // ACE_ETCL_CONSTRAINT_VISITOR_H diff --git a/dep/acelite/ace/ETCL/ETCL_Interpreter.cpp b/dep/acelite/ace/ETCL/ETCL_Interpreter.cpp deleted file mode 100644 index 727bd264672..00000000000 --- a/dep/acelite/ace/ETCL/ETCL_Interpreter.cpp +++ /dev/null @@ -1,113 +0,0 @@ -// -*- C++ -*- -// $Id: ETCL_Interpreter.cpp 91813 2010-09-17 07:52:52Z johnnyw $ - -#include "ace/Guard_T.h" -#include "ace/Truncate.h" - -#include "ace/ETCL/ETCL_Interpreter.h" -#include "ace/ETCL/ETCL_Constraint.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ETCL_Parser_Export ACE_SYNCH_MUTEX ETCL_Interpreter::parserMutex__; - -ETCL_Interpreter::ETCL_Interpreter (void) - : root_ (0) -{ -} - -ETCL_Interpreter::~ETCL_Interpreter (void) -{ - delete this->root_; -} - -int -ETCL_Interpreter::build_tree (const char* constraints) -{ - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, - guard, - ETCL_Interpreter::parserMutex__, - -1); - - Lex_String_Input::reset ((char*)constraints); - - yyval.constraint = 0; - int return_value = ::yyparse (); - - if (return_value == 0 && yyval.constraint != 0) - { - this->root_ = yyval.constraint; - } - else - { - this->root_ = 0; - } - - return return_value; -} - -int -ETCL_Interpreter::is_empty_string (const char* str) -{ - int return_value = 0; - - if (str != 0) - { - int i = 0; - - while (str[i] != '\0') - { - if (str[i] != ' ') - { - break; - } - - ++i; - } - - if (str[i] == '\0') - { - return_value = 1; - } - } - - return return_value; -} - -char* Lex_String_Input::string_ = 0; -char* Lex_String_Input::current_ = 0; -char* Lex_String_Input::end_ = 0; - -// Routine to have Lex read its input from the constraint string. - -int -Lex_String_Input::copy_into (char* buf, - int max_size) -{ - int const chars_left = - ACE_Utils::truncate_cast ( - Lex_String_Input::end_ - Lex_String_Input::current_); - - int const n = max_size > chars_left ? chars_left : max_size; - - if (n > 0) - { - ACE_OS::memcpy (buf, - Lex_String_Input::current_, - n); - Lex_String_Input::current_ += n; - } - - return n; -} - -void -Lex_String_Input::reset (char* input_string) -{ - Lex_String_Input::string_ = input_string; - Lex_String_Input::current_ = input_string; - Lex_String_Input::end_ = - input_string + ACE_OS::strlen (Lex_String_Input::string_); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/ETCL/ETCL_Interpreter.h b/dep/acelite/ace/ETCL/ETCL_Interpreter.h deleted file mode 100644 index 8553c9b3309..00000000000 --- a/dep/acelite/ace/ETCL/ETCL_Interpreter.h +++ /dev/null @@ -1,117 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file ETCL_Interpreter.h - * - * $Id: ETCL_Interpreter.h 82434 2008-07-28 11:40:36Z johnnyw $ - * - * @author Jeff Parsons based on previous work by - * @author Seth Widoff - */ -//============================================================================= - - -#ifndef ETCL_INTERPRETER_H -#define ETCL_INTERPRETER_H - -#include /**/ "ace/pre.h" - -#include "ace/Thread_Mutex.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Synch_Traits.h" - -#include "etcl_parser_export.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ETCL_Constraint; - -ACE_END_VERSIONED_NAMESPACE_DECL - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ETCL_Interpreter - * - * @brief ETCL_Interpreter is the superclass for all ETCL interpreters. - * Its build tree method invokes the yacc parser to parse a constraint - * or preference string. - */ -class ETCL_Parser_Export ETCL_Interpreter -{ -protected: - // = Initialization and termination methods. - /// Constructor. - ETCL_Interpreter (void); - - /// Destructor. - virtual ~ETCL_Interpreter (void); - - /// Using the Yacc generated parser, construct an expression tree - /// representing @a constraints from the tokens returned by it. - int build_tree (const char* constraints); - - static int is_empty_string (const char* str); - - /// The root of the expression tree, not equal to null if build_tree - /// successfully builds a tree from the constraints. - ETCL_Constraint* root_; -private: - /// This mutex protects the method from reentrance. - static ACE_SYNCH_MUTEX parserMutex__; -}; - - -// Functions we need for parsing. -extern int yyparse (void); -extern void yyrestart (FILE*); -extern int yylex (void); - -// Have yylex read from the constraint string, not from stdin. -#undef YY_INPUT -#define YY_INPUT(b, r, ms) (r = Lex_String_Input::copy_into(b, ms)) - -/** - * @class Lex_String_Input - * - * @brief Have Lex read from a string and not from stdin. Essentially, - * the interpreter needs to call yylex() until EOF, and call - * TAO_Lex_String_Input::reset() with the new string, prior to - * calling yyparse. - */ -class Lex_String_Input -{ -public: - /// Reset the lex input. - static void reset (char* input_string); - - /// Method lex will call to read from the input string. - static int copy_into (char* buf, int max_size); - -private: - - /// Pointers to keep track of the input string. - static char* string_; - static char* current_; - static char* end_; -}; - -/// The union used by lex and bison to build the Abstract Syntax Tree. -typedef union -{ - ACE_VERSIONED_NAMESPACE_NAME::ETCL_Constraint* constraint; -} YYSTYPE; - -extern YYSTYPE yylval; -extern YYSTYPE yyval; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif // ETCL_INTERPRETER_H diff --git a/dep/acelite/ace/ETCL/ETCL_l.cpp b/dep/acelite/ace/ETCL/ETCL_l.cpp deleted file mode 100644 index ed985de0035..00000000000 --- a/dep/acelite/ace/ETCL/ETCL_l.cpp +++ /dev/null @@ -1,1877 +0,0 @@ - -/* A lexical scanner generated by flex */ - -/* Scanner skeleton version: - */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif - -#include "ace/ETCL/ETCL_Constraint.h" - -#ifdef __cplusplus - -#include "ace/OS_NS_unistd.h" -#include "ace/OS_NS_stdio.h" - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -#if __STDC__ - -#define YY_USE_PROTOS -#define YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN yy_start = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START ((yy_start - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#define YY_BUF_SIZE 16384 - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -typedef struct yy_buffer_state *YY_BUFFER_STATE; - -extern int yyleng; -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - YY_RESTORE_YY_MORE_OFFSET \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, yytext_ptr ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; - - -struct yy_buffer_state -{ - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 -}; - -static YY_BUFFER_STATE yy_current_buffer = 0; - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - */ -#define YY_CURRENT_BUFFER yy_current_buffer - - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; - -static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - -int yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart YY_PROTO(( FILE *input_file )); - -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) - -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); - -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) - - -typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; -typedef int yy_state_type; -extern char *yytext; -#define yytext_ptr yytext - -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; - -#define YY_NUM_RULES 41 -#define YY_END_OF_BUFFER 42 -static yyconst short int yy_accept[118] = - { 0, - 0, 0, 42, 40, 39, 41, 40, 24, 40, 22, - 23, 14, 12, 13, 25, 15, 35, 16, 40, 18, - 38, 38, 38, 31, 40, 32, 40, 38, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 11, 21, 0, - 37, 0, 36, 0, 35, 17, 20, 19, 38, 38, - 38, 38, 27, 0, 0, 0, 38, 38, 38, 38, - 10, 38, 38, 38, 9, 38, 38, 0, 0, 38, - 38, 38, 0, 0, 0, 8, 38, 38, 38, 2, - 1, 7, 38, 38, 0, 36, 38, 33, 0, 0, - 0, 38, 38, 38, 38, 5, 34, 0, 0, 0, - - 38, 6, 3, 38, 0, 0, 0, 38, 4, 30, - 0, 0, 26, 0, 28, 29, 0 - } ; - -static yyconst int yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 4, 1, 1, 5, 1, 1, 6, 7, - 8, 9, 10, 1, 11, 12, 13, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 1, 1, 15, - 16, 17, 1, 1, 18, 19, 19, 19, 20, 21, - 19, 19, 19, 19, 19, 22, 19, 19, 19, 19, - 19, 23, 24, 25, 26, 19, 19, 19, 19, 19, - 27, 28, 29, 1, 30, 1, 31, 19, 19, 32, - - 33, 34, 35, 36, 37, 19, 19, 38, 39, 40, - 41, 42, 19, 43, 44, 45, 46, 19, 47, 48, - 49, 19, 1, 1, 1, 50, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst int yy_meta[51] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 2, 1, 1, 1, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 1, 1, 1, 2, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 1 - } ; - -static yyconst short int yy_base[122] = - { 0, - 0, 0, 146, 147, 147, 147, 129, 147, 45, 147, - 147, 147, 147, 147, 130, 147, 40, 127, 126, 125, - 0, 122, 116, 147, 0, 147, 21, 98, 104, 88, - 98, 94, 24, 92, 89, 100, 93, 147, 147, 50, - 147, 51, 48, 115, 46, 147, 147, 147, 0, 106, - 101, 0, 147, 93, 92, 75, 91, 88, 84, 77, - 0, 71, 78, 72, 0, 76, 70, 57, 60, 90, - 93, 0, 72, 69, 68, 0, 78, 64, 63, 0, - 0, 0, 74, 69, 90, 89, 82, 0, 66, 59, - 66, 52, 52, 51, 54, 0, 0, 49, 49, 54, - - 45, 0, 0, 43, 44, 47, 39, 30, 0, 147, - 35, 37, 0, 35, 147, 147, 147, 85, 87, 62, - 89 - } ; - -static yyconst short int yy_def[122] = - { 0, - 117, 1, 117, 117, 117, 117, 117, 117, 118, 117, - 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, - 119, 119, 119, 117, 120, 117, 117, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 117, 117, 118, - 117, 117, 117, 117, 117, 117, 117, 117, 119, 119, - 119, 121, 117, 117, 117, 117, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 118, 117, 119, - 119, 121, 117, 117, 117, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 117, 117, 119, 119, 117, 117, - 117, 119, 119, 119, 119, 119, 119, 117, 117, 117, - - 119, 119, 119, 119, 117, 117, 117, 119, 119, 117, - 117, 117, 119, 117, 117, 117, 0, 117, 117, 117, - 117 - } ; - -static yyconst short int yy_nxt[198] = - { 0, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 21, 21, - 22, 21, 21, 21, 23, 21, 24, 25, 26, 27, - 28, 29, 30, 31, 21, 21, 32, 21, 33, 34, - 35, 21, 36, 21, 21, 21, 37, 21, 21, 38, - 41, 44, 53, 45, 62, 41, 68, 44, 54, 45, - 63, 43, 41, 55, 52, 56, 116, 69, 115, 85, - 85, 114, 42, 86, 113, 112, 111, 42, 68, 110, - 69, 109, 108, 107, 42, 40, 40, 40, 49, 49, - 72, 72, 106, 105, 104, 103, 102, 101, 100, 99, - - 98, 97, 86, 86, 96, 95, 94, 93, 92, 91, - 90, 89, 88, 87, 84, 83, 82, 81, 80, 79, - 78, 77, 76, 75, 74, 73, 71, 70, 43, 67, - 66, 65, 64, 61, 60, 59, 58, 57, 51, 50, - 48, 47, 46, 43, 39, 117, 3, 117, 117, 117, - 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, - 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, - 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, - 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, - 117, 117, 117, 117, 117, 117, 117 - - } ; - -static yyconst short int yy_chk[198] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 9, 17, 27, 17, 33, 40, 42, 45, 27, 45, - 33, 43, 68, 27, 120, 27, 114, 43, 112, 69, - 69, 111, 9, 69, 108, 107, 106, 40, 42, 105, - 43, 104, 101, 100, 68, 118, 118, 118, 119, 119, - 121, 121, 99, 98, 95, 94, 93, 92, 91, 90, - - 89, 87, 86, 85, 84, 83, 79, 78, 77, 75, - 74, 73, 71, 70, 67, 66, 64, 63, 62, 60, - 59, 58, 57, 56, 55, 54, 51, 50, 44, 37, - 36, 35, 34, 32, 31, 30, 29, 28, 23, 22, - 20, 19, 18, 15, 7, 3, 117, 117, 117, 117, - 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, - 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, - 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, - 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, - 117, 117, 117, 117, 117, 117, 117 - - } ; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -#define INITIAL 0 - -ACE_END_VERSIONED_NAMESPACE_DECL - -//============================================================================= -/** - * @file ETCL_l.cpp - * - * $Id: ETCL_l.cpp 93651 2011-03-28 08:49:11Z johnnyw $ - * - * @author Carlos O'Ryan based on previous work by Seth Widoff - */ -//============================================================================= - - -#include "ace/ETCL/ETCL_Interpreter.h" -#include "ace/ETCL/ETCL_y.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -static const char* extract_string(char*); -//static const char * extract_string(char*); - -#define YY_LEX_DEBUG - -#ifdef CONSTRAINT_DEBUG -#define YY_LEX_DEBUG ACE_OS::fprintf(stderr, "%s\n", yytext) -#endif /* CONSTRAINT_DEBUG */ - -//#define YY_DECL int ETCL_yylex (ETCL_YYSTYPE *lvalp, void* state) - -#define YY_BREAK -#define YY_NO_UNPUT - - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); -#else -extern int yywrap YY_PROTO(( void )); -#endif -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); -#endif - -#ifndef YY_NO_INPUT -#ifdef __cplusplus -static int yyinput YY_PROTO(( void )); -#else -static int input YY_PROTO(( void )); -#endif -#endif - -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -ACE_END_VERSIONED_NAMESPACE_DECL - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ - -//FUZZ: disable check_for_lack_ACE_OS -#ifndef ETCL_ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ETCL_ECHO { size_t __dum_ret = fwrite( yytext, yyleng, 1, yyout ); (void) __dum_ret; } -#endif - //FUZZ: enable check_for_lack_ACE_OS - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = ACE_OS::getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else if ( ((result = ACE_OS::fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL int yylex YY_PROTO(( void )) -#endif - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - YY_USER_ACTION - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -YY_DECL - { - register yy_state_type yy_current_state; - register char *yy_cp = 0; - register char *yy_bp = 0; - register int yy_act; - -//#line 50 "ETCL/ETCL.ll" - - if ( yy_init ) - { - yy_init = 0; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! yy_start ) - yy_start = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_load_buffer_state(); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = yy_c_buf_p; - - /* Support of yytext. */ - *yy_cp = yy_hold_char; - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = yy_start; -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 118 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 147 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - - -do_action: /* This label is used only to access EOF actions. */ - - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - goto yy_find_action; - -case 1: -YY_RULE_SETUP -//#line 52 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_MIN; } - YY_BREAK -case 2: -YY_RULE_SETUP -//#line 53 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_MAX; } - YY_BREAK -case 3: -YY_RULE_SETUP -//#line 54 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_FIRST; } - YY_BREAK -case 4: -YY_RULE_SETUP -//#line 55 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_RANDOM; } - YY_BREAK -case 5: -YY_RULE_SETUP -//#line 56 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_WITH; } - YY_BREAK -case 6: -YY_RULE_SETUP -//#line 57 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_EXIST; } - YY_BREAK -case 7: -YY_RULE_SETUP -//#line 58 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_NOT; } - YY_BREAK -case 8: -YY_RULE_SETUP -//#line 59 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_AND; } - YY_BREAK -case 9: -YY_RULE_SETUP -//#line 60 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_OR; } - YY_BREAK -case 10: -YY_RULE_SETUP -//#line 61 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_IN; } - YY_BREAK -case 11: -YY_RULE_SETUP -//#line 62 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_TWIDDLE; } - YY_BREAK -case 12: -YY_RULE_SETUP -//#line 63 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_PLUS; } - YY_BREAK -case 13: -YY_RULE_SETUP -//#line 64 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_MINUS; } - YY_BREAK -case 14: -YY_RULE_SETUP -//#line 65 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_MULT; } - YY_BREAK -case 15: -YY_RULE_SETUP -//#line 66 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_DIV; } - YY_BREAK -case 16: -YY_RULE_SETUP -//#line 67 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_LT; } - YY_BREAK -case 17: -YY_RULE_SETUP -//#line 68 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_LE; } - YY_BREAK -case 18: -YY_RULE_SETUP -//#line 69 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_GT; } - YY_BREAK -case 19: -YY_RULE_SETUP -//#line 70 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_GE; } - YY_BREAK -case 20: -YY_RULE_SETUP -//#line 71 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_EQ; } - YY_BREAK -case 21: -YY_RULE_SETUP -//#line 72 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_NE; } - YY_BREAK -case 22: -YY_RULE_SETUP -//#line 73 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_LPAREN; } - YY_BREAK -case 23: -YY_RULE_SETUP -//#line 74 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_RPAREN; } - YY_BREAK -case 24: -YY_RULE_SETUP -//#line 75 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_DOLLAR; } - YY_BREAK -case 25: -YY_RULE_SETUP -//#line 76 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_DOT; } - YY_BREAK -case 26: -YY_RULE_SETUP -//#line 77 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_DEFAULT; } - YY_BREAK -case 27: -YY_RULE_SETUP -//#line 78 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_DISCRIMINANT; } - YY_BREAK -case 28: -YY_RULE_SETUP -//#line 79 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_TYPE_ID; } - YY_BREAK -case 29: -YY_RULE_SETUP -//#line 80 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_REPOS_ID; } - YY_BREAK -case 30: -YY_RULE_SETUP -//#line 81 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_LENGTH; } - YY_BREAK -case 31: -YY_RULE_SETUP -//#line 82 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_LBRA; } - YY_BREAK -case 32: -YY_RULE_SETUP -//#line 83 "ETCL/ETCL.ll" -{ YY_LEX_DEBUG; return ETCL_RBRA; } - YY_BREAK -case 33: -YY_RULE_SETUP -//#line 84 "ETCL/ETCL.ll" -{ - yylval.constraint = - new ETCL_Literal_Constraint ((ACE_CDR::Boolean) 1); - YY_LEX_DEBUG; return ETCL_BOOLEAN; - } - YY_BREAK -case 34: -YY_RULE_SETUP -//#line 89 "ETCL/ETCL.ll" -{ - yylval.constraint = - new ETCL_Literal_Constraint ((ACE_CDR::Boolean) 0); - YY_LEX_DEBUG; return ETCL_BOOLEAN; - } - YY_BREAK -case 35: -YY_RULE_SETUP -//#line 94 "ETCL/ETCL.ll" -{ - yylval.constraint = - new ETCL_Literal_Constraint (ACE_OS::atoi (yytext)); - YY_LEX_DEBUG; return ETCL_INTEGER; - } - YY_BREAK -case 36: -YY_RULE_SETUP -//#line 99 "ETCL/ETCL.ll" -{ - double v; - sscanf (yytext, "%lf", &v); - yylval.constraint = - new ETCL_Literal_Constraint (v); - YY_LEX_DEBUG; return ETCL_FLOAT; - } - YY_BREAK -case 37: -YY_RULE_SETUP -//#line 106 "ETCL/ETCL.ll" -{ - yylval.constraint = - new ETCL_Literal_Constraint (extract_string(yytext)); - YY_LEX_DEBUG; return ETCL_STRING; - } - YY_BREAK -case 38: -YY_RULE_SETUP -//#line 111 "ETCL/ETCL.ll" -{ - yylval.constraint = - new ETCL_Identifier (yytext); - YY_LEX_DEBUG; return ETCL_IDENT; - } - YY_BREAK -case 39: -YY_RULE_SETUP -//#line 116 "ETCL/ETCL.ll" -{ - YY_LEX_DEBUG; break; // Ignore - } - YY_BREAK -case 40: -YY_RULE_SETUP -//#line 119 "ETCL/ETCL.ll" -{ - YY_LEX_DEBUG; break; // @@ TODO - } - YY_BREAK -case 41: -YY_RULE_SETUP -//#line 122 "ETCL/ETCL.ll" -ETCL_ECHO; - YY_BREAK -case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; - YY_RESTORE_YY_MORE_OFFSET - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = yytext_ptr + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = yy_c_buf_p; - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; - - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ - - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -static int yy_get_next_buffer() - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; - register int number_to_move, i; - int ret_val; - - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_current_buffer->yy_n_chars = yy_n_chars = 0; - - else - { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; - - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; -#endif - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); - - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - if ( yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; - } - - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -static yy_state_type yy_get_previous_state() - { - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = yy_start; - - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 118 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; - } - - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif - { - register int yy_is_jam; - register char *yy_cp = yy_c_buf_p; - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 118 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 117); - - return yy_is_jam ? 0 : yy_current_state; - } - -#if 0 -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ -#endif /* 0 */ - -#ifdef __cplusplus -static int yyinput() -#else -static int input() -#endif - { - int c; - - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; - - else - { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; - - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart( yyin ); - - /* fall through */ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - return EOF; - - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; - break; - } - } - } - - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; - - - return c; - } - -void yyflush_current_buffer (void) -{ - YY_FLUSH_BUFFER; -} - - -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } - - -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - { - if ( yy_current_buffer == new_buffer ) - return; - - if ( yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - yy_current_buffer = new_buffer; - yy_load_buffer_state(); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } - - -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer( b, file ); - - return b; - } - - -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - { - if ( ! b ) - return; - - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - - - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - - - { - yy_flush_buffer( b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - -#if defined (ACE_HAS_WINCE) - // Mimic the behavior as WinCE does not have isatty(). - if ((file != 0) && (file == ACE_OS::fileno(file))) { - b->yy_is_interactive = 1; - } - else { - b->yy_is_interactive = 0; - } -#else - b->yy_is_interactive = file ? (ACE_OS::isatty( ACE_OS::fileno(file) ) > 0) : 0; -#endif // ACE_HAS_WINCE - - } - - -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif - - { - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == yy_current_buffer ) - yy_load_buffer_state(); - } - - -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer( b ); - - return b; - } -#endif - - -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) -#else -YY_BUFFER_STATE yy_scan_string( yy_str ) -yyconst char *yy_str; -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len ); - } -#endif - - -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; - } -#endif - - -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) ACE_OS::fprintf( stderr, "%s\n", msg ); - ACE_OS::exit( YY_EXIT_FAILURE ); - } - - - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) - - -/* Internal utility routines. */ - -#ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } -#endif - -#ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; - } -#endif - - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { - return (void *) ACE_OS::malloc( size ); - } - -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) ACE_OS::realloc( (char *) ptr, size ); - } - -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - ACE_OS::free( ptr ); - } - -#if YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif -//#line 122 "ETCL/ETCL.ll" - - -const char* -extract_string(char* str) -{ - char *t = str; - for (char * i = str + 1; *i != '\''; ++i, ++t) - { - if (*i == '\\') - { - ++i; - if (*i == 0) - return 0; - else if (*i == 't') - *t = '\t'; - else if (*i == 'n') - *t = '\n'; - else if (*i == '\\') - *t = '\\'; - else - *t = *i; - continue; - } - - *t = *i; - } - - *t = '\0'; - return str; -} - -int -yywrap (void) -{ - return 1; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/ETCL/ETCL_y.cpp b/dep/acelite/ace/ETCL/ETCL_y.cpp deleted file mode 100644 index 880b6300d6a..00000000000 --- a/dep/acelite/ace/ETCL/ETCL_y.cpp +++ /dev/null @@ -1,1288 +0,0 @@ - -/* A Bison parser, made from ETCL/ETCL.yy - by GNU Bison version 1.28 */ - -#define YYBISON 1 /* Identify Bison output. */ - -#define ETCL_GT 257 -#define ETCL_GE 258 -#define ETCL_LT 259 -#define ETCL_LE 260 -#define ETCL_EQ 261 -#define ETCL_NE 262 -#define ETCL_EXIST 263 -#define ETCL_DEFAULT 264 -#define ETCL_AND 265 -#define ETCL_OR 266 -#define ETCL_NOT 267 -#define ETCL_IN 268 -#define ETCL_TWIDDLE 269 -#define ETCL_BOOLEAN 270 -#define ETCL_PLUS 271 -#define ETCL_MINUS 272 -#define ETCL_MULT 273 -#define ETCL_DIV 274 -#define ETCL_UMINUS 275 -#define ETCL_INTEGER 276 -#define ETCL_FLOAT 277 -#define ETCL_STRING 278 -#define ETCL_RPAREN 279 -#define ETCL_LPAREN 280 -#define ETCL_RBRA 281 -#define ETCL_LBRA 282 -#define ETCL_IDENT 283 -#define ETCL_UNSIGNED 284 -#define ETCL_SIGNED 285 -#define ETCL_DOUBLE 286 -#define ETCL_CONSTRAINT 287 -#define ETCL_COMPONENT 288 -#define ETCL_WITH 289 -#define ETCL_MAX 290 -#define ETCL_MIN 291 -#define ETCL_FIRST 292 -#define ETCL_RANDOM 293 -#define ETCL_DOLLAR 294 -#define ETCL_DOT 295 -#define ETCL_DISCRIMINANT 296 -#define ETCL_LENGTH 297 -#define ETCL_TYPE_ID 298 -#define ETCL_REPOS_ID 299 - - -//============================================================================= -/** - * @file ETCL_y.cpp - * - * $Id: ETCL_y.cpp 93651 2011-03-28 08:49:11Z johnnyw $ - * - * @author Carlos O'Ryan based on previous work by Seth Widoff - */ -//============================================================================= - - -#include "ace/ETCL/ETCL_y.h" -#include "ace/ETCL/ETCL_Constraint.h" -#include "ace/ETCL/ETCL_Interpreter.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -extern int yylex (void); -extern void yyflush_current_buffer (void); - -static void yyerror (const char *) -{ - // @@ TODO - // Ignore error messages -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -#ifndef __cplusplus -#ifndef __STDC__ -#define const -#endif -#endif - - - -#define YYFINAL 114 -#define YYFLAG -32768 -#define YYNTBASE 46 - -#define YYTRANSLATE(x) ((unsigned)(x) <= 299 ? yytranslate[x] : 65) - -static const char yytranslate[] = { 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45 -}; - -#if YYDEBUG != 0 -static const short yyprhs[] = { 0, - 0, 2, 4, 7, 10, 13, 15, 17, 21, 23, - 27, 29, 33, 37, 41, 45, 49, 53, 55, 59, - 64, 66, 70, 72, 76, 80, 82, 86, 90, 92, - 95, 97, 101, 103, 106, 109, 111, 114, 117, 119, - 121, 124, 128, 132, 135, 137, 138, 141, 144, 146, - 148, 149, 152, 154, 156, 159, 161, 163, 165, 167, - 169, 171, 176, 181, 184, 189, 190, 192, 195, 198 -}; - -static const short yyrhs[] = { 48, - 0, 47, 0, 37, 48, 0, 36, 48, 0, 35, - 48, 0, 38, 0, 39, 0, 48, 12, 49, 0, - 49, 0, 49, 11, 50, 0, 50, 0, 51, 7, - 51, 0, 51, 8, 51, 0, 51, 3, 51, 0, - 51, 4, 51, 0, 51, 5, 51, 0, 51, 6, - 51, 0, 51, 0, 52, 14, 57, 0, 52, 14, - 40, 57, 0, 52, 0, 53, 15, 53, 0, 53, - 0, 53, 17, 54, 0, 53, 18, 54, 0, 54, - 0, 54, 19, 55, 0, 54, 20, 55, 0, 55, - 0, 13, 56, 0, 56, 0, 26, 48, 25, 0, - 22, 0, 17, 22, 0, 18, 22, 0, 23, 0, - 17, 23, 0, 18, 23, 0, 24, 0, 16, 0, - 9, 29, 0, 9, 40, 57, 0, 10, 40, 57, - 0, 40, 57, 0, 29, 0, 0, 41, 59, 0, - 29, 58, 0, 60, 0, 61, 0, 0, 41, 59, - 0, 60, 0, 61, 0, 29, 58, 0, 43, 0, - 42, 0, 44, 0, 45, 0, 62, 0, 63, 0, - 28, 22, 27, 58, 0, 26, 29, 25, 58, 0, - 22, 58, 0, 26, 64, 25, 58, 0, 0, 22, - 0, 17, 22, 0, 18, 22, 0, 24, 0 -}; - -#endif - -#if YYDEBUG != 0 -static const short yyrline[] = { 0, - 92, 93, 96, 98, 100, 102, 104, 108, 110, 113, - 115, 118, 120, 122, 124, 126, 128, 130, 133, 135, - 137, 140, 142, 145, 147, 149, 152, 154, 156, 159, - 161, 164, 166, 168, 170, 172, 174, 176, 178, 180, - 182, 184, 186, 188, 190, 194, 196, 199, 202, 203, - 206, 208, 211, 212, 215, 217, 219, 221, 223, 225, - 226, 229, 233, 237, 241, 245, 247, 249, 251, 253 -}; -#endif - - -#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) - -static const char * const yytname[] = { "$","error","$undefined.","ETCL_GT", -"ETCL_GE","ETCL_LT","ETCL_LE","ETCL_EQ","ETCL_NE","ETCL_EXIST", -"ETCL_DEFAULT","ETCL_AND","ETCL_OR","ETCL_NOT","ETCL_IN", -"ETCL_TWIDDLE","ETCL_BOOLEAN","ETCL_PLUS","ETCL_MINUS","ETCL_MULT", -"ETCL_DIV","ETCL_UMINUS","ETCL_INTEGER","ETCL_FLOAT","ETCL_STRING", -"ETCL_RPAREN","ETCL_LPAREN","ETCL_RBRA","ETCL_LBRA","ETCL_IDENT", -"ETCL_UNSIGNED","ETCL_SIGNED","ETCL_DOUBLE","ETCL_CONSTRAINT", -"ETCL_COMPONENT","ETCL_WITH","ETCL_MAX","ETCL_MIN","ETCL_FIRST", -"ETCL_RANDOM","ETCL_DOLLAR","ETCL_DOT","ETCL_DISCRIMINANT","ETCL_LENGTH", -"ETCL_TYPE_ID","ETCL_REPOS_ID","constraint","preference","bool_or","bool_and", -"bool_compare","expr_in","expr_twiddle","expr","term","factor_not","factor", -"component","component_ext","component_dot","component_array","component_assoc", -"component_pos","union_pos","union_val", 0 -}; -#endif - -static const short yyr1[] = { 0, - 46, 46, 47, 47, 47, 47, 47, 48, 48, 49, - 49, 50, 50, 50, 50, 50, 50, 50, 51, 51, - 51, 52, 52, 53, 53, 53, 54, 54, 54, 55, - 55, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 57, 57, 57, 57, 57, - 58, 58, 58, 58, 59, 59, 59, 59, 59, 59, - 59, 60, 61, 62, 63, 64, 64, 64, 64, 64 -}; - -static const short yyr2[] = { 0, - 1, 1, 2, 2, 2, 1, 1, 3, 1, 3, - 1, 3, 3, 3, 3, 3, 3, 1, 3, 4, - 1, 3, 1, 3, 3, 1, 3, 3, 1, 2, - 1, 3, 1, 2, 2, 1, 2, 2, 1, 1, - 2, 3, 3, 2, 1, 0, 2, 2, 1, 1, - 0, 2, 1, 1, 2, 1, 1, 1, 1, 1, - 1, 4, 4, 2, 4, 0, 1, 2, 2, 1 -}; - -static const short yydefact[] = { 0, - 0, 0, 0, 40, 0, 0, 33, 36, 39, 0, - 45, 0, 0, 0, 6, 7, 46, 2, 1, 9, - 11, 18, 21, 23, 26, 29, 31, 41, 46, 46, - 30, 34, 37, 35, 38, 0, 5, 4, 3, 0, - 0, 51, 0, 44, 49, 50, 0, 0, 0, 0, - 0, 0, 0, 0, 46, 0, 0, 0, 0, 0, - 42, 43, 32, 0, 0, 0, 48, 53, 54, 51, - 66, 51, 57, 56, 58, 59, 47, 60, 61, 8, - 10, 14, 15, 16, 17, 12, 13, 46, 19, 22, - 24, 25, 27, 28, 51, 51, 52, 64, 0, 0, - 67, 70, 0, 55, 20, 63, 62, 68, 69, 51, - 65, 0, 0, 0 -}; - -static const short yydefgoto[] = { 112, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 44, 67, 77, 68, 69, 78, 79, 103 -}; - -static const short yypact[] = { 41, - -13, -39, 94,-32768, 38, 46,-32768,-32768,-32768, 73, --32768, 73, 73, 73,-32768,-32768, -9,-32768, -6, 7, --32768, 121, -5, 19, 55,-32768,-32768,-32768, -9, -9, --32768,-32768,-32768,-32768,-32768, 21, -6, -6, -6, 6, - 25, -2, -1,-32768,-32768,-32768, 73, 73, 73, 73, - 73, 73, 73, 73, -18, 73, 73, 73, 73, 73, --32768,-32768,-32768, 27, 29, -1,-32768,-32768,-32768, -2, - 31, -2,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 7, --32768,-32768,-32768,-32768,-32768,-32768,-32768, -9,-32768, 67, - 55, 55,-32768,-32768, -2, -2,-32768,-32768, 44, 50, --32768,-32768, 69,-32768,-32768,-32768,-32768,-32768,-32768, -2, --32768, 98, 100,-32768 -}; - -static const short yypgoto[] = {-32768, --32768, 95, 54, 58, 86,-32768, 59, 30, 33, 111, - -26, -65, 53, -17, -15,-32768,-32768,-32768 -}; - - -#define YYLAST 140 - - -static const short yytable[] = { 45, - 30, 46, 61, 62, 98, 47, 104, 40, 55, 41, - 42, 45, 45, 46, 46, 28, 40, 48, 41, 42, - 70, 88, 43, 40, 71, 41, 29, 72, 89, 106, - 107, 43, 47, 56, 64, 57, 58, 45, 66, 46, - 73, 74, 75, 76, 111, 63, 65, 99, 100, 1, - 2, 95, 101, 3, 102, 96, 4, 5, 6, 32, - 33, 105, 7, 8, 9, 108, 10, 34, 35, 11, - 45, 109, 46, 59, 60, 12, 13, 14, 15, 16, - 17, 1, 2, 57, 58, 3, 91, 92, 4, 5, - 6, 93, 94, 110, 7, 8, 9, 113, 10, 114, - 80, 11, 1, 2, 36, 81, 37, 38, 39, 4, - 5, 6, 17, 31, 90, 7, 8, 9, 97, 10, - 0, 0, 11, 49, 50, 51, 52, 53, 54, 0, - 0, 0, 0, 17, 82, 83, 84, 85, 86, 87 -}; - -static const short yycheck[] = { 17, - 40, 17, 29, 30, 70, 12, 72, 26, 14, 28, - 29, 29, 30, 29, 30, 29, 26, 11, 28, 29, - 22, 40, 41, 26, 26, 28, 40, 29, 55, 95, - 96, 41, 12, 15, 29, 17, 18, 55, 41, 55, - 42, 43, 44, 45, 110, 25, 22, 17, 18, 9, - 10, 25, 22, 13, 24, 27, 16, 17, 18, 22, - 23, 88, 22, 23, 24, 22, 26, 22, 23, 29, - 88, 22, 88, 19, 20, 35, 36, 37, 38, 39, - 40, 9, 10, 17, 18, 13, 57, 58, 16, 17, - 18, 59, 60, 25, 22, 23, 24, 0, 26, 0, - 47, 29, 9, 10, 10, 48, 12, 13, 14, 16, - 17, 18, 40, 3, 56, 22, 23, 24, 66, 26, - -1, -1, 29, 3, 4, 5, 6, 7, 8, -1, - -1, -1, -1, 40, 49, 50, 51, 52, 53, 54 -}; -/* -*-C-*- Note some compilers choke on comments on `//#line' lines. */ -//#line 3 "/pkg/gnu/share/bison.simple" -/* This file comes from bison-1.28. */ - -/* Skeleton output parser for bison, - Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ - -/* This is the parser code that is written into each bison parser - when the %semantic_parser declaration is not specified in the grammar. - It was written by Richard Stallman by simplifying the hairy parser - used when %semantic_parser is specified. */ - -ACE_END_VERSIONED_NAMESPACE_DECL - -#ifndef YYSTACK_USE_ALLOCA -#ifdef alloca -#define YYSTACK_USE_ALLOCA -#else /* alloca not defined */ -#ifdef __GNUC__ -#define YYSTACK_USE_ALLOCA -#define alloca __builtin_alloca -#else /* not GNU C. */ -#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || (defined (__sun) && defined (__i386)) -#define YYSTACK_USE_ALLOCA -#include -#else /* not sparc */ -/* We think this test detects Watcom and Microsoft C. */ -/* This used to test MSDOS, but that is a bad idea - since that symbol is in the user namespace. */ -#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) -#if 0 /* No need for malloc.h, which pollutes the namespace; - instead, just don't use alloca. */ -#include -#endif -#else /* not MSDOS, or __TURBOC__ */ -#if defined(_AIX) -/* I don't know what this was needed for, but it pollutes the namespace. - So I turned it off. rms, 2 May 1997. */ -/* #include */ - #pragma alloca -#define YYSTACK_USE_ALLOCA -#else /* not MSDOS, or __TURBOC__, or _AIX */ -#if 0 -#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, - and on HPUX 10. Eventually we can turn this on. */ -#define YYSTACK_USE_ALLOCA -#define alloca __builtin_alloca -#endif /* __hpux */ -#endif -#endif /* not _AIX */ -#endif /* not MSDOS, or __TURBOC__ */ -#endif /* not sparc */ -#endif /* not GNU C */ -#endif /* alloca not defined */ -#endif /* YYSTACK_USE_ALLOCA not defined */ - -#ifdef YYSTACK_USE_ALLOCA -#define YYSTACK_ALLOC alloca -#else -#define YYSTACK_ALLOC malloc -#endif - -/* Note: there must be only one dollar sign in this file. - It is replaced by the list of actions, each action - as one case of the switch. */ - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY -2 -#define YYEOF 0 -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrlab1 -/* Like YYERROR except do call yyerror. - This remains here temporarily to ease the - transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ -#define YYFAIL goto yyerrlab -#define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(token, value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { yychar = (token), yylval = (value); \ - yychar1 = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ - goto yybackup; \ - } \ - else \ - { yyerror ("syntax error: cannot back up"); YYERROR; } \ -while (0) - -#define YYTERROR 1 -#define YYERRCODE 256 - -#ifndef YYPURE -#define YYLEX yylex() -#endif - -#ifdef YYPURE -#ifdef YYLSP_NEEDED -#ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) -#else -#define YYLEX yylex(&yylval, &yylloc) -#endif -#else /* not YYLSP_NEEDED */ -#ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, YYLEX_PARAM) -#else -#define YYLEX yylex(&yylval) -#endif -#endif /* not YYLSP_NEEDED */ -#endif - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/* If nonreentrant, generate the variables here */ - -#ifndef YYPURE - -int yychar; /* the lookahead symbol */ -YYSTYPE yylval; /* the semantic value of the */ - /* lookahead symbol */ -YYSTYPE yyval; /* the variable used to return */ - /* semantic values from the action */ - /* routines */ - - -#ifdef YYLSP_NEEDED -YYLTYPE yylloc; /* location data for the lookahead */ - /* symbol */ -#endif - -int yynerrs; /* number of parse errors so far */ -#endif /* not YYPURE */ - -#if YYDEBUG != 0 -int yydebug; /* nonzero means print parse trace */ -/* Since this is uninitialized, it does not stop multiple parsers - from coexisting. */ -#endif - -/* YYINITDEPTH indicates the initial size of the parser's stacks */ - -#ifndef YYINITDEPTH -#define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH is the maximum size the stacks can grow to - (effective only if the built-in stack extension method is used). */ - -#if YYMAXDEPTH == 0 -#undef YYMAXDEPTH -#endif - -#ifndef YYMAXDEPTH -#define YYMAXDEPTH 10000 -#endif - -/* Define __yy_memcpy. Note that the size argument - should be passed with type unsigned int, because that is what the non-GCC - definitions require. With GCC, __builtin_memcpy takes an arg - of type size_t, but it can handle unsigned int. */ - -#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ -#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) -#else /* not GNU C or C++ */ -#ifndef __cplusplus - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (to, from, count) - char *to; - char *from; - unsigned int count; -{ - register char *f = from; - register char *t = to; - register int i = count; - - while (i-- > 0) - *t++ = *f++; -} - -#else /* __cplusplus */ - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (char *to, char *from, unsigned int count) -{ - register char *t = to; - register char *f = from; - register int i = count; - - while (i-- > 0) - *t++ = *f++; -} - -#endif -#endif - -//#line 217 "/pkg/gnu/share/bison.simple" - -/* The user can define YYPARSE_PARAM as the name of an argument to be passed - into yyparse. The argument should have type void *. - It should actually point to an object. - Grammar actions can access the variable by casting it - to the proper pointer type. */ - -#ifdef YYPARSE_PARAM -#ifdef __cplusplus -#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM -#define YYPARSE_PARAM_DECL -#else /* not __cplusplus */ -#define YYPARSE_PARAM_ARG YYPARSE_PARAM -#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; -#endif /* not __cplusplus */ -#else /* not YYPARSE_PARAM */ -#define YYPARSE_PARAM_ARG -#define YYPARSE_PARAM_DECL -#endif /* not YYPARSE_PARAM */ - -/* Prevent warning if -Wstrict-prototypes. */ -#ifdef __GNUC__ -#ifdef YYPARSE_PARAM -int yyparse (void *); -#else -int yyparse (void); -#endif -#endif - -int -yyparse(YYPARSE_PARAM_ARG) - YYPARSE_PARAM_DECL -{ - register int yystate; - register int yyn; - register short *yyssp; - register YYSTYPE *yyvsp; - int yyerrstatus; /* number of tokens to shift before error messages enabled */ - int yychar1 = 0; /* lookahead token as an internal (translated) token number */ - - short yyssa[YYINITDEPTH]; /* the state stack */ - YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ - - short *yyss = yyssa; /* refer to the stacks thru separate pointers */ - YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ - -#ifdef YYLSP_NEEDED - YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; - -#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) -#else -#define YYPOPSTACK (yyvsp--, yyssp--) -#endif - - int yystacksize = YYINITDEPTH; - int yyfree_stacks = 0; - -#ifdef YYPURE - int yychar; - YYSTYPE yylval; - int yynerrs; -#ifdef YYLSP_NEEDED - YYLTYPE yylloc; -#endif -#endif - - int yylen; - -#if YYDEBUG != 0 - if (yydebug) - ACE_OS::fprintf(stderr, "Starting parse\n"); -#endif - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - - yyssp = yyss - 1; - yyvsp = yyvs; -#ifdef YYLSP_NEEDED - yylsp = yyls; -#endif - -/* Push a new state, which is found in yystate . */ -/* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. */ -yynewstate: - - *++yyssp = yystate; - - if (yyssp >= yyss + yystacksize - 1) - { - /* Give user a chance to reallocate the stack */ - /* Use copies of these so that the &'s don't force the real ones into memory. */ - YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; -#ifdef YYLSP_NEEDED - YYLTYPE *yyls1 = yyls; -#endif - - /* Get the current used size of the three stacks, in elements. */ - int size = yyssp - yyss + 1; - -#ifdef yyoverflow - /* Each stack pointer address is followed by the size of - the data in use in that stack, in bytes. */ -#ifdef YYLSP_NEEDED - /* This used to be a conditional around just the two extra args, - but that might be undefined if yyoverflow is a macro. */ - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yyls1, size * sizeof (*yylsp), - &yystacksize); -#else - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yystacksize); -#endif - - yyss = yyss1; yyvs = yyvs1; -#ifdef YYLSP_NEEDED - yyls = yyls1; -#endif -#else /* no yyoverflow */ - /* Extend the stack our own way. */ - if (yystacksize >= YYMAXDEPTH) - { - yyerror("parser stack overflow"); - if (yyfree_stacks) - { - ACE_OS::free (yyss); - ACE_OS::free (yyvs); -#ifdef YYLSP_NEEDED - ACE_OS::free (yyls); -#endif - } - return 2; - } - yystacksize *= 2; - if (yystacksize > YYMAXDEPTH) - yystacksize = YYMAXDEPTH; -#ifndef YYSTACK_USE_ALLOCA - yyfree_stacks = 1; -#endif - yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); - __yy_memcpy ((char *)yyss, (char *)yyss1, - size * (unsigned int) sizeof (*yyssp)); - yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); - __yy_memcpy ((char *)yyvs, (char *)yyvs1, - size * (unsigned int) sizeof (*yyvsp)); -#ifdef YYLSP_NEEDED - yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); - __yy_memcpy ((char *)yyls, (char *)yyls1, - size * (unsigned int) sizeof (*yylsp)); -#endif -#endif /* no yyoverflow */ - - yyssp = yyss + size - 1; - yyvsp = yyvs + size - 1; -#ifdef YYLSP_NEEDED - yylsp = yyls + size - 1; -#endif - -#if YYDEBUG != 0 - if (yydebug) - ACE_OS::fprintf(stderr, "Stack size increased to %d\n", yystacksize); -#endif - - if (yyssp >= yyss + yystacksize - 1) - YYABORT; - } - -#if YYDEBUG != 0 - if (yydebug) - ACE_OS::fprintf(stderr, "Entering state %d\n", yystate); -#endif - - goto yybackup; - yybackup: - -/* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ -/* yyresume: */ - - /* First try to decide what to do without reference to lookahead token. */ - - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* yychar is either YYEMPTY or YYEOF - or a valid token in external form. */ - - if (yychar == YYEMPTY) - { -#if YYDEBUG != 0 - if (yydebug) - ACE_OS::fprintf(stderr, "Reading a token: "); -#endif - yychar = YYLEX; - } - - /* Convert token to internal form (in yychar1) for indexing tables with */ - - if (yychar <= 0) /* This means end of input. */ - { - yychar1 = 0; - yychar = YYEOF; /* Don't call YYLEX any more */ - -#if YYDEBUG != 0 - if (yydebug) - ACE_OS::fprintf(stderr, "Now at end of input.\n"); -#endif - } - else - { - yychar1 = YYTRANSLATE(yychar); - -#if YYDEBUG != 0 - if (yydebug) - { - ACE_OS::fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); - /* Give the individual parser a way to print the precise meaning - of a token, for further debugging info. */ -#ifdef YYPRINT - YYPRINT (stderr, yychar, yylval); -#endif - ACE_OS::fprintf (stderr, ")\n"); - } -#endif - } - - yyn += yychar1; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) - goto yydefault; - - yyn = yytable[yyn]; - - /* yyn is what to do for this token type in this state. - Negative => reduce, -yyn is rule number. - Positive => shift, yyn is new state. - New state is final state => don't bother to shift, - just return success. - 0, or most negative number => error. */ - - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - else if (yyn == 0) - goto yyerrlab; - - if (yyn == YYFINAL) - YYACCEPT; - - /* Shift the lookahead token. */ - -#if YYDEBUG != 0 - if (yydebug) - ACE_OS::fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); -#endif - - /* Discard the token being shifted unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - - *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif - - /* count tokens shifted since error; after three, turn off error status. */ - if (yyerrstatus) yyerrstatus--; - - yystate = yyn; - goto yynewstate; - -/* Do the default action for the current state. */ -yydefault: - - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - -/* Do a reduction. yyn is the number of a rule to reduce with. */ -yyreduce: - yylen = yyr2[yyn]; - if (yylen > 0) - yyval = yyvsp[1-yylen]; /* implement default value of the action */ - -#if YYDEBUG != 0 - if (yydebug) - { - int i; - - ACE_OS::fprintf (stderr, "Reducing via rule %d (line %d), ", - yyn, yyrline[yyn]); - - /* Print the symbols being reduced, and their result. */ - for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) - ACE_OS::fprintf (stderr, "%s ", yytname[yyrhs[i]]); - ACE_OS::fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); - } -#endif - - - switch (yyn) { - -case 3: -//#line 97 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Preference (ETCL_MIN, yyvsp[0].constraint); ; - break;} -case 4: -//#line 99 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Preference (ETCL_MAX, yyvsp[0].constraint); ; - break;} -case 5: -//#line 101 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Preference (ETCL_WITH, yyvsp[0].constraint); ; - break;} -case 6: -//#line 103 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Preference (ETCL_FIRST); ; - break;} -case 7: -//#line 105 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Preference (ETCL_RANDOM); ; - break;} -case 8: -//#line 109 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Binary_Expr (ETCL_OR, yyvsp[-2].constraint, yyvsp[0].constraint); ; - break;} -case 10: -//#line 114 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Binary_Expr (ETCL_AND, yyvsp[-2].constraint, yyvsp[0].constraint); ; - break;} -case 12: -//#line 119 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Binary_Expr (ETCL_EQ, yyvsp[-2].constraint, yyvsp[0].constraint); ; - break;} -case 13: -//#line 121 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Binary_Expr (ETCL_NE, yyvsp[-2].constraint, yyvsp[0].constraint); ; - break;} -case 14: -//#line 123 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Binary_Expr (ETCL_GT, yyvsp[-2].constraint, yyvsp[0].constraint); ; - break;} -case 15: -//#line 125 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Binary_Expr (ETCL_GE, yyvsp[-2].constraint, yyvsp[0].constraint); ; - break;} -case 16: -//#line 127 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Binary_Expr (ETCL_LT, yyvsp[-2].constraint, yyvsp[0].constraint); ; - break;} -case 17: -//#line 129 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Binary_Expr (ETCL_LE, yyvsp[-2].constraint, yyvsp[0].constraint); ; - break;} -case 19: -//#line 134 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Binary_Expr (ETCL_IN, yyvsp[-2].constraint, yyvsp[0].constraint); ; - break;} -case 20: -//#line 136 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Binary_Expr (ETCL_IN, yyvsp[-3].constraint, yyvsp[0].constraint); ; - break;} -case 22: -//#line 141 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Binary_Expr (ETCL_TWIDDLE, yyvsp[-2].constraint, yyvsp[0].constraint); ; - break;} -case 24: -//#line 146 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Binary_Expr (ETCL_PLUS, yyvsp[-2].constraint, yyvsp[0].constraint); ; - break;} -case 25: -//#line 148 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Binary_Expr (ETCL_MINUS, yyvsp[-2].constraint, yyvsp[0].constraint); ; - break;} -case 27: -//#line 153 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Binary_Expr (ETCL_MULT, yyvsp[-2].constraint, yyvsp[0].constraint); ; - break;} -case 28: -//#line 155 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Binary_Expr (ETCL_DIV, yyvsp[-2].constraint, yyvsp[0].constraint); ; - break;} -case 30: -//#line 160 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Unary_Expr (ETCL_NOT, yyvsp[0].constraint); ; - break;} -case 32: -//#line 165 "ETCL/ETCL.yy" -{ yyval.constraint = yyvsp[-1].constraint; ; - break;} -case 33: -//#line 167 "ETCL/ETCL.yy" -{ yyval.constraint = yyvsp[0].constraint; ; - break;} -case 34: -//#line 169 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Unary_Expr (ETCL_PLUS, yyvsp[0].constraint); ; - break;} -case 35: -//#line 171 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Unary_Expr (ETCL_MINUS, yyvsp[0].constraint); ; - break;} -case 36: -//#line 173 "ETCL/ETCL.yy" -{ yyval.constraint = yyvsp[0].constraint; ; - break;} -case 37: -//#line 175 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Unary_Expr (ETCL_PLUS, yyvsp[0].constraint); ; - break;} -case 38: -//#line 177 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Unary_Expr (ETCL_MINUS, yyvsp[0].constraint); ; - break;} -case 39: -//#line 179 "ETCL/ETCL.yy" -{ yyval.constraint = yyvsp[0].constraint; ; - break;} -case 40: -//#line 181 "ETCL/ETCL.yy" -{ yyval.constraint = yyvsp[0].constraint; ; - break;} -case 41: -//#line 183 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Exist (yyvsp[0].constraint); ; - break;} -case 42: -//#line 185 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Exist (yyvsp[0].constraint); ; - break;} -case 43: -//#line 187 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Default (yyvsp[0].constraint); ; - break;} -case 44: -//#line 189 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Eval (yyvsp[0].constraint); ; - break;} -case 45: -//#line 191 "ETCL/ETCL.yy" -{ yyval.constraint = yyvsp[0].constraint; ; - break;} -case 46: -//#line 195 "ETCL/ETCL.yy" -{ yyval.constraint = 0; ; - break;} -case 47: -//#line 197 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Dot (yyvsp[0].constraint); ; - break;} -case 48: -//#line 200 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Component (yyvsp[-1].constraint, yyvsp[0].constraint); ; - break;} -case 51: -//#line 207 "ETCL/ETCL.yy" -{ yyval.constraint = 0; ; - break;} -case 52: -//#line 209 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Dot (yyvsp[0].constraint); ; - break;} -case 55: -//#line 216 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Component (yyvsp[-1].constraint, yyvsp[0].constraint); ; - break;} -case 56: -//#line 218 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Special (ETCL_LENGTH); ; - break;} -case 57: -//#line 220 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Special (ETCL_DISCRIMINANT); ; - break;} -case 58: -//#line 222 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Special (ETCL_TYPE_ID); ; - break;} -case 59: -//#line 224 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Special (ETCL_REPOS_ID); ; - break;} -case 62: -//#line 230 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Component_Array (yyvsp[-2].constraint, yyvsp[0].constraint); ; - break;} -case 63: -//#line 234 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Component_Assoc (yyvsp[-2].constraint, yyvsp[0].constraint); ; - break;} -case 64: -//#line 238 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Component_Pos (yyvsp[-1].constraint, yyvsp[0].constraint); ; - break;} -case 65: -//#line 242 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Union_Pos (yyvsp[-2].constraint, yyvsp[0].constraint); ; - break;} -case 66: -//#line 246 "ETCL/ETCL.yy" -{ yyval.constraint = 0; ; - break;} -case 67: -//#line 248 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Union_Value (+1, yyvsp[0].constraint); ; - break;} -case 68: -//#line 250 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Union_Value (+1, yyvsp[0].constraint); ; - break;} -case 69: -//#line 252 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Union_Value (-1, yyvsp[0].constraint); ; - break;} -case 70: -//#line 254 "ETCL/ETCL.yy" -{ yyval.constraint = new ETCL_Union_Value (yyvsp[0].constraint); ; - break;} -} - /* the action file gets copied in in place of this dollarsign */ -//#line 543 "/pkg/gnu/share/bison.simple" - - yyvsp -= yylen; - yyssp -= yylen; -#ifdef YYLSP_NEEDED - yylsp -= yylen; -#endif - -#if YYDEBUG != 0 - if (yydebug) - { - short *ssp1 = yyss - 1; - ACE_OS::fprintf (stderr, "state stack now"); - while (ssp1 != yyssp) - ACE_OS::fprintf (stderr, " %d", *++ssp1); - ACE_OS::fprintf (stderr, "\n"); - } -#endif - - *++yyvsp = yyval; - -#ifdef YYLSP_NEEDED - yylsp++; - if (yylen == 0) - { - yylsp->first_line = yylloc.first_line; - yylsp->first_column = yylloc.first_column; - yylsp->last_line = (yylsp-1)->last_line; - yylsp->last_column = (yylsp-1)->last_column; - yylsp->text = 0; - } - else - { - yylsp->last_line = (yylsp+yylen-1)->last_line; - yylsp->last_column = (yylsp+yylen-1)->last_column; - } -#endif - - /* Now "shift" the result of the reduction. - Determine what state that goes to, - based on the state we popped back to - and the rule number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTBASE] + *yyssp; - if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTBASE]; - - goto yynewstate; - -yyerrlab: /* here on detecting error */ - - if (! yyerrstatus) - /* If not already recovering from an error, report this error. */ - { - ++yynerrs; - -#ifdef YYERROR_VERBOSE - yyn = yypact[yystate]; - - if (yyn > YYFLAG && yyn < YYLAST) - { - int size = 0; - char *msg; - int x, count; - - count = 0; - /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - size += ACE_OS::strlen(yytname[x]) + 15, count++; - msg = (char *) ACE_OS::malloc(size + 15); - if (msg != 0) - { - ACE_OS::strcpy(msg, "parse error"); - - if (count < 5) - { - count = 0; - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - { - ACE_OS::strcat(msg, count == 0 ? ", expecting `" : " or `"); - ACE_OS::strcat(msg, yytname[x]); - ACE_OS::strcat(msg, "'"); - count++; - } - } - yyerror(msg); - ACE_OS::free(msg); - } - else - yyerror ("parse error; also virtual memory exceeded"); - } - else -#endif /* YYERROR_VERBOSE */ - yyerror("parse error"); - } - - goto yyerrlab1; -yyerrlab1: /* here on error raised explicitly by an action */ - - if (yyerrstatus == 3) - { - /* if just tried and failed to reuse lookahead token after an error, discard it. */ - - /* return failure if at end of input */ - if (yychar == YYEOF) - YYABORT; - -#if YYDEBUG != 0 - if (yydebug) - ACE_OS::fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); -#endif - - yychar = YYEMPTY; - } - - /* Else will try to reuse lookahead token - after shifting the error token. */ - - yyerrstatus = 3; /* Each real token shifted decrements this */ - - goto yyerrhandle; - -yyerrdefault: /* current state does not do anything special for the error token. */ - -#if 0 - /* This is wrong; only states that explicitly want error tokens - should shift them. */ - yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ - if (yyn) goto yydefault; -#endif - -yyerrpop: /* pop the current state because it cannot handle the error token */ - - if (yyssp == yyss) YYABORT; - yyvsp--; - yystate = *--yyssp; -#ifdef YYLSP_NEEDED - yylsp--; -#endif - -#if YYDEBUG != 0 - if (yydebug) - { - short *ssp1 = yyss - 1; - ACE_OS::fprintf (stderr, "Error: state stack now"); - while (ssp1 != yyssp) - ACE_OS::fprintf (stderr, " %d", *++ssp1); - ACE_OS::fprintf (stderr, "\n"); - } -#endif - -yyerrhandle: - - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yyerrdefault; - - yyn += YYTERROR; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) - goto yyerrdefault; - - yyn = yytable[yyn]; - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrpop; - yyn = -yyn; - goto yyreduce; - } - else if (yyn == 0) - goto yyerrpop; - - if (yyn == YYFINAL) - YYACCEPT; - -#if YYDEBUG != 0 - if (yydebug) - ACE_OS::fprintf(stderr, "Shifting error token, "); -#endif - - *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif - - yystate = yyn; - goto yynewstate; - - yyacceptlab: - /* YYACCEPT comes here. */ - if (yyfree_stacks) - { - ACE_OS::free (yyss); - ACE_OS::free (yyvs); -#ifdef YYLSP_NEEDED - ACE_OS::free (yyls); -#endif - } - return 0; - - yyabortlab: - /* YYABORT comes here. */ - - /* Flush out yy_current_buffer before next parse. Since there is - no error recovery, the buffer could still contain tokens from this - parse. */ - yyflush_current_buffer(); - - if (yyfree_stacks) - { - ACE_OS::free (yyss); - ACE_OS::free (yyvs); -#ifdef YYLSP_NEEDED - ACE_OS::free (yyls); -#endif - } - return 1; -} -//#line 257 "ETCL/ETCL.yy" - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/ETCL/ETCL_y.h b/dep/acelite/ace/ETCL/ETCL_y.h deleted file mode 100644 index 577296e9ee2..00000000000 --- a/dep/acelite/ace/ETCL/ETCL_y.h +++ /dev/null @@ -1,45 +0,0 @@ -// $Id: ETCL_y.h 81458 2008-04-28 11:31:49Z johnnyw $ -#define ETCL_GT 257 -#define ETCL_GE 258 -#define ETCL_LT 259 -#define ETCL_LE 260 -#define ETCL_EQ 261 -#define ETCL_NE 262 -#define ETCL_EXIST 263 -#define ETCL_DEFAULT 264 -#define ETCL_AND 265 -#define ETCL_OR 266 -#define ETCL_NOT 267 -#define ETCL_IN 268 -#define ETCL_TWIDDLE 269 -#define ETCL_BOOLEAN 270 -#define ETCL_PLUS 271 -#define ETCL_MINUS 272 -#define ETCL_MULT 273 -#define ETCL_DIV 274 -#define ETCL_UMINUS 275 -#define ETCL_INTEGER 276 -#define ETCL_FLOAT 277 -#define ETCL_STRING 278 -#define ETCL_RPAREN 279 -#define ETCL_LPAREN 280 -#define ETCL_RBRA 281 -#define ETCL_LBRA 282 -#define ETCL_IDENT 283 -#define ETCL_UNSIGNED 284 -#define ETCL_SIGNED 285 -#define ETCL_DOUBLE 286 -#define ETCL_CONSTRAINT 287 -#define ETCL_COMPONENT 288 -#define ETCL_WITH 289 -#define ETCL_MAX 290 -#define ETCL_MIN 291 -#define ETCL_FIRST 292 -#define ETCL_RANDOM 293 -#define ETCL_DOLLAR 294 -#define ETCL_DOT 295 -#define ETCL_DISCRIMINANT 296 -#define ETCL_LENGTH 297 -#define ETCL_TYPE_ID 298 -#define ETCL_REPOS_ID 299 - diff --git a/dep/acelite/ace/ETCL/ace_etcl_export.h b/dep/acelite/ace/ETCL/ace_etcl_export.h deleted file mode 100644 index 561d99f85be..00000000000 --- a/dep/acelite/ace/ETCL/ace_etcl_export.h +++ /dev/null @@ -1,40 +0,0 @@ - -// -*- C++ -*- -// $Id: ace_etcl_export.h 81458 2008-04-28 11:31:49Z johnnyw $ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl -// ------------------------------ -#ifndef ACE_ETCL_EXPORT_H -#define ACE_ETCL_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) -# if !defined (ACE_ETCL_HAS_DLL) -# define ACE_ETCL_HAS_DLL 0 -# endif /* ! ACE_ETCL_HAS_DLL */ -#else -# if !defined (ACE_ETCL_HAS_DLL) -# define ACE_ETCL_HAS_DLL 1 -# endif /* ! ACE_ETCL_HAS_DLL */ -#endif - -#if defined (ACE_ETCL_HAS_DLL) && (ACE_ETCL_HAS_DLL == 1) -# if defined (ACE_ETCL_BUILD_DLL) -# define ACE_ETCL_Export ACE_Proper_Export_Flag -# define ACE_ETCL_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define ACE_ETCL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* ACE_ETCL_BUILD_DLL */ -# define ACE_ETCL_Export ACE_Proper_Import_Flag -# define ACE_ETCL_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define ACE_ETCL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* ACE_ETCL_BUILD_DLL */ -#else /* ACE_ETCL_HAS_DLL == 1 */ -# define ACE_ETCL_Export -# define ACE_ETCL_SINGLETON_DECLARATION(T) -# define ACE_ETCL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* ACE_ETCL_HAS_DLL == 1 */ - -#endif /* ACE_ETCL_EXPORT_H */ - -// End of auto generated file. diff --git a/dep/acelite/ace/ETCL/etcl_parser_export.h b/dep/acelite/ace/ETCL/etcl_parser_export.h deleted file mode 100644 index 678d25b466a..00000000000 --- a/dep/acelite/ace/ETCL/etcl_parser_export.h +++ /dev/null @@ -1,40 +0,0 @@ - -// -*- C++ -*- -// $Id: etcl_parser_export.h 81640 2008-05-07 19:04:11Z parsons $ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl -// ------------------------------ -#ifndef ETCL_PARSER_EXPORT_H -#define ETCL_PARSER_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) -# if !defined (ETCL_PARSER_HAS_DLL) -# define ETCL_PARSER_HAS_DLL 0 -# endif /* ! ETCL_PARSER_HAS_DLL */ -#else -# if !defined (ETCL_PARSER_HAS_DLL) -# define ETCL_PARSER_HAS_DLL 1 -# endif /* ! ETCL_PARSER_HAS_DLL */ -#endif - -#if defined (ETCL_PARSER_HAS_DLL) && (ETCL_PARSER_HAS_DLL == 1) -# if defined (ETCL_PARSER_BUILD_DLL) -# define ETCL_Parser_Export ACE_Proper_Export_Flag -# define ETCL_PARSER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define ETCL_PARSER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* ETCL_PARSER_BUILD_DLL */ -# define ETCL_Parser_Export ACE_Proper_Import_Flag -# define ETCL_PARSER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define ETCL_PARSER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* ETCL_PARSER_BUILD_DLL */ -#else /* ETCL_PARSER_HAS_DLL == 1 */ -# define ETCL_Parser_Export -# define ETCL_PARSER_SINGLETON_DECLARATION(T) -# define ETCL_PARSER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* ETCL_PARSER_HAS_DLL == 1 */ - -#endif /* ETCL_PARSER_EXPORT_H */ - -// End of auto generated file. diff --git a/dep/acelite/ace/Encoding_Converter.cpp b/dep/acelite/ace/Encoding_Converter.cpp deleted file mode 100644 index b5fd2b35402..00000000000 --- a/dep/acelite/ace/Encoding_Converter.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// $Id: Encoding_Converter.cpp 80826 2008-03-04 14:51:23Z wotte $ -#include "ace/Encoding_Converter.h" - -#if defined (ACE_USES_WCHAR) -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Encoding_Converter::~ACE_Encoding_Converter (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_USES_WCHAR */ diff --git a/dep/acelite/ace/Encoding_Converter.h b/dep/acelite/ace/Encoding_Converter.h deleted file mode 100644 index 34d22fa29a1..00000000000 --- a/dep/acelite/ace/Encoding_Converter.h +++ /dev/null @@ -1,70 +0,0 @@ -// -*- C++ -*- - -//========================================================================= -/** - * @file Encoding_Converter.h - * - * $Id: Encoding_Converter.h 80826 2008-03-04 14:51:23Z wotte $ - * - * This class is the base class for all encoding converters that convert - * to and from UTF-8. - * - * @author Chad Elliott - */ -//========================================================================= - -#ifndef ACE_ENCODING_CONVERTER_H -#define ACE_ENCODING_CONVERTER_H - -#include /**/ "ace/pre.h" - -#include "ace/Basic_Types.h" - -#if defined (ACE_USES_WCHAR) -#include /**/ "ace/ACE_export.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** The base class for all ACE UTF Encoding Converters. - * This class provides a generic interface that is used to implement - * various UTF encoding conversion classes. - */ -class ACE_Export ACE_Encoding_Converter -{ -public: - /// This enum describes the various states that can be returned - /// from the to_utf8() and from_utf8() methods which depends on - /// both the source buffer and the size of the target buffer. - enum Result {CONVERSION_OK, - SOURCE_EXHAUSTED, - TARGET_EXHAUSTED, - SOURCE_ILLEGAL - }; - - /// This destructor is here (and virtual) because we have virtual - /// functions. - virtual ~ACE_Encoding_Converter (void); - - /// Convert the source (which can be in any encoding) to UTF-8 and - /// store it in the provided target buffer. - virtual Result to_utf8 (const void* source, - size_t source_size, - ACE_Byte* target, - size_t target_size, - bool strict = true) = 0; - - /// Convert the UTF-8 source into an alternate encoding and store it - /// in the provided target buffer. - virtual Result from_utf8 (const ACE_Byte* source, - size_t source_size, - void* target, - size_t target_size, - bool strict = true) = 0; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_USES_WCHAR */ - -#include /**/ "ace/post.h" - -#endif /* ACE_ENCODING_CONVERTER_H */ diff --git a/dep/acelite/ace/Encoding_Converter_Factory.cpp b/dep/acelite/ace/Encoding_Converter_Factory.cpp deleted file mode 100644 index f603ae3e893..00000000000 --- a/dep/acelite/ace/Encoding_Converter_Factory.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// $Id: Encoding_Converter_Factory.cpp 80826 2008-03-04 14:51:23Z wotte $ -#include "ace/Encoding_Converter_Factory.h" - -#if defined (ACE_USES_WCHAR) -#include "ace/UTF32_Encoding_Converter.h" -#include "ace/UTF16_Encoding_Converter.h" -#include "ace/UTF8_Encoding_Converter.h" -#include "ace/OS_Memory.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Encoding_Converter* -ACE_Encoding_Converter_Factory::create ( - const ACE_Byte* source, - size_t source_size, - ACE_Encoding_Converter_Factory::Encoding_Hint hint) -{ -#if defined (ACE_BIG_ENDIAN) - bool const convert_for_bigendian = true; -#else - bool const convert_for_bigendian = false; -#endif /* ACE_BIG_ENDIAN */ - ACE_Encoding_Converter* converter = 0; - - switch (hint) - { - case ACE_UTF_32BE: - ACE_NEW_RETURN (converter, - ACE_UTF32_Encoding_Converter (!convert_for_bigendian), - 0); - break; - case ACE_UTF_32LE: - ACE_NEW_RETURN (converter, - ACE_UTF32_Encoding_Converter (convert_for_bigendian), - 0); - break; - case ACE_UTF_16BE: - ACE_NEW_RETURN (converter, - ACE_UTF16_Encoding_Converter (!convert_for_bigendian), - 0); - break; - case ACE_UTF_16LE: - ACE_NEW_RETURN (converter, - ACE_UTF16_Encoding_Converter (convert_for_bigendian), - 0); - break; - case ACE_UTF_8: - ACE_NEW_RETURN (converter, - ACE_UTF8_Encoding_Converter, - 0); - break; - default: - // First check for ASCII since much of ASCII text will appear to - // convert from UTF-16 to UTF-8. - converter = ACE_UTF8_Encoding_Converter::encoded (source, source_size); - if (converter != 0) - return converter; - - // Check for UTF-32 - converter = ACE_UTF32_Encoding_Converter::encoded (source, source_size); - if (converter != 0) - return converter; - - // Check for UTF-16 - converter = ACE_UTF16_Encoding_Converter::encoded (source, source_size); - if (converter != 0) - return converter; - } - - return converter; -} - -ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_USES_WCHAR */ diff --git a/dep/acelite/ace/Encoding_Converter_Factory.h b/dep/acelite/ace/Encoding_Converter_Factory.h deleted file mode 100644 index 1441c690bef..00000000000 --- a/dep/acelite/ace/Encoding_Converter_Factory.h +++ /dev/null @@ -1,54 +0,0 @@ -// -*- C++ -*- - -//========================================================================= -/** - * @file Encoding_Converter_Factory.h - * - * $Id: Encoding_Converter_Factory.h 80826 2008-03-04 14:51:23Z wotte $ - * - * This class can be used to create encoding converters of various types. - * - * @author Chad Elliott - */ -//========================================================================= - -#ifndef ACE_ENCODING_CONVERTER_FACTORY_H -#define ACE_ENCODING_CONVERTER_FACTORY_H - -#include /**/ "ace/pre.h" - -#include "ace/Basic_Types.h" - -#if defined (ACE_USES_WCHAR) -#include /**/ "ace/ACE_export.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Encoding_Converter; - -/** Create an encoding converter based on the source or hint. - * This class allows users to avoid knowing any concrete converter types. - */ -class ACE_Export ACE_Encoding_Converter_Factory -{ -public: - /// This enum is used to tell what type of converter to create. - enum Encoding_Hint { ACE_UTF_32BE, ACE_UTF_32LE, - ACE_UTF_16BE, ACE_UTF_16LE, - ACE_UTF_8, ACE_NONE - }; - - /// Create an encoding converter based on the source. If a hint is - /// given, it just creates the specified type of converter without looking - /// at the source. - static ACE_Encoding_Converter* create (const ACE_Byte* source, - size_t source_size, - Encoding_Hint hint = ACE_NONE); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_USES_WCHAR */ - -#include /**/ "ace/post.h" - -#endif /* ACE_ENCODING_CONVERTER_FACTORY_H */ diff --git a/dep/acelite/ace/Env_Value_T.cpp b/dep/acelite/ace/Env_Value_T.cpp deleted file mode 100644 index 1997bbea484..00000000000 --- a/dep/acelite/ace/Env_Value_T.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// $Id: Env_Value_T.cpp 80826 2008-03-04 14:51:23Z wotte $ - -#ifndef ACE_ENV_VALUE_T_CPP -#define ACE_ENV_VALUE_T_CPP - -#include "ace/Env_Value_T.h" - -#if ! defined (__ACE_INLINE__) -#include "ace/Env_Value_T.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_ENV_VALUE_T_CPP */ diff --git a/dep/acelite/ace/Env_Value_T.h b/dep/acelite/ace/Env_Value_T.h deleted file mode 100644 index 412baf935ed..00000000000 --- a/dep/acelite/ace/Env_Value_T.h +++ /dev/null @@ -1,162 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Env_Value_T.h - * - * $Id: Env_Value_T.h 92712 2010-11-25 12:22:13Z johnnyw $ - * - * Template to encapsulate getting a value from an environment variable - * and using a supplied default value if not in the environment. - * - * - * @author Chris Cleeland (derived from work by Carlos O'Ryan) - */ -//============================================================================= - -#ifndef ACE_ENV_VALUE_T_H -#define ACE_ENV_VALUE_T_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" -#include "ace/Global_Macros.h" -#include "ace/OS_NS_stdlib.h" -#include "ace/Copy_Disabled.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Env_Value - * - * @brief Environment Variable Value - * - * Reads a variable from the user environment, providing a default - * value. - */ -template -class ACE_Env_Value : private ACE_Copy_Disabled -{ -public: - /** - * Default constructor which isn't bound to a specific environment - * variable name or a default value. Before being useful it must - * open()'d. - */ - ACE_Env_Value (void); - - /// Constructor that calls open(). - ACE_Env_Value (const ACE_TCHAR *varname, const T &vardefault); - - /// Destroy the value. - ~ACE_Env_Value (void); - - /// Returns the value as type T. - operator T (void); - - /// The constructor, read @a varname from the environment, using - /// @a defval as its value if it is not defined. - void open (const ACE_TCHAR *varname, const T &defval); - - /// Returns the name of the variable being tracked. - const ACE_TCHAR *varname (void) const; - -private: - void fetch_value (void); - - const ACE_TCHAR *varname_; - T value_; -}; - -/// Function to convert a string @a s into type @c T. -template void ACE_Convert (const ACE_TCHAR *s, T &t); - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Env_Value_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Env_Value_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template <> inline void -ACE_Convert (const ACE_TCHAR *s, ACE_TCHAR *&v) -{ - v = (ACE_TCHAR *) s; -} - -template <> inline void -ACE_Convert (const ACE_TCHAR *s, const ACE_TCHAR *&v) -{ - v = (const ACE_TCHAR *) s; -} - -template <> inline void -ACE_Convert (const ACE_TCHAR *s, short &si) -{ - si = static_cast (ACE_OS::strtol (s, 0, 10)); -} - -template <> inline void -ACE_Convert (const ACE_TCHAR *s, u_short &us) -{ - us = static_cast (ACE_OS::strtol (s, 0, 10)); -} - -template <> inline void -ACE_Convert (const ACE_TCHAR *s, u_int &i) -{ - i = static_cast (ACE_OS::strtol (s, 0, 10)); -} - -template <> inline void -ACE_Convert (const ACE_TCHAR *s, long &l) -{ - l = ACE_OS::strtol (s, 0, 10); -} - -template <> inline void -ACE_Convert (const ACE_TCHAR *s, int &i) -{ - i = static_cast (ACE_OS::strtol (s, 0, 10)); -} - -template <> inline void -ACE_Convert (const ACE_TCHAR *s, u_long &ul) -{ - ul = ACE_OS::strtoul (s, 0, 10); -} - -template <> inline void -ACE_Convert (const ACE_TCHAR *s, double &d) -{ - d = ACE_OS::strtod (s, 0); -} - -// Default calls a CTOR on type T of the form 'T::T(const char*)', but -// users can feel free to create their own specialized conversion -// functions if necessary, as shown above. Note that for 'char*' the -// default is used because a simple cast will be performed and no -// conversion will be necessary. -template inline void -ACE_Convert (const ACE_TCHAR *s, T &t) -{ - t = T (s); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Env_Value_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_ENV_VALUE_T_H */ diff --git a/dep/acelite/ace/Env_Value_T.inl b/dep/acelite/ace/Env_Value_T.inl deleted file mode 100644 index d9af1b03164..00000000000 --- a/dep/acelite/ace/Env_Value_T.inl +++ /dev/null @@ -1,60 +0,0 @@ -// $Id: Env_Value_T.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE -ACE_Env_Value::operator T (void) -{ - return value_; -} - -template ACE_INLINE -ACE_Env_Value::ACE_Env_Value (void) - : varname_ (0) -{ -} - -template ACE_INLINE -ACE_Env_Value::ACE_Env_Value (const ACE_TCHAR *varname, - const T &defval) - : varname_ (varname), - value_(defval) -{ - this->fetch_value (); -} - -template ACE_INLINE void -ACE_Env_Value::open (const ACE_TCHAR *varname, - const T &defval) -{ - this->varname_ = varname; - this->value_ = defval; - this->fetch_value (); -} - -template ACE_INLINE void -ACE_Env_Value::fetch_value (void) -{ -#if defined (ACE_WIN32) - const ACE_TCHAR *env = ACE_OS::getenv (this->varname_); - if (env != 0) - ACE_Convert (env, value_); -#else - char *nenv = ACE_OS::getenv (ACE_TEXT_ALWAYS_CHAR (this->varname_)); - if (nenv != 0) - ACE_Convert (ACE_TEXT_CHAR_TO_TCHAR (nenv), this->value_); -#endif -} - -template ACE_INLINE const ACE_TCHAR* -ACE_Env_Value::varname (void) const -{ - return this->varname_; -} - -template ACE_INLINE -ACE_Env_Value::~ACE_Env_Value (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Event.cpp b/dep/acelite/ace/Event.cpp deleted file mode 100644 index 40eef30b04c..00000000000 --- a/dep/acelite/ace/Event.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// $Id: Event.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/Event.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Event.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Log_Msg.h" - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Event::ACE_Event (int manual_reset, - int initial_state, - int type, - const ACE_TCHAR *name, - void *arg, - LPSECURITY_ATTRIBUTES sa) - : removed_ (false) -{ - if (ACE_OS::event_init (&this->handle_, - manual_reset, - initial_state, - type, - name, - arg, - sa) != 0) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Event::ACE_Event"))); -} - -ACE_Event::~ACE_Event (void) -{ - this->remove (); -} - -int -ACE_Event::remove (void) -{ - int result = 0; - if (!this->removed_) - { - this->removed_ = true; - result = ACE_OS::event_destroy (&this->handle_); - } - return result; -} - -int -ACE_Event::wait (void) -{ - return ACE_OS::event_wait (&this->handle_); -} - -int -ACE_Event::wait (const ACE_Time_Value *abstime, int use_absolute_time) -{ - return ACE_OS::event_timedwait (&this->handle_, - const_cast (abstime), - use_absolute_time); -} - -int -ACE_Event::signal (void) -{ - return ACE_OS::event_signal (&this->handle_); -} - -int -ACE_Event::pulse (void) -{ - return ACE_OS::event_pulse (&this->handle_); -} - -int -ACE_Event::reset (void) -{ - return ACE_OS::event_reset (&this->handle_); -} - -void -ACE_Event::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Event.h b/dep/acelite/ace/Event.h deleted file mode 100644 index 887b504d8f9..00000000000 --- a/dep/acelite/ace/Event.h +++ /dev/null @@ -1,143 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Event.h - * - * $Id: Event.h 80826 2008-03-04 14:51:23Z wotte $ - * - * Moved from Synch.h. - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_EVENT_H -#define ACE_EVENT_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/OS_NS_Thread.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Event - * - * @brief A wrapper around the Win32 event locking mechanism. - * - * Portable implementation of an Event mechanism, which is native to - * Win32, but must be emulated on UNIX. All platforms support - * process-scope locking support. However, only Win32 platforms - * support global naming and system-scope locking support. - */ -class ACE_Export ACE_Event -{ -public: - /// Constructor that creates event. - ACE_Event (int manual_reset = 0, - int initial_state = 0, - int type = USYNC_THREAD, - const ACE_TCHAR *name = 0, - void *arg = 0, - LPSECURITY_ATTRIBUTES sa = 0); - - /// Implicitly destroy the event variable. - ~ACE_Event (void); - - /** - * Explicitly destroy the event variable. Note that only one thread - * should call this method since it doesn't protect against race - * conditions. - */ - int remove (void); - - /// Underlying handle to event. - ACE_event_t handle (void) const; - - /** - * Set the underlying handle to event. Note that this method assumes - * ownership of the and will close it down in . If - * you want the to stay open when is called make - * sure to call on the before closing it. You are - * responsible for the closing the existing before - * overwriting it. - */ - void handle (ACE_event_t new_handle); - - /** - * if MANUAL reset - * sleep till the event becomes signaled - * event remains signaled after wait() completes. - * else AUTO reset - * sleep till the event becomes signaled - * event resets wait() completes. - */ - int wait (void); - - /// Same as wait() above, but this one can be timed - /// @a abstime is absolute time-of-day if if @a use_absolute_time - /// is non-0, else it is relative time. - int wait (const ACE_Time_Value *abstime, - int use_absolute_time = 1); - - /** - * if MANUAL reset - * wake up all waiting threads - * set to signaled state - * else AUTO reset - * if no thread is waiting, set to signaled state - * if thread(s) are waiting, wake up one waiting thread and - * reset event - */ - int signal (void); - - /** - * if MANUAL reset - * wakeup all waiting threads and - * reset event - * else AUTO reset - * wakeup one waiting thread (if present) and - * reset event - */ - int pulse (void); - - /// Set to nonsignaled state. - int reset (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// The underlying handle. - ACE_event_t handle_; - - /// Keeps track of whether has been called yet to avoid - /// multiple calls, e.g., explicitly and implicitly in the - /// destructor. This flag isn't protected by a lock, so make sure - /// that you don't have multiple threads simultaneously calling - /// on the same object, which is a bad idea anyway... - bool removed_; - -private: - // = Prevent copying. - ACE_Event (const ACE_Event& event); - const ACE_Event &operator= (const ACE_Event &rhs); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Event.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_EVENT_H */ diff --git a/dep/acelite/ace/Event.inl b/dep/acelite/ace/Event.inl deleted file mode 100644 index ae0805c95f0..00000000000 --- a/dep/acelite/ace/Event.inl +++ /dev/null @@ -1,18 +0,0 @@ -// -*- C++ -*- -// $Id: Event.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE ACE_event_t -ACE_Event::handle (void) const -{ - return this->handle_; -} - -ACE_INLINE void -ACE_Event::handle (ACE_event_t new_handle) -{ - this->handle_ = new_handle; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Event_Handler.cpp b/dep/acelite/ace/Event_Handler.cpp deleted file mode 100644 index fdeacd6d742..00000000000 --- a/dep/acelite/ace/Event_Handler.cpp +++ /dev/null @@ -1,394 +0,0 @@ -// Event_Handler.cpp -// $Id: Event_Handler.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/Event_Handler.h" -#include "ace/OS_Errno.h" -#include "ace/Reactor.h" -#include "ace/Thread_Manager.h" -/* Need to see if ACE_HAS_BUILTIN_ATOMIC_OP defined */ -#include "ace/Atomic_Op.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Event_Handler.inl" -#endif /* __ACE_INLINE__ */ - -#include - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Implement conceptually abstract virtual functions in the base class -// so derived classes don't have to implement unused ones. - -ACE_Event_Handler::ACE_Event_Handler (ACE_Reactor *r, - int p) - : reference_count_ (1), - priority_ (p), - reactor_ (r), - reference_counting_policy_ (Reference_Counting_Policy::DISABLED) -{ - // ACE_TRACE ("ACE_Event_Handler::ACE_Event_Handler"); -} - -ACE_Event_Handler::~ACE_Event_Handler (void) -{ - // ACE_TRACE ("ACE_Event_Handler::~ACE_Event_Handler"); -} - -// Gets the file descriptor associated with this I/O device. - -ACE_HANDLE -ACE_Event_Handler::get_handle (void) const -{ - ACE_TRACE ("ACE_Event_Handler::get_handle"); - return ACE_INVALID_HANDLE; -} - -// Sets the file descriptor associated with this I/O device. - -void -ACE_Event_Handler::set_handle (ACE_HANDLE) -{ - ACE_TRACE ("ACE_Event_Handler::set_handle"); -} - -// Gets the priority of this handler. - -int -ACE_Event_Handler::priority (void) const -{ - ACE_TRACE ("ACE_Event_Handler::priority"); - return this->priority_; -} - -// Sets the priority - -void -ACE_Event_Handler::priority (int priority) -{ - ACE_TRACE ("ACE_Event_Handler::priority"); - this->priority_ = priority; -} - -// Called when the object is about to be removed from the Dispatcher -// tables. - -int -ACE_Event_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask) -{ - ACE_TRACE ("ACE_Event_Handler::handle_close"); - return -1; -} - -// Called when input becomes available on fd. - -int -ACE_Event_Handler::handle_input (ACE_HANDLE) -{ - ACE_TRACE ("ACE_Event_Handler::handle_input"); - return -1; -} - -// Called when output is possible on fd. - -int -ACE_Event_Handler::handle_output (ACE_HANDLE) -{ - ACE_TRACE ("ACE_Event_Handler::handle_output"); - return -1; -} - -// Called when urgent data is available on fd. - -int -ACE_Event_Handler::handle_exception (ACE_HANDLE) -{ - ACE_TRACE ("ACE_Event_Handler::handle_exception"); - return -1; -} - -// Called when timer expires, TV stores the current time. - -int -ACE_Event_Handler::handle_timeout (const ACE_Time_Value &, const void *) -{ - ACE_TRACE ("ACE_Event_Handler::handle_timeout"); - return -1; -} - -// Called when a monitored Process exits - -int -ACE_Event_Handler::handle_exit (ACE_Process *) -{ - ACE_TRACE ("ACE_Event_Handler::handle_exit"); - return -1; -} - -// Called when a registered signal occurs. - -int -ACE_Event_Handler::handle_signal (int, siginfo_t *, ucontext_t *) -{ - ACE_TRACE ("ACE_Event_Handler::handle_signal"); - return -1; -} - -int -ACE_Event_Handler::resume_handler (void) -{ - ACE_TRACE ("ACE_Event_Handler::resume_handler"); - - // Return a default value and allow the reactor to take care of - // resuming the handler - return ACE_Event_Handler::ACE_REACTOR_RESUMES_HANDLER; -} - - -int -ACE_Event_Handler::handle_qos (ACE_HANDLE) -{ - ACE_TRACE ("ACE_Event_Handler::handle_qos"); - return -1; -} - -int -ACE_Event_Handler::handle_group_qos (ACE_HANDLE) -{ - ACE_TRACE ("ACE_Event_Handler::handle_group_qos"); - return -1; -} - -void -ACE_Event_Handler::reactor (ACE_Reactor *reactor) -{ - ACE_TRACE ("ACE_Event_Handler::reactor"); - this->reactor_ = reactor; -} - -ACE_Reactor * -ACE_Event_Handler::reactor (void) const -{ - ACE_TRACE ("ACE_Event_Handler::reactor"); - return this->reactor_; -} - -ACE_Reactor_Timer_Interface * -ACE_Event_Handler::reactor_timer_interface (void) const -{ - ACE_TRACE ("ACE_Event_Handler::reactor_timer_interface"); - return this->reactor_; -} - -ACE_Event_Handler::Reference_Count -ACE_Event_Handler::add_reference (void) -{ - bool const reference_counting_required = - this->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - - if (reference_counting_required) - return ++this->reference_count_; - else - return 1; -} - -ACE_Event_Handler::Reference_Count -ACE_Event_Handler::remove_reference (void) -{ - bool const reference_counting_required = - this->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - - if (reference_counting_required) - { - Reference_Count result = - --this->reference_count_; - - if (result == 0) - delete this; - - return result; - } - else - { - return 1; - } -} - -ACE_Event_Handler::Policy::~Policy (void) -{ -} - -ACE_Event_Handler::Reference_Counting_Policy::Reference_Counting_Policy (Reference_Counting_Policy::Value value) - : value_ (value) -{ -} - -ACE_Event_Handler::Reference_Counting_Policy::Value -ACE_Event_Handler::Reference_Counting_Policy::value (void) const -{ - return this->value_; -} - -void -ACE_Event_Handler::Reference_Counting_Policy::value (ACE_Event_Handler::Reference_Counting_Policy::Value value) -{ - this->value_ = value; -} - -ACE_Event_Handler::Reference_Counting_Policy & -ACE_Event_Handler::reference_counting_policy (void) -{ - return this->reference_counting_policy_; -} - -ACE_THR_FUNC_RETURN -ACE_Event_Handler::read_adapter (void *args) -{ - ACE_Event_Handler *this_ptr = static_cast (args); - ACE_Reactor *r = this_ptr->reactor (); - - while (this_ptr->handle_input (ACE_STDIN) != -1) - continue; - - this_ptr->handle_close (ACE_STDIN, ACE_Event_Handler::READ_MASK); - // It's possible for handle_close() to "delete this" so we need to - // cache the reactor pointer and use it here. - r->notify (); - - return 0; -} - -int -ACE_Event_Handler::register_stdin_handler (ACE_Event_Handler *eh, - ACE_Reactor *reactor, - ACE_Thread_Manager *thr_mgr, - int flags) -{ -#if defined (ACE_WIN32) - ACE_UNUSED_ARG (reactor); - - eh->reactor (reactor); - return thr_mgr->spawn (&read_adapter, static_cast (eh), flags); -#else - // Keep compilers happy. - ACE_UNUSED_ARG (flags); - ACE_UNUSED_ARG (thr_mgr); - return reactor->register_handler (ACE_STDIN, - eh, - ACE_Event_Handler::READ_MASK); -#endif /* ACE_WIN32 */ -} - -int -ACE_Event_Handler::remove_stdin_handler (ACE_Reactor *reactor, - ACE_Thread_Manager * /* thr_mgr */) -{ -#if defined (ACE_WIN32) - ACE_UNUSED_ARG (reactor); - - // What should we do here? - ACE_NOTSUP_RETURN (-1); -#else - return reactor->remove_handler (ACE_STDIN, - ACE_Event_Handler::READ_MASK); -#endif /* ACE_WIN32 */ -} - -// --------------------------------------------------------------------- - -ACE_Event_Handler_var::ACE_Event_Handler_var (void) - : ptr_ (0) -{ -} - -ACE_Event_Handler_var::ACE_Event_Handler_var (ACE_Event_Handler *p) - : ptr_ (p) -{ -} - -ACE_Event_Handler_var::ACE_Event_Handler_var (const ACE_Event_Handler_var &b) - : ptr_ (b.ptr_) -{ - if (this->ptr_ != 0) - { - this->ptr_->add_reference (); - } -} - -ACE_Event_Handler_var::~ACE_Event_Handler_var (void) -{ - if (this->ptr_ != 0) - { - ACE_Errno_Guard eguard (errno); - this->ptr_->remove_reference (); - } -} - -ACE_Event_Handler_var & -ACE_Event_Handler_var::operator= (ACE_Event_Handler *p) -{ - if (this->ptr_ != p) - { - ACE_Event_Handler_var tmp (p); - std::swap (this->ptr_, tmp.ptr_); - } - - return *this; -} - -ACE_Event_Handler_var & -ACE_Event_Handler_var::operator= (const ACE_Event_Handler_var &b) -{ - ACE_Event_Handler_var tmp (b); - std::swap (this->ptr_, tmp.ptr_); - - return *this; -} - -ACE_Event_Handler * -ACE_Event_Handler_var::operator->() const -{ - return this->ptr_; -} - -ACE_Event_Handler * -ACE_Event_Handler_var::handler (void) const -{ - return this->ptr_; -} - -ACE_Event_Handler * -ACE_Event_Handler_var::release (void) -{ - ACE_Event_Handler * const old = this->ptr_; - this->ptr_ = 0; - return old; -} - -void -ACE_Event_Handler_var::reset (ACE_Event_Handler *p) -{ - *this = p; -} - -// --------------------------------------------------------------------- - -ACE_Notification_Buffer::ACE_Notification_Buffer (void) - : eh_ (0), - mask_ (ACE_Event_Handler::NULL_MASK) -{ - ACE_TRACE ("ACE_Notification_Buffer::ACE_Notification_Buffer"); -} - -ACE_Notification_Buffer::ACE_Notification_Buffer (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask) - : eh_ (eh), - mask_ (mask) -{ - ACE_TRACE ("ACE_Notification_Buffer::ACE_Notification_Buffer"); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Event_Handler.h b/dep/acelite/ace/Event_Handler.h deleted file mode 100644 index fe5d1de748d..00000000000 --- a/dep/acelite/ace/Event_Handler.h +++ /dev/null @@ -1,390 +0,0 @@ -/* -*- C++ -*- */ - -//========================================================================== -/** - * @file Event_Handler.h - * - * $Id: Event_Handler.h 92345 2010-10-24 12:39:33Z johnnyw $ - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_EVENT_HANDLER_H -#define ACE_EVENT_HANDLER_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_signal.h" -#include "ace/Atomic_Op.h" -#include "ace/Synch_Traits.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declaration. -class ACE_Message_Block; -class ACE_Reactor; -class ACE_Reactor_Timer_Interface; -class ACE_Thread_Manager; -class ACE_Process; - -typedef unsigned long ACE_Reactor_Mask; - -/** - * @class ACE_Event_Handler - * - * @brief - * Provides an abstract interface for handling various types of - * I/O, timer, and signal events. - * - * Subclasses read/write input/output on an I/O descriptor, - * handle an exception raised on an I/O descriptor, handle a - * timer's expiration, or handle a signal. - */ -class ACE_Export ACE_Event_Handler -{ -public: - enum - { - LO_PRIORITY = 0, - HI_PRIORITY = 10, - NULL_MASK = 0, -#if defined (ACE_USE_POLL) - READ_MASK = POLLIN, - WRITE_MASK = POLLOUT, - EXCEPT_MASK = POLLPRI, -#else /* USE SELECT */ - READ_MASK = (1 << 0), - WRITE_MASK = (1 << 1), - EXCEPT_MASK = (1 << 2), -#endif /* ACE_USE_POLL */ - ACCEPT_MASK = (1 << 3), - CONNECT_MASK = (1 << 4), - TIMER_MASK = (1 << 5), - QOS_MASK = (1 << 6), - GROUP_QOS_MASK = (1 << 7), - SIGNAL_MASK = (1 << 8), - ALL_EVENTS_MASK = READ_MASK | - WRITE_MASK | - EXCEPT_MASK | - ACCEPT_MASK | - CONNECT_MASK | - TIMER_MASK | - QOS_MASK | - GROUP_QOS_MASK | - SIGNAL_MASK, - RWE_MASK = READ_MASK | - WRITE_MASK | - EXCEPT_MASK, - DONT_CALL = (1 << 9) - }; - - /// Destructor is virtual to enable proper cleanup. - virtual ~ACE_Event_Handler (void); - - /// Get the I/O handle. - virtual ACE_HANDLE get_handle (void) const; - - /// Set the I/O handle. - virtual void set_handle (ACE_HANDLE); - - // = Get/set priority - - /// Get the priority of the Event_Handler. - /// @note Priorities run from MIN_PRIORITY (which is the "lowest priority") - /// to MAX_PRIORITY (which is the "highest priority"). - virtual int priority (void) const; - - /// Set the priority of the Event_Handler. - virtual void priority (int priority); - - /// Called when input events occur (e.g., connection or data). - virtual int handle_input (ACE_HANDLE fd = ACE_INVALID_HANDLE); - - /// Called when output events are possible (e.g., when flow control - /// abates or non-blocking connection completes). - virtual int handle_output (ACE_HANDLE fd = ACE_INVALID_HANDLE); - - /// Called when an exceptional events occur (e.g., SIGURG). - virtual int handle_exception (ACE_HANDLE fd = ACE_INVALID_HANDLE); - - /** - * Called when timer expires. @a current_time represents the current - * time that the Event_Handler was selected for timeout - * dispatching and @a act is the asynchronous completion token that - * was passed in when was invoked. - */ - virtual int handle_timeout (const ACE_Time_Value ¤t_time, - const void *act = 0); - - /// Called when a process exits. - virtual int handle_exit (ACE_Process *); - - /// Called when a handle_*() method returns -1 or when the - /// remove_handler() method is called on an ACE_Reactor. The - /// @a close_mask indicates which event has triggered the - /// handle_close() method callback on a particular @a handle. - virtual int handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask close_mask); - - /// Called when object is signaled by OS (either via UNIX signals or - /// when a Win32 object becomes signaled). - virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0); - - enum - { - /// The handler is not resumed at all. Could lead to deadlock.. - ACE_EVENT_HANDLER_NOT_RESUMED = -1, - /// The reactor takes responsibility of resuming the handler and - /// is the default - ACE_REACTOR_RESUMES_HANDLER = 0, - /// The application takes responsibility of resuming the handler - ACE_APPLICATION_RESUMES_HANDLER - }; - - /** - * Called to figure out whether the handler needs to resumed by the - * reactor or the application can take care of it. The default - * value of 0 would be returned which would allow the reactor to - * take care of resumption of the handler. The application can - * return a value more than zero and decide to resume the handler - * themselves. - * - * @note This method has an affect only when used with the - * ACE_Dev_Poll_Reactor (and then, only on Linux) or the ACE_TP_Reactor. - */ - virtual int resume_handler (void); - - virtual int handle_qos (ACE_HANDLE = ACE_INVALID_HANDLE); - virtual int handle_group_qos (ACE_HANDLE = ACE_INVALID_HANDLE); - - // = Accessors to set/get the various event demultiplexors. - /// Set the event demultiplexors. - virtual void reactor (ACE_Reactor *reactor); - - /// Get the event demultiplexors. - virtual ACE_Reactor *reactor (void) const; - - /// Get only the reactor's timer related interface. - virtual ACE_Reactor_Timer_Interface *reactor_timer_interface (void) const; - - /** - * Used to read from non-socket ACE_HANDLEs in our own thread to - * work around Win32 limitations that don't allow us to 'able on - * Win32. - */ - static int register_stdin_handler (ACE_Event_Handler *eh, - ACE_Reactor *reactor, - ACE_Thread_Manager *thr_mgr, - int flags = THR_DETACHED); - - /// Performs the inverse of the register_stdin_handler() method. - static int remove_stdin_handler (ACE_Reactor *reactor, - ACE_Thread_Manager *thr_mgr); - - /// Reference count type. - typedef long Reference_Count; - - /// Increment reference count on the handler. - /** - * This method is called when the handler is registered with the - * Reactor and when the Reactor makes an upcall on the handler. - * Reference count is 1 when the handler is created. - * - * @return Current reference count. - */ - virtual Reference_Count add_reference (void); - - /// Decrement reference count on the handler. - /** - * This method is called when the handler is removed from the - * Reactor and when an upcall made on the handler by the Reactor - * completes. Handler is deleted when the reference count reaches - * 0. - * - * @return Current reference count. - */ - virtual Reference_Count remove_reference (void); - - /** - * @class Policy - * - * @brief Base class for all handler policies. - */ - class ACE_Export Policy - { - - public: - - /// Virtual destructor. - virtual ~Policy (void); - }; - - /** - * @class Reference_Counting_Policy - * - * @brief - * This policy dictates the reference counting requirements - * for the handler. - * - * This policy allows applications to configure whether it wants the - * Reactor to call add_reference() and remove_reference() during - * registrations, removals, and upcalls. - * - * Default: DISABLED. - */ - class ACE_Export Reference_Counting_Policy : public Policy - { - /// This policy can only be created by the handler. - friend class ACE_Event_Handler; - - public: - - enum Value - { - /// Perform reference counting. - ENABLED, - /// Don't perform reference counting. - DISABLED - }; - - /// Current Reference_Counting_Policy. - Value value (void) const; - - /// Update Reference_Counting_Policy. - void value (Value value); - - private: - - /// Private constructor. - Reference_Counting_Policy (Value value); - - /// The value of the policy. - Value value_; - }; - - /// Current Reference_Counting_Policy. - Reference_Counting_Policy &reference_counting_policy (void); - -protected: - /// Force ACE_Event_Handler to be an abstract base class. - ACE_Event_Handler (ACE_Reactor * = 0, - int priority = ACE_Event_Handler::LO_PRIORITY); - - /// Typedef for implementation of reference counting. - typedef ACE_Atomic_Op Atomic_Reference_Count; - - /// Reference count. - Atomic_Reference_Count reference_count_; - -private: - - /// Priority of this Event_Handler. - int priority_; - - /// Pointer to the various event demultiplexors. - ACE_Reactor *reactor_; - - /// Reference counting requirements. - Reference_Counting_Policy reference_counting_policy_; -}; - -/** - * @class ACE_Event_Handler_var - * - * @brief Auto pointer like class for Event Handlers. - * - * Used to manage lifecycle of handlers. This class calls - * ACE_Event_Handler::remove_reference() in its destructor. - */ -class ACE_Export ACE_Event_Handler_var -{ - -public: - - /// Default constructor. - ACE_Event_Handler_var (void); - - /// Construct with a handler. - ACE_Event_Handler_var (ACE_Event_Handler *p); - - /// Copy constructor. - ACE_Event_Handler_var (const ACE_Event_Handler_var &b); - - /// Destructor. - ~ACE_Event_Handler_var (void); - - /// Assignment to a handler. - ACE_Event_Handler_var &operator= (ACE_Event_Handler *p); - - /// Assignment to a ACE_Event_Handler_var. - ACE_Event_Handler_var &operator= (const ACE_Event_Handler_var &b); - - /// Overloaded "->". - ACE_Event_Handler *operator-> () const; - - /// Access the handler. - ACE_Event_Handler *handler (void) const; - - /// Release the handler. - ACE_Event_Handler *release (void); - - /// Reset the handler. - void reset (ACE_Event_Handler *p = 0); - -private: - - /// Handler. - ACE_Event_Handler *ptr_; -}; - -/** - * @class ACE_Notification_Buffer - * - * @brief Simple wrapper for passing s and - * ACE_Reactor_Masks between threads. - */ -class ACE_Export ACE_Notification_Buffer -{ -public: - ACE_Notification_Buffer (void); - - ACE_Notification_Buffer (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask); - - /// Default destructor. - ~ACE_Notification_Buffer (void); - - /// Pointer to the Event_Handler that will be dispatched - /// by the main event loop. - ACE_Event_Handler *eh_; - - /// Mask that indicates which method to call. - ACE_Reactor_Mask mask_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Event_Handler.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_EVENT_HANDLER_H */ diff --git a/dep/acelite/ace/Event_Handler.inl b/dep/acelite/ace/Event_Handler.inl deleted file mode 100644 index d97c45466ae..00000000000 --- a/dep/acelite/ace/Event_Handler.inl +++ /dev/null @@ -1,12 +0,0 @@ -// -*- C++ -*- -// -// $Id: Event_Handler.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Notification_Buffer::~ACE_Notification_Buffer (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Event_Handler_Handle_Timeout_Upcall.cpp b/dep/acelite/ace/Event_Handler_Handle_Timeout_Upcall.cpp deleted file mode 100644 index b16679a11ec..00000000000 --- a/dep/acelite/ace/Event_Handler_Handle_Timeout_Upcall.cpp +++ /dev/null @@ -1,99 +0,0 @@ -// $Id: Event_Handler_Handle_Timeout_Upcall.cpp 95586 2012-03-03 20:45:57Z johnnyw $ - -#include "ace/Event_Handler_Handle_Timeout_Upcall.h" -#include "ace/Reactor_Timer_Interface.h" -#include "ace/Abstract_Timer_Queue.h" - -#if !defined(__ACE_INLINE__) -# include "ace/Event_Handler_Handle_Timeout_Upcall.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Event_Handler_Handle_Timeout_Upcall:: -ACE_Event_Handler_Handle_Timeout_Upcall (void) : - requires_reference_counting_ (0) -{ -} - -ACE_Event_Handler_Handle_Timeout_Upcall:: -~ACE_Event_Handler_Handle_Timeout_Upcall (void) -{ -} - -int -ACE_Event_Handler_Handle_Timeout_Upcall:: -timeout (ACE_Timer_Queue &timer_queue, - ACE_Event_Handler *event_handler, - const void *act, - int recurring_timer, - const ACE_Time_Value &cur_time) -{ - int requires_reference_counting = 0; - - if (!recurring_timer) - { - requires_reference_counting = - event_handler->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - } - - // Upcall to the s handle_timeout method. - if (event_handler->handle_timeout (cur_time, act) == -1) - { - if (event_handler->reactor_timer_interface ()) - event_handler->reactor_timer_interface ()->cancel_timer (event_handler, 0); - else - timer_queue.cancel (event_handler, 0); // 0 means "call handle_close()". - } - - if (!recurring_timer && - requires_reference_counting) - { - event_handler->remove_reference (); - } - - return 0; -} - -int -ACE_Event_Handler_Handle_Timeout_Upcall:: -cancel_type (ACE_Timer_Queue &, - ACE_Event_Handler *event_handler, - int dont_call, - int &requires_reference_counting) -{ - requires_reference_counting = - event_handler->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - - // Upcall to the s handle_close method - if (dont_call == 0) - event_handler->handle_close (ACE_INVALID_HANDLE, - ACE_Event_Handler::TIMER_MASK); - - return 0; -} - -int -ACE_Event_Handler_Handle_Timeout_Upcall:: -deletion (ACE_Timer_Queue &timer_queue, - ACE_Event_Handler *event_handler, - const void *) -{ - int requires_reference_counting = 0; - - this->cancel_type (timer_queue, - event_handler, - 0, - requires_reference_counting); - - this->cancel_timer (timer_queue, - event_handler, - 0, - requires_reference_counting); - - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Event_Handler_Handle_Timeout_Upcall.h b/dep/acelite/ace/Event_Handler_Handle_Timeout_Upcall.h deleted file mode 100644 index 0ce4a4dd9ca..00000000000 --- a/dep/acelite/ace/Event_Handler_Handle_Timeout_Upcall.h +++ /dev/null @@ -1,103 +0,0 @@ -//$Id: Event_Handler_Handle_Timeout_Upcall.h 95334 2011-12-15 12:52:50Z msmit $ - -#ifndef ACE_EVENT_HANDLER_HANDLE_TIMEOUT_UPCALL_H -#define ACE_EVENT_HANDLER_HANDLE_TIMEOUT_UPCALL_H - -#include /**/ "ace/pre.h" - -/** - * @file Event_Handler_Handle_Timeout_Upcall.h - * - * @author Carlos O'Ryan - * - * Based on classes and files developed by Doug Schmidt, Darrell - * Brunsch, Irfan Pyarali and a cast of thousands. - */ - -#include "ace/Timer_Queuefwd.h" -#include "ace/Copy_Disabled.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Time_Value; - -/** - * @class ACE_Event_Handler_Handle_Timeout_Upcall - * - * @brief Functor for Timer_Queues. - * - * This class implements the functor required by the Timer - * Queue to call on ACE_Event_Handlers. - */ -class ACE_Export ACE_Event_Handler_Handle_Timeout_Upcall - : private ACE_Copy_Disabled -{ -public: - // = Initialization and termination methods. - /// Constructor. - ACE_Event_Handler_Handle_Timeout_Upcall (void); - - /// Destructor. - ~ACE_Event_Handler_Handle_Timeout_Upcall (void); - - /// This method is called when a timer is registered. - int registration (ACE_Timer_Queue &timer_queue, - ACE_Event_Handler *handler, - const void *arg); - - /// This method is called before the timer expires. - int preinvoke (ACE_Timer_Queue &timer_queue, - ACE_Event_Handler *handler, - const void *arg, - int recurring_timer, - const ACE_Time_Value &cur_time, - const void *&upcall_act); - - /// This method is called when the timer expires. - int timeout (ACE_Timer_Queue &timer_queue, - ACE_Event_Handler *handler, - const void *arg, - int recurring_timer, - const ACE_Time_Value &cur_time); - - /// This method is called after the timer expires. - int postinvoke (ACE_Timer_Queue &timer_queue, - ACE_Event_Handler *handler, - const void *arg, - int recurring_timer, - const ACE_Time_Value &cur_time, - const void *upcall_act); - - /// This method is called when a handler is cancelled - int cancel_type (ACE_Timer_Queue &timer_queue, - ACE_Event_Handler *handler, - int dont_call, - int &requires_reference_counting); - - /// This method is called when a timer is cancelled - int cancel_timer (ACE_Timer_Queue &timer_queue, - ACE_Event_Handler *handler, - int dont_call, - int requires_reference_counting); - - /// This method is called when the timer queue is destroyed and - /// the timer is still contained in it - int deletion (ACE_Timer_Queue &timer_queue, - ACE_Event_Handler *handler, - const void *arg); - -private: - - /// Flag indicating that reference counting is required for this - /// event handler upcall. - int requires_reference_counting_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined(__ACE_INLINE__) -# include "ace/Event_Handler_Handle_Timeout_Upcall.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_EVENT_HANDLER_HANDLE_TIMEOUT_UPCALL_H */ diff --git a/dep/acelite/ace/Event_Handler_Handle_Timeout_Upcall.inl b/dep/acelite/ace/Event_Handler_Handle_Timeout_Upcall.inl deleted file mode 100644 index f52a7206c47..00000000000 --- a/dep/acelite/ace/Event_Handler_Handle_Timeout_Upcall.inl +++ /dev/null @@ -1,71 +0,0 @@ -// $Id: Event_Handler_Handle_Timeout_Upcall.inl 95336 2011-12-15 13:22:33Z msmit $ - -#include "ace/Event_Handler.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -ACE_Event_Handler_Handle_Timeout_Upcall:: -registration (ACE_Timer_Queue &, - ACE_Event_Handler *event_handler, - const void *) -{ - event_handler->add_reference (); - return 0; -} - -ACE_INLINE int -ACE_Event_Handler_Handle_Timeout_Upcall:: -preinvoke (ACE_Timer_Queue &, - ACE_Event_Handler *event_handler, - const void *, - int, - const ACE_Time_Value &, - const void * & upcall_act) -{ - bool const requires_reference_counting = - event_handler->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - - if (requires_reference_counting) - { - event_handler->add_reference (); - - upcall_act = &this->requires_reference_counting_; - } - - return 0; -} - -ACE_INLINE int -ACE_Event_Handler_Handle_Timeout_Upcall:: -postinvoke (ACE_Timer_Queue & /* timer_queue */, - ACE_Event_Handler *event_handler, - const void * /* timer_act */, - int /* recurring_timer */, - const ACE_Time_Value & /* cur_time */, - const void *upcall_act) -{ - if (upcall_act == &this->requires_reference_counting_) - { - event_handler->remove_reference (); - } - - return 0; -} - -ACE_INLINE int -ACE_Event_Handler_Handle_Timeout_Upcall:: -cancel_timer (ACE_Timer_Queue &, - ACE_Event_Handler *event_handler, - int, - int requires_reference_counting) -{ - if (requires_reference_counting) - event_handler->remove_reference (); - - return 0; -} - - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Event_Handler_T.cpp b/dep/acelite/ace/Event_Handler_T.cpp deleted file mode 100644 index 3d2649524fc..00000000000 --- a/dep/acelite/ace/Event_Handler_T.cpp +++ /dev/null @@ -1,121 +0,0 @@ -// Event_Handler_T.cpp -// -// $Id: Event_Handler_T.cpp 91626 2010-09-07 10:59:20Z johnnyw $ - -#ifndef ACE_EVENT_HANDLER_T_CPP -#define ACE_EVENT_HANDLER_T_CPP - -#include "ace/Event_Handler_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (__ACE_INLINE__) -#include "ace/Event_Handler_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Event_Handler_T) - -template void -ACE_Event_Handler_T::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Event_Handler_T::dump"); -#endif /* ACE_HAS_DUMP */ -} - -template -ACE_Event_Handler_T::~ACE_Event_Handler_T (void) -{ - ACE_TRACE ("ACE_Event_Handler_T::~ACE_Event_Handler_T"); - if (this->delete_handler_) - delete this->op_handler_; -} - -template -ACE_Event_Handler_T::ACE_Event_Handler_T (T *op_handler, int delete_handler, - GET_HANDLE get_handle, - IO_HANDLER input_h, - CL_HANDLER close_h, - SIG_HANDLER sig_h, - TO_HANDLER timeout_h, - IO_HANDLER output_h, - SET_HANDLE set_handle, - IO_HANDLER except_h) - : op_handler_ (op_handler), - input_handler_ (input_h), - output_handler_ (output_h), - except_handler_ (except_h), - to_handler_ (timeout_h), - cl_handler_ (close_h), - sig_handler_ (sig_h), - delete_handler_ (delete_handler), - set_handle_ (set_handle), - get_handle_ (get_handle) -{ - ACE_TRACE ("ACE_Event_Handler_T::ACE_Event_Handler_T"); -} - -template ACE_HANDLE -ACE_Event_Handler_T::get_handle (void) const -{ - ACE_TRACE ("ACE_Event_Handler_T::get_handle"); - return this->get_handle_ == 0 ? ACE_INVALID_HANDLE : (this->op_handler_->*get_handle_) (); -} - -template void -ACE_Event_Handler_T::set_handle (ACE_HANDLE h) -{ - ACE_TRACE ("ACE_Event_Handler_T::set_handle"); - if (this->set_handle_ != 0) - (this->op_handler_->*set_handle_) (h); -} - -template int -ACE_Event_Handler_T::handle_input (ACE_HANDLE fd) -{ - ACE_TRACE ("ACE_Event_Handler_T::handle_input"); - return this->input_handler_ == 0 ? 0 : (this->op_handler_->*input_handler_) (fd); -} - -template int -ACE_Event_Handler_T::handle_output (ACE_HANDLE fd) -{ - ACE_TRACE ("ACE_Event_Handler_T::handle_output"); - return this->output_handler_ == 0 ? 0 : (this->op_handler_->*output_handler_) (fd); -} - -template int -ACE_Event_Handler_T::handle_exception (ACE_HANDLE fd) -{ - ACE_TRACE ("ACE_Event_Handler_T::handle_exception"); - return this->except_handler_ == 0 ? 0 : (this->op_handler_->*except_handler_) (fd); -} - -template int -ACE_Event_Handler_T::handle_timeout (const ACE_Time_Value &tv, const void *arg) -{ - ACE_TRACE ("ACE_Event_Handler_T::handle_timeout"); - return this->to_handler_ == 0 ? 0 : (this->op_handler_->*to_handler_) (tv, arg); -} - -template int -ACE_Event_Handler_T::handle_close (ACE_HANDLE fd, ACE_Reactor_Mask close_mask) -{ - ACE_TRACE ("ACE_Event_Handler_T::handle_close"); - return this->cl_handler_ == 0 ? 0 : (this->op_handler_->*cl_handler_) (fd, close_mask); -} - -template int -ACE_Event_Handler_T::handle_signal (int signum, siginfo_t *s, ucontext_t *u) -{ - ACE_TRACE ("ACE_Event_Handler_T::handle_signal"); - return this->sig_handler_ == 0 ? 0 : (this->op_handler_->*sig_handler_) (signum, s, u); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_EVENT_HANDLER_T_CPP */ diff --git a/dep/acelite/ace/Event_Handler_T.h b/dep/acelite/ace/Event_Handler_T.h deleted file mode 100644 index 61ea28a1715..00000000000 --- a/dep/acelite/ace/Event_Handler_T.h +++ /dev/null @@ -1,188 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Event_Handler_T.h - * - * $Id: Event_Handler_T.h 91626 2010-09-07 10:59:20Z johnnyw $ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_EVENT_HANDLER_T_H -#define ACE_EVENT_HANDLER_T_H -#include /**/ "ace/pre.h" - -#include "ace/Event_Handler.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Event_Handler_T - * - * @brief Enable a class that doesn't inherit from the - * ACE_Event_Handler to be incorporated into the ACE_Reactor - * framework. Thanks to Greg Lavender (g.lavender@isode.com) - * for sharing this idea. - * - * It is sometimes the case that an application has a hierarchy - * of operation dispatcher classes that have their own - * inheritance hierarchy but also would like to integrate with - * the ACE_Reactor. Rather than adopt a "mixin" approach, it is - * often cleaner to define a template as a subclass of - * ACE_Event_Handler and parameterize it with an operation - * dispatcher type. - * When constructing an instantiation of the ACE_Event_Handler_T - * object, a set of pointers to member functions must be - * provided so that when one of the handle_* methods is called - * by the ACE_Reactor, the appropriate method is called on the - * underlying operations object. This is done since in some - * cases it is useful to map any event that happens to the same - * method on an object. - * The ACE_Event_Handler_T template is instantiated by an - * operations object and registered with the ACE_Reactor, and it - * then calls the appropriate op_handler. So, it's basically - * just another level of indirection in event dispatching. The - * coupling betweent the ultimate handler of the event and the - * ACE_Event_Handler class is relaxed a bit by have this - * intermediate object of type around. The - * client object can then dynamically change the bindings for - * the various handlers so that during the life of one of the - * operation objects, it can change how it wants events to be - * handled. It just instantiates a new instance of the template - * with different bindings and reregisters this new object with - * the ACE_Reactor. - */ -template -class ACE_Event_Handler_T : public ACE_Event_Handler -{ -public: - // = Typedefs to simplify pointer-to-member-function registration. - - // Get/set the underlying handle. - typedef ACE_HANDLE (T::*GET_HANDLE) (void) const; - typedef void (T::*SET_HANDLE) (ACE_HANDLE); - - /// Handle I/O events. - typedef int (T::*IO_HANDLER) (ACE_HANDLE); - - /// Handle timeout events. - typedef int (T::*TO_HANDLER) (const ACE_Time_Value &, const void *); - - /// Handle close events. - typedef int (T::*CL_HANDLER) (ACE_HANDLE, ACE_Reactor_Mask); - - /// = Initialization and termination methods. - typedef int (T::*SIG_HANDLER) (int, siginfo_t*, ucontext_t*); - - /// Initialize the op_handler. - ACE_Event_Handler_T (T *op_handler, - int delete_handler, - GET_HANDLE get_handle = 0, - IO_HANDLER input = 0, - CL_HANDLER close = 0, - SIG_HANDLER sig = 0, - TO_HANDLER timeout = 0, - IO_HANDLER output = 0, - SET_HANDLE set_handle = 0, - IO_HANDLER except = 0); - - /// Close down and delete the - ~ACE_Event_Handler_T (void); - - // = Override all the ACE_Event_Handler methods. - - // These methods all delegate down to the operations handler. - virtual ACE_HANDLE get_handle (void) const; - virtual void set_handle (ACE_HANDLE); - virtual int handle_input (ACE_HANDLE fd = ACE_INVALID_HANDLE); - virtual int handle_output (ACE_HANDLE fd = ACE_INVALID_HANDLE); - virtual int handle_exception (ACE_HANDLE fd = ACE_INVALID_HANDLE); - virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg = 0); - virtual int handle_close (ACE_HANDLE fd, ACE_Reactor_Mask close_mask); - virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0); - - // = Get/set the operations handler. - T *op_handler (void); - void op_handler (T *); - - // = Get/set the target pointer-to-method used for dispatching. - - GET_HANDLE handle_get (void); - void handle_get (GET_HANDLE); - - SET_HANDLE handle_set (void); - void handle_set (SET_HANDLE); - - IO_HANDLER input_handler (void); - void input_handler (IO_HANDLER); - - IO_HANDLER output_handler (void); - void output_handler (IO_HANDLER); - - IO_HANDLER except_handler (void); - void except_handler (IO_HANDLER); - - TO_HANDLER to_handler (void); - void to_handler (TO_HANDLER); - - CL_HANDLER cl_handler (void); - void cl_handler (CL_HANDLER); - - SIG_HANDLER sig_handler (void); - void sig_handler (SIG_HANDLER); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Pointer to the object that handles all the delegated operations. - T *op_handler_; - - // = Handle input, output, and exception events. - IO_HANDLER input_handler_; - IO_HANDLER output_handler_; - IO_HANDLER except_handler_; - - /// Handle timeout events. - TO_HANDLER to_handler_; - - /// Handle close events. - CL_HANDLER cl_handler_; - - /// Handle signal events. - SIG_HANDLER sig_handler_; - - /// Keeps track of whether we need to delete the handler in the - /// destructor. - int delete_handler_; - - // = Get/set underlying handle. - SET_HANDLE set_handle_; - GET_HANDLE get_handle_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Event_Handler_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Event_Handler_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Event_Handler_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_EVENT_HANDLER_H */ diff --git a/dep/acelite/ace/Event_Handler_T.inl b/dep/acelite/ace/Event_Handler_T.inl deleted file mode 100644 index 9c209f9812a..00000000000 --- a/dep/acelite/ace/Event_Handler_T.inl +++ /dev/null @@ -1,134 +0,0 @@ -// -*- C++ -*- -// $Id: Event_Handler_T.inl 91626 2010-09-07 10:59:20Z johnnyw $ - -#include "ace/Global_Macros.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE void -ACE_Event_Handler_T::op_handler (T *op) -{ - ACE_TRACE ("ACE_Event_Handler_T::op_handler"); - this->op_handler_ = op; -} - -template ACE_INLINE T * -ACE_Event_Handler_T::op_handler (void) -{ - ACE_TRACE ("ACE_Event_Handler_T::op_handler"); - return this->op_handler_; -} - -template ACE_INLINE typename ACE_Event_Handler_T::GET_HANDLE -ACE_Event_Handler_T::handle_get (void) -{ - ACE_TRACE ("ACE_Event_Handler_T::handle_get"); - return this->get_handle_; -} - -template ACE_INLINE void -ACE_Event_Handler_T::handle_get (typename ACE_Event_Handler_T::GET_HANDLE h) -{ - ACE_TRACE ("ACE_Event_Handler_T::handle_get"); - this->get_handle_ = h; -} - -template ACE_INLINE typename ACE_Event_Handler_T::SET_HANDLE -ACE_Event_Handler_T::handle_set (void) -{ - ACE_TRACE ("ACE_Event_Handler_T::handle_set"); - return this->set_handle_; -} - -template ACE_INLINE void -ACE_Event_Handler_T::handle_set (typename ACE_Event_Handler_T::SET_HANDLE h) -{ - ACE_TRACE ("ACE_Event_Handler_T::handle_set"); - this->set_handle_ = h; -} - -template ACE_INLINE typename ACE_Event_Handler_T::IO_HANDLER -ACE_Event_Handler_T::input_handler (void) -{ - ACE_TRACE ("ACE_Event_Handler_T::input_handler"); - return this->input_handler_; -} - -template ACE_INLINE void -ACE_Event_Handler_T::input_handler (typename ACE_Event_Handler_T::IO_HANDLER h) -{ - ACE_TRACE ("ACE_Event_Handler_T::input_handler"); - this->input_handler_ = h; -} - -template ACE_INLINE typename ACE_Event_Handler_T::IO_HANDLER -ACE_Event_Handler_T::output_handler (void) -{ - ACE_TRACE ("ACE_Event_Handler_T::output_handler"); - return this->output_handler_; -} - -template ACE_INLINE void -ACE_Event_Handler_T::output_handler (typename ACE_Event_Handler_T::IO_HANDLER h) -{ - ACE_TRACE ("ACE_Event_Handler_T::output_handler"); - this->output_handler_ = h; -} - -template ACE_INLINE typename ACE_Event_Handler_T::IO_HANDLER -ACE_Event_Handler_T::except_handler (void) -{ - ACE_TRACE ("ACE_Event_Handler_T::except_handler"); - return this->except_handler_; -} - -template ACE_INLINE void -ACE_Event_Handler_T::except_handler (typename ACE_Event_Handler_T::IO_HANDLER h) -{ - ACE_TRACE ("ACE_Event_Handler_T::except_handler"); - this->except_handler_ = h; -} - -template ACE_INLINE typename ACE_Event_Handler_T::TO_HANDLER -ACE_Event_Handler_T::to_handler (void) -{ - ACE_TRACE ("ACE_Event_Handler_T::to_handler"); - return this->to_handler_; -} - -template ACE_INLINE void -ACE_Event_Handler_T::to_handler (typename ACE_Event_Handler_T::TO_HANDLER h) -{ - ACE_TRACE ("ACE_Event_Handler_T::to_handler"); - this->to_handler_ = h; -} - -template ACE_INLINE typename ACE_Event_Handler_T::CL_HANDLER -ACE_Event_Handler_T::cl_handler (void) -{ - ACE_TRACE ("ACE_Event_Handler_T::cl_handler"); - return this->cl_handler_; -} - -template ACE_INLINE void -ACE_Event_Handler_T::cl_handler (typename ACE_Event_Handler_T::CL_HANDLER h) -{ - ACE_TRACE ("ACE_Event_Handler_T::cl_handler"); - this->cl_handler_ = h; -} - -template ACE_INLINE typename ACE_Event_Handler_T::SIG_HANDLER -ACE_Event_Handler_T::sig_handler (void) -{ - ACE_TRACE ("ACE_Event_Handler_T::sig_handler"); - return this->sig_handler_; -} - -template ACE_INLINE void -ACE_Event_Handler_T::sig_handler (typename ACE_Event_Handler_T::SIG_HANDLER h) -{ - ACE_TRACE ("ACE_Event_Handler_T::sig_handler"); - this->sig_handler_ = h; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/FIFO.cpp b/dep/acelite/ace/FIFO.cpp deleted file mode 100644 index a4d7ba1d0b9..00000000000 --- a/dep/acelite/ace/FIFO.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// $Id: FIFO.cpp 94034 2011-05-09 19:11:03Z johnnyw $ - -#include "ace/FIFO.h" - -#if !defined (__ACE_INLINE__) -#include "ace/FIFO.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Log_Msg.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_errno.h" -#include "ace/OS_NS_sys_stat.h" -#include "ace/OS_NS_fcntl.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_FIFO) - -void -ACE_FIFO::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_FIFO::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("rendezvous_ = %s"), this->rendezvous_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -int -ACE_FIFO::open (const ACE_TCHAR *r, int flags, mode_t perms, - LPSECURITY_ATTRIBUTES sa) -{ - ACE_TRACE ("ACE_FIFO::open"); - ACE_OS::strsncpy (this->rendezvous_, r, MAXPATHLEN); - - if ((flags & O_CREAT) != 0 - && ACE_OS::mkfifo (this->rendezvous_, perms) == -1 - && !(errno == EEXIST)) - return -1; - - this->set_handle (ACE_OS::open (this->rendezvous_, flags, 0, sa)); - return this->get_handle () == ACE_INVALID_HANDLE ? -1 : 0; -} - -ACE_FIFO::ACE_FIFO (const ACE_TCHAR *fifo_name, - int flags, - mode_t perms, - LPSECURITY_ATTRIBUTES sa) -{ - ACE_TRACE ("ACE_FIFO::ACE_FIFO"); - if (this->open (fifo_name, flags, perms, sa) == -1) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_FIFO"))); -} - -ACE_FIFO::ACE_FIFO (void) -{ -// ACE_TRACE ("ACE_FIFO::ACE_FIFO"); -} - -int -ACE_FIFO::close (void) -{ - ACE_TRACE ("ACE_FIFO::close"); - int result = 0; - - if (this->get_handle () != ACE_INVALID_HANDLE) - { - result = ACE_OS::close (this->get_handle ()); - this->set_handle (ACE_INVALID_HANDLE); - } - return result; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/FIFO.h b/dep/acelite/ace/FIFO.h deleted file mode 100644 index f4836368d74..00000000000 --- a/dep/acelite/ace/FIFO.h +++ /dev/null @@ -1,99 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file FIFO.h - * - * $Id: FIFO.h 91574 2010-08-30 16:52:24Z shuston $ - * - * @author Doug Schmidt - */ -//========================================================================== - - -#ifndef ACE_FIFO_H -#define ACE_FIFO_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/IPC_SAP.h" -#include "ace/os_include/os_limits.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_FIFO - * - * @brief Abstract base class for UNIX FIFOs - * - * UNIX FIFOs are also known Named Pipes, which are totally - * unrelated to Windows Named Pipes. If you want to use a local - * IPC mechanism that will be portable to both UNIX and Windows, - * take a look at the ACE_Pipe or ACE_SPIPE_Stream classes. - */ -class ACE_Export ACE_FIFO : public ACE_IPC_SAP -{ -public: - /** - * Open up the named pipe (FIFO) on the @a rendezvous point in accordance - * with the @a flags. - * - * If @a flags contains @c O_CREAT open() will attempt to call mkfifo() - * to create the FIFO before opening it. In this case, this method - * will not fail simply because the fifo already exists. - * - * @retval 0 for success - * @retval -1 for error; errno contains the error code. - */ - int open (const ACE_TCHAR *rendezvous, int flags, mode_t perms, - LPSECURITY_ATTRIBUTES sa = 0); - - /// Close down the ACE_FIFO without removing the rendezvous point. - int close (void); - - /// Close down the ACE_FIFO and remove the rendezvous point from the - /// file system. - int remove (void); - - /// Return the local address of this endpoint. - int get_local_addr (const ACE_TCHAR *&rendezvous) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /** - * Protected constructors ensure this class cannot be used directly. - * User code must use ACE_FIFO_Send and/or ACE_FIFO_Recv. - */ - //@{ - /// Default constructor. - ACE_FIFO (void); - - /// Open up the named pipe on the @a rendezvous in accordance with the - /// flags. - ACE_FIFO (const ACE_TCHAR *rendezvous, int flags, mode_t perms, - LPSECURITY_ATTRIBUTES sa = 0); - //@} - -private: - /// Rendezvous point in the file system. - ACE_TCHAR rendezvous_[MAXPATHLEN + 1]; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/FIFO.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_FIFO_H */ diff --git a/dep/acelite/ace/FIFO.inl b/dep/acelite/ace/FIFO.inl deleted file mode 100644 index 05cc030a917..00000000000 --- a/dep/acelite/ace/FIFO.inl +++ /dev/null @@ -1,25 +0,0 @@ -// -*- C++ -*- -// -// $Id: FIFO.inl 80826 2008-03-04 14:51:23Z wotte $ - -#include "ace/OS_NS_unistd.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -ACE_FIFO::get_local_addr (const ACE_TCHAR *&r) const -{ - ACE_TRACE ("ACE_FIFO::get_local_addr"); - r = this->rendezvous_; - return 0; -} - -ACE_INLINE int -ACE_FIFO::remove (void) -{ - ACE_TRACE ("ACE_FIFO::remove"); - int const result = this->close (); - return ACE_OS::unlink (this->rendezvous_) == -1 || result == -1 ? -1 : 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/FIFO_Recv.cpp b/dep/acelite/ace/FIFO_Recv.cpp deleted file mode 100644 index 37700ddaf67..00000000000 --- a/dep/acelite/ace/FIFO_Recv.cpp +++ /dev/null @@ -1,88 +0,0 @@ -// $Id: FIFO_Recv.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/FIFO_Recv.h" -#include "ace/Log_Msg.h" -#include "ace/OS_NS_fcntl.h" - -#if !defined (__ACE_INLINE__) -#include "ace/FIFO_Recv.inl" -#endif /* __ACE_INLINE__ */ - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Recv) - -void -ACE_FIFO_Recv::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_FIFO_Recv::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_FIFO::dump (); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("aux_handle_ = %d"), this->aux_handle_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -int -ACE_FIFO_Recv::close (void) -{ - ACE_TRACE ("ACE_FIFO_Recv::close"); - int result = ACE_FIFO::close (); - - if (this->aux_handle_ != ACE_INVALID_HANDLE) - return ACE_OS::close (this->aux_handle_); - else - return result; -} - -// Note that persistent means "open fifo for writing, as well as -// reading." This ensures that the fifo never gets EOF, even if there -// aren't any writers at the moment! - -int -ACE_FIFO_Recv::open (const ACE_TCHAR *fifo_name, - int flags, - mode_t perms, - int persistent, - LPSECURITY_ATTRIBUTES sa) -{ - ACE_TRACE ("ACE_FIFO_Recv::open"); - - if (ACE_FIFO::open (fifo_name, ACE_NONBLOCK | flags, perms, sa) == -1) - return -1; - else if (this->disable (ACE_NONBLOCK) == -1) - return -1; - else if (persistent - && (this->aux_handle_ = ACE_OS::open (fifo_name, O_WRONLY, 0, sa)) == ACE_INVALID_HANDLE) - return -1; - else - return this->get_handle () == ACE_INVALID_HANDLE ? -1 : 0; -} - -ACE_FIFO_Recv::ACE_FIFO_Recv (void) - : aux_handle_ (ACE_INVALID_HANDLE) -{ - ACE_TRACE ("ACE_FIFO_Recv::ACE_FIFO_Recv"); -} - -ACE_FIFO_Recv::ACE_FIFO_Recv (const ACE_TCHAR *fifo_name, - int flags, - mode_t perms, - int persistent, - LPSECURITY_ATTRIBUTES sa) - : aux_handle_ (ACE_INVALID_HANDLE) -{ - ACE_TRACE ("ACE_FIFO_Recv::ACE_FIFO_Recv"); - - if (this->ACE_FIFO_Recv::open (fifo_name, - flags, - perms, - persistent, - sa) == -1) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_FIFO_Recv"))); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/FIFO_Recv.h b/dep/acelite/ace/FIFO_Recv.h deleted file mode 100644 index 2b6b2f25c59..00000000000 --- a/dep/acelite/ace/FIFO_Recv.h +++ /dev/null @@ -1,96 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file FIFO_Recv.h - * - * $Id: FIFO_Recv.h 91574 2010-08-30 16:52:24Z shuston $ - * - * @author Doug Schmidt - */ -//========================================================================== - - -#ifndef ACE_FIFO_RECV_H -#define ACE_FIFO_RECV_H - -#include /**/ "ace/pre.h" - -#include "ace/FIFO.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_fcntl.h" -#include "ace/Default_Constants.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_FIFO_Recv - * - * @brief Receiver side of the bytestream C++ wrapper for UNIX - * FIFOs. - */ -class ACE_Export ACE_FIFO_Recv : public ACE_FIFO -{ -public: - /// @name Initialization methods. - /// - /// Note that @c ACE_NONBLOCK will be added to any @a flags value passed. - /// This causes the open to succeed even if no writer has yet opened the - /// fifo. There is no way to disable this behavior. - /// - /// @arg persistent Means "open fifo for writing, as well as - /// reading." This ensures that the fifo never gets EOF, even if there - /// aren't any writers at the moment! - //@{ - - /// Default constructor. - ACE_FIFO_Recv (void); - - /// Open up a bytestream named pipe for reading. - ACE_FIFO_Recv (const ACE_TCHAR *rendezvous, - int flags = O_CREAT | O_RDONLY, - mode_t perms = ACE_DEFAULT_FILE_PERMS, - int persistent = 1, - LPSECURITY_ATTRIBUTES sa = 0); - - /// Open up a bytestream named pipe for reading. - int open (const ACE_TCHAR *rendezvous, - int flags = O_CREAT | O_RDONLY, - mode_t perms = ACE_DEFAULT_FILE_PERMS, - int persistent = 1, - LPSECURITY_ATTRIBUTES sa = 0); - //@} - - /// Close down the fifo. - int close (void); - - /// Recv @a buf of up to @a len bytes. - ssize_t recv (void *buf, size_t len); - - /// Recv @a buf of exactly @a len bytes (block until done). - ssize_t recv_n (void *buf, size_t len); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Auxiliary handle that is used to implement persistent FIFOs. - ACE_HANDLE aux_handle_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/FIFO_Recv.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_FIFO_RECV_H */ diff --git a/dep/acelite/ace/FIFO_Recv.inl b/dep/acelite/ace/FIFO_Recv.inl deleted file mode 100644 index d4c3fee4326..00000000000 --- a/dep/acelite/ace/FIFO_Recv.inl +++ /dev/null @@ -1,24 +0,0 @@ -// -*- C++ -*- -// -// $Id: FIFO_Recv.inl 80826 2008-03-04 14:51:23Z wotte $ - -#include "ace/ACE.h" -#include "ace/OS_NS_unistd.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE ssize_t -ACE_FIFO_Recv::recv (void *buf, size_t len) -{ - ACE_TRACE ("ACE_FIFO_Recv::recv"); - return ACE_OS::read (this->get_handle (), (char *) buf, len); -} - -ACE_INLINE ssize_t -ACE_FIFO_Recv::recv_n (void *buf, size_t n) -{ - ACE_TRACE ("ACE_FIFO_Recv::recv_n"); - return ACE::recv_n (this->get_handle (), buf, n); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/FIFO_Recv_Msg.cpp b/dep/acelite/ace/FIFO_Recv_Msg.cpp deleted file mode 100644 index 9d041d558cc..00000000000 --- a/dep/acelite/ace/FIFO_Recv_Msg.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// $Id: FIFO_Recv_Msg.cpp 93359 2011-02-11 11:33:12Z mcorino $ - -#include "ace/FIFO_Recv_Msg.h" - -#include "ace/Log_Msg.h" - -#if !defined (__ACE_INLINE__) -#include "ace/FIFO_Recv_Msg.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Recv_Msg) - -void -ACE_FIFO_Recv_Msg::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_FIFO_Recv_Msg::dump"); - ACE_FIFO_Recv::dump (); -#endif /* ACE_HAS_DUMP */ -} - -// Note that persistent means "open FIFO for writing, as well as -// reading." This ensures that the FIFO never gets EOF, even if there -// aren't any writers at the moment! - -int -ACE_FIFO_Recv_Msg::open (const ACE_TCHAR *fifo_name, - int flags, - mode_t perms, - int persistent, - LPSECURITY_ATTRIBUTES sa) -{ - ACE_TRACE ("ACE_FIFO_Recv_Msg::open"); - - return ACE_FIFO_Recv::open (fifo_name, - flags, - perms, - persistent, - sa); -} - -ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg (void) -{ - ACE_TRACE ("ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg"); -} - -ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg (const ACE_TCHAR *fifo_name, - int flags, - mode_t perms, - int persistent, - LPSECURITY_ATTRIBUTES sa) -{ - ACE_TRACE ("ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg"); - - if (this->ACE_FIFO_Recv_Msg::open (fifo_name, - flags, - perms, - persistent, - sa) == -1) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_FIFO_Recv_Msg"))); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/FIFO_Recv_Msg.h b/dep/acelite/ace/FIFO_Recv_Msg.h deleted file mode 100644 index 6b691e97f10..00000000000 --- a/dep/acelite/ace/FIFO_Recv_Msg.h +++ /dev/null @@ -1,138 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file FIFO_Recv_Msg.h - * - * $Id: FIFO_Recv_Msg.h 84480 2009-02-16 18:58:16Z johnnyw $ - * - * @author Doug Schmidt - */ -//============================================================================= - - -#ifndef ACE_FIFO_RECV_MSG_H -#define ACE_FIFO_RECV_MSG_H -#include /**/ "ace/pre.h" - -#include "ace/FIFO_Recv.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward decls -class ACE_Str_Buf; - -/** - * @class ACE_FIFO_Recv_Msg - * - * @brief Receiver side for the record oriented C++ wrapper for UNIX FIFOs. - * - * This method works slightly differently on platforms with the - * @c ACE_HAS_STREAM_PIPES configuration setting than those without. - * With ACE_HAS_STREAM_PIPES, the @c getmsg() system function is used - * and it preserves message boundaries internally. Without - * @c ACE_HAS_STREAM_PIPES, the message boundaries are emulated by - * this class and ACE_FIFO_Send_Msg cooperating. The sending class - * first writes an integer number of bytes in the message, then the - * message. ACE_FIFO_Recv_Msg reads the count, then the data. - * The operational differences occur primarily when a message is larger - * than what a caller of this class requests. See recv() for details. - */ -class ACE_Export ACE_FIFO_Recv_Msg : public ACE_FIFO_Recv -{ -public: - // = Initialization methods. - /// Default constructor. - ACE_FIFO_Recv_Msg (void); - - /// Open up a record-oriented named pipe for reading. - ACE_FIFO_Recv_Msg (const ACE_TCHAR *rendezvous, - int flags = O_CREAT | O_RDONLY, - mode_t perms = ACE_DEFAULT_FILE_PERMS, - int persistent = 1, - LPSECURITY_ATTRIBUTES sa = 0); - - /// Open up a record-oriented named pipe for reading. - int open (const ACE_TCHAR *rendezvous, - int flags = O_CREAT | O_RDONLY, - mode_t perms = ACE_DEFAULT_FILE_PERMS, - int persistent = 1, - LPSECURITY_ATTRIBUTES sa = 0); - - /// Receive a message based on attributes in an ACE_Str_Buf. - /** - * @param msg Reference to an ACE_Str_Buf whose @c buf member points - * to the memory to receive the data and @c maxlen member - * contains the maximum number of bytes to receive. - * On return after successfully reading data, the - * @c len member contains the number of bytes received and - * placed in the buffer pointed to by @c msg.buf. - * - * @retval -1 Error; consult @c errno for specific error number. - * @return If the @c ACE_HAS_STREAM_PIPES configuration setting is - * defined, the return value is the number of bytes received - * in the message and will be the same as @c buf.len. - * The return value from the @c getmsg() system function - * is discarded. - * If @c ACE_HAS_STREAM_PIPES is not defined, the number - * of bytes in the message read from the FIFO is returned. - * If the message is larger than the maximum length - * requested in @c msg.maxlen, the return value reflects - * the entire message length, and the @c msg.len member - * reflects how many bytes were actually placed in the - * caller's buffer. Any part of the message longer than - * @c msg.maxlen is discarded. - */ - ssize_t recv (ACE_Str_Buf &msg); - - /// Receive a message based on buffer pointer and maximum size. - /** - * @param buf Pointer to the memory to receive the data. - * @param len The maximum number of bytes to receive. - * - * @retval -1 Error; consult @c errno for specific error number. - * @return The number of bytes received in the message. For messages - * that are larger than the requested maximum size, the - * behavior is different depending on the @c ACE_HAS_STREAM_PIPES - * configuration setting. With @c ACE_HAS_STREAM_PIPES, - * the return value will be the same as @arg len (this is - * also possible if the message is exactly the same length - * as @arg len, and the two cases are indistinguishable). - * Without @c ACE_HAS_STREAM_PIPES, the return value is - * the total length of the message, including bytes in - * excess of @arg len. The excess bytes are discarded. - */ - ssize_t recv (void *buf, size_t len); - -#if defined (ACE_HAS_STREAM_PIPES) - /// Recv @a data and @a cntl message via Stream pipes. - ssize_t recv (ACE_Str_Buf *data, - ACE_Str_Buf *cntl, - int *flags); - - /// Recv @a data and @a cntl message via Stream pipes in "band" mode. - ssize_t recv (int *band, - ACE_Str_Buf *data, - ACE_Str_Buf *cntl, - int *flags); -#endif /* ACE_HAS_STREAM_PIPES */ - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/FIFO_Recv_Msg.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_FIFO_RECV_MSG_H */ diff --git a/dep/acelite/ace/FIFO_Recv_Msg.inl b/dep/acelite/ace/FIFO_Recv_Msg.inl deleted file mode 100644 index d6dfc369d90..00000000000 --- a/dep/acelite/ace/FIFO_Recv_Msg.inl +++ /dev/null @@ -1,137 +0,0 @@ -// -*- C++ -*- -// -// $Id: FIFO_Recv_Msg.inl 91813 2010-09-17 07:52:52Z johnnyw $ - -#include "ace/Min_Max.h" -#include "ace/OS_NS_stropts.h" -#include "ace/Truncate.h" - -#if !defined (ACE_HAS_STREAM_PIPES) -#include "ace/OS_NS_unistd.h" -#endif - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE ssize_t -ACE_FIFO_Recv_Msg::recv (ACE_Str_Buf &recv_msg) -{ - ACE_TRACE ("ACE_FIFO_Recv_Msg::recv"); -#if defined (ACE_HAS_STREAM_PIPES) - int i = 0; - if (ACE_OS::getmsg (this->get_handle (), - (strbuf *) 0, - (strbuf *) &recv_msg, - &i) == -1) - { - return -1; - } - else - { - return recv_msg.len; - } -#else /* Do the ol' 2-read trick... */ - if (ACE_OS::read (this->get_handle (), - (char *) &recv_msg.len, - sizeof recv_msg.len) != sizeof recv_msg.len) - { - return -1; - } - else - { - size_t remaining = static_cast (recv_msg.len); - size_t requested = static_cast (recv_msg.maxlen); - ssize_t recv_len = ACE_OS::read (this->get_handle (), - (char *) recv_msg.buf, - ACE_MIN (remaining, requested)); - - if (recv_len == -1) - { - return -1; - } - - // Tell caller what's really in the buffer. - recv_msg.len = static_cast (recv_len); - - // If there are more bytes remaining in the message, read them and - // throw them away. Leaving them in the FIFO would make it difficult - // to find the start of the next message in the fifo. - // Since the ACE_HAS_STREAM_PIPES version of this method doesn't - // return getmsg()'s indication of "data remaining", don't worry about - // saving the indication here either to read the remainder later. - size_t total_msg_size = remaining; - remaining -= recv_len; - - while (remaining > 0) - { - const size_t throw_away = 1024; - char dev_null[throw_away]; - recv_len = ACE_OS::read (this->get_handle (), - dev_null, - ACE_MIN (remaining, throw_away)); - - if (recv_len == -1) - { - break; - } - - remaining -= recv_len; - } - - return ACE_Utils::truncate_cast (total_msg_size); - } -#endif /* ACE_HAS_STREAM_PIPES */ -} - -ACE_INLINE ssize_t -ACE_FIFO_Recv_Msg::recv (void *buf, size_t max_len) -{ - ACE_TRACE ("ACE_FIFO_Recv_Msg::recv"); - ACE_Str_Buf recv_msg ((char *) buf, 0, static_cast (max_len)); - - return this->recv (recv_msg); -} - -#if defined (ACE_HAS_STREAM_PIPES) -ACE_INLINE ssize_t -ACE_FIFO_Recv_Msg::recv (ACE_Str_Buf *data, - ACE_Str_Buf *cntl, - int *flags) -{ - ACE_TRACE ("ACE_FIFO_Recv_Msg::recv"); - if (ACE_OS::getmsg (this->get_handle (), - (strbuf *) cntl, - (strbuf *) data, - flags) == -1) - { - return -1; - } - else - { - return (cntl == 0 ? 0 : cntl->len) + (data == 0 ? 0 : data->len); - } -} - -ACE_INLINE ssize_t -ACE_FIFO_Recv_Msg::recv (int *band, - ACE_Str_Buf *data, - ACE_Str_Buf *cntl, - int *flags) -{ - ACE_TRACE ("ACE_FIFO_Recv_Msg::recv"); - - if (ACE_OS::getpmsg (this->get_handle (), - (strbuf *) cntl, - (strbuf *) data, - band, - flags) == -1) - { - return -1; - } - else - { - return (cntl == 0 ? 0 : cntl->len) + (data == 0 ? 0 : data->len); - } -} -#endif /* ACE_HAS_STREAM_PIPES */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/FIFO_Send.cpp b/dep/acelite/ace/FIFO_Send.cpp deleted file mode 100644 index 93df476ae5a..00000000000 --- a/dep/acelite/ace/FIFO_Send.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// $Id: FIFO_Send.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/FIFO_Send.h" -#include "ace/Log_Msg.h" - -#if !defined (__ACE_INLINE__) -#include "ace/FIFO_Send.inl" -#endif /* __ACE_INLINE__ */ - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Send) - -void -ACE_FIFO_Send::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_FIFO_Send::dump"); - ACE_FIFO::dump (); -#endif /* ACE_HAS_DUMP */ -} - -ACE_FIFO_Send::ACE_FIFO_Send (void) -{ -// ACE_TRACE ("ACE_FIFO_Send::ACE_FIFO_Send"); -} - -int -ACE_FIFO_Send::open (const ACE_TCHAR *rendezvous_name, - int flags, - mode_t perms, - LPSECURITY_ATTRIBUTES sa) -{ - ACE_TRACE ("ACE_FIFO_Send::open"); - return ACE_FIFO::open (rendezvous_name, - flags | O_WRONLY, - perms, - sa); -} - -ACE_FIFO_Send::ACE_FIFO_Send (const ACE_TCHAR *fifo_name, - int flags, - mode_t perms, - LPSECURITY_ATTRIBUTES sa) -{ - ACE_TRACE ("ACE_FIFO_Send::ACE_FIFO_Send"); - if (this->ACE_FIFO_Send::open (fifo_name, - flags, - perms, - sa) == -1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_FIFO_Send::ACE_FIFO_Send"))); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/FIFO_Send.h b/dep/acelite/ace/FIFO_Send.h deleted file mode 100644 index c6bf6002303..00000000000 --- a/dep/acelite/ace/FIFO_Send.h +++ /dev/null @@ -1,81 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file FIFO_Send.h - * - * $Id: FIFO_Send.h 91574 2010-08-30 16:52:24Z shuston $ - * - * @author Doug Schmidt - */ -//========================================================================== - - -#ifndef ACE_FIFO_SEND_H -#define ACE_FIFO_SEND_H - -#include /**/ "ace/pre.h" - -#include "ace/FIFO.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/os_fcntl.h" -#include "ace/Default_Constants.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_FIFO_Send - * - * @brief Sender side for the bytestream C++ wrapper for UNIX FIFOs - */ -class ACE_Export ACE_FIFO_Send : public ACE_FIFO -{ -public: - /// @name Initialization methods. - /// - /// Note that @c O_WRONLY will be added to any @a flags value passed. - /// Default behavior is to block until a receiver also opens the fifo. - /// To use non-blocking behavior include ACE_NONBLOCK in @a flags. - //@{ - /// Default constructor. - ACE_FIFO_Send (void); - - /// Open up a bytestream named pipe for writing. - ACE_FIFO_Send (const ACE_TCHAR *rendezvous, - int flags = O_WRONLY, - mode_t perms = ACE_DEFAULT_FILE_PERMS, - LPSECURITY_ATTRIBUTES sa = 0); - - /// Open up a bytestream named pipe for writing. - int open (const ACE_TCHAR *rendezvous, - int flags = O_WRONLY, - mode_t perms = ACE_DEFAULT_FILE_PERMS, - LPSECURITY_ATTRIBUTES sa = 0); - //@} - - /// Send @a buf of up to @a len bytes. - ssize_t send (const void *buf, size_t len); - - /// Send @a buf of exactly @a len bytes (block until done). - ssize_t send_n (const void *buf, size_t len); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/FIFO_Send.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_FIFO_SEND_H */ diff --git a/dep/acelite/ace/FIFO_Send.inl b/dep/acelite/ace/FIFO_Send.inl deleted file mode 100644 index a01facd61f0..00000000000 --- a/dep/acelite/ace/FIFO_Send.inl +++ /dev/null @@ -1,24 +0,0 @@ -// -*- C++ -*- -// -// $Id: FIFO_Send.inl 80826 2008-03-04 14:51:23Z wotte $ - -#include "ace/ACE.h" -#include "ace/OS_NS_unistd.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE ssize_t -ACE_FIFO_Send::send (const void *buf, size_t len) -{ - ACE_TRACE ("ACE_FIFO_Send::send"); - return ACE_OS::write (this->get_handle (), (const char *) buf, len); -} - -ACE_INLINE ssize_t -ACE_FIFO_Send::send_n (const void *buf, size_t n) -{ - ACE_TRACE ("ACE_FIFO_Send::send_n"); - return ACE::send_n (this->get_handle (), buf, n); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/FIFO_Send_Msg.cpp b/dep/acelite/ace/FIFO_Send_Msg.cpp deleted file mode 100644 index a54295c2733..00000000000 --- a/dep/acelite/ace/FIFO_Send_Msg.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// $Id: FIFO_Send_Msg.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/FIFO_Send_Msg.h" - -#include "ace/Log_Msg.h" -#include "ace/OS_NS_sys_uio.h" - -#if !defined (__ACE_INLINE__) -#include "ace/FIFO_Send_Msg.inl" -#endif /* __ACE_INLINE__ */ - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Send_Msg) - -void -ACE_FIFO_Send_Msg::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_FIFO_Send_Msg::dump"); - ACE_FIFO_Send::dump (); -#endif /* ACE_HAS_DUMP */ -} - -ssize_t -ACE_FIFO_Send_Msg::send (const ACE_Str_Buf &send_msg) -{ - // ACE_TRACE ("ACE_FIFO_Send_Msg::send"); -#if defined (ACE_HAS_STREAM_PIPES) - if (ACE_OS::putmsg (this->get_handle (), - (strbuf *) 0, - (strbuf *) &send_msg, - 0) == -1) - return -1; - else - return send_msg.len; -#else - iovec iov[2]; - - iov[0].iov_base = (char *) &send_msg.len; - iov[0].iov_len = sizeof send_msg.len; - - iov[1].iov_base = (char *) send_msg.buf; - iov[1].iov_len = static_cast (send_msg.len); - - ssize_t sent = ACE_OS::writev (this->get_handle (), iov, 2); - if (sent > 0) - sent -= iov[0].iov_len; // Don't count the length we added. - return sent; -#endif /* ACE_HAS_STREAM_PIPES */ -} - -ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg (void) -{ -// ACE_TRACE ("ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg"); -} - -int -ACE_FIFO_Send_Msg::open (const ACE_TCHAR *fifo_name, - int flags, - mode_t perms, - LPSECURITY_ATTRIBUTES sa) -{ - ACE_TRACE ("ACE_FIFO_Send_Msg::open"); - return ACE_FIFO_Send::open (fifo_name, flags | O_WRONLY, perms, sa); -} - -ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg (const ACE_TCHAR *fifo_name, - int flags, - mode_t perms, - LPSECURITY_ATTRIBUTES sa) -{ - ACE_TRACE ("ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg"); - if (this->ACE_FIFO_Send_Msg::open (fifo_name, flags, perms, sa) == -1) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_FIFO_Send_Msg"))); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/FIFO_Send_Msg.h b/dep/acelite/ace/FIFO_Send_Msg.h deleted file mode 100644 index 434ae108130..00000000000 --- a/dep/acelite/ace/FIFO_Send_Msg.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file FIFO_Send_Msg.h - * - * $Id: FIFO_Send_Msg.h 84480 2009-02-16 18:58:16Z johnnyw $ - * - * @author Doug Schmidt - */ -//============================================================================= - - -#ifndef ACE_FIFO_SEND_MSG_H -#define ACE_FIFO_SEND_MSG_H -#include /**/ "ace/pre.h" - -#include "ace/FIFO_Send.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_STREAM_PIPES) -# include "ace/OS_NS_stropts.h" -#endif /* ACE_HAS_STREAM_PIPES */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward Decls -class ACE_Str_Buf; - -/** - * @class ACE_FIFO_Send_Msg - * - * @brief Sender side for the Record oriented C++ wrapper for UNIX - * FIFOs. - */ -class ACE_Export ACE_FIFO_Send_Msg : public ACE_FIFO_Send -{ -public: - // = Initialization methods. - /// Default constructor. - ACE_FIFO_Send_Msg (void); - - /// Open up a record-oriented named pipe for writing. - ACE_FIFO_Send_Msg (const ACE_TCHAR *rendezvous, - int flags = O_WRONLY, - mode_t perms = ACE_DEFAULT_FILE_PERMS, - LPSECURITY_ATTRIBUTES sa = 0); - - /// Open up a record-oriented named pipe for writing. - int open (const ACE_TCHAR *rendezvous, - int flags = O_WRONLY, - mode_t perms = ACE_DEFAULT_FILE_PERMS, - LPSECURITY_ATTRIBUTES sa = 0); - - /// Send @a buf of up to @a len bytes. - ssize_t send (const ACE_Str_Buf &msg); - - /// Send @a buf of exactly @a len bytes (block until done). - ssize_t send (const void *buf, size_t len); - -#if defined (ACE_HAS_STREAM_PIPES) - /// Send @a data and @a cntl message via Stream pipes. - ssize_t send (const ACE_Str_Buf *data, - const ACE_Str_Buf *cntl = 0, - int flags = 0); - - /// Send @a data and @a cntl message via Stream pipes in "band" mode. - ssize_t send (int band, - const ACE_Str_Buf *data, - const ACE_Str_Buf *cntl = 0, - int flags = MSG_BAND); -#endif /* ACE_HAS_STREAM_PIPES */ - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/FIFO_Send_Msg.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_FIFO_SEND_MSG_H */ diff --git a/dep/acelite/ace/FIFO_Send_Msg.inl b/dep/acelite/ace/FIFO_Send_Msg.inl deleted file mode 100644 index 0a34e64e370..00000000000 --- a/dep/acelite/ace/FIFO_Send_Msg.inl +++ /dev/null @@ -1,53 +0,0 @@ -// -*- C++ -*- -// -// $Id: FIFO_Send_Msg.inl 80826 2008-03-04 14:51:23Z wotte $ - -#include "ace/OS_NS_stropts.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE ssize_t -ACE_FIFO_Send_Msg::send (const void *buf, size_t len) -{ - ACE_TRACE ("ACE_FIFO_Send_Msg::send"); - ACE_Str_Buf send_msg ((char *) buf, static_cast (len)); - - return this->send (send_msg); -} - -#if defined (ACE_HAS_STREAM_PIPES) -ACE_INLINE ssize_t -ACE_FIFO_Send_Msg::send (const ACE_Str_Buf *data, - const ACE_Str_Buf *cntl, - int flags) -{ - ACE_TRACE ("ACE_FIFO_Send_Msg::send"); - if (ACE_OS::putmsg (this->get_handle (), - (strbuf *) cntl, - (strbuf *) data, - flags) == -1) - return-1; - else - return (cntl == 0 ? 0 : cntl->len) + (data == 0 ? 0 : data->len); -} - -ACE_INLINE ssize_t -ACE_FIFO_Send_Msg::send (int band, - const ACE_Str_Buf *data, - const ACE_Str_Buf *cntl, - int flags) -{ - ACE_TRACE ("ACE_FIFO_Send_Msg::send"); - - if (ACE_OS::putpmsg (this->get_handle (), - (strbuf *) cntl, - (strbuf *) data, - band, - flags) == -1) - return -1; - else - return (cntl == 0 ? 0 : cntl->len) + (data == 0 ? 0 : data->len); -} -#endif /* ACE_HAS_STREAM_PIPES */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/FILE.cpp b/dep/acelite/ace/FILE.cpp deleted file mode 100644 index 49ff2c1ca3d..00000000000 --- a/dep/acelite/ace/FILE.cpp +++ /dev/null @@ -1,147 +0,0 @@ -// $Id: FILE.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -/* Defines the member functions for the base class of the ACE_IO_SAP - ACE_FILE abstraction. */ - -#include "ace/FILE.h" - -#include "ace/OS_NS_unistd.h" -#include "ace/OS_NS_sys_stat.h" - -#if !defined (__ACE_INLINE__) -#include "ace/FILE.inl" -#endif /* __ACE_INLINE__ */ - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_FILE) - -void -ACE_FILE::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_FILE::dump"); - ACE_IO_SAP::dump (); -#endif /* ACE_HAS_DUMP */ -} - -// This is the do-nothing constructor. - -ACE_FILE::ACE_FILE (void) -{ - ACE_TRACE ("ACE_FILE::ACE_FILE"); -} - -// Close the file - -int -ACE_FILE::close (void) -{ - ACE_TRACE ("ACE_FILE::close"); - int result = 0; - - if (this->get_handle () != ACE_INVALID_HANDLE) - { - result = ACE_OS::close (this->get_handle ()); - this->set_handle (ACE_INVALID_HANDLE); - } - return result; -} - -int -ACE_FILE::get_info (ACE_FILE_Info *finfo) -{ - ACE_TRACE ("ACE_FILE::get_info"); - ACE_stat filestatus; - - int const result = ACE_OS::fstat (this->get_handle (), &filestatus); - - if (result == 0) - { - finfo->mode_ = filestatus.st_mode; - finfo->nlink_ = filestatus.st_nlink; - finfo->size_ = filestatus.st_size; - } - - return result; -} - -int -ACE_FILE::get_info (ACE_FILE_Info &finfo) -{ - ACE_TRACE ("ACE_FILE::get_info"); - - return this->get_info (&finfo); -} - -int -ACE_FILE::truncate (ACE_OFF_T length) -{ - ACE_TRACE ("ACE_FILE::truncate"); - return ACE_OS::ftruncate (this->get_handle (), length); -} - -ACE_OFF_T -ACE_FILE::seek (ACE_OFF_T offset, int startpos) -{ - return ACE_OS::lseek (this->get_handle (), offset, startpos); -} - -ACE_OFF_T -ACE_FILE::tell (void) -{ - ACE_TRACE ("ACE_FILE::tell"); - return ACE_OS::lseek (this->get_handle (), 0, SEEK_CUR); -} - -// Return the local endpoint address. - -int -ACE_FILE::get_local_addr (ACE_Addr &addr) const -{ - ACE_TRACE ("ACE_FILE::get_local_addr"); - - // Perform the downcast since had better be an - // . - ACE_FILE_Addr *file_addr = - dynamic_cast (&addr); - - if (file_addr == 0) - return -1; - else - { - *file_addr = this->addr_; - return 0; - } -} - -// Return the same result as . - -int -ACE_FILE::get_remote_addr (ACE_Addr &addr) const -{ - ACE_TRACE ("ACE_FILE::get_remote_addr"); - - return this->get_local_addr (addr); -} - -int -ACE_FILE::remove (void) -{ - ACE_TRACE ("ACE_FILE::remove"); - - this->close (); - return ACE_OS::unlink (this->addr_.get_path_name ()); -} - -int -ACE_FILE::unlink (void) -{ - ACE_TRACE ("ACE_FILE::unlink"); - - return ACE_OS::unlink (this->addr_.get_path_name ()); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/FILE.h b/dep/acelite/ace/FILE.h deleted file mode 100644 index b0cf712642e..00000000000 --- a/dep/acelite/ace/FILE.h +++ /dev/null @@ -1,126 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file FILE.h - * - * $Id: FILE.h 91685 2010-09-09 09:35:14Z johnnyw $ - * - * @author Gerhard Lenzer - */ -//============================================================================= - -#ifndef ACE_FILE_H -#define ACE_FILE_H -#include /**/ "ace/pre.h" - -#include "ace/IO_SAP.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/FILE_Addr.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_FILE_Info - * - * @brief Abstracts basic OS FILE information. - */ -class ACE_Export ACE_FILE_Info -{ -public: - /// Mode of file - mode_t mode_; - - /// No of links - nlink_t nlink_; - - /// Size of file - ACE_OFF_T size_; -}; - -/** - * @class ACE_FILE - * - * @brief Defines the core methods of the ACE_FILE abstraction. - */ -class ACE_Export ACE_FILE : public ACE_IO_SAP -{ -public: - /// Close the ACE_FILE handle without removing the ACE_FILE from - /// the file system. - int close (void); - - /// Close and remove the ACE_FILE from the file system. - int remove (void); - - /// Remove the ACE_FILE from the file system without closing the - /// ACE_FILE handle. - int unlink (void); - - /// Get information on this ACE_FILE. - int get_info (ACE_FILE_Info *finfo); - - /// Get information on this ACE_FILE. - int get_info (ACE_FILE_Info &finfo); - - /// Set filesize to length byte. - int truncate (ACE_OFF_T length); - - /** - * Sets the file pointer as follows: - * o If @ whence is @c SEEK_SET, the pointer is set to @a offset - * bytes. - * - * o If @a whence> is @c SEEK_CUR, the pointer is set to its - * current location plus @a offset. - * - * o If @a whence is @c SEEK_END, the pointer is set to the size - * of the file plus offset. - */ - ACE_OFF_T seek (ACE_OFF_T offset, - int whence = SEEK_CUR); - - /// Return an offset for the file handle. - ACE_OFF_T tell (void); - - /** - * Disable signal @a signum - * This is here to prevent Win32 from - * disabling SPIPE using socket calls - */ - int disable (int signum) const ; - - /// Return the local endpoint address in the referenced ACE_Addr. - /// Returns 0 if successful, else -1. - int get_local_addr (ACE_Addr &) const; - - /// Return the same thing as get_local_addr(). - int get_remote_addr (ACE_Addr &) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Ensure that this class is only created by the - /// ACE_FILE_Connector. - ACE_FILE (void); - - /// File we are "connected" with... - ACE_FILE_Addr addr_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/FILE.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_FILE_H */ diff --git a/dep/acelite/ace/FILE.inl b/dep/acelite/ace/FILE.inl deleted file mode 100644 index 288374afc58..00000000000 --- a/dep/acelite/ace/FILE.inl +++ /dev/null @@ -1,18 +0,0 @@ -// -*- C++ -*- -// -// $Id: FILE.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -ACE_FILE::disable (int signum) const -{ -#if defined (ACE_WIN32) - ACE_UNUSED_ARG (signum) ; - return 0 ; -#else /* ACE_WIN32 */ - return ACE_IO_SAP::disable (signum) ; -#endif /* ACE_WIN32 */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/FILE_Addr.cpp b/dep/acelite/ace/FILE_Addr.cpp deleted file mode 100644 index a20e2a9744b..00000000000 --- a/dep/acelite/ace/FILE_Addr.cpp +++ /dev/null @@ -1,124 +0,0 @@ -// $Id: FILE_Addr.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/FILE_Addr.h" -#include "ace/Lib_Find.h" -#include "ace/Log_Msg.h" -#include "ace/OS_NS_stdlib.h" -#include "ace/OS_NS_string.h" -#include "ace/os_include/sys/os_socket.h" - -#if !defined (__ACE_INLINE__) -#include "ace/FILE_Addr.inl" -#endif /* __ACE_INLINE__ */ - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_FILE_Addr) - -ACE_FILE_Addr::ACE_FILE_Addr (void) - : ACE_Addr (AF_FILE, sizeof this->filename_ / sizeof (ACE_TCHAR)) -{ - this->filename_[0] = '\0'; -} - -int -ACE_FILE_Addr::set (const ACE_FILE_Addr &sa) -{ - if (sa.get_type () == AF_ANY) - { -#if defined (ACE_DEFAULT_TEMP_FILE) - // Create a temporary file. - ACE_OS::strcpy (this->filename_, - ACE_DEFAULT_TEMP_FILE); -#else /* ACE_DEFAULT_TEMP_FILE */ - if (ACE::get_temp_dir (this->filename_, MAXPATHLEN - 15) == -1) - // -15 for ace-file-XXXXXX - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Temporary path too long, ") - ACE_TEXT ("defaulting to current directory\n"))); - this->filename_[0] = 0; - } - - // Add the filename to the end - ACE_OS::strcat (this->filename_, ACE_TEXT ("ace-fileXXXXXX")); - -#endif /* ACE_DEFAULT_TEMP_FILE */ - - if (ACE_OS::mktemp (this->filename_) == 0) - return -1; - this->base_set (AF_FILE, - static_cast (ACE_OS::strlen (this->filename_) + 1)); - } - else - { - (void)ACE_OS::strsncpy (this->filename_, sa.filename_, sa.get_size ()); - - this->base_set (sa.get_type (), sa.get_size ()); - } - return 0; -} - -// Copy constructor. - -ACE_FILE_Addr::ACE_FILE_Addr (const ACE_FILE_Addr &sa) - : ACE_Addr (AF_FILE, sizeof this->filename_) -{ - this->set (sa); -} - -int -ACE_FILE_Addr::set (const ACE_TCHAR *filename) -{ - this->ACE_Addr::base_set (AF_FILE, - static_cast (ACE_OS::strlen (filename) + 1)); - (void) ACE_OS::strsncpy (this->filename_, - filename, - sizeof this->filename_ / sizeof (ACE_TCHAR)); - return 0; -} - -ACE_FILE_Addr & -ACE_FILE_Addr::operator= (const ACE_FILE_Addr &sa) -{ - if (this != &sa) - this->set (sa); - return *this; -} - -// Create a ACE_Addr from a ACE_FILE pathname. - -ACE_FILE_Addr::ACE_FILE_Addr (const ACE_TCHAR *filename) -{ - this->set (filename); -} - -int -ACE_FILE_Addr::addr_to_string (ACE_TCHAR *s, size_t len) const -{ - ACE_OS::strsncpy (s, this->filename_, len); - return 0; -} - -// Return the address. - -void * -ACE_FILE_Addr::get_addr (void) const -{ - return (void *)&this->filename_; -} - -void -ACE_FILE_Addr::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_FILE_Addr::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("filename_ = %s"), this->filename_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/FILE_Addr.h b/dep/acelite/ace/FILE_Addr.h deleted file mode 100644 index 432275b9665..00000000000 --- a/dep/acelite/ace/FILE_Addr.h +++ /dev/null @@ -1,89 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file FILE_Addr.h - * - * $Id: FILE_Addr.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_FILE_ADDR_H -#define ACE_FILE_ADDR_H -#include /**/ "ace/pre.h" - -#include "ace/Addr.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Flag_Manip.h" -#include "ace/os_include/os_dirent.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_FILE_Addr - * - * @brief Defines the FILE address family address format. - */ -class ACE_Export ACE_FILE_Addr : public ACE_Addr -{ -public: - // = Initialization methods. - /// Default constructor. - ACE_FILE_Addr (void); - - /// Copy constructor. - ACE_FILE_Addr (const ACE_FILE_Addr &sa); - - /// Acts like a copy constructor. If @a sa == ACE_Addr::sap_any then - /// create a temporary filename using ACE_OS::mktemp. - int set (const ACE_FILE_Addr &sa); - - /// Create a ACE_FILE_Addr from a pathname. - explicit ACE_FILE_Addr (const ACE_TCHAR *filename); - - /// Create a ACE_FILE_Addr from a pathname. - int set (const ACE_TCHAR *filename); - - /// Assignment operator. - ACE_FILE_Addr &operator= (const ACE_FILE_Addr &); - - /// Return a pointer to the address. - virtual void *get_addr (void) const; - - /// Transform the current address into string format. - virtual int addr_to_string (ACE_TCHAR *addr, size_t) const; - - /// Compare two addresses for equality. - bool operator == (const ACE_FILE_Addr &SAP) const; - - /// Compare two addresses for inequality. - bool operator != (const ACE_FILE_Addr &SAP) const; - - /// Return the path name used for the rendezvous point. - const ACE_TCHAR *get_path_name (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Name of the file. - ACE_TCHAR filename_[MAXPATHLEN + 1]; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/FILE_Addr.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_FILE_ADDR_H */ diff --git a/dep/acelite/ace/FILE_Addr.inl b/dep/acelite/ace/FILE_Addr.inl deleted file mode 100644 index 0ae7d31d278..00000000000 --- a/dep/acelite/ace/FILE_Addr.inl +++ /dev/null @@ -1,34 +0,0 @@ -// -*- C++ -*- -// -// $Id: FILE_Addr.inl 80826 2008-03-04 14:51:23Z wotte $ - - -#include "ace/SString.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Compare two addresses for equality. - -ACE_INLINE bool -ACE_FILE_Addr::operator == (const ACE_FILE_Addr &sap) const -{ - return ACE_OS::strcmp (this->filename_, sap.filename_) == 0; -} - -// Compare two addresses for inequality. - -ACE_INLINE bool -ACE_FILE_Addr::operator != (const ACE_FILE_Addr &sap) const -{ - return !((*this) == sap); // This is lazy, of course... ;-) -} - -// Return the path name used for the rendezvous point. - -ACE_INLINE const ACE_TCHAR * -ACE_FILE_Addr::get_path_name (void) const -{ - return this->filename_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/FILE_Connector.cpp b/dep/acelite/ace/FILE_Connector.cpp deleted file mode 100644 index c27a5cec64e..00000000000 --- a/dep/acelite/ace/FILE_Connector.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// $Id: FILE_Connector.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/FILE_Connector.h" -#include "ace/Handle_Ops.h" -#include "ace/OS_NS_stdlib.h" - -#if !defined (__ACE_INLINE__) -#include "ace/FILE_Connector.inl" -#endif /* __ACE_INLINE__ */ - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_FILE_Connector) - -void -ACE_FILE_Connector::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_FILE_Connector::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_FILE_Connector::ACE_FILE_Connector (void) -{ - ACE_TRACE ("ACE_FILE_Connector::ACE_FILE_Connector"); -} - -int -ACE_FILE_Connector::connect (ACE_FILE_IO &new_io, - const ACE_FILE_Addr &remote_sap, - ACE_Time_Value *timeout, - const ACE_Addr &, - int, - int flags, - int perms) -{ - ACE_TRACE ("ACE_FILE_Connector::connect"); - ACE_ASSERT (new_io.get_handle () == ACE_INVALID_HANDLE); - - ACE_HANDLE handle = ACE_INVALID_HANDLE; - - // Check to see if caller has requested that we create the filename. - if (reinterpret_cast ( - const_cast (remote_sap)) == ACE_Addr::sap_any) - { - // Create a new temporary file. - // Use ACE_OS::mkstemp() if it is available since it avoids a - // race condition, and subsequently a security hole due to that - // race condition (specifically, a denial-of-service attack). - // - // However, using mkstemp() prevents us from doing a timed open - // since it opens the file for us. Better to avoid the race - // condition. - char filename[] = "ace-file-XXXXXX"; - - handle = ACE_OS::mkstemp (filename); // mkstemp() replaces "XXXXXX" - - if (handle == ACE_INVALID_HANDLE - || new_io.addr_.set (ACE_TEXT_CHAR_TO_TCHAR (filename)) != 0) - return -1; - - new_io.set_handle (handle); - - return 0; - } - else - new_io.addr_ = remote_sap; // class copy. - - handle = ACE::handle_timed_open (timeout, - new_io.addr_.get_path_name (), - flags, - perms); - - new_io.set_handle (handle); - return handle == ACE_INVALID_HANDLE ? -1 : 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/FILE_Connector.h b/dep/acelite/ace/FILE_Connector.h deleted file mode 100644 index 624ab3d6a5f..00000000000 --- a/dep/acelite/ace/FILE_Connector.h +++ /dev/null @@ -1,113 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file FILE_Connector.h - * - * $Id: FILE_Connector.h 82723 2008-09-16 09:35:44Z johnnyw $ - * - * @author Doug Schmidt - */ -//============================================================================= - -#ifndef ACE_FILE_CONNECTOR_H -#define ACE_FILE_CONNECTOR_H -#include /**/ "ace/pre.h" - -#include "ace/FILE_IO.h" -#include "ace/Log_Msg.h" -#include "ace/os_include/os_fcntl.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_FILE_Connector - * - * @brief Defines an active connection factory for the ACE_FILE wrappers. - * - * Note that the O_APPEND flag is only partly supported on Win32. If - * you specify O_APPEND, then the file pointer will be positioned at - * the end of the file initially during open, but it is not - * re-positioned at the end prior to each write, as specified by - * POSIX. This is generally good enough for typical situations, but - * it is ``not quite right'' in its semantics. - */ -class ACE_Export ACE_FILE_Connector -{ -public: - // = Initialization methods. - /// Default constructor. - ACE_FILE_Connector (void); - - /** - * Actively ``connect'' and produce a @a new_io ACE_FILE_IO object - * if things go well. The @a remote_sap is the file that we are - * trying to create/open. If it's the default value of - * ACE_Addr::sap_any then the user is letting the OS create the - * filename (via ). The @a timeout is the amount of - * time to wait to create/open the file. If it's 0 then we block - * indefinitely. If *timeout == {0, 0} then the file is created - * using non-blocking mode. If *timeout > {0, 0} then this is the - * maximum amount of time to wait before timing out. The - * @a local_sap and @a reuse_addr parameters are ignored. The @a flags - * and @a perms arguments are passed down to the - * method. - */ - ACE_FILE_Connector (ACE_FILE_IO &new_io, - const ACE_FILE_Addr &remote_sap, - ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = O_RDWR | O_CREAT, - int perms = ACE_DEFAULT_FILE_PERMS); - - /** - * Actively ``connect'' and produce a @a new_io object - * if things go well. The @a remote_sap is the file that we are - * trying to create/open. If it's the default value of - * ACE_Addr::sap_any then the user is letting the OS create the - * filename (via ). The @a timeout is the amount of - * time to wait to create/open the file. If it's 0 then we block - * indefinitely. If *timeout == {0, 0} then the file is created - * using non-blocking mode. In this case, if the create/open can't - * be done immediately the value of -1 is returned with . If *timeout > {0, 0} then this is the maximum amount of - * time to wait before timing out. If the time expires before the - * connection is made @c errno == ETIME. The @a local_sap and - * @a reuse_addr parameters are ignored. The @a flags and @a perms - * arguments are passed down to the method. - */ - int connect (ACE_FILE_IO &new_io, - const ACE_FILE_Addr &remote_sap, - ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = O_RDWR | O_CREAT, - int perms = ACE_DEFAULT_FILE_PERMS); - - /// Resets any event associations on this handle - bool reset_new_handle (ACE_HANDLE handle); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - // = Meta-type "trait" information. - typedef ACE_FILE_Addr PEER_ADDR; - typedef ACE_FILE_IO PEER_STREAM; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/FILE_Connector.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_FILE_CONNECTOR_H */ diff --git a/dep/acelite/ace/FILE_Connector.inl b/dep/acelite/ace/FILE_Connector.inl deleted file mode 100644 index 953f661fb05..00000000000 --- a/dep/acelite/ace/FILE_Connector.inl +++ /dev/null @@ -1,35 +0,0 @@ -// -*- C++ -*- -// -// $Id: FILE_Connector.inl 82723 2008-09-16 09:35:44Z johnnyw $ - -// Creates a Local ACE_FILE. - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_FILE_Connector::ACE_FILE_Connector (ACE_FILE_IO &new_io, - const ACE_FILE_Addr &remote_sap, - ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - int reuse_addr, - int flags, - int perms) -{ - ACE_TRACE ("ACE_FILE_Connector::ACE_FILE_Connector"); - if (this->connect (new_io, remote_sap, timeout, local_sap, - reuse_addr, flags, perms) == ACE_IO_SAP::INVALID_HANDLE - && timeout != 0 && !(errno == EWOULDBLOCK || errno == ETIME)) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("address %s, %p\n"), - remote_sap.get_path_name (), - ACE_TEXT ("ACE_FILE_IO"))); -} - -ACE_INLINE bool -ACE_FILE_Connector::reset_new_handle (ACE_HANDLE) -{ - // Nothing to do here since the handle is not a socket - return false; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/FILE_IO.cpp b/dep/acelite/ace/FILE_IO.cpp deleted file mode 100644 index 37c412c2497..00000000000 --- a/dep/acelite/ace/FILE_IO.cpp +++ /dev/null @@ -1,145 +0,0 @@ -// $Id: FILE_IO.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/FILE_IO.h" - -#include "ace/Log_Msg.h" -#include "ace/OS_NS_sys_stat.h" -#include "ace/OS_Memory.h" -#include "ace/Truncate.h" - -#if !defined (__ACE_INLINE__) -#include "ace/FILE_IO.inl" -#endif /* __ACE_INLINE__ */ - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_FILE_IO) - -void -ACE_FILE_IO::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_FILE_IO::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - this->addr_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -// Simple-minded do nothing constructor. - -ACE_FILE_IO::ACE_FILE_IO (void) -{ - ACE_TRACE ("ACE_FILE_IO::ACE_FILE_IO"); -} - -// Send N char *ptrs and int lengths. Note that the char *'s precede -// the ints (basically, an varargs version of writev). The count N is -// the *total* number of trailing arguments, *not* a couple of the -// number of tuple pairs! - -ssize_t -ACE_FILE_IO::send (size_t n, ...) const -{ - ACE_TRACE ("ACE_FILE_IO::send"); - va_list argp; - int total_tuples = ACE_Utils::truncate_cast (n / 2); - iovec *iovp = 0; -#if defined (ACE_HAS_ALLOCA) - iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); -#else - ACE_NEW_RETURN (iovp, - iovec[total_tuples], - -1); -#endif /* !defined (ACE_HAS_ALLOCA) */ - - va_start (argp, n); - - for (int i = 0; i < total_tuples; i++) - { - iovp[i].iov_base = va_arg (argp, char *); - iovp[i].iov_len = va_arg (argp, int); - } - - ssize_t result = ACE_OS::writev (this->get_handle (), - iovp, - total_tuples); -#if !defined (ACE_HAS_ALLOCA) - delete [] iovp; -#endif /* !defined (ACE_HAS_ALLOCA) */ - va_end (argp); - return result; -} - -// This is basically an interface to ACE_OS::readv, that doesn't use -// the struct iovec explicitly. The ... can be passed as an arbitrary -// number of (char *ptr, int len) tuples. However, the count N is the -// *total* number of trailing arguments, *not* a couple of the number -// of tuple pairs! - -ssize_t -ACE_FILE_IO::recv (size_t n, ...) const -{ - ACE_TRACE ("ACE_FILE_IO::recv"); - va_list argp; - int total_tuples = ACE_Utils::truncate_cast (n / 2); - iovec *iovp = 0; -#if defined (ACE_HAS_ALLOCA) - iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); -#else - ACE_NEW_RETURN (iovp, - iovec[total_tuples], - -1); -#endif /* !defined (ACE_HAS_ALLOCA) */ - - va_start (argp, n); - - for (int i = 0; i < total_tuples; i++) - { - iovp[i].iov_base = va_arg (argp, char *); - iovp[i].iov_len = va_arg (argp, int); - } - - ssize_t const result = ACE_OS::readv (this->get_handle (), - iovp, - total_tuples); -#if !defined (ACE_HAS_ALLOCA) - delete [] iovp; -#endif /* !defined (ACE_HAS_ALLOCA) */ - va_end (argp); - return result; -} - -// Allows a client to read from a file without having to provide a -// buffer to read. This method determines how much data is in the -// file, allocates a buffer of this size, reads in the data, and -// returns the number of bytes read. - -ssize_t -ACE_FILE_IO::recvv (iovec *io_vec) -{ - ACE_TRACE ("ACE_FILE_IO::recvv"); - - io_vec->iov_base = 0; - size_t const length = - static_cast (ACE_OS::filesize (this->get_handle ())); - - if (length > 0) - { - ACE_NEW_RETURN (io_vec->iov_base, - char[length], - -1); - io_vec->iov_len = this->recv_n (io_vec->iov_base, - length); - return io_vec->iov_len; - } - else - { - return ACE_Utils::truncate_cast (length); - } -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/FILE_IO.h b/dep/acelite/ace/FILE_IO.h deleted file mode 100644 index 4540db830ee..00000000000 --- a/dep/acelite/ace/FILE_IO.h +++ /dev/null @@ -1,170 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file FILE_IO.h - * - * $Id: FILE_IO.h 92298 2010-10-21 11:15:17Z johnnyw $ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_FILE_IO_H -#define ACE_FILE_IO_H -#include /**/ "ace/pre.h" - -#include "ace/FILE.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/FILE_Addr.h" - -// Used in the FILE_IO.h file... -#include "ace/os_include/os_stdio.h" -#include "ace/os_include/sys/os_uio.h" - -#if defined (ACE_HAS_STREAM_PIPES) -# include "ace/OS_NS_stropts.h" -#endif /* ACE_HAS_STREAM_PIPES */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward decl. -class ACE_Message_Block; -class ACE_Time_Value; - -/** - * @class ACE_FILE_IO - * - * @brief Read/Write operations on Files - */ -class ACE_Export ACE_FILE_IO : public ACE_FILE -{ -public: - friend class ACE_FILE_Connector; - - // = Initialization method. - /// Default constructor. - ACE_FILE_IO (void); - - /// send upto @a n bytes in @a buf. - ssize_t send (const void *buf, size_t n) const; - - /// Recv upto @a n bytes in @a buf. - ssize_t recv (void *buf, size_t n) const; - - /// Send n bytes, keep trying until n are sent. - ssize_t send_n (const void *buf, size_t n) const; - - /// Send all the @a message_blocks chained through their next and - /// cont pointers. This call uses the underlying OS gather-write - /// operation to reduce the domain-crossing penalty. - ssize_t send_n (const ACE_Message_Block *message_block, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); - - /// Recv n bytes, keep trying until n are received. - ssize_t recv_n (void *buf, size_t n) const; - -#if defined (ACE_HAS_STREAM_PIPES) - /// Send bytes via STREAM pipes. - ssize_t send (const ACE_Str_Buf *cntl, - const ACE_Str_Buf *data, - int flags = 0) const; - - /// Recv bytes via STREAM pipes. - ssize_t recv (ACE_Str_Buf *cntl, - ACE_Str_Buf *data, - int *flags) const; - - /// Send bytes via STREAM pipes using "band" mode. - ssize_t send (const ACE_Str_Buf *cntl, - const ACE_Str_Buf *data, - int band, - int flags) const; - - /// Recv bytes via STREAM pipes using "band" mode. - ssize_t recv (ACE_Str_Buf *cntl, - ACE_Str_Buf *data, - int *band, - int *flags) const; - -#endif /* ACE_HAS_STREAM_PIPES */ - - /// Send iovecs via <::writev>. - ssize_t send (const iovec iov[], int n) const; - - /// Recv iovecs via <::readv>. - ssize_t recv (iovec iov[], int n) const; - - /** - * Send N char *ptrs and int lengths. Note that the char *'s - * precede the ints (basically, an varargs version of writev). The - * count N is the *total* number of trailing arguments, *not* a - * couple of the number of tuple pairs! - */ - ssize_t send (size_t n, ...) const; - - /** - * This is an interface to ::readv, that doesn't use the struct - * iovec explicitly. The ... can be passed as an arbitrary number - * of (char *ptr, int len) tuples. However, the count N is the - * *total* number of trailing arguments, *not* a couple of the - * number of tuple pairs! - */ - ssize_t recv (size_t n, ...) const; - - /// Send @a n bytes via Win32 WriteFile using overlapped I/O. - ssize_t send (const void *buf, - size_t n, - ACE_OVERLAPPED *overlapped) const; - - /// Recv @a n bytes via Win32 ReadFile using overlapped I/O. - ssize_t recv (void *buf, - size_t n, - ACE_OVERLAPPED *overlapped) const; - - /// Send an @c iovec of size @a n to the file. - ssize_t sendv (const iovec iov[], - int n) const; - - /** - * Allows a client to read from a file without having to provide a - * buffer to read. This method determines how much data is in the - * file, allocates a buffer of this size, reads in the data, and - * returns the number of bytes read. The caller is responsible for - * deleting the member in the field of using - * delete [] io_vec->iov_base. - */ - ssize_t recvv (iovec *io_vec); - - /// Send an of size @a n to the file. Will block until all - /// bytes are sent or an error occurs. - ssize_t sendv_n (const iovec iov[], - int n) const; - - /// Receive an of size @a n to the file. - ssize_t recvv_n (iovec iov[], - int n) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - // = Meta-type info - typedef ACE_FILE_Addr PEER_ADDR; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/FILE_IO.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_FILE_IO_H */ diff --git a/dep/acelite/ace/FILE_IO.inl b/dep/acelite/ace/FILE_IO.inl deleted file mode 100644 index d2e4f756c2c..00000000000 --- a/dep/acelite/ace/FILE_IO.inl +++ /dev/null @@ -1,152 +0,0 @@ -// -*- C++ -*- -// -// $Id: FILE_IO.inl 80826 2008-03-04 14:51:23Z wotte $ - -#include "ace/ACE.h" -#include "ace/OS_NS_sys_uio.h" -#include "ace/OS_NS_unistd.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE ssize_t -ACE_FILE_IO::sendv_n (const iovec iov[], int n) const -{ - ACE_TRACE ("ACE_FILE_IO::sendv_n"); - return ACE::writev_n (this->get_handle (), - iov, - n); -} - -ACE_INLINE ssize_t -ACE_FILE_IO::send_n (const ACE_Message_Block *message_block, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) -{ - ACE_TRACE ("ACE_FILE_IO::send_n"); - ACE_UNUSED_ARG (timeout); - return ACE::write_n (this->get_handle (), - message_block, - bytes_transferred); -} - -// Recv an n byte message from the file. - -ACE_INLINE ssize_t -ACE_FILE_IO::recvv_n (iovec iov[], int n) const -{ - ACE_TRACE ("ACE_FILE_IO::recvv_n"); - // @@ Carlos, can you please update this to call the - // new ACE::recvv_n() method that you write? - return ACE_OS::readv (this->get_handle (), - iov, - n); -} - -// Send an of size to the file. - -ACE_INLINE ssize_t -ACE_FILE_IO::sendv (const iovec iov[], int n) const -{ - ACE_TRACE ("ACE_FILE_IO::sendv"); - return ACE_OS::writev (this->get_handle (), iov, n); -} - -// Send exactly N bytes from BUF to this file. Keeping trying until -// this many bytes are sent. - -ACE_INLINE ssize_t -ACE_FILE_IO::send_n (const void *buf, size_t n) const -{ - ACE_TRACE ("ACE_FILE_IO::send_n"); - return ACE::write_n (this->get_handle (), buf, n); -} - -// Receive exactly N bytes from this file into BUF. Keep trying until -// this many bytes are received. - -ACE_INLINE ssize_t -ACE_FILE_IO::recv_n (void *buf, size_t n) const -{ - ACE_TRACE ("ACE_FILE_IO::recv_n"); - return ACE::read_n (this->get_handle (), buf, n); -} - -ACE_INLINE ssize_t -ACE_FILE_IO::send (const void *buf, size_t n) const -{ - ACE_TRACE ("ACE_FILE_IO::send"); - return ACE_OS::write (this->get_handle (), buf, n); -} - -ACE_INLINE ssize_t -ACE_FILE_IO::recv (void *buf, size_t n) const -{ - ACE_TRACE ("ACE_FILE_IO::recv"); - return ACE_OS::read (this->get_handle (), buf, n); -} - -ACE_INLINE ssize_t -ACE_FILE_IO::send (const iovec iov[], int n) const -{ - ACE_TRACE ("ACE_FILE_IO::send"); - return ACE_OS::writev (this->get_handle (), iov, n); -} - -ACE_INLINE ssize_t -ACE_FILE_IO::recv (iovec iov[], int n) const -{ - ACE_TRACE ("ACE_FILE_IO::recv"); - return ACE_OS::readv (this->get_handle (), iov, n); -} - -#if defined (ACE_HAS_STREAM_PIPES) -ACE_INLINE ssize_t -ACE_FILE_IO::recv (ACE_Str_Buf *cntl, ACE_Str_Buf *data, int *band, int *flags) const -{ - ACE_TRACE ("ACE_FILE_IO::recv"); - return ACE_OS::getpmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, band, flags); -} - -ACE_INLINE ssize_t -ACE_FILE_IO::send (const ACE_Str_Buf *cntl, const ACE_Str_Buf *data, int band, int flags) const -{ - ACE_TRACE ("ACE_FILE_IO::send"); - return ACE_OS::putpmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, band, flags); -} - -ACE_INLINE ssize_t -ACE_FILE_IO::recv (ACE_Str_Buf *cntl, ACE_Str_Buf *data, int *flags) const -{ - ACE_TRACE ("ACE_FILE_IO::recv"); - return ACE_OS::getmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, flags); -} - -ACE_INLINE ssize_t -ACE_FILE_IO::send (const ACE_Str_Buf *cntl, const ACE_Str_Buf *data, int flags) const -{ - ACE_TRACE ("ACE_FILE_IO::send"); - return ACE_OS::putmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, flags); -} - -ACE_INLINE ssize_t -ACE_FILE_IO::send (const void *buf, size_t n, - ACE_OVERLAPPED *overlapped) const -{ - ACE_TRACE ("ACE_FILE_IO::send"); - return ACE_OS::write (this->get_handle (), - buf, n, - overlapped); -} - -ACE_INLINE ssize_t -ACE_FILE_IO::recv (void *buf, size_t n, - ACE_OVERLAPPED *overlapped) const -{ - ACE_TRACE ("ACE_FILE_IO::recv"); - return ACE_OS::read (this->get_handle (), buf, n, - overlapped); -} - -#endif /* ACE_HAS_STREAM_PIPES */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/File_Lock.cpp b/dep/acelite/ace/File_Lock.cpp deleted file mode 100644 index b67e8d50e84..00000000000 --- a/dep/acelite/ace/File_Lock.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// $Id: File_Lock.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/File_Lock.h" -#include "ace/Log_Msg.h" - -#if !defined (__ACE_INLINE__) -#include "ace/File_Lock.inl" -#endif /* __ACE_INLINE__ */ - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_File_Lock) - -void -ACE_File_Lock::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_File_Lock::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - this->lock_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_File_Lock::ACE_File_Lock (ACE_HANDLE h, - bool unlink_in_destructor) - : removed_ (false), - unlink_in_destructor_ (unlink_in_destructor) -{ -// ACE_TRACE ("ACE_File_Lock::ACE_File_Lock"); - if (ACE_OS::flock_init (&this->lock_) == -1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_File_Lock::ACE_File_Lock"))); - this->set_handle (h); -} - -ACE_File_Lock::ACE_File_Lock (const ACE_TCHAR *name, - int flags, - mode_t perms, - bool unlink_in_destructor) - : unlink_in_destructor_ (unlink_in_destructor) -{ -// ACE_TRACE ("ACE_File_Lock::ACE_File_Lock"); - - if (this->open (name, flags, perms) == -1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p %s\n"), - ACE_TEXT ("ACE_File_Lock::ACE_File_Lock"), - name)); -} - -int -ACE_File_Lock::open (const ACE_TCHAR *name, - int flags, - mode_t perms) -{ -// ACE_TRACE ("ACE_File_Lock::open"); - this->removed_ = false; - return ACE_OS::flock_init (&this->lock_, flags, name, perms); -} - -ACE_File_Lock::~ACE_File_Lock (void) -{ -// ACE_TRACE ("ACE_File_Lock::~ACE_File_Lock"); - this->remove (this->unlink_in_destructor_); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/File_Lock.h b/dep/acelite/ace/File_Lock.h deleted file mode 100644 index 4cd58fcd184..00000000000 --- a/dep/acelite/ace/File_Lock.h +++ /dev/null @@ -1,170 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file File_Lock.h - * - * $Id: File_Lock.h 91064 2010-07-12 10:11:24Z johnnyw $ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_FILE_LOCK_H -#define ACE_FILE_LOCK_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/OS_NS_stdio.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_File_Lock - * - * @brief A wrapper around the UNIX file locking mechanism. - * - * Allows us to "adapt" the UNIX file locking mechanisms to work - * with all of our Guard stuff... - */ -class ACE_Export ACE_File_Lock -{ -public: - /** - * Set the of the File_Lock to @a handle. Note that this - * constructor assumes ownership of the @a handle and will close it - * down in . If you want the @a handle to stay open when - * is called make sure to call on the @a handle. - * If you don't want the file unlinked in the destructor pass a - * zero value for . - */ - ACE_File_Lock (ACE_HANDLE handle = ACE_INVALID_HANDLE, - bool unlink_in_destructor = true); - - /// Open the @a filename with @a flags and @a mode and set the result - /// to . If you don't want the file unlinked in the - /// destructor pass a false value for @a unlink_in_destructor. - ACE_File_Lock (const ACE_TCHAR *filename, - int flags, - mode_t mode = 0, - bool unlink_in_destructor = true); - - /// Open the @a filename with @a flags and @a mode and set the result to - /// . - int open (const ACE_TCHAR *filename, - int flags, - mode_t mode = 0); - - /// Remove a File lock by releasing it and closing down the . - ~ACE_File_Lock (void); - - /// Remove a File lock by releasing it and closing down the - /// . If @a unlink_file is true then we unlink the file. - int remove (bool unlink_file = true); - - /** - * Note, for interface uniformity with other synchronization - * wrappers we include the acquire() method. This is implemented as - * a write-lock to be on the safe-side... - */ - int acquire (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1); - - /** - * Note, for interface uniformity with other synchronization - * wrappers we include the method. This is implemented - * as a write-lock to be on the safe-side... Returns -1 on failure. - * If we "failed" because someone else already had the lock, @c errno - * is set to @c EBUSY. - */ - int tryacquire (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1); - - /// Unlock a readers/writer lock. - int release (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1); - - /// Acquire a write lock, but block if any readers or a - /// writer hold the lock. - int acquire_write (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1); - - /** - * Conditionally acquire a write lock (i.e., won't block). Returns - * -1 on failure. If we "failed" because someone else already had - * the lock, @c errno is set to @c EBUSY. - */ - int tryacquire_write (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1); - - /** - * Conditionally upgrade to a write lock (i.e., won't block). Returns - * -1 on failure. If we "failed" because someone else already had - * the lock, @c errno is set to @c EBUSY. - */ - int tryacquire_write_upgrade (short whence = 0, - ACE_OFF_T start = 0, - ACE_OFF_T len = 1); - - /** - * Acquire a read lock, but block if a writer hold the lock. - * Returns -1 on failure. If we "failed" because someone else - * already had the lock, @c errno is set to @c EBUSY. - */ - int acquire_read (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1); - - /** - * Conditionally acquire a read lock (i.e., won't block). Returns - * -1 on failure. If we "failed" because someone else already had - * the lock, @c errno is set to @c EBUSY. - */ - int tryacquire_read (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1); - - /// Get underlying ACE_HANDLE for the file. - ACE_HANDLE get_handle (void) const; - - /** - * Set underlying ACE_HANDLE. Note that this method assumes - * ownership of the @a handle and will close it down in . If - * you want the @a handle to stay open when is called make - * sure to call on the @a handle before closing it. You are - * responsible for the closing the existing @a handle before - * overwriting it. - */ - void set_handle (ACE_HANDLE); - - /// Dump state of the object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Locking structure for OS record locks. - ACE_OS::ace_flock_t lock_; - - /// Keeps track of whether has been called yet to avoid - /// multiple calls, e.g., explicitly and implicitly in the - /// destructor. This flag isn't protected by a lock, so make sure - /// that you don't have multiple threads simultaneously calling - /// on the same object, which is a bad idea anyway... - bool removed_; - - /// Keeps track of whether to unlink the underlying file in the - /// destructor. - bool const unlink_in_destructor_; - -private: - // = Prevent assignment and initialization. - void operator= (const ACE_File_Lock &); - ACE_File_Lock (const ACE_File_Lock &); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/File_Lock.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_FILE_LOCK_H */ diff --git a/dep/acelite/ace/File_Lock.inl b/dep/acelite/ace/File_Lock.inl deleted file mode 100644 index cf0cefed16e..00000000000 --- a/dep/acelite/ace/File_Lock.inl +++ /dev/null @@ -1,96 +0,0 @@ -// -*- C++ -*- -// -// $Id: File_Lock.inl 87213 2009-10-23 13:11:34Z johnnyw $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE int -ACE_File_Lock::acquire_read (short whence, ACE_OFF_T start, ACE_OFF_T len) -{ -// ACE_TRACE ("ACE_File_Lock::acquire_read"); - return ACE_OS::flock_rdlock (&this->lock_, whence, start, len); -} - -ACE_INLINE int -ACE_File_Lock::tryacquire_read (short whence, ACE_OFF_T start, ACE_OFF_T len) -{ -// ACE_TRACE ("ACE_File_Lock::tryacquire_read"); - return ACE_OS::flock_tryrdlock (&this->lock_, whence, start, len); -} - -ACE_INLINE int -ACE_File_Lock::tryacquire_write (short whence, ACE_OFF_T start, ACE_OFF_T len) -{ -// ACE_TRACE ("ACE_File_Lock::tryacquire_write"); - return ACE_OS::flock_trywrlock (&this->lock_, whence, start, len); -} - -ACE_INLINE int -ACE_File_Lock::tryacquire_write_upgrade (short whence, - ACE_OFF_T start, - ACE_OFF_T len) -{ -// ACE_TRACE ("ACE_File_Lock::tryacquire_write_upgrade"); - return ACE_OS::flock_trywrlock (&this->lock_, whence, start, len); -} - -ACE_INLINE int -ACE_File_Lock::tryacquire (short whence, ACE_OFF_T start, ACE_OFF_T len) -{ -// ACE_TRACE ("ACE_File_Lock::tryacquire"); - return this->tryacquire_write (whence, start, len); -} - -ACE_INLINE int -ACE_File_Lock::acquire_write (short whence, ACE_OFF_T start, ACE_OFF_T len) -{ -// ACE_TRACE ("ACE_File_Lock::acquire_write"); - return ACE_OS::flock_wrlock (&this->lock_, whence, start, len); -} - -ACE_INLINE int -ACE_File_Lock::acquire (short whence, ACE_OFF_T start, ACE_OFF_T len) -{ -// ACE_TRACE ("ACE_File_Lock::acquire"); - return this->acquire_write (whence, start, len); -} - -ACE_INLINE int -ACE_File_Lock::release (short whence, ACE_OFF_T start, ACE_OFF_T len) -{ -// ACE_TRACE ("ACE_File_Lock::release"); - return ACE_OS::flock_unlock (&this->lock_, whence, start, len); -} - -ACE_INLINE int -ACE_File_Lock::remove (bool unlink_file) -{ -// ACE_TRACE ("ACE_File_Lock::remove"); - - int result = 0; - - if (!this->removed_) - { - this->removed_ = true; - result = ACE_OS::flock_destroy (&this->lock_, - unlink_file); - } - return result; -} - -ACE_INLINE ACE_HANDLE -ACE_File_Lock::get_handle (void) const -{ -// ACE_TRACE ("ACE_File_Lock::get_handle"); - return this->lock_.handle_; -} - -ACE_INLINE void -ACE_File_Lock::set_handle (ACE_HANDLE h) -{ -// ACE_TRACE ("ACE_File_Lock::set_handle"); - this->lock_.handle_ = h; - this->removed_ = false; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Filecache.cpp b/dep/acelite/ace/Filecache.cpp deleted file mode 100644 index 65e548c75ec..00000000000 --- a/dep/acelite/ace/Filecache.cpp +++ /dev/null @@ -1,743 +0,0 @@ -// $Id: Filecache.cpp 94034 2011-05-09 19:11:03Z johnnyw $ - -#include "ace/Filecache.h" -#include "ace/Object_Manager.h" -#include "ace/Log_Msg.h" -#include "ace/ACE.h" -#include "ace/Guard_T.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_time.h" -#include "ace/OS_NS_unistd.h" -#include "ace/OS_NS_fcntl.h" -#include "ace/Truncate.h" - -#if defined (ACE_WIN32) -// Specifies no sharing flags. -#define R_MASK ACE_DEFAULT_OPEN_PERMS -#define W_MASK 0 -#else -#define R_MASK S_IRUSR|S_IRGRP|S_IROTH -#define W_MASK S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR|S_IWGRP|S_IWOTH -#endif /* ACE_WIN32 */ - -#if defined (ACE_WIN32) -// See if you can get rid of some of these. -#define READ_FLAGS (FILE_FLAG_SEQUENTIAL_SCAN | \ - FILE_FLAG_OVERLAPPED | \ - O_RDONLY) -// static const int RCOPY_FLAGS = (FILE_FLAG_SEQUENTIAL_SCAN | -// O_RDONLY); -#define WRITE_FLAGS (FILE_FLAG_SEQUENTIAL_SCAN | \ - FILE_FLAG_OVERLAPPED | \ - O_RDWR | O_CREAT | O_TRUNC) -// static const int WCOPY_FLAGS = (FILE_FLAG_SEQUENTIAL_SCAN | -// O_RDWR | O_CREAT | O_TRUNC); -#else -#define READ_FLAGS O_RDONLY -// static const int RCOPY_FLAGS = O_RDONLY; -#define WRITE_FLAGS (O_RDWR | O_CREAT | O_TRUNC) -// static const int WCOPY_FLAGS = O_RDWR | O_CREAT | O_TRUNC; -#endif /* ACE_WIN32 */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// static data members -ACE_Filecache *ACE_Filecache::cvf_ = 0; - -void -ACE_Filecache_Handle::init (void) -{ - this->file_ = 0; - this->handle_ = ACE_INVALID_HANDLE; -} - -ACE_Filecache_Handle::ACE_Filecache_Handle (void) - : file_ (0), handle_ (0), mapit_ (0) -{ - this->init (); -} - -ACE_Filecache_Handle::ACE_Filecache_Handle (const ACE_TCHAR *filename, - ACE_Filecache_Flag mapit) - : file_ (0), handle_ (0), mapit_ (mapit) -{ - this->init (); - // Fetch the file from the Virtual_Filesystem let the - // Virtual_Filesystem do the work of cache coherency. - - // Filecache will also do the acquire, since it holds the lock at - // that time. - this->file_ = ACE_Filecache::instance ()->fetch (filename, mapit); -} - -ACE_Filecache_Handle::ACE_Filecache_Handle (const ACE_TCHAR *filename, - int size, - ACE_Filecache_Flag mapit) - : file_ (0), handle_ (0), mapit_ (mapit) -{ - this->init (); - - if (size == 0) - ACE_Filecache::instance ()->remove (filename); - else - { - // Since this is being opened for a write, simply create a new - // ACE_Filecache_Object now, and let the destructor add it into CVF - // later - - // Filecache will also do the acquire, since it holds the lock at - // that time. - this->file_ = ACE_Filecache::instance ()->create (filename, size); - } -} - -ACE_Filecache_Handle::~ACE_Filecache_Handle (void) -{ - if (this->handle_ != ACE_INVALID_HANDLE) - // this was dup ()'d - ACE_OS::close (this->handle_); - - ACE_Filecache::instance ()->finish (this->file_); -} - -void * -ACE_Filecache_Handle::address (void) const -{ - return this->file_ == 0 ? 0 : this->file_->address (); -} - -ACE_HANDLE -ACE_Filecache_Handle::handle (void) const -{ - if (this->handle_ == ACE_INVALID_HANDLE && this->file_ != 0) - { - ACE_Filecache_Handle *mutable_this = - const_cast (this); - mutable_this->handle_ = ACE_OS::dup (this->file_->handle ()); - } - return this->handle_; -} - -int -ACE_Filecache_Handle::error (void) const -{ - if (this->file_ == 0) - return -1; - else - return this->file_->error (); -} - -ACE_OFF_T -ACE_Filecache_Handle::size (void) const -{ - if (this->file_ == 0) - return -1; - else - return this->file_->size (); -} - -// ------------------ -// ACE_Filecache_Hash -// ------------------ - -#define ACE_Filecache_Hash \ - ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_Null_Mutex> -#define ACE_Filecache_Hash_Entry \ - ACE_Hash_Map_Entry - -template <> -ACE_Filecache_Hash_Entry::ACE_Hash_Map_Entry ( - const ACE_TCHAR *const &ext_id, - ACE_Filecache_Object *const &int_id, - ACE_Filecache_Hash_Entry *next, - ACE_Filecache_Hash_Entry *prev) - : ext_id_ (ext_id - ? ACE_OS::strdup (ext_id) - : ACE_OS::strdup (ACE_TEXT (""))), - int_id_ (int_id), - next_ (next), - prev_ (prev) -{ -} - -template <> -ACE_Filecache_Hash_Entry::ACE_Hash_Map_Entry (ACE_Filecache_Hash_Entry *next, - ACE_Filecache_Hash_Entry *prev) - : ext_id_ (0), - int_id_ (0), - next_ (next), - prev_ (prev) -{ -} - -template <> -ACE_Filecache_Hash_Entry::~ACE_Hash_Map_Entry (void) -{ - ACE_OS::free ((void *) ext_id_); -} - -// We need these template specializations since KEY is defined as a -// ACE_TCHAR*, which doesn't have a hash() or equal() method defined on it. - -template <> -unsigned long -ACE_Filecache_Hash::hash (const ACE_TCHAR *const &ext_id) -{ - return ACE::hash_pjw (ext_id); -} - -template <> -int -ACE_Filecache_Hash::equal (const ACE_TCHAR *const &id1, - const ACE_TCHAR *const &id2) -{ - return ACE_OS::strcmp (id1, id2) == 0; -} - -#undef ACE_Filecache_Hash -#undef ACE_Filecache_Hash_Entry - - -// ------------- -// ACE_Filecache -// ------------- - -ACE_Filecache * -ACE_Filecache::instance (void) -{ - // Double check locking pattern. - if (ACE_Filecache::cvf_ == 0) - { - ACE_SYNCH_RW_MUTEX &lock = - *ACE_Managed_Object::get_preallocated_object - (ACE_Object_Manager::ACE_FILECACHE_LOCK); - ACE_GUARD_RETURN (ACE_SYNCH_RW_MUTEX, ace_mon, lock, 0); - - // @@ James, please check each of the ACE_NEW_RETURN calls to - // make sure that it is safe to return if allocation fails. - if (ACE_Filecache::cvf_ == 0) - ACE_NEW_RETURN (ACE_Filecache::cvf_, - ACE_Filecache, - 0); - } - - return ACE_Filecache::cvf_; -} - -ACE_Filecache::ACE_Filecache (void) - : size_ (ACE_DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE), - hash_ (size_) -{ -} - -ACE_Filecache::~ACE_Filecache (void) -{ -} - -ACE_Filecache_Object * -ACE_Filecache::insert_i (const ACE_TCHAR *filename, - ACE_SYNCH_RW_MUTEX &filelock, - int mapit) -{ - ACE_Filecache_Object *handle = 0; - - if (this->hash_.find (filename, handle) == -1) - { - ACE_NEW_RETURN (handle, - ACE_Filecache_Object (filename, filelock, 0, mapit), - 0); - - // ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%t) CVF: creating %s\n"), filename)); - - if (this->hash_.bind (filename, handle) == -1) - { - delete handle; - handle = 0; - } - } - else - handle = 0; - - return handle; -} - -ACE_Filecache_Object * -ACE_Filecache::remove_i (const ACE_TCHAR *filename) -{ - ACE_Filecache_Object *handle = 0; - - // Disassociate file from the cache. - if (this->hash_.unbind (filename, handle) == 0) - { - handle->stale_ = 1; - - // Try a lock. If it succeeds, we can delete it now. - // Otherwise, it will clean itself up later. - if (handle->lock_.tryacquire_write () == 0) - { - delete handle; - handle = 0; - } - } - else - handle = 0; - - return handle; -} - -ACE_Filecache_Object * -ACE_Filecache::update_i (const ACE_TCHAR *filename, - ACE_SYNCH_RW_MUTEX &filelock, - int mapit) -{ - ACE_Filecache_Object *handle = 0; - - handle = this->remove_i (filename); - handle = this->insert_i (filename, filelock, mapit); - - return handle; -} - -int -ACE_Filecache::find (const ACE_TCHAR *filename) -{ - return this->hash_.find (filename); -} - - -ACE_Filecache_Object * -ACE_Filecache::remove (const ACE_TCHAR *filename) -{ - ACE_Filecache_Object *handle = 0; - - ACE_OFF_T loc = ACE::hash_pjw (filename) % this->size_; - ACE_SYNCH_RW_MUTEX &hashlock = this->hash_lock_[loc]; - // ACE_SYNCH_RW_MUTEX &filelock = this->file_lock_[loc]; - - if (this->hash_.find (filename, handle) != -1) - { - ACE_WRITE_GUARD_RETURN (ACE_SYNCH_RW_MUTEX, - ace_mon, - hashlock, - 0); - - return this->remove_i (filename); - } - - return 0; -} - - -ACE_Filecache_Object * -ACE_Filecache::fetch (const ACE_TCHAR *filename, int mapit) -{ - ACE_Filecache_Object *handle = 0; - - ACE_OFF_T loc = ACE::hash_pjw (filename) % this->size_; - ACE_SYNCH_RW_MUTEX &hashlock = this->hash_lock_[loc]; - ACE_SYNCH_RW_MUTEX &filelock = this->file_lock_[loc]; - - filelock.acquire_read (); - - if (this->hash_.find (filename, handle) == -1) - { - ACE_WRITE_GUARD_RETURN (ACE_SYNCH_RW_MUTEX, - ace_mon, - hashlock, - 0); - - // Second check in the method call - handle = this->insert_i (filename, filelock, mapit); - - if (handle == 0) - filelock.release (); - } - else - { - if (handle->update ()) - { - { - // Double check locking pattern - ACE_WRITE_GUARD_RETURN (ACE_SYNCH_RW_MUTEX, - ace_mon, - hashlock, - 0); - - // Second check in the method call - handle = this->update_i (filename, filelock, mapit); - - if (handle == 0) - filelock.release (); - } - } - // ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%t) CVF: found %s\n"), filename)); - } - - return handle; -} - -ACE_Filecache_Object * -ACE_Filecache::create (const ACE_TCHAR *filename, int size) -{ - ACE_Filecache_Object *handle = 0; - - ACE_OFF_T loc = ACE::hash_pjw (filename) % this->size_; - ACE_SYNCH_RW_MUTEX &filelock = this->file_lock_[loc]; - - ACE_NEW_RETURN (handle, - ACE_Filecache_Object (filename, size, filelock), - 0); - handle->acquire (); - - return handle; -} - -ACE_Filecache_Object * -ACE_Filecache::finish (ACE_Filecache_Object *&file) -{ - if (file == 0) - return file; - - ACE_OFF_T loc = ACE::hash_pjw (file->filename_) % this->size_; - ACE_SYNCH_RW_MUTEX &hashlock = this->hash_lock_[loc]; - - if (file != 0) - switch (file->action_) - { - case ACE_Filecache_Object::ACE_WRITING: - { - ACE_WRITE_GUARD_RETURN (ACE_SYNCH_RW_MUTEX, - ace_mon, - hashlock, - 0); - - file->release (); - - this->remove_i (file->filename_); -#if 0 - int result = this->hash_.bind (file->filename (), file); - - if (result == 0) - file->acquire (); -#else - // Last one using a stale file is resposible for deleting it. - if (file->stale_) - { - // Try a lock. If it succeds, we can delete it now. - // Otherwise, it will clean itself up later. - if (file->lock_.tryacquire_write () == 0) - { - delete file; - file = 0; - } - } -#endif - } - - break; - default: - file->release (); - - // Last one using a stale file is resposible for deleting it. - if (file->stale_) - { - // Try a lock. If it succeds, we can delete it now. - // Otherwise, it will clean itself up later. - if (file->lock_.tryacquire_write () == 0) - { - delete file; - file = 0; - } - } - - break; - } - - return file; -} - -void -ACE_Filecache_Object::init (void) -{ - this->filename_[0] = '\0'; - this->handle_ = ACE_INVALID_HANDLE; - this->error_ = ACE_SUCCESS; - this->tempname_ = 0; - this->size_ = 0; - - ACE_OS::memset (&(this->stat_), 0, sizeof (this->stat_)); -} - -ACE_Filecache_Object::ACE_Filecache_Object (void) - : tempname_ (0), - mmap_ (), - handle_ (0), - // stat_ (), - size_ (0), - action_ (0), - error_ (0), - stale_ (0), - // sa_ (), - junklock_ (), - lock_ (junklock_) -{ - this->init (); -} - -ACE_Filecache_Object::ACE_Filecache_Object (const ACE_TCHAR *filename, - ACE_SYNCH_RW_MUTEX &lock, - LPSECURITY_ATTRIBUTES sa, - int mapit) - : tempname_ (0), - mmap_ (), - handle_ (0), - // stat_ (), - size_ (0), - action_ (0), - error_ (0), - stale_ (0), - sa_ (sa), - junklock_ (), - lock_ (lock) -{ - this->init (); - - // ASSERT strlen(filename) < sizeof (this->filename_) - ACE_OS::strcpy (this->filename_, filename); - this->action_ = ACE_Filecache_Object::ACE_READING; - // place ourselves into the READING state - - // Can we access the file? - if (ACE_OS::access (this->filename_, R_OK) == -1) - { - this->error_i (ACE_Filecache_Object::ACE_ACCESS_FAILED); - return; - } - - // Can we stat the file? - if (ACE_OS::stat (this->filename_, &this->stat_) == -1) - { - this->error_i (ACE_Filecache_Object::ACE_STAT_FAILED); - return; - } - - this->size_ = ACE_Utils::truncate_cast (this->stat_.st_size); - this->tempname_ = this->filename_; - - // Can we open the file? - this->handle_ = ACE_OS::open (this->tempname_, - READ_FLAGS, R_MASK, this->sa_); - if (this->handle_ == ACE_INVALID_HANDLE) - { - this->error_i (ACE_Filecache_Object::ACE_OPEN_FAILED, - ACE_TEXT ("ACE_Filecache_Object::ctor: open")); - return; - } - - if (mapit) - { - // Can we map the file? - if (this->mmap_.map (this->handle_, static_cast (-1), - PROT_READ, ACE_MAP_PRIVATE, 0, 0, this->sa_) != 0) - { - this->error_i (ACE_Filecache_Object::ACE_MEMMAP_FAILED, - ACE_TEXT ("ACE_Filecache_Object::ctor: map")); - ACE_OS::close (this->handle_); - this->handle_ = ACE_INVALID_HANDLE; - return; - } - } - - // Ok, finished! - this->action_ = ACE_Filecache_Object::ACE_READING; -} - -ACE_Filecache_Object::ACE_Filecache_Object (const ACE_TCHAR *filename, - ACE_OFF_T size, - ACE_SYNCH_RW_MUTEX &lock, - LPSECURITY_ATTRIBUTES sa) - : stale_ (0), - sa_ (sa), - lock_ (lock) -{ - this->init (); - - this->size_ = size; - ACE_OS::strcpy (this->filename_, filename); - this->action_ = ACE_Filecache_Object::ACE_WRITING; - - // Can we access the file? - if (ACE_OS::access (this->filename_, R_OK|W_OK) == -1 - // Does it exist? - && ACE_OS::access (this->filename_, F_OK) != -1) - { - // File exists, but we cannot access it. - this->error_i (ACE_Filecache_Object::ACE_ACCESS_FAILED); - return; - } - - this->tempname_ = this->filename_; - - // Can we open the file? - this->handle_ = ACE_OS::open (this->tempname_, WRITE_FLAGS, W_MASK, this->sa_); - if (this->handle_ == ACE_INVALID_HANDLE) - { - this->error_i (ACE_Filecache_Object::ACE_OPEN_FAILED, - ACE_TEXT ("ACE_Filecache_Object::acquire: open")); - return; - } - - // Can we write? - if (ACE_OS::pwrite (this->handle_, "", 1, this->size_ - 1) != 1) - { - this->error_i (ACE_Filecache_Object::ACE_WRITE_FAILED, - ACE_TEXT ("ACE_Filecache_Object::acquire: write")); - ACE_OS::close (this->handle_); - return; - } - - // Can we map? - if (this->mmap_.map (this->handle_, this->size_, PROT_RDWR, MAP_SHARED, - 0, 0, this->sa_) != 0) - { - this->error_i (ACE_Filecache_Object::ACE_MEMMAP_FAILED, - ACE_TEXT ("ACE_Filecache_Object::acquire: map")); - ACE_OS::close (this->handle_); - } - - // Ok, done! -} - -ACE_Filecache_Object::~ACE_Filecache_Object (void) -{ - if (this->error_ == ACE_SUCCESS) - { - this->mmap_.unmap (); - ACE_OS::close (this->handle_); - this->handle_ = ACE_INVALID_HANDLE; - } - - this->lock_.release (); -} - -int -ACE_Filecache_Object::acquire (void) -{ - return this->lock_.tryacquire_read (); -} - -int -ACE_Filecache_Object::release (void) -{ - if (this->action_ == ACE_WRITING) - { - // We are safe since only one thread has a writable Filecache_Object - -#if 0 - ACE_HANDLE original = ACE_OS::open (this->filename_, WRITE_FLAGS, W_MASK, - this->sa_); - if (original == ACE_INVALID_HANDLE) - this->error_ = ACE_Filecache_Object::ACE_OPEN_FAILED; - else if (ACE_OS::write (original, this->mmap_.addr (), - this->size_) == -1) - { - this->error_ = ACE_Filecache_Object::ACE_WRITE_FAILED; - ACE_OS::close (original); - ACE_OS::unlink (this->filename_); - } - else if (ACE_OS::stat (this->filename_, &this->stat_) == -1) - this->error_ = ACE_Filecache_Object::ACE_STAT_FAILED; -#endif - - this->mmap_.unmap (); - ACE_OS::close (this->handle_); - this->handle_ = ACE_INVALID_HANDLE; - -#if 0 - // Leave the file in an acquirable state. - this->handle_ = ACE_OS::open (this->tempname_, READ_FLAGS, R_MASK); - if (this->handle_ == ACE_INVALID_HANDLE) - { - this->error_i (ACE_Filecache_Object::ACE_OPEN_FAILED, - "ACE_Filecache_Object::acquire: open"); - } - else if (this->mmap_.map (this->handle_, -1, - PROT_READ, - ACE_MAP_PRIVATE, - 0, - 0, - this->sa_) != 0) - { - this->error_i (ACE_Filecache_Object::ACE_MEMMAP_FAILED, - "ACE_Filecache_Object::acquire: map"); - ACE_OS::close (this->handle_); - this->handle_ = ACE_INVALID_HANDLE; - } - - this->action_ = ACE_Filecache_Object::ACE_READING; -#endif - } - - return this->lock_.release (); -} - -int -ACE_Filecache_Object::error (void) const -{ - // The existence of the object means a read lock is being held. - return this->error_; -} - -int -ACE_Filecache_Object::error_i (int error_value, const ACE_TCHAR *s) -{ - s = s; - ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p.\n"), s)); - this->error_ = error_value; - return error_value; -} - -const ACE_TCHAR * -ACE_Filecache_Object::filename (void) const -{ - // The existence of the object means a read lock is being held. - return this->filename_; -} - -ACE_OFF_T -ACE_Filecache_Object::size (void) const -{ - // The existence of the object means a read lock is being held. - return this->size_; -} - -ACE_HANDLE -ACE_Filecache_Object::handle (void) const -{ - // The existence of the object means a read lock is being held. - return this->handle_; -} - -void * -ACE_Filecache_Object::address (void) const -{ - // The existence of the object means a read lock is being held. - return this->mmap_.addr (); -} - -int -ACE_Filecache_Object::update (void) const -{ - // The existence of the object means a read lock is being held. - int result; - ACE_stat statbuf; - - if (ACE_OS::stat (this->filename_, &statbuf) == -1) - result = 1; - else - result = ACE_OS::difftime (this->stat_.st_mtime, statbuf.st_mtime) < 0; - - return result; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Filecache.h b/dep/acelite/ace/Filecache.h deleted file mode 100644 index 9165a70fcd3..00000000000 --- a/dep/acelite/ace/Filecache.h +++ /dev/null @@ -1,356 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Filecache.h - * - * $Id: Filecache.h 91066 2010-07-12 11:05:04Z johnnyw $ - * - * @author James Hu - */ -//============================================================================= - - -#ifndef ACE_FILECACHE_H -#define ACE_FILECACHE_H - -#include /**/ "ace/pre.h" - -#include "ace/Mem_Map.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Hash_Map_Manager_T.h" -#include "ace/Null_Mutex.h" -#include "ace/Synch_Traits.h" -#include "ace/RW_Thread_Mutex.h" -#include "ace/OS_NS_sys_stat.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -enum ACE_Filecache_Flag -{ - ACE_NOMAP = 0, - ACE_MAPIT = 1 -}; - -class ACE_Filecache_Object; - -/** - * @class ACE_Filecache_Handle - * - * @brief - * Abstraction over a real file. This is meant to be the entry - * point into the Cached Virtual Filesystem. - * - * This is a cached filesystem implementation based loosely on the - * implementation of JAWS_File. The interfaces will be nearly the - * same. The under-the-hood implementation should hopefully be a - * much faster thing. - * These will be given their own implementations later. For now, we - * borrow the implementation provided by JAWS. - * On creation, the cache is checked, and reference count is - * incremented. On destruction, reference count is decremented. If - * the reference count is 0, the file is removed from the cache. - * E.g. 1, - * { - * ACE_Filecache_Handle foo("foo.html"); - * this->peer ().send (foo.address (), foo.size ()); - * } - * E.g. 2, - * { - * ACE_Filecache_Handle foo("foo.html"); - * io->transmitfile (foo.handle (), this->peer ().handle ()); - * } - * E.g. 3, - * { - * ACE_Filecache_Handle foo("foo.html", content_length); - * this->peer ().recv (foo.address (), content_length); - * } - * TODO: - */ -class ACE_Export ACE_Filecache_Handle -{ - // (1) Get rid of the useless copying of files when reading. - // Although it does make sure the file you send isn't being changed, - // it doesn't make sure the file is in a sensible state before - // sending it. - // - // Alternative: if the file get's trashed while it is being shipped, - // let the client request the file again. The cache should have an - // updated copy by that point. - // - // (2) Use hashing for locating files. This means I need a hastable - // implementation with buckets. - // - // (3) Only lock when absolutely necessary. JAWS_Virtual_Filesystem was - // rather conservative, but for some reason it still ran into problems. - // Since this design should be simpler, problems should be easier to spot. - // -public: - - /// Query cache for file, and acquire it. Assumes the file is being - /// opened for reading. - ACE_Filecache_Handle (const ACE_TCHAR *filename, - ACE_Filecache_Flag mapit = ACE_MAPIT); - - /** - * Create new entry, and acquire it. Presence of SIZE assumes the - * file is being opened for writing. If SIZE is zero, assumes the - * file is to be removed from the cache. - */ - ACE_Filecache_Handle (const ACE_TCHAR *filename, - int size, - ACE_Filecache_Flag mapit = ACE_MAPIT); - - /// Closes any open handles, release acquired file. - ~ACE_Filecache_Handle (void); - - /// Base address of memory mapped file. - void *address (void) const; - - /// A handle (e.g., UNIX file descriptor, or NT file handle). - ACE_HANDLE handle (void) const; - - /// Any associated error in handle creation and acquisition. - int error (void) const; - - /// The size of the file. - ACE_OFF_T size (void) const; - -protected: - /// Default do nothing constructor. Prevent it from being called. - ACE_Filecache_Handle (void); - - /// Common initializations for constructors. - void init (void); - -public: - /// These come from ACE_Filecache_Object, which is an internal class. - enum - { - ACE_SUCCESS = 0, - ACE_ACCESS_FAILED, - ACE_OPEN_FAILED, - ACE_COPY_FAILED, - ACE_STAT_FAILED, - ACE_MEMMAP_FAILED, - ACE_WRITE_FAILED - }; - -private: - /// A reference to the low level instance. - ACE_Filecache_Object *file_; - - /// A dup'd version of the one from file_. - ACE_HANDLE handle_; - - int mapit_; -}; - -typedef ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_Null_Mutex> - ACE_Filecache_Hash; - -typedef ACE_Hash_Map_Entry ACE_Filecache_Hash_Entry; - -/** - * @class ACE_Filecache - * - * @brief - * A hash table holding the information about entry point into - * the Cached Virtual Filesystem. On insertion, the reference - * count is incremented. On destruction, reference count is - * decremented. - */ -class ACE_Export ACE_Filecache -{ -public: - /// Singleton pattern. - static ACE_Filecache *instance (void); - - ~ACE_Filecache (void); - - /// Returns 0 if the file associated with ``filename'' is in the cache, - /// or -1 if not. - int find (const ACE_TCHAR *filename); - - /// Return the file associated with ``filename'' if it is in the cache, - /// or create if not. - ACE_Filecache_Object *fetch (const ACE_TCHAR *filename, int mapit = 1); - - /// Remove the file associated with ``filename'' from the cache. - ACE_Filecache_Object *remove (const ACE_TCHAR *filename); - - /// Create a new Filecache_Object, returns it. - ACE_Filecache_Object *create (const ACE_TCHAR *filename, int size); - - /// Release an acquired Filecache_Object, returns it again or NULL if it - /// was deleted. - ACE_Filecache_Object *finish (ACE_Filecache_Object *&new_file); - -protected: - ACE_Filecache_Object *insert_i (const ACE_TCHAR *filename, - ACE_SYNCH_RW_MUTEX &filelock, - int mapit); - ACE_Filecache_Object *remove_i (const ACE_TCHAR *filename); - ACE_Filecache_Object *update_i (const ACE_TCHAR *filename, - ACE_SYNCH_RW_MUTEX &filelock, - int mapit); - -public: - - enum - { - /// For this stupid implementation, use an array. Someday, use a - /// balanced search tree, or real hash table. - ACE_DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE = 512, - - /// This determines the highwater mark in megabytes for the cache. - /// This will be ignored for now. - ACE_DEFAULT_VIRTUAL_FILESYSTEM_CACHE_SIZE = 20 - }; - -protected: - /// Prevent it from being called. - ACE_Filecache (void); - -private: - ACE_OFF_T size_; - - /// The hash table - ACE_Filecache_Hash hash_; - - /// The reference to the instance - static ACE_Filecache *cvf_; - - // = Synchronization variables. - ACE_SYNCH_RW_MUTEX hash_lock_[ACE_DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE]; - ACE_SYNCH_RW_MUTEX file_lock_[ACE_DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE]; -}; - -/** - * @class ACE_Filecache_Object - * - * @brief - * Abstraction over a real file. This is what the Virtual - * Filesystem contains. This class is not intended for general - * consumption. Please consult a physician before attempting to - * use this class. - */ -class ACE_Export ACE_Filecache_Object -{ -public: - friend class ACE_Filecache; - - /// Creates a file for reading. - ACE_Filecache_Object (const ACE_TCHAR *filename, - ACE_SYNCH_RW_MUTEX &lock, - LPSECURITY_ATTRIBUTES sa = 0, - int mapit = 1); - - /// Creates a file for writing. - ACE_Filecache_Object (const ACE_TCHAR *filename, - ACE_OFF_T size, - ACE_SYNCH_RW_MUTEX &lock, - LPSECURITY_ATTRIBUTES sa = 0); - - /// Only if reference count is zero should this be called. - ~ACE_Filecache_Object (void); - - /// Increment the reference_count_. - int acquire (void); - - /// Decrement the reference_count_. - int release (void); - - // = error_ accessors - int error (void) const; - int error (int error_value, - const ACE_TCHAR *s = ACE_TEXT ("ACE_Filecache_Object")); - - /// filename_ accessor - const ACE_TCHAR *filename (void) const; - - /// handle_ accessor. - ACE_HANDLE handle (void) const; - - /// Base memory address for memory mapped file. - void *address (void) const; - - /// size_ accessor. - ACE_OFF_T size (void) const; - - /// True if file on disk is newer than cached file. - int update (void) const; - -protected: - /// Prevent from being called. - ACE_Filecache_Object (void); - - /// Common initialization code, - void init (void); - -private: - /// Internal error logging method, no locking. - int error_i (int error_value, - const ACE_TCHAR *s = ACE_TEXT ("ACE_Filecache_Object")); - -public: - - enum Creation_States - { - ACE_READING = 1, - ACE_WRITING = 2 - }; - - enum Error_Conditions - { - ACE_SUCCESS = 0, - ACE_ACCESS_FAILED, - ACE_OPEN_FAILED, - ACE_COPY_FAILED, - ACE_STAT_FAILED, - ACE_MEMMAP_FAILED, - ACE_WRITE_FAILED - }; - -private: - /// The temporary file name and the real file name. The real file is - /// copied into the temporary file for safety reasons. - ACE_TCHAR *tempname_; - ACE_TCHAR filename_[MAXPATHLEN + 1]; - - /// Holds the memory mapped version of the temporary file. - ACE_Mem_Map mmap_; - - /// The descriptor to the temporary file. - ACE_HANDLE handle_; - - /// Used to compare against the real file to test if an update is needed. - ACE_stat stat_; - ACE_OFF_T size_; - - /// Status indicators. - int action_; - int error_; - - /// If set to 1, means the object is flagged for removal. - int stale_; - - /// Security attribute object. - LPSECURITY_ATTRIBUTES sa_; - - /// The default initializer - ACE_SYNCH_RW_MUTEX junklock_; - - /// Provides a bookkeeping mechanism for users of this object. - ACE_SYNCH_RW_MUTEX &lock_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_FILECACHE_H */ diff --git a/dep/acelite/ace/FlReactor/ACE_FlReactor_export.h b/dep/acelite/ace/FlReactor/ACE_FlReactor_export.h deleted file mode 100644 index 282adb6494d..00000000000 --- a/dep/acelite/ace/FlReactor/ACE_FlReactor_export.h +++ /dev/null @@ -1,58 +0,0 @@ - -// -*- C++ -*- -// $Id: ACE_FlReactor_export.h 80826 2008-03-04 14:51:23Z wotte $ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl -s ACE_FlReactor -// ------------------------------ -#ifndef ACE_FLREACTOR_EXPORT_H -#define ACE_FLREACTOR_EXPORT_H - -#include /**/ "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_FLREACTOR_HAS_DLL) -# define ACE_FLREACTOR_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && ACE_FLREACTOR_HAS_DLL */ - -#if !defined (ACE_FLREACTOR_HAS_DLL) -# define ACE_FLREACTOR_HAS_DLL 1 -#endif /* ! ACE_FLREACTOR_HAS_DLL */ - -#if defined (ACE_FLREACTOR_HAS_DLL) && (ACE_FLREACTOR_HAS_DLL == 1) -# if defined (ACE_FLREACTOR_BUILD_DLL) -# define ACE_FlReactor_Export ACE_Proper_Export_Flag -# define ACE_FLREACTOR_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define ACE_FLREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* ACE_FLREACTOR_BUILD_DLL */ -# define ACE_FlReactor_Export ACE_Proper_Import_Flag -# define ACE_FLREACTOR_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define ACE_FLREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* ACE_FLREACTOR_BUILD_DLL */ -#else /* ACE_FLREACTOR_HAS_DLL == 1 */ -# define ACE_FlReactor_Export -# define ACE_FLREACTOR_SINGLETON_DECLARATION(T) -# define ACE_FLREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* ACE_FLREACTOR_HAS_DLL == 1 */ - -// Set ACE_FLREACTOR_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (ACE_FLREACTOR_NTRACE) -# if (ACE_NTRACE == 1) -# define ACE_FLREACTOR_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define ACE_FLREACTOR_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !ACE_FLREACTOR_NTRACE */ - -#if (ACE_FLREACTOR_NTRACE == 1) -# define ACE_FLREACTOR_TRACE(X) -#else /* (ACE_FLREACTOR_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define ACE_FLREACTOR_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (ACE_FLREACTOR_NTRACE == 1) */ - -#endif /* ACE_FLREACTOR_EXPORT_H */ - -// End of auto generated file. diff --git a/dep/acelite/ace/FlReactor/FlReactor.cpp b/dep/acelite/ace/FlReactor/FlReactor.cpp deleted file mode 100644 index 4cab9c9df78..00000000000 --- a/dep/acelite/ace/FlReactor/FlReactor.cpp +++ /dev/null @@ -1,328 +0,0 @@ -// $Id: FlReactor.cpp 95511 2012-01-27 09:40:38Z johnnyw $ - -#include "ace/FlReactor/FlReactor.h" - -#include /**/ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE (ACE_FlReactor) - -// Must be called with lock held -ACE_FlReactor::ACE_FlReactor (size_t size, - bool restart, - ACE_Sig_Handler *h) - : ACE_Select_Reactor (size, restart, h) -{ - // When the ACE_Select_Reactor is constructed it creates the notify - // pipe and registers it with the register_handler_i() method. The - // FlReactor overloads this method BUT because the - // register_handler_i occurs when constructing the base class - // ACE_Select_Reactor, the ACE_Select_Reactor register_handler_i() - // is called not the FlReactor register_handler_i(). This means - // that the notify pipe is registered with the ACE_Select_Reactor - // event handling code not the FlReactor and so notfications don't - // work. To get around this we simply close and re-opened the - // notification handler in the constructor of the FlReactor. - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - this->notify_handler_->close (); - this->notify_handler_->open (this, 0); -#endif /* ACE_MT_SAFE */ -} - -ACE_FlReactor::~ACE_FlReactor (void) -{ -} - -// This is just the from ace/Reactor.cpp -// but we use the Fl functions to wait for an event, not , just use the Fl mechanism - // to wait for one or more events... - - // Wait for something to happen. - double t = 0; - if (max_wait_time != 0) - t = max_wait_time->sec () + max_wait_time->usec () / 1000000.0F; - - while (t > 0) { - t = Fl::wait (t); - } - - // Reset the width, in case it changed during the upcalls. - width = this->handler_rep_.max_handlep1 (); - - // Now actually read the result needed by the - // using - -int -ACE_FoxReactor::wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &handle_set, - ACE_Time_Value *max_wait_time) -{ - ACE_TRACE( "ACE_FoxReactor::wait_for_multiple_events" ); - - int nfound = 0; - do - { - max_wait_time = this->timer_queue_->calculate_timeout (max_wait_time); - size_t width = this->handler_rep_.max_handlep1 (); - handle_set.rd_mask_ = this->wait_set_.rd_mask_; - handle_set.wr_mask_ = this->wait_set_.wr_mask_; - handle_set.ex_mask_ = this->wait_set_.ex_mask_; - - nfound = FoxWaitForMultipleEvents (width, - handle_set, - max_wait_time); - - } while( nfound == -1 && this->handle_error () > 0 ); - - if (nfound > 0) - { -#if !defined (ACE_WIN32) - handle_set.rd_mask_.sync (this->handler_rep_.max_handlep1 ()); - handle_set.wr_mask_.sync (this->handler_rep_.max_handlep1 ()); - handle_set.ex_mask_.sync (this->handler_rep_.max_handlep1 ()); -#endif /* ACE_WIN32 */ - } - - return nfound; - // Timed out or input available -} - -int -ACE_FoxReactor::FoxWaitForMultipleEvents (int width, - ACE_Select_Reactor_Handle_Set &wait_set, - ACE_Time_Value */*max_wait_time*/) -{ - // Check to make sure our handle's are all usable. - ACE_Select_Reactor_Handle_Set temp_set = wait_set; - - if (ACE_OS::select (width, - temp_set.rd_mask_, - temp_set.wr_mask_, - temp_set.ex_mask_, - (ACE_Time_Value *) &ACE_Time_Value::zero ) == -1) - return -1; // Bad file arguments... - - // Qt processing. - this->fxapp->runOneEvent () ; - - // Reset the width, in case it changed during the upcalls. - width = handler_rep_.max_handlep1 (); - - // Now actually read the result needed by the using - // modifies the @c fd_set. - */ - void sync (ACE_HANDLE max); - - /// Returns a pointer to the underlying @c fd_set. Returns 0 if - /// there are no handle bits set ( == 0). - operator fd_set *(); - - /// Returns a pointer to the underlying @c fd_set. Returns 0 if - /// there are no handle bits set ( == 0). - fd_set *fdset (void); - -#if defined (ACE_HAS_BIG_FD_SET) - /// Assignment operator optimizes for cases where == 0. - ACE_Handle_Set & operator= (const ACE_Handle_Set &); -#endif /* ACE_HAS_BIG_FD_SET */ - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Size of the set, i.e., a count of the number of enabled bits. - int size_; - - /// Current max handle. - ACE_HANDLE max_handle_; - -#if defined (ACE_HAS_BIG_FD_SET) - /// Current min handle. - ACE_HANDLE min_handle_; -#endif /* ACE_HAS_BIG_FD_SET */ - - /// Bitmask. - fd_set mask_; - - enum - { - WORDSIZE = NFDBITS, -#if !defined (ACE_WIN32) - NUM_WORDS = howmany (MAXSIZE, NFDBITS), -#endif /* ACE_WIN32 */ - NBITS = 256 - }; - - /// Counts the number of bits enabled in N. Uses a table lookup to - /// speed up the count. - static int count_bits (u_long n); - -#if defined (ACE_HAS_BIG_FD_SET) - /// Find the position of the bit counting from right to left. - static int bitpos (u_long bit); -#endif /* ACE_HAS_BIG_FD_SET */ - - /// Resets the after a clear of the original - /// . - void set_max (ACE_HANDLE max); - - /// Table that maps bytes to counts of the enabled bits in each value - /// from 0 to 255. - static const char nbits_[NBITS]; -}; - -/** - * @class ACE_Handle_Set_Iterator - * - * @brief Iterator for the ACE_Handle_Set abstraction. - */ -class ACE_Export ACE_Handle_Set_Iterator -{ -public: - /// Constructor. - ACE_Handle_Set_Iterator (const ACE_Handle_Set &hs); - - /// Default dtor. - ~ACE_Handle_Set_Iterator (void); - - /// Reset the state of the iterator by reinitializing the state - /// that we maintain. - void reset_state (void); - - /** - * "Next" operator. Returns the next unseen ACE_HANDLE in the - * up to ). When all the - * handles have been seen returns . Advances - * the iterator automatically, so you need not call - * (which is now obsolete). - */ - ACE_HANDLE operator () (void); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// The Handle_Set we are iterating through. - const ACE_Handle_Set &handles_; - - /// Index of the bit we're examining in the current word_num_() word. -#if defined (ACE_WIN32) - u_int handle_index_; -#elif !defined (ACE_HAS_BIG_FD_SET) - int handle_index_; -#elif defined (ACE_HAS_BIG_FD_SET) - int handle_index_; - u_long oldlsb_; -#endif /* ACE_WIN32 */ - - /// Number of the word we're iterating over (typically between 0..7). - int word_num_; - -#if defined (ACE_HAS_BIG_FD_SET) - /// Number max of the words with a possible bit on. - int word_max_; -#endif /* ACE_HAS_BIG_FD_SET */ - -#if !defined (ACE_WIN32) && !defined (ACE_HAS_BIG_FD_SET) - /// Value of the bits in the word we're iterating on. - fd_mask word_val_; -#elif !defined (ACE_WIN32) && defined (ACE_HAS_BIG_FD_SET) - /// Value of the bits in the word we're iterating on. - u_long word_val_; -#endif /* !ACE_WIN32 && !ACE_HAS_BIG_FD_SET */ -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Handle_Set.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_HANDLE_SET */ diff --git a/dep/acelite/ace/Handle_Set.inl b/dep/acelite/ace/Handle_Set.inl deleted file mode 100644 index fd401caa628..00000000000 --- a/dep/acelite/ace/Handle_Set.inl +++ /dev/null @@ -1,183 +0,0 @@ -// -*- C++ -*- -// -// $Id: Handle_Set.inl 96017 2012-08-08 22:18:09Z mitza $ - -#include "ace/Log_Msg.h" - -// AIX defines bzero() in this odd file... used by FD_ZERO -#if defined (ACE_HAS_STRINGS) -# include "ace/os_include/os_strings.h" -#endif /* ACE_HAS_STRINGS */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Initialize the bitmask to all 0s and reset the associated fields. - -ACE_INLINE void -ACE_Handle_Set::reset (void) -{ - ACE_TRACE ("ACE_Handle_Set::reset"); - this->max_handle_ = - ACE_INVALID_HANDLE; -#if defined (ACE_HAS_BIG_FD_SET) - this->min_handle_ = - NUM_WORDS * WORDSIZE; -#endif /* ACE_HAS_BIG_FD_SET */ - this->size_ = 0; - // #if !defined (ACE_HAS_BIG_FD_SET) Why is this here? -Steve Huston - FD_ZERO (&this->mask_); - // #endif /* ACE_HAS_BIG_FD_SET */ -} - -#if defined (ACE_HAS_BIG_FD_SET) -ACE_INLINE ACE_Handle_Set & -ACE_Handle_Set::operator = (const ACE_Handle_Set &rhs) -{ - ACE_TRACE ("ACE_Handle_Set::operator ="); - - if (rhs.size_ > 0) - { - this->size_ = - rhs.size_; - this->max_handle_ = - rhs.max_handle_; - this->min_handle_ = - rhs.min_handle_; - this->mask_ = - rhs.mask_; - } - else - this->reset (); - - return *this; -} -#endif /* ACE_HAS_BIG_FD_SET */ - -// Returns the number of the large bit. - -ACE_INLINE ACE_HANDLE -ACE_Handle_Set::max_set (void) const -{ - ACE_TRACE ("ACE_Handle_Set::max_set"); - return this->max_handle_; -} - -// Checks whether handle is enabled. - -ACE_INLINE int -ACE_Handle_Set::is_set (ACE_HANDLE handle) const -{ - ACE_TRACE ("ACE_Handle_Set::is_set"); -#if defined (ACE_HAS_BIG_FD_SET) - return FD_ISSET (handle, - &this->mask_) - && this->size_ > 0; -#elif defined (ACE_HAS_NONCONST_FD_ISSET) - return FD_ISSET (handle, - const_cast (&this->mask_)); -#elif defined (ACE_VXWORKS) && ACE_VXWORKS >= 0x690 - return static_cast (FD_ISSET (handle, &this->mask_)); -#else - return FD_ISSET (handle, - &this->mask_); -#endif /* ACE_HAS_BIG_FD_SET */ -} - -// Enables the handle. - -ACE_INLINE void -ACE_Handle_Set::set_bit (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Handle_Set::set_bit"); - if ((handle != ACE_INVALID_HANDLE) - && (!this->is_set (handle))) - { -#if defined (ACE_WIN32) - FD_SET ((SOCKET) handle, - &this->mask_); - ++this->size_; -#else /* ACE_WIN32 */ -#if defined (ACE_HAS_BIG_FD_SET) - if (this->size_ == 0) - FD_ZERO (&this->mask_); - - if (handle < this->min_handle_) - this->min_handle_ = handle; -#endif /* ACE_HAS_BIG_FD_SET */ - - FD_SET (handle, - &this->mask_); - ++this->size_; - - if (handle > this->max_handle_) - this->max_handle_ = handle; -#endif /* ACE_WIN32 */ - } -} - -// Disables the handle. - -ACE_INLINE void -ACE_Handle_Set::clr_bit (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Handle_Set::clr_bit"); - - if ((handle != ACE_INVALID_HANDLE) && - (this->is_set (handle))) - { - FD_CLR ((ACE_SOCKET) handle, - &this->mask_); - --this->size_; - -#if !defined (ACE_WIN32) - if (handle == this->max_handle_) - this->set_max (this->max_handle_); -#endif /* !ACE_WIN32 */ - } -} - -// Returns a count of the number of enabled bits. - -ACE_INLINE int -ACE_Handle_Set::num_set (void) const -{ - ACE_TRACE ("ACE_Handle_Set::num_set"); -#if defined (ACE_WIN32) - return this->mask_.fd_count; -#else /* !ACE_WIN32 */ - return this->size_; -#endif /* ACE_WIN32 */ -} - -// Returns a pointer to the underlying fd_set. - -ACE_INLINE -ACE_Handle_Set::operator fd_set *() -{ - ACE_TRACE ("ACE_Handle_Set::operator fd_set *"); - - if (this->size_ > 0) - return (fd_set *) &this->mask_; - else - return (fd_set *) 0; -} - -// Returns a pointer to the underlying fd_set. - -ACE_INLINE fd_set * -ACE_Handle_Set::fdset (void) -{ - ACE_TRACE ("ACE_Handle_Set::fdset"); - - if (this->size_ > 0) - return (fd_set *) &this->mask_; - else - return (fd_set *) 0; -} - -ACE_INLINE -ACE_Handle_Set_Iterator::~ACE_Handle_Set_Iterator (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Hash_Cache_Map_Manager_T.cpp b/dep/acelite/ace/Hash_Cache_Map_Manager_T.cpp deleted file mode 100644 index 19478977569..00000000000 --- a/dep/acelite/ace/Hash_Cache_Map_Manager_T.cpp +++ /dev/null @@ -1,226 +0,0 @@ -// $Id: Hash_Cache_Map_Manager_T.cpp 93359 2011-02-11 11:33:12Z mcorino $ - -#ifndef ACE_HASH_CACHE_MAP_MANAGER_T_CPP -#define ACE_HASH_CACHE_MAP_MANAGER_T_CPP - -#include "ace/Hash_Cache_Map_Manager_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (__ACE_INLINE__) -#include "ace/Hash_Cache_Map_Manager_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Cache_Map_Manager) - -template -ACE_Hash_Cache_Map_Manager::ACE_Hash_Cache_Map_Manager (CACHING_STRATEGY &caching_s, - size_t size, - ACE_Allocator *alloc) - : ACE_HCMM_BASE (caching_s, - size, - alloc) -{ -} - -template -ACE_Hash_Cache_Map_Manager::~ACE_Hash_Cache_Map_Manager (void) -{ -} - -template int -ACE_Hash_Cache_Map_Manager::bind (const KEY &key, - const VALUE &value, - CACHE_ENTRY *&entry) -{ - // Insert a entry which has the and the which is - // the combination of the and the attributes of the caching - // strategy. - CACHE_VALUE cache_value (value, - this->caching_strategy_.attributes ()); - - int bind_result = this->map_.bind (key, - cache_value, - entry); - - if (bind_result != -1) - { - - int result = this->caching_strategy_.notify_bind (bind_result, - cache_value.second); - - if (result == -1) - { - - this->map_.unbind (key); - - // Unless the notification goes thru the bind operation is - // not complete. - bind_result = -1; - - } - } - - return bind_result; -} - -template int -ACE_Hash_Cache_Map_Manager::rebind (const KEY &key, - const VALUE &value, - CACHE_ENTRY *&entry) -{ - CACHE_VALUE cache_value (value, - this->caching_strategy_.attributes ()); - - int rebind_result = this->map_.rebind (key, - cache_value, - entry); - - if (rebind_result != -1) - { - - int result = this->caching_strategy_.notify_rebind (rebind_result, - cache_value.second ()); - - if (result == -1) - { - - // Make sure the unbind operation is done only when the - // notification fails after a bind which is denoted by - // rebind_result = 0 - if (rebind_result == 0) - this->map_.unbind (key); - - // Unless the notification goes thru the rebind operation is - // not complete. - rebind_result = -1; - - } - - } - - return rebind_result; -} - -template int -ACE_Hash_Cache_Map_Manager::trybind (const KEY &key, - VALUE &value, - CACHE_ENTRY *&entry) -{ - CACHE_VALUE cache_value (value, - this->caching_strategy_.attributes ()); - - int trybind_result = this->map_.trybind (key, - cache_value, - entry); - - if (trybind_result != -1) - { - int result = this->caching_strategy_.notify_trybind (trybind_result, - cache_value.second ()); - - if (result == -1) - { - - // If the entry has got inserted into the map, it is removed - // due to failure. - if (trybind_result == 0) - this->map_.unbind (key); - - trybind_result = -1; - - } - else - { - - // If an attempt is made to bind an existing entry the value - // is overwritten with the value from the map. - if (trybind_result == 1) - value = cache_value.first (); - - } - - } - - return trybind_result; -} - -template int -ACE_Hash_Cache_Map_Manager::find (const KEY &key, - CACHE_ENTRY *&entry) -{ - // Lookup the key and populate the . - int find_result = this->map_.find (key, - entry); - - if (find_result != -1) - { - - int result = this->caching_strategy_.notify_find (find_result, - entry->int_id_.second); - - // Unless the find and notification operations go thru, this - // method is not successful. - if (result == -1) - find_result = -1; - else - find_result = 0; - - } - - return find_result; -} - -template int -ACE_Hash_Cache_Map_Manager::find (const KEY &key, - VALUE &value) -{ - CACHE_ENTRY *entry = 0; - - int result = this->find (key, - entry); - - if (result != -1) - { - value = entry->int_id_.first; - } - - return result; -} - -template int -ACE_Hash_Cache_Map_Manager::find (const KEY &key) -{ - CACHE_ENTRY *entry = 0; - - return this->find (key, - entry); -} - -template int -ACE_Hash_Cache_Map_Manager::unbind (CACHE_ENTRY *entry) -{ - // Remove the entry from the cache. - int unbind_result = this->map_.unbind (entry); - - if (unbind_result != -1) - { - - int result = this->caching_strategy_.notify_unbind (unbind_result, - entry->int_id_.second); - - if (result == -1) - unbind_result = -1; - - } - - return unbind_result; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HASH_CACHE_MAP_MANAGER_T_CPP */ diff --git a/dep/acelite/ace/Hash_Cache_Map_Manager_T.h b/dep/acelite/ace/Hash_Cache_Map_Manager_T.h deleted file mode 100644 index e1fc4d77317..00000000000 --- a/dep/acelite/ace/Hash_Cache_Map_Manager_T.h +++ /dev/null @@ -1,210 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Hash_Cache_Map_Manager_T.h - * - * $Id: Hash_Cache_Map_Manager_T.h 93366 2011-02-11 19:30:35Z johnnyw $ - * - * @author Kirthika Parameswaran - */ -//============================================================================= - - -#ifndef HASH_CACHE_MAP_MANAGER_T_H -#define HASH_CACHE_MAP_MANAGER_T_H - -#include /**/ "ace/pre.h" - -#include "ace/Hash_Map_Manager_T.h" -#include "ace/Cache_Map_Manager_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Null_Mutex.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward declaration. -class ACE_Allocator; - -#define ACE_CACHE_MAP_MANAGER \ - ACE_Cache_Map_Manager, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>, \ - ACE_Hash_Map_Iterator_Ex, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>, \ - ACE_Hash_Map_Reverse_Iterator_Ex, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>, \ - CACHING_STRATEGY, \ - ATTRIBUTES> - - /** - * @class ACE_Hash_Cache_Map_Manager - * - * @brief Defines a abstraction which will purge entries from a map. - * The map considered is the ACE_Hash_Map_Manager_Ex. - * - * The Hash_Cache_Map_Manager will manage the map it contains - * and provide purging on demand from the map. The strategy for - * caching is decided by the user and provided to the Cache - * Manager. The Cache Manager acts as a agent and communicates - * between the Map and the Strategy for purging entries from the - * map. To tap the optimal methods like find(key,value,entry) - * present in the ACE_Hash_Map_Manager, - * Hash_Cache_Map_Manager provides extra functionality on top - * of the Cache_Map_Manager. - * No locking mechanism provided since locking at this level - * isn't efficient. Locking has to be provided by the - * application. - */ -template -class ACE_Hash_Cache_Map_Manager : public ACE_CACHE_MAP_MANAGER -{ - public: - - /** - * The actual value mapped to the key in the map. The - * are used by the strategy and is transparent to the user of this - * class. - */ - typedef std::pair CACHE_VALUE; - typedef ACE_Hash_Map_Manager_Ex HASH_MAP; - typedef ACE_Hash_Map_Entry CACHE_ENTRY; - typedef KEY key_type; - typedef VALUE mapped_type; - - // = Initialization and termination methods. - /// Initialize a with @a size entries. - ACE_Hash_Cache_Map_Manager (CACHING_STRATEGY &caching_s, - size_t size = ACE_DEFAULT_MAP_SIZE, - ACE_Allocator *alloc = 0); - - /// Close down a and release dynamically allocated - /// resources. - ~ACE_Hash_Cache_Map_Manager (void); - - /** - * Associate @a key with @a value. If @a key is already in the - * MAP then the ENTRY is not changed. Returns 0 if a new entry is - * bound successfully, returns 1 if an attempt is made to bind an - * existing entry, and returns -1 if failures occur. - */ - int bind (const KEY &key, - const VALUE &value); - - /** - * Same as a normal bind, except the cache entry is also passed back - * to the caller. The entry in this case will either be the newly - * created entry, or the existing one. - */ - int bind (const KEY &key, - const VALUE &value, - CACHE_ENTRY *&entry); - - /// Loopkup entry in the cache. - int find (const KEY &key, - VALUE &value); - - /// Is @a key in the cache? - int find (const KEY &key); - - /// Obtain the entry when the find succeeds. - int find (const KEY &key, - CACHE_ENTRY *&entry); - - /** - * Reassociate the @a key with @a value. If the @a key already exists - * in the cache then returns 1, on a new bind returns 0 and returns - * -1 in case of any failures. - */ - int rebind (const KEY &key, - const VALUE &value); - - /** - * Reassociate @a key with @a value, storing the old value into the - * "out" parameter @a old_value. The function fails if @a key is not - * in the cache for caches that do not allow user specified keys. - * However, for caches that allow user specified keys, if the key is - * not in the cache, a new @a key / @a value association is created. - */ - int rebind (const KEY &key, - const VALUE &value, - VALUE &old_value); - - /** - * Reassociate @a key with @a value, storing the old key and value - * into the "out" parameters @a old_key and @a old_value. The - * function fails if @a key is not in the cache for caches that do not - * allow user specified keys. However, for caches that allow user - * specified keys, if the key is not in the cache, a new @a key / @a value - * association is created. - */ - int rebind (const KEY &key, - const VALUE &value, - KEY &old_key, - VALUE &old_value); - - /** - * Same as a normal rebind, except the cache entry is also passed back - * to the caller. The entry in this case will either be the newly - * created entry, or the existing one. - */ - int rebind (const KEY &key, - const VALUE &value, - CACHE_ENTRY *&entry); - - /** - * Associate @a key with @a value if and only if @a key is not in the - * cache. If @a key is already in the cache, then the @a value parameter - * is overwritten with the existing value in the cache. Returns 0 if a - * new @a key / @a value association is created. Returns 1 if an - * attempt is made to bind an existing entry. This function fails - * for maps that do not allow user specified keys. - */ - int trybind (const KEY &key, - VALUE &value); - - /** - * Same as a normal trybind, except the cache entry is also passed - * back to the caller. The entry in this case will either be the - * newly created entry, or the existing one. - */ - int trybind (const KEY &key, - VALUE &value, - CACHE_ENTRY *&entry); - - /// Remove @a key from the cache. - int unbind (const KEY &key); - - /// Remove @a key from the cache, and return the @a value associated with - /// @a key. - int unbind (const KEY &key, - VALUE &value); - - /// Remove entry from map. - int unbind (CACHE_ENTRY *entry); - -protected: - /// Base class. - typedef ACE_CACHE_MAP_MANAGER ACE_HCMM_BASE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - - -#if defined (__ACE_INLINE__) -#include "ace/Hash_Cache_Map_Manager_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Hash_Cache_Map_Manager_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Hash_Cache_Map_Manager_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* HASH_CACHE_MAP_MANAGER_T_H */ diff --git a/dep/acelite/ace/Hash_Cache_Map_Manager_T.inl b/dep/acelite/ace/Hash_Cache_Map_Manager_T.inl deleted file mode 100644 index 8c4bb122360..00000000000 --- a/dep/acelite/ace/Hash_Cache_Map_Manager_T.inl +++ /dev/null @@ -1,72 +0,0 @@ -// -*- C++ -*- -// $Id: Hash_Cache_Map_Manager_T.inl 93359 2011-02-11 11:33:12Z mcorino $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_INLINE int -ACE_Hash_Cache_Map_Manager::bind ( - const KEY &key, - const VALUE &value) -{ - return ACE_HCMM_BASE::bind (key, value); -} - -template -ACE_INLINE int -ACE_Hash_Cache_Map_Manager::rebind ( - const KEY &key, - const VALUE &value) -{ - return ACE_HCMM_BASE::rebind (key, value); -} - -template -ACE_INLINE int -ACE_Hash_Cache_Map_Manager::rebind ( - const KEY &key, - const VALUE &value, - VALUE &old_value) -{ - return ACE_HCMM_BASE::rebind (key, value, old_value); -} - -template -ACE_INLINE int -ACE_Hash_Cache_Map_Manager::rebind ( - const KEY &key, - const VALUE &value, - KEY &old_key, - VALUE &old_value) -{ - return ACE_HCMM_BASE::rebind (key, - value, - old_key, - old_value); -} - -template -ACE_INLINE int -ACE_Hash_Cache_Map_Manager::trybind ( - const KEY &key, - VALUE &value) -{ - return ACE_HCMM_BASE::trybind (key, value); -} - -template -ACE_INLINE int -ACE_Hash_Cache_Map_Manager::unbind (const KEY &key) -{ - return ACE_HCMM_BASE::unbind (key); -} - -template -ACE_INLINE int -ACE_Hash_Cache_Map_Manager::unbind (const KEY &key, - VALUE &value) -{ - return ACE_HCMM_BASE::unbind (key, value); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Hash_Map_Manager.h b/dep/acelite/ace/Hash_Map_Manager.h deleted file mode 100644 index d6c0c4b8ae3..00000000000 --- a/dep/acelite/ace/Hash_Map_Manager.h +++ /dev/null @@ -1,31 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Hash_Map_Manager.h - * - * $Id: Hash_Map_Manager.h 80826 2008-03-04 14:51:23Z wotte $ - * - * Backward compatibility header. - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_HASH_MAP_MANAGER_H -#define ACE_HASH_MAP_MANAGER_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// Include the templates here. -#include "ace/Hash_Map_Manager_T.h" - -#include /**/ "ace/post.h" - -#endif /* ACE_HASH_MAP_MANAGER_H */ diff --git a/dep/acelite/ace/Hash_Map_Manager_T.cpp b/dep/acelite/ace/Hash_Map_Manager_T.cpp deleted file mode 100644 index 457d7d9037e..00000000000 --- a/dep/acelite/ace/Hash_Map_Manager_T.cpp +++ /dev/null @@ -1,542 +0,0 @@ - -//============================================================================= -/** - * @file Hash_Map_Manager_T.cpp - * - * $Id: Hash_Map_Manager_T.cpp 84477 2009-02-16 13:30:38Z johnnyw $ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - - -#ifndef ACE_HASH_MAP_MANAGER_T_CPP -#define ACE_HASH_MAP_MANAGER_T_CPP - -#include "ace/Hash_Map_Manager_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (__ACE_INLINE__) -# include "ace/Hash_Map_Manager_T.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Malloc_Base.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Hash_Map_Entry::ACE_Hash_Map_Entry (ACE_Hash_Map_Entry *next, - ACE_Hash_Map_Entry *prev) - : next_ (next), - prev_ (prev) -{ -} - -template -ACE_Hash_Map_Entry::ACE_Hash_Map_Entry (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_Hash_Map_Entry *next, - ACE_Hash_Map_Entry *prev) - : ext_id_ (ext_id), - int_id_ (int_id), - next_ (next), - prev_ (prev) -{ -} - -template -ACE_Hash_Map_Entry::~ACE_Hash_Map_Entry (void) -{ -} - -template EXT_ID & -ACE_Hash_Map_Entry::key () -{ - return ext_id_; -} - -template const EXT_ID & -ACE_Hash_Map_Entry::key () const -{ - return ext_id_; -} - -template INT_ID & -ACE_Hash_Map_Entry::item () -{ - return int_id_; -} - -template const INT_ID & -ACE_Hash_Map_Entry::item () const -{ - return int_id_; -} - -template void -ACE_Hash_Map_Entry::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("next_ = %d"), this->next_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("prev_ = %d"), this->prev_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template void -ACE_Hash_Map_Manager_Ex::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("total_size_ = %d\n"), this->total_size_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("cur_size_ = %d\n"), this->cur_size_)); - this->table_allocator_->dump (); - this->entry_allocator_->dump (); - this->lock_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template int -ACE_Hash_Map_Manager_Ex::create_buckets (size_t size) -{ - size_t bytes = size * sizeof (ACE_Hash_Map_Entry); - void *ptr = 0; - - ACE_ALLOCATOR_RETURN (ptr, - this->table_allocator_->malloc (bytes), - -1); - - this->table_ = (ACE_Hash_Map_Entry *) ptr; - - this->total_size_ = size; - - // Initialize each entry in the hash table to be a circular linked - // list with the dummy node in the front serving as the anchor of - // the list. - for (size_t i = 0; i < size; i++) - new (&this->table_[i]) ACE_Hash_Map_Entry (&this->table_[i], - &this->table_[i]); - return 0; -} - -template int -ACE_Hash_Map_Manager_Ex::open (size_t size, - ACE_Allocator *table_alloc, - ACE_Allocator *entry_alloc) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - // Calling this->close_i () to ensure we release previous allocated - // memory before allocating new one. - this->close_i (); - - if (table_alloc == 0) - table_alloc = ACE_Allocator::instance (); - - this->table_allocator_ = table_alloc; - - if (entry_alloc == 0) - entry_alloc = table_alloc; - - this->entry_allocator_ = entry_alloc; - - // This assertion is here to help track a situation that shouldn't - // happen, but did with Sun C++ 4.1 (before a change to this class - // was made: it used to have an enum that was supposed to be defined - // to be ACE_DEFAULT_MAP_SIZE, but instead was defined to be 0). - if (size == 0) - return -1; - - return this->create_buckets (size); -} - -template int -ACE_Hash_Map_Manager_Ex::close_i (void) -{ - // Protect against "double-deletion" in case the destructor also - // gets called. - if (this->table_ != 0) - { - // Remove all the entries. - this->unbind_all_i (); - - // Iterate through the buckets cleaning up the sentinels. - for (size_t i = 0; i < this->total_size_; i++) - { - // Destroy the dummy entry. - ACE_Hash_Map_Entry *entry = &this->table_[i]; - - // The second argument results in a no-op instead of - // deallocation. - ACE_DES_FREE_TEMPLATE2 (entry, ACE_NOOP, - ACE_Hash_Map_Entry, EXT_ID, INT_ID); - } - - // Reset size. - this->total_size_ = 0; - - // Free table memory. - this->table_allocator_->free (this->table_); - - // Should be done last... - this->table_ = 0; - } - - return 0; -} - -template int -ACE_Hash_Map_Manager_Ex::unbind_all_i (void) -{ - // Iterate through the entire map calling the destuctor of each - // . - for (size_t i = 0; i < this->total_size_; i++) - { - for (ACE_Hash_Map_Entry *temp_ptr = this->table_[i].next_; - temp_ptr != &this->table_[i]; - ) - { - ACE_Hash_Map_Entry *hold_ptr = temp_ptr; - temp_ptr = temp_ptr->next_; - - // Explicitly call the destructor. - ACE_DES_FREE_TEMPLATE2 (hold_ptr, this->entry_allocator_->free, - ACE_Hash_Map_Entry, EXT_ID, INT_ID); - } - - // Restore the sentinel. - this->table_[i].next_ = &this->table_[i]; - this->table_[i].prev_ = &this->table_[i]; - } - - this->cur_size_ = 0; - - return 0; -} - -template int -ACE_Hash_Map_Manager_Ex::bind_i (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_Hash_Map_Entry *&entry) -{ - size_t loc = 0; - if (this->shared_find (ext_id, entry, loc) == -1) - { - void *ptr = 0; - // Not found. - ACE_ALLOCATOR_RETURN (ptr, - this->entry_allocator_->malloc (sizeof (ACE_Hash_Map_Entry)), - -1); - - entry = new (ptr) ACE_Hash_Map_Entry (ext_id, - int_id, - this->table_[loc].next_, - &this->table_[loc]); - this->table_[loc].next_ = entry; - entry->next_->prev_ = entry; - ++this->cur_size_; - return 0; - } - else - return 1; -} - -template int -ACE_Hash_Map_Manager_Ex::trybind_i (const EXT_ID &ext_id, - INT_ID &int_id, - ACE_Hash_Map_Entry *&entry) -{ - size_t loc = 0; - if (this->shared_find (ext_id, entry, loc) == -1) - { - // Not found. - void *ptr = 0; - ACE_ALLOCATOR_RETURN (ptr, - this->entry_allocator_->malloc (sizeof (ACE_Hash_Map_Entry)), - -1); - - entry = new (ptr) ACE_Hash_Map_Entry (ext_id, - int_id, - this->table_[loc].next_, - &this->table_[loc]); - this->table_[loc].next_ = entry; - entry->next_->prev_ = entry; - ++this->cur_size_; - return 0; - } - else - return 1; -} - -template int -ACE_Hash_Map_Manager_Ex::unbind_i (const EXT_ID &ext_id, - INT_ID &int_id) -{ - ACE_Hash_Map_Entry *temp; - - size_t loc = 0; - if (this->shared_find (ext_id, temp, loc) == -1) - { - errno = ENOENT; - return -1; - } - - int_id = temp->int_id_; - - return this->unbind_i (temp); -} - -template int -ACE_Hash_Map_Manager_Ex::unbind_i (ACE_Hash_Map_Entry *entry) -{ - entry->next_->prev_ = entry->prev_; - entry->prev_->next_ = entry->next_; - - // Explicitly call the destructor. - ACE_DES_FREE_TEMPLATE2 (entry, this->entry_allocator_->free, - ACE_Hash_Map_Entry, EXT_ID, INT_ID); - - --this->cur_size_; - return 0; -} - -template int -ACE_Hash_Map_Manager_Ex::shared_find (const EXT_ID &ext_id, - ACE_Hash_Map_Entry *&entry, - size_t &loc) -{ - if (this->total_size_ == 0) - { - errno = ENOENT; - return -1; - } - - loc = this->hash (ext_id) % this->total_size_; - - ACE_Hash_Map_Entry *temp = this->table_[loc].next_; - - while (temp != &this->table_[loc] && this->equal (temp->ext_id_, ext_id) == 0) - temp = temp->next_; - - if (temp == &this->table_[loc]) - { - errno = ENOENT; - return -1; - } - else - { - entry = temp; - return 0; - } -} - -template int -ACE_Hash_Map_Manager_Ex::rebind_i (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_Hash_Map_Entry *&entry) -{ - size_t dummy = 0; - if (this->shared_find (ext_id, entry, dummy) == -1) - return this->bind_i (ext_id, int_id); - else - { - entry->ext_id_ = ext_id; - entry->int_id_ = int_id; - return 1; - } -} - -template int -ACE_Hash_Map_Manager_Ex::rebind_i (const EXT_ID &ext_id, - const INT_ID &int_id, - INT_ID &old_int_id, - ACE_Hash_Map_Entry *&entry) -{ - size_t dummy = 0; - if (this->shared_find (ext_id, entry, dummy) == -1) - return this->bind_i (ext_id, int_id); - else - { - old_int_id = entry->int_id_; - entry->ext_id_ = ext_id; - entry->int_id_ = int_id; - return 1; - } -} - -template int -ACE_Hash_Map_Manager_Ex::rebind_i (const EXT_ID &ext_id, - const INT_ID &int_id, - EXT_ID &old_ext_id, - INT_ID &old_int_id, - ACE_Hash_Map_Entry *&entry) -{ - size_t dummy = 0; - if (this->shared_find (ext_id, entry, dummy) == -1) - return this->bind_i (ext_id, int_id); - else - { - old_ext_id = entry->ext_id_; - old_int_id = entry->int_id_; - entry->ext_id_ = ext_id; - entry->int_id_ = int_id; - return 1; - } -} - -// ------------------------------------------------------------ - -ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Map_Iterator_Base_Ex) - -template void -ACE_Hash_Map_Iterator_Base_Ex::dump_i (void) const -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex::dump_i"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("index_ = %d "), this->index_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("next_ = %x"), this->next_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -} - -template int -ACE_Hash_Map_Iterator_Base_Ex::forward_i (void) -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex::forward_i"); - - if (this->map_man_->table_ == 0) - return -1; - // Handle initial case specially. - else if (this->index_ == -1) - { - this->index_++; - return this->forward_i (); - } - else if (this->index_ >= static_cast (this->map_man_->total_size_)) - return 0; - - this->next_ = this->next_->next_; - if (this->next_ == &this->map_man_->table_[this->index_]) - { - while (++this->index_ < static_cast (this->map_man_->total_size_)) - { - this->next_ = this->map_man_->table_[this->index_].next_; - if (this->next_ != &this->map_man_->table_[this->index_]) - break; - } - } - - return this->index_ < static_cast (this->map_man_->total_size_); -} - -template int -ACE_Hash_Map_Iterator_Base_Ex::reverse_i (void) -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex::reverse_i"); - - if (this->map_man_->table_ == 0) - return -1; - else if (this->index_ == static_cast (this->map_man_->total_size_)) - { - --this->index_; - return this->reverse_i (); - } - else if (this->index_ < 0) - return 0; - - this->next_ = this->next_->prev_; - if (this->next_ == &this->map_man_->table_[this->index_]) - { - while (--this->index_ >= 0) - { - this->next_ = this->map_man_->table_[this->index_].prev_; - if (this->next_ != &this->map_man_->table_[this->index_]) - break; - } - } - - return this->index_ >= 0; -} - -// ------------------------------------------------------------ - -ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Map_Const_Iterator_Base_Ex) - -template void -ACE_Hash_Map_Const_Iterator_Base_Ex::dump_i (void) const -{ - ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex::dump_i"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("index_ = %d "), this->index_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("next_ = %x"), this->next_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -} - -template int -ACE_Hash_Map_Const_Iterator_Base_Ex::forward_i (void) -{ - ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex::forward_i"); - - if (this->map_man_->table_ == 0) - return -1; - // Handle initial case specially. - else if (this->index_ == -1) - { - ++this->index_; - return this->forward_i (); - } - else if (this->index_ >= (ssize_t) this->map_man_->total_size_) - return 0; - - this->next_ = this->next_->next_; - if (this->next_ == &this->map_man_->table_[this->index_]) - { - while (++this->index_ < (ssize_t) this->map_man_->total_size_) - { - this->next_ = this->map_man_->table_[this->index_].next_; - if (this->next_ != &this->map_man_->table_[this->index_]) - break; - } - } - - return this->index_ < (ssize_t) this->map_man_->total_size_; -} - -template int -ACE_Hash_Map_Const_Iterator_Base_Ex::reverse_i (void) -{ - ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex::reverse_i"); - - if (this->map_man_->table_ == 0) - return -1; - else if (this->index_ == (ssize_t) this->map_man_->total_size_) - { - --this->index_; - return this->reverse_i (); - } - else if (this->index_ < 0) - return 0; - - this->next_ = this->next_->prev_; - if (this->next_ == &this->map_man_->table_[this->index_]) - { - while (--this->index_ >= 0) - { - this->next_ = this->map_man_->table_[this->index_].prev_; - if (this->next_ != &this->map_man_->table_[this->index_]) - break; - } - } - - return this->index_ >= 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HASH_MAP_MANAGER_T_CPP */ diff --git a/dep/acelite/ace/Hash_Map_Manager_T.h b/dep/acelite/ace/Hash_Map_Manager_T.h deleted file mode 100644 index 6b754341ac3..00000000000 --- a/dep/acelite/ace/Hash_Map_Manager_T.h +++ /dev/null @@ -1,1306 +0,0 @@ -// // -*- C++ -*- - -//============================================================================= -/** - * @file Hash_Map_Manager_T.h - * - * $Id: Hash_Map_Manager_T.h 91626 2010-09-07 10:59:20Z johnnyw $ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_HASH_MAP_MANAGER_T_H -#define ACE_HASH_MAP_MANAGER_T_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Default_Constants.h" -#include "ace/Functor_T.h" -#include "ace/Log_Msg.h" -#include - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Hash_Map_Entry - * - * @brief Define an entry in the hash table. - */ -template -class ACE_Hash_Map_Entry -{ -public: - // = Initialization and termination methods. - /// Constructor. - ACE_Hash_Map_Entry (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_Hash_Map_Entry *next = 0, - ACE_Hash_Map_Entry *prev = 0); - - /// Constructor. - ACE_Hash_Map_Entry (ACE_Hash_Map_Entry *next, - ACE_Hash_Map_Entry *prev); - - /// Destructor. - ~ACE_Hash_Map_Entry (void); - - /// Key accessor. - EXT_ID& key (void); - - /// Read-only key accessor. - const EXT_ID& key (void) const; - - /// Item accessor. - INT_ID& item (void); - - /// Read-only item accessor. - const INT_ID& item (void) const; - - /// Key used to look up an entry. - /// @deprecated Use key() - EXT_ID ext_id_; - - /// The contents of the entry itself. - /// @deprecated Use item() - INT_ID int_id_; - - /// Pointer to the next item in the bucket of overflow nodes. - ACE_Hash_Map_Entry *next_; - - /// Pointer to the prev item in the bucket of overflow nodes. - ACE_Hash_Map_Entry *prev_; - - /// Dump the state of an object. - void dump (void) const; -}; - -// Forward decl. -template -class ACE_Hash_Map_Iterator_Base_Ex; - -// Forward decl. -template -class ACE_Hash_Map_Const_Iterator_Base_Ex; - -// Forward decl. -template -class ACE_Hash_Map_Iterator_Ex; - -// Forward decl. -template -class ACE_Hash_Map_Const_Iterator_Ex; - -// Forward decl. -template -class ACE_Hash_Map_Reverse_Iterator_Ex; - -// Forward decl. -template -class ACE_Hash_Map_Const_Reverse_Iterator_Ex; - -// Forward decl. -template -class ACE_Hash_Map_Bucket_Iterator; - -// Forward decl. -class ACE_Allocator; - -/** - * @class ACE_Hash_Map_Manager_Ex - * - * @brief Define a map abstraction that efficiently associates - * @c EXT_ID type objects with @c INT_ID type objects. - * - * This implementation of a map uses a hash table. Key hashing - * is achieved through the @c HASH_KEY object and key comparison is - * achieved through the @c COMPARE_KEYS object. - * This class uses an ACE_Allocator to allocate memory. The - * user can make this a persistent class by providing an - * ACE_Allocator with a persistable memory pool. - */ - -template -class ACE_Hash_Map_Manager_Ex -{ -public: - friend class ACE_Hash_Map_Iterator_Base_Ex; - friend class ACE_Hash_Map_Iterator_Ex; - friend class ACE_Hash_Map_Const_Iterator_Base_Ex; - friend class ACE_Hash_Map_Const_Iterator_Ex; - friend class ACE_Hash_Map_Reverse_Iterator_Ex; - friend class ACE_Hash_Map_Const_Reverse_Iterator_Ex; - friend class ACE_Hash_Map_Bucket_Iterator; - - typedef EXT_ID - KEY; - typedef INT_ID - VALUE; - typedef ACE_LOCK lock_type; - typedef ACE_Hash_Map_Entry - ENTRY; - - // = ACE-style iterator typedefs. - typedef ACE_Hash_Map_Iterator_Ex - ITERATOR; - typedef ACE_Hash_Map_Const_Iterator_Ex - CONST_ITERATOR; - typedef ACE_Hash_Map_Reverse_Iterator_Ex - REVERSE_ITERATOR; - typedef ACE_Hash_Map_Const_Reverse_Iterator_Ex - CONST_REVERSE_ITERATOR; - - // = STL-style iterator typedefs. - typedef ACE_Hash_Map_Iterator_Ex - iterator; - typedef ACE_Hash_Map_Const_Iterator_Ex - const_iterator; - typedef ACE_Hash_Map_Reverse_Iterator_Ex - reverse_iterator; - typedef ACE_Hash_Map_Const_Reverse_Iterator_Ex - const_reverse_iterator; - - // = STL-style typedefs/traits. - typedef EXT_ID key_type; - typedef INT_ID data_type; - typedef ACE_Hash_Map_Entry value_type; - typedef value_type & reference; - typedef value_type const & const_reference; - typedef value_type * pointer; - typedef value_type const * const_pointer; - typedef ptrdiff_t difference_type; - typedef size_t size_type; - - // = Initialization and termination methods. - - /** - * Initialize an ACE_Hash_Map_Manager_Ex with a default number of elements. - * - * @param table_alloc is a pointer to a memory allocator used for - * table_, so it should supply size*sizeof (ACE_Hash_Map_Entry). - * If @a table_alloc is 0 it defaults to ACE_Allocator::instance(). - * @param entry_alloc is a pointer to an additional allocator for - * entries, so it should be able to allocate 'size' / chunks - * of sizeof(ACE_Hash_Map_Entry) bytes each. - * If @a entry_alloc is 0 it defaults to the same allocator as - * @a table_alloc. - */ - ACE_Hash_Map_Manager_Ex (ACE_Allocator *table_alloc = 0, - ACE_Allocator *entry_alloc = 0); - - /** - * Initialize an ACE_Hash_Map_Manager_Ex with @a size elements. - * - * @param table_alloc is a pointer to a memory allocator used for - * table_, so it should supply size*sizeof (ACE_Hash_Map_Entry). - * If @a table_alloc is 0 it defaults to ACE_Allocator::instance(). - * @param entry_alloc is a pointer to an additional allocator for - * entries, so it should be able to allocate 'size' / chunks - * of sizeof(ACE_Hash_Map_Entry) bytes each. - * If @a entry_alloc is 0 it defaults to the same allocator as - * @a table_alloc. - */ - ACE_Hash_Map_Manager_Ex (size_t size, - ACE_Allocator *table_alloc = 0, - ACE_Allocator *entry_alloc = 0); - - /** - * Initialize an ACE_Hash_Map_Manager_Ex with @a size elements. - * @param table_alloc is a pointer to a memory allocator used for - * table_, so it should supply size*sizeof (ACE_Hash_Map_Entry). - * If @a table_alloc is 0 it defaults to ACE_Allocator::instance(). - * @param entry_alloc is a pointer to an additional allocator for - * entries, so it should be able to allocate 'size' / chunks - * of sizeof(ACE_Hash_Map_Entry) bytes each. - * If @a entry_alloc is 0 then it defaults to the same allocator as - * @a table_alloc. - * @return -1 on failure, 0 on success - */ - - int open (size_t size = ACE_DEFAULT_MAP_SIZE, - ACE_Allocator *table_alloc = 0, - ACE_Allocator *entry_alloc = 0); - - /// Close down the ACE_Hash_Map_Manager_Ex and release dynamically allocated - /// resources. - int close (void); - - /// Removes all the entries in the ACE_Hash_Map_Manager_Ex. - int unbind_all (void); - - /// Cleanup the ACE_Hash_Map_Manager_Ex. - ~ACE_Hash_Map_Manager_Ex (void); - - /** - * Associate @a item with @a int_id. If @a item is already in the - * map then the map is not changed. - * - * @retval 0 if a new entry is bound successfully. - * @retval 1 if an attempt is made to bind an existing entry. - * @retval -1 if a failure occurs; check @c errno for more information. - */ - int bind (const EXT_ID &item, - const INT_ID &int_id); - - /** - * Same as a normal bind, except the map entry is also passed back - * to the caller. The entry in this case will either be the newly - * created entry, or the existing one. - */ - int bind (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_Hash_Map_Entry *&entry); - - /** - * Associate @a ext_id with @a int_id if and only if @a ext_id is not - * in the map. If @a ext_id is already in the map then the @a int_id - * parameter is assigned the existing value in the map. Returns 0 - * if a new entry is bound successfully, returns 1 if an attempt is - * made to bind an existing entry, and returns -1 if failures occur. - */ - int trybind (const EXT_ID &ext_id, - INT_ID &int_id); - - /** - * Same as a normal trybind, except the map entry is also passed - * back to the caller. The entry in this case will either be the - * newly created entry, or the existing one. - */ - int trybind (const EXT_ID &ext_id, - INT_ID &int_id, - ACE_Hash_Map_Entry *&entry); - - /** - * Reassociate @a ext_id with @a int_id. If @a ext_id is not in the - * map then behaves just like . Returns 0 if a new entry is - * bound successfully, returns 1 if an existing entry was rebound, - * and returns -1 if failures occur. - */ - int rebind (const EXT_ID &ext_id, - const INT_ID &int_id); - - /** - * Same as a normal rebind, except the map entry is also passed back - * to the caller. The entry in this case will either be the newly - * created entry, or the existing one. - */ - int rebind (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_Hash_Map_Entry *&entry); - - /** - * Associate @a ext_id with @a int_id. If @a ext_id is not in the map - * then behaves just like . Otherwise, store the old value of - * @a int_id into the "out" parameter and rebind the new parameters. - * Returns 0 if a new entry is bound successfully, returns 1 if an - * existing entry was rebound, and returns -1 if failures occur. - */ - int rebind (const EXT_ID &ext_id, - const INT_ID &int_id, - INT_ID &old_int_id); - - /** - * Same as a normal rebind, except the map entry is also passed back - * to the caller. The entry in this case will either be the newly - * created entry, or the existing one. - */ - int rebind (const EXT_ID &ext_id, - const INT_ID &int_id, - INT_ID &old_int_id, - ACE_Hash_Map_Entry *&entry); - - /** - * Associate @a ext_id with @a int_id. If @a ext_id is not in the map - * then behaves just like . Otherwise, store the old values - * of @a ext_id and @a int_id into the "out" parameters and rebind the - * new parameters. This is very useful if you need to have an - * atomic way of updating ACE_Hash_Map_Entrys and you also need - * full control over memory allocation. Returns 0 if a new entry is - * bound successfully, returns 1 if an existing entry was rebound, - * and returns -1 if failures occur. - */ - int rebind (const EXT_ID &ext_id, - const INT_ID &int_id, - EXT_ID &old_ext_id, - INT_ID &old_int_id); - - /** - * Same as a normal rebind, except the map entry is also passed back - * to the caller. The entry in this case will either be the newly - * created entry, or the existing one. - */ - int rebind (const EXT_ID &ext_id, - const INT_ID &int_id, - EXT_ID &old_ext_id, - INT_ID &old_int_id, - ACE_Hash_Map_Entry *&entry); - - /// Locate @a ext_id and pass out parameter via @a int_id. - /// Return 0 if found, returns -1 if not found. - int find (const EXT_ID &ext_id, - INT_ID &int_id) const; - - /// Returns 0 if the @a ext_id is in the mapping, otherwise -1. - int find (const EXT_ID &ext_id) const; - - /// Locate @a ext_id and pass out parameter via @a entry. If found, - /// return 0, returns -1 if not found. - int find (const EXT_ID &ext_id, - ACE_Hash_Map_Entry *&entry) const; - - /// Locate @a ext_id and pass out an iterator that points to its - /// corresponding value. - /** - * @param pos @a pos will be set to @c end() if not found. - */ - void find (EXT_ID const & ext_id, iterator & pos) const; - - /** - * Unbind (remove) the @a ext_id from the map. Don't return the - * @a int_id to the caller (this is useful for collections where the - * @a int_ids are *not* dynamically allocated...) - */ - int unbind (const EXT_ID &ext_id); - - /// Break any association of @a ext_id. Returns the value of @a int_id - /// in case the caller needs to deallocate memory. Return 0 if the - /// unbind was successful, and returns -1 if failures occur. - int unbind (const EXT_ID &ext_id, - INT_ID &int_id); - - /// Remove entry from map. - /** - * This unbind operation is fast relative to those that accept an - * external ID parameter since no map lookup is performed. - * - * @return 0 if the unbind was successful, and -1 if failures - * occur. - */ - int unbind (ACE_Hash_Map_Entry *entry); - - /// Remove entry from map pointed to by @c iterator @a pos. - /** - * This unbind operation is fast relative to those that accept an - * external ID parameter since no map lookup is performed. - * - * @return 0 if the unbind was successful, and -1 if failures - * occur. - */ - int unbind (iterator pos); - - /// Returns the current number of ACE_Hash_Map_Entry objects in the - /// hash table. - size_t current_size (void) const; - - /// Return the size of the array that's used to point to the - /// linked lists of ACE_Hash_Map_Entry objects in the hash table. - size_t total_size (void) const; - - /** - * Returns a reference to the underlying . This makes it - * possible to acquire the lock explicitly, which can be useful in - * some cases if you instantiate the ACE_Atomic_Op with an - * ACE_Recursive_Mutex or ACE_Process_Mutex, or if you need to - * guard the state of an iterator. - * @note The right name would be , but HP/C++ will choke on that! - */ - ACE_LOCK &mutex (void); - - /// Dump the state of an object. - void dump (void) const; - - // = STL styled iterator factory functions. - - /// Return forward iterator. - iterator begin (void); - iterator end (void); - const_iterator begin (void) const; - const_iterator end (void) const; - - /// Return reverse iterator. - reverse_iterator rbegin (void); - reverse_iterator rend (void); - const_reverse_iterator rbegin (void) const; - const_reverse_iterator rend (void) const; - -protected: - // = The following methods do the actual work. - - /// Returns 1 if == , else 0. This is defined as a - /// separate method to facilitate template specialization. - int equal (const EXT_ID &id1, const EXT_ID &id2); - - /// Compute the hash value of the @a ext_id. This is defined as a - /// separate method to facilitate template specialization. - u_long hash (const EXT_ID &ext_id); - - // = These methods assume locks are held by private methods. - - /// Performs bind. Must be called with locks held. - int bind_i (const EXT_ID &ext_id, - const INT_ID &int_id); - - /// Performs bind. Must be called with locks held. - int bind_i (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_Hash_Map_Entry *&entry); - - /// Performs trybind. Must be called with locks held. - int trybind_i (const EXT_ID &ext_id, - INT_ID &int_id); - - /// Performs trybind. Must be called with locks held. - int trybind_i (const EXT_ID &ext_id, - INT_ID &int_id, - ACE_Hash_Map_Entry *&entry); - - /// Performs rebind. Must be called with locks held. - int rebind_i (const EXT_ID &ext_id, - const INT_ID &int_id); - - /// Performs rebind. Must be called with locks held. - int rebind_i (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_Hash_Map_Entry *&entry); - - /// Performs rebind. Must be called with locks held. - int rebind_i (const EXT_ID &ext_id, - const INT_ID &int_id, - INT_ID &old_int_id); - - /// Performs rebind. Must be called with locks held. - int rebind_i (const EXT_ID &ext_id, - const INT_ID &int_id, - INT_ID &old_int_id, - ACE_Hash_Map_Entry *&entry); - - /// Performs rebind. Must be called with locks held. - int rebind_i (const EXT_ID &ext_id, - const INT_ID &int_id, - EXT_ID &old_ext_id, - INT_ID &old_int_id); - - /// Performs rebind. Must be called with locks held. - int rebind_i (const EXT_ID &ext_id, - const INT_ID &int_id, - EXT_ID &old_ext_id, - INT_ID &old_int_id, - ACE_Hash_Map_Entry *&entry); - - /// Performs a find of @a int_id using @a ext_id as the key. Must be - /// called with locks held. - int find_i (const EXT_ID &ext_id, - INT_ID &int_id); - - /// Performs a find using @a ext_id as the key. Must be called with - /// locks held. - int find_i (const EXT_ID &ext_id); - - /// Performs a find using @a ext_id as the key. Must be called with - /// locks held. - int find_i (const EXT_ID &ext_id, - ACE_Hash_Map_Entry *&entry); - - /// Performs unbind. Must be called with locks held. - int unbind_i (const EXT_ID &ext_id, - INT_ID &int_id); - - /// Performs unbind. Must be called with locks held. - int unbind_i (const EXT_ID &ext_id); - - /// Performs unbind. Must be called with locks held. - int unbind_i (ACE_Hash_Map_Entry *entry); - - /** - * Resize the map. Must be called with locks held. - * @note This method should never be called more than once or else all the - * hashing will get screwed up as the size will change. - */ - int create_buckets (size_t size); - - /// Close down a . Must be called with - /// locks held. - int close_i (void); - - /// Removes all the entries in . Must be called with - /// locks held. - int unbind_all_i (void); - - /// Pointer to a memory allocator used for table_, so it should - /// supply size*sizeof (ACE_Hash_Map_Entry), - ACE_Allocator *table_allocator_; - - /// Addidtional allocator for entries, so it should be able to - /// allocate 'size' / chunks of sizeof(ACE_Hash_Map_Entry) bytes each. - ACE_Allocator *entry_allocator_; - - /// Synchronization variable for the MT_SAFE - /// @c ACE_Hash_Map_Manager_Ex. - mutable ACE_LOCK lock_; - - /// Function object used for hashing keys. - HASH_KEY hash_key_; - - /// Function object used for comparing keys. - COMPARE_KEYS compare_keys_; - -protected: - /// Returns the ACE_Hash_Map_Entry that corresponds to @a ext_id. - int shared_find (const EXT_ID &ext_id, - ACE_Hash_Map_Entry *&entry, - size_t &loc); - - /// Accessor of the underlying table - ACE_Hash_Map_Entry *table (void); - -private: - /** - * Array of ACE_Hash_Map_Entry *s, each of which points to an - * ACE_Hash_Map_Entry that serves as the beginning of a linked - * list of s that hash to that bucket. - */ - ACE_Hash_Map_Entry *table_; - - /// Total size of the hash table. - size_t total_size_; - - /// Current number of entries in the table - /// @note That this can be larger than due to the - /// bucket chaining). - size_t cur_size_; - - // = Disallow these operations. - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Hash_Map_Manager_Ex &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Hash_Map_Manager_Ex (const ACE_Hash_Map_Manager_Ex &)) -}; - -/** - * @class ACE_Hash_Map_Iterator_Base_Ex - * - * @brief Base iterator for the ACE_Hash_Map_Manager_Ex - * - * This class factors out common code from its templatized - * subclasses. - */ -template -class ACE_Hash_Map_Iterator_Base_Ex -{ -public: - // = STL-style typedefs/traits. - typedef ACE_Hash_Map_Manager_Ex - container_type; - - // = std::iterator_traits typedefs/traits. - typedef typename container_type::value_type value_type; - typedef typename container_type::reference reference; - typedef typename container_type::pointer pointer; - typedef typename container_type::difference_type difference_type; - - // = Initialization method. - /// Contructor. - /** - * If @a head != @c false, the iterator constructed is positioned - * at the head of the map. It is positioned at the end otherwise. - * @par - */ - ACE_Hash_Map_Iterator_Base_Ex ( - ACE_Hash_Map_Manager_Ex &mm, - bool head); - - /// Contructor. - /** - * This constructor positions the iterator to the given @a entry. - */ - ACE_Hash_Map_Iterator_Base_Ex ( - ACE_Hash_Map_Manager_Ex & mm, - ACE_Hash_Map_Entry * entry, - size_t index); - - // = ITERATION methods. - - /// Pass back the next that hasn't been seen in the Set. - /// Returns 0 when all items have been seen, else 1. - int next (ACE_Hash_Map_Entry *&next_entry) const; - - /// Returns 1 when all items have been seen, else 0. - int done (void) const; - - /// Returns a reference to the interal element @c this is pointing to. - ACE_Hash_Map_Entry& operator* (void) const; - - /// Returns a pointer to the interal element @c this is pointing to. - ACE_Hash_Map_Entry* operator-> (void) const; - - /// Returns reference the Hash_Map_Manager_Ex that is being iterated - /// over. - ACE_Hash_Map_Manager_Ex& map (void); - - /// Check if two iterators point to the same position - bool operator== (const ACE_Hash_Map_Iterator_Base_Ex &) const; - bool operator!= (const ACE_Hash_Map_Iterator_Base_Ex &) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Move forward by one element in the set. Returns 0 when there's - /// no more item in the set after the current items, else 1. - int forward_i (void); - - /// Move backward by one element in the set. Returns 0 when there's - /// no more item in the set before the current item, else 1. - int reverse_i (void); - - /// Dump the state of an object. - void dump_i (void) const; - - /// Map we are iterating over. - ACE_Hash_Map_Manager_Ex *map_man_; - - /// Keeps track of how far we've advanced in the table. - ssize_t index_; - - /// Keeps track of how far we've advanced in a linked list in each - /// table slot. - ACE_Hash_Map_Entry *next_; -}; - -/** - * @class ACE_Hash_Map_Const_Iterator_Base_Ex - * - * @brief Base const iterator for the ACE_Hash_Map_Manager_Ex - * - * This class factors out common code from its templatized - * subclasses. - */ -template -class ACE_Hash_Map_Const_Iterator_Base_Ex -{ -public: - // = STL-style typedefs/traits. - typedef ACE_Hash_Map_Manager_Ex - container_type; - - // = std::iterator_traits typedefs/traits. - typedef typename container_type::value_type value_type; - typedef typename container_type::const_reference reference; - typedef typename container_type::const_pointer pointer; - typedef typename container_type::difference_type difference_type; - - // = Initialization method. - /// Contructor. If head the iterator constructed is positioned - /// at the head of the map, it is positioned at the end otherwise. - ACE_Hash_Map_Const_Iterator_Base_Ex (const ACE_Hash_Map_Manager_Ex &mm, - bool head); - - // = ITERATION methods. - - /// Pass back the next that hasn't been seen in the Set. - /// Returns 0 when all items have been seen, else 1. - int next (ACE_Hash_Map_Entry *&next_entry) const; - - /// Returns 1 when all items have been seen, else 0. - int done (void) const; - - /// Returns a reference to the interal element @c this is pointing to. - ACE_Hash_Map_Entry& operator* (void) const; - - /// Returns a pointer to the interal element @c this is pointing to. - ACE_Hash_Map_Entry* operator-> (void) const; - - /// Returns reference the Hash_Map_Manager_Ex that is being iterated - /// over. - const ACE_Hash_Map_Manager_Ex& map (void); - - /// Check if two iterators point to the same position - bool operator== (const ACE_Hash_Map_Const_Iterator_Base_Ex &) const; - bool operator!= (const ACE_Hash_Map_Const_Iterator_Base_Ex &) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Move forward by one element in the set. Returns 0 when there's - /// no more item in the set after the current items, else 1. - int forward_i (void); - - /// Move backward by one element in the set. Returns 0 when there's - /// no more item in the set before the current item, else 1. - int reverse_i (void); - - /// Dump the state of an object. - void dump_i (void) const; - - /// Map we are iterating over. - const ACE_Hash_Map_Manager_Ex *map_man_; - - /// Keeps track of how far we've advanced in the table. - ssize_t index_; - - /// Keeps track of how far we've advanced in a linked list in each - /// table slot. - ACE_Hash_Map_Entry *next_; -}; - -/** - * @class ACE_Hash_Map_Iterator_Ex - * - * @brief Forward iterator for the ACE_Hash_Map_Manager_Ex. - * - * This class does not perform any internal locking of the - * ACE_Hash_Map_Manager_Ex it is iterating upon since locking is - * inherently inefficient and/or error-prone within an STL-style - * iterator. If you require locking, you can explicitly use an - * ACE_GUARD or ACE_READ_GUARD on the ACE_Hash_Map_Manager_Ex's - * internal lock, which is accessible via its mutex() method. - */ -template -class ACE_Hash_Map_Iterator_Ex : public ACE_Hash_Map_Iterator_Base_Ex -{ -public: - // = STL-style traits/typedefs - typedef typename ACE_Hash_Map_Iterator_Base_Ex::container_type - container_type; - - // = STL-style traits/typedefs - typedef std::bidirectional_iterator_tag iterator_category; - typedef typename container_type::value_type value_type; - typedef typename container_type::reference reference; - typedef typename container_type::pointer pointer; - typedef typename container_type::difference_type difference_type; - - // = Initialization method. - ACE_Hash_Map_Iterator_Ex (ACE_Hash_Map_Manager_Ex &mm, - int tail = 0); - - /// Contructor. - /** - * This constructor positions the iterator to the given @a entry. - */ - ACE_Hash_Map_Iterator_Ex ( - ACE_Hash_Map_Manager_Ex & mm, - ACE_Hash_Map_Entry * entry, - size_t index); - - // = Iteration methods. - /// Move forward by one element in the set. Returns 0 when all the - /// items in the set have been seen, else 1. - int advance (void); - - /// Dump the state of an object. - void dump (void) const; - - // = STL styled iteration, compare, and reference functions. - - /// Prefix advance. - ACE_Hash_Map_Iterator_Ex &operator++ (void); - - /// Postfix advance. - ACE_Hash_Map_Iterator_Ex operator++ (int); - - /// Prefix reverse. - ACE_Hash_Map_Iterator_Ex &operator-- (void); - - /// Postfix reverse. - ACE_Hash_Map_Iterator_Ex operator-- (int); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -/** - * @class ACE_Hash_Map_Const_Iterator_Ex - * - * @brief Const forward iterator for the ACE_Hash_Map_Manager_Ex. - * - * This class does not perform any internal locking of the - * ACE_Hash_Map_Manager_Ex it is iterating upon since locking is - * inherently inefficient and/or error-prone within an STL-style - * iterator. If you require locking, you can explicitly use an - * ACE_GUARD or ACE_READ_GUARD on the ACE_Hash_Map_Manager_Ex's - * internal lock, which is accessible via its mutex() method. - */ -template -class ACE_Hash_Map_Const_Iterator_Ex : public ACE_Hash_Map_Const_Iterator_Base_Ex -{ -public: - // = STL-style traits/typedefs - typedef typename ACE_Hash_Map_Const_Iterator_Base_Ex::container_type - container_type; - - // = std::iterator_trait traits/typedefs - typedef std::bidirectional_iterator_tag iterator_category; - typedef typename container_type::value_type value_type; - typedef typename container_type::reference reference; - typedef typename container_type::pointer pointer; - typedef typename container_type::difference_type difference_type; - - // = Initialization method. - ACE_Hash_Map_Const_Iterator_Ex (const ACE_Hash_Map_Manager_Ex &mm, - int tail = 0); - - // = Iteration methods. - /// Move forward by one element in the set. Returns 0 when all the - /// items in the set have been seen, else 1. - int advance (void); - - /// Dump the state of an object. - void dump (void) const; - - // = STL styled iteration, compare, and reference functions. - - /// Prefix advance. - ACE_Hash_Map_Const_Iterator_Ex &operator++ (void); - - /// Postfix advance. - ACE_Hash_Map_Const_Iterator_Ex operator++ (int); - - /// Prefix reverse. - ACE_Hash_Map_Const_Iterator_Ex &operator-- (void); - - /// Postfix reverse. - ACE_Hash_Map_Const_Iterator_Ex operator-- (int); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -/** - * @class ACE_Hash_Map_Bucket_Iterator - * - * @brief Forward iterator for the ACE_Hash_Map_Manager_Ex which - * only traverses a particular bucket. The particular bucket is - * specified by the parameter specified in the constructor. - * - * This class does not perform any internal locking of the - * ACE_Hash_Map_Manager_Ex it is iterating upon since locking is - * inherently inefficient and/or error-prone within an STL-style - * iterator. If you require locking, you can explicitly use an - * ACE_GUARD or ACE_READ_GUARD on the ACE_Hash_Map_Manager_Ex's - * internal lock, which is accessible via its mutex() method. - * - * Note that a creation method for this new iterator cannot be added - * to the hash map, since this would require adding explicit template - * instantiations for bucket iterators on platforms with broken - * templates. - */ -template -class ACE_Hash_Map_Bucket_Iterator -{ -public: - // = STL-style traits/typedefs - typedef ACE_Hash_Map_Manager_Ex - container_type; - - // = std::iterator traits/typedefs - typedef std::bidirectional_iterator_tag iterator_category; - typedef typename container_type::value_type value_type; - typedef typename container_type::reference reference; - typedef typename container_type::pointer pointer; - typedef typename container_type::difference_type difference_type; - - // = Initialization method. - ACE_Hash_Map_Bucket_Iterator (ACE_Hash_Map_Manager_Ex &mm, - const EXT_ID &ext_id, - int tail = 0); - - // = STL styled iteration, compare, and reference functions. - - /// Prefix advance. - ACE_Hash_Map_Bucket_Iterator &operator++ (void); - - /// Postfix advance. - ACE_Hash_Map_Bucket_Iterator operator++ (int); - - /// Prefix reverse. - ACE_Hash_Map_Bucket_Iterator &operator-- (void); - - /// Postfix reverse. - ACE_Hash_Map_Bucket_Iterator operator-- (int); - - /// Returns a reference to the interal element @c this is pointing to. - ACE_Hash_Map_Entry& operator* (void) const; - - /// Returns a pointer to the interal element @c this is pointing to. - ACE_Hash_Map_Entry* operator-> (void) const; - - /// Returns reference the Hash_Map_Manager_Ex that is being iterated - /// over. - ACE_Hash_Map_Manager_Ex& map (void); - - /// Check if two iterators point to the same position - bool operator== (const ACE_Hash_Map_Bucket_Iterator &) const; - bool operator!= (const ACE_Hash_Map_Bucket_Iterator &) const; - -protected: - /// Move forward by one element in the set. Returns 0 when there's - /// no more item in the set after the current items, else 1. - int forward_i (void); - - /// Move backward by one element in the set. Returns 0 when there's - /// no more item in the set before the current item, else 1. - int reverse_i (void); - - /// Map we are iterating over. - ACE_Hash_Map_Manager_Ex *map_man_; - - /// Keeps track of how far we've advanced in the table. - ssize_t index_; - - /// Keeps track of how far we've advanced in a linked list in each - /// table slot. - ACE_Hash_Map_Entry *next_; -}; - -/** - * @class ACE_Hash_Map_Reverse_Iterator_Ex - * - * @brief Reverse iterator for the ACE_Hash_Map_Manager_Ex. - * - * This class does not perform any internal locking of the - * ACE_Hash_Map_Manager_Ex it is iterating upon since locking is - * inherently inefficient and/or error-prone within an STL-style - * iterator. If you require locking, you can explicitly use an - * ACE_GUARD or ACE_READ_GUARD on the ACE_Hash_Map_Manager_Ex's - * internal lock, which is accessible via its mutex() method. - */ -template -class ACE_Hash_Map_Reverse_Iterator_Ex : public ACE_Hash_Map_Iterator_Base_Ex -{ -public: - // = STL-style traits/typedefs - typedef typename ACE_Hash_Map_Iterator_Base_Ex::container_type - container_type; - - // = std::iterator_traits typedefs - typedef std::bidirectional_iterator_tag iterator_category; - typedef typename container_type::value_type value_type; - typedef typename container_type::reference reference; - typedef typename container_type::pointer pointer; - typedef typename container_type::difference_type difference_type; - - // = Initialization method. - ACE_Hash_Map_Reverse_Iterator_Ex (ACE_Hash_Map_Manager_Ex &mm, - bool head = false); - - // = Iteration methods. - /// Move forward by one element in the set. Returns 0 when all the - /// items in the set have been seen, else 1. - int advance (void); - - /// Dump the state of an object. - void dump (void) const; - - // = STL styled iteration, compare, and reference functions. - - /// Prefix reverse. - ACE_Hash_Map_Reverse_Iterator_Ex &operator++ (void); - - /// Postfix reverse. - ACE_Hash_Map_Reverse_Iterator_Ex operator++ (int); - - /// Prefix advance. - ACE_Hash_Map_Reverse_Iterator_Ex &operator-- (void); - - /// Postfix advance. - ACE_Hash_Map_Reverse_Iterator_Ex operator-- (int); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -/** - * @class ACE_Hash_Map_Const_Reverse_Iterator_Ex - * - * @brief Const reverse iterator for the ACE_Hash_Map_Manager_Ex. - * - * This class does not perform any internal locking of the - * ACE_Hash_Map_Manager_Ex it is iterating upon since locking is - * inherently inefficient and/or error-prone within an STL-style - * iterator. If you require locking, you can explicitly use an - * ACE_GUARD or ACE_READ_GUARD on the ACE_Hash_Map_Manager_Ex's - * internal lock, which is accessible via its method. - */ -template -class ACE_Hash_Map_Const_Reverse_Iterator_Ex : public ACE_Hash_Map_Const_Iterator_Base_Ex -{ -public: - // = STL-style traits/typedefs - typedef typename ACE_Hash_Map_Const_Iterator_Base_Ex::container_type - container_type; - - // = std::iterator_traits typedefs - typedef std::bidirectional_iterator_tag iterator_category; - typedef typename container_type::value_type value_type; - typedef typename container_type::reference reference; - typedef typename container_type::pointer pointer; - typedef typename container_type::difference_type difference_type; - - // = Initialization method. - ACE_Hash_Map_Const_Reverse_Iterator_Ex (const ACE_Hash_Map_Manager_Ex &mm, - bool head = false); - - // = Iteration methods. - /// Move forward by one element in the set. Returns 0 when all the - /// items in the set have been seen, else 1. - int advance (void); - - /// Dump the state of an object. - void dump (void) const; - - // = STL styled iteration, compare, and reference functions. - - /// Prefix reverse. - ACE_Hash_Map_Const_Reverse_Iterator_Ex &operator++ (void); - - /// Postfix reverse. - ACE_Hash_Map_Const_Reverse_Iterator_Ex operator++ (int); - - /// Prefix advance. - ACE_Hash_Map_Const_Reverse_Iterator_Ex &operator-- (void); - - /// Postfix advance. - ACE_Hash_Map_Const_Reverse_Iterator_Ex operator-- (int); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -/** - * @class ACE_Hash_Map_Manager - * - * @brief Wrapper for backward compatibility. - * - * This implementation of a map uses a hash table. This class - * expects that the contains a method called . - * In addition, the must support . Both of - * these constraints can be alleviated via template - * specialization, as shown in the $ACE_ROOT/tests/Conn_Test.cpp - * test. - * - * Requirements and Performance Characteristics - * - Internal Structure - * Hash Table - * - Duplicates allowed? - * No - * - Random access allowed? - * Yes - * - Search speed - * O(1) - * - Insert/replace speed - * O(1), can be longer if the hash map has to resize - * - Iterator still valid after change to container? - * Yes - * - Frees memory for removed elements? - * Yes - * - Items inserted by - * Value - * - Requirements for key type - * -# Default constructor - * -# Copy constructor - * -# operator= - * -# operator== - * - Requirements for object type - * -# Default constructor - * -# Copy constructor - * -# operator= - * -# operator< - */ -template -class ACE_Hash_Map_Manager : public ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_LOCK> -{ -public: - - /** - * Initialize a @c Hash_Map_Manager with default size elements. - * @param table_alloc is a pointer to a memory allocator used for - * table_, so it should supply size*sizeof (ACE_Hash_Map_Entry). - * @param entry_alloc is a pointer to an additional allocator for - * entries, so it should be able to allocate 'size' / chunks - * of sizeof(ACE_Hash_Map_Entry) bytes each. - * If @c table_alloc is 0 it defaults to @c ACE_Allocator::instance(). - * If @c entry_alloc is 0 then it defaults to the same allocator as - * @c table_alloc. - */ - ACE_Hash_Map_Manager (ACE_Allocator *table_alloc = 0, - ACE_Allocator *entry_alloc = 0); - - /** - * Initialize a @c Hash_Map_Manager with @c size elements. - * @param table_alloc is a pointer to a memory allocator used for - * table_, so it should supply size*sizeof (ACE_Hash_Map_Entry). - * @param entry_alloc is a pointer to an additional allocator for - * entries, so it should be able to allocate 'size' / chunks - * of sizeof(ACE_Hash_Map_Entry) bytes each. - * If @c table_alloc is 0 it defaults to @c ACE_Allocator::instance(). - * If @c entry_alloc is 0 then it defaults to the same allocator as - * @c table_alloc. - */ - ACE_Hash_Map_Manager (size_t size, - ACE_Allocator *table_alloc = 0, - ACE_Allocator *entry_alloc = 0); - - // = The following two are necessary for template specialization of - // ACE_Hash_Map_Manager to work. - int equal (const EXT_ID &id1, const EXT_ID &id2); - u_long hash (const EXT_ID &ext_id); -}; - -/** - * @class ACE_Hash_Map_Iterator - * - * @brief Wrapper for backward compatibility. - */ -template -class ACE_Hash_Map_Iterator : public ACE_Hash_Map_Iterator_Ex, ACE_Equal_To, ACE_LOCK> -{ -public: - // = STL-style traits/typedefs - typedef typename ACE_Hash_Map_Iterator_Ex, ACE_Equal_To, ACE_LOCK>::container_type - container_type; - - typedef typename ACE_Hash_Map_Iterator_Ex, ACE_Equal_To, ACE_LOCK>::iterator_category - iterator_category; - - typedef typename ACE_Hash_Map_Iterator_Ex, ACE_Equal_To, ACE_LOCK>::value_type - value_type; - - typedef typename ACE_Hash_Map_Iterator_Ex, ACE_Equal_To, ACE_LOCK>::reference - reference; - - typedef typename ACE_Hash_Map_Iterator_Ex, ACE_Equal_To, ACE_LOCK>::pointer - pointer; - - typedef typename ACE_Hash_Map_Iterator_Ex, ACE_Equal_To, ACE_LOCK>::difference_type - difference_type; - - // = Initialization method. - /// Construct from map - ACE_Hash_Map_Iterator (ACE_Hash_Map_Manager &mm, - int tail = 0); - - /// Construct from base - ACE_Hash_Map_Iterator (const ACE_Hash_Map_Iterator_Ex, ACE_Equal_To, ACE_LOCK> &base); - - /// Assignment from base - ACE_Hash_Map_Iterator & - operator= (const ACE_Hash_Map_Iterator_Ex, ACE_Equal_To, ACE_LOCK> &base); -}; - -/** - * @class ACE_Hash_Map_Const_Iterator - * - * @brief Wrapper for backward compatibility. - */ -template -class ACE_Hash_Map_Const_Iterator : public ACE_Hash_Map_Const_Iterator_Ex, ACE_Equal_To, ACE_LOCK> -{ -public: - // = STL-style traits/typedefs - typedef typename ACE_Hash_Map_Const_Iterator_Ex, ACE_Equal_To, ACE_LOCK>::container_type - container_type; - - // = std::iterator_traits typedefs - typedef typename ACE_Hash_Map_Const_Iterator_Ex, ACE_Equal_To, ACE_LOCK>::iterator_category - iterator_category; - - typedef typename ACE_Hash_Map_Const_Iterator_Ex, ACE_Equal_To, ACE_LOCK>::value_type - value_type; - - typedef typename ACE_Hash_Map_Const_Iterator_Ex, ACE_Equal_To, ACE_LOCK>::reference - reference; - - typedef typename ACE_Hash_Map_Const_Iterator_Ex, ACE_Equal_To, ACE_LOCK>::pointer - pointer; - - typedef typename ACE_Hash_Map_Const_Iterator_Ex, ACE_Equal_To, ACE_LOCK>::difference_type - difference_type; - - // = Initialization method. - /// Construct from map - ACE_Hash_Map_Const_Iterator (const ACE_Hash_Map_Manager &mm, - int tail = 0); - - /// Construct from base - ACE_Hash_Map_Const_Iterator (const ACE_Hash_Map_Const_Iterator_Ex, ACE_Equal_To, ACE_LOCK> &base); - - /// Assignment from base - ACE_Hash_Map_Const_Iterator & - operator= (const ACE_Hash_Map_Const_Iterator_Ex, ACE_Equal_To, ACE_LOCK> &base); -}; - -/** - * @class ACE_Hash_Map_Reverse_Iterator - * - * @brief Wrapper for backward compatibility. - */ -template -class ACE_Hash_Map_Reverse_Iterator : public ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Equal_To, ACE_LOCK> -{ -public: - // = STL-style traits/typedefs - typedef typename ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Equal_To, ACE_LOCK>::container_type - container_type; - - // = std::iterator_traits typedefs - typedef typename ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Equal_To, ACE_LOCK>::iterator_category - iterator_category; - - typedef typename ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Equal_To, ACE_LOCK>::value_type - value_type; - - typedef typename ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Equal_To, ACE_LOCK>::reference - reference; - - typedef typename ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Equal_To, ACE_LOCK>::pointer - pointer; - - typedef typename ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Equal_To, ACE_LOCK>::difference_type - difference_type; - - // = Initialization method. - ACE_Hash_Map_Reverse_Iterator (ACE_Hash_Map_Manager &mm, - bool head = false); - - /// Construct from base - ACE_Hash_Map_Reverse_Iterator (const ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Equal_To, ACE_LOCK> &base); - - /// Assignment from base - ACE_Hash_Map_Reverse_Iterator & - operator= (const ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Equal_To, ACE_LOCK> &base); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -# include "ace/Hash_Map_Manager_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Hash_Map_Manager_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Hash_Map_Manager_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_HASH_MAP_MANAGER_T_H */ diff --git a/dep/acelite/ace/Hash_Map_Manager_T.inl b/dep/acelite/ace/Hash_Map_Manager_T.inl deleted file mode 100644 index 9525b13a670..00000000000 --- a/dep/acelite/ace/Hash_Map_Manager_T.inl +++ /dev/null @@ -1,1246 +0,0 @@ -// -*- C++ -*- -// -// $Id: Hash_Map_Manager_T.inl 84477 2009-02-16 13:30:38Z johnnyw $ - -#include "ace/Guard_T.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE -ACE_Hash_Map_Manager_Ex::ACE_Hash_Map_Manager_Ex (size_t size, - ACE_Allocator *table_alloc, - ACE_Allocator *entry_alloc) - : table_allocator_ (table_alloc), - entry_allocator_ (entry_alloc), - table_ (0), - total_size_ (0), - cur_size_ (0) -{ - if (this->open (size, table_alloc, entry_alloc) == -1) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_Hash_Map_Manager_Ex\n"))); -} - -template ACE_INLINE -ACE_Hash_Map_Manager_Ex::ACE_Hash_Map_Manager_Ex (ACE_Allocator *table_alloc, - ACE_Allocator *entry_alloc) - : table_allocator_ (table_alloc), - entry_allocator_ (entry_alloc), - table_ (0), - total_size_ (0), - cur_size_ (0) -{ - if (this->open (ACE_DEFAULT_MAP_SIZE, table_alloc, entry_alloc) == -1) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Hash_Map_Manager_Ex open"))); -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::close (void) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->close_i (); -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::unbind_all (void) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->unbind_all_i (); -} - -template ACE_INLINE -ACE_Hash_Map_Manager_Ex::~ACE_Hash_Map_Manager_Ex (void) -{ - this->close (); -} - -template ACE_INLINE size_t -ACE_Hash_Map_Manager_Ex::current_size (void) const -{ - return this->cur_size_; -} - -template ACE_INLINE size_t -ACE_Hash_Map_Manager_Ex::total_size (void) const -{ - return this->total_size_; -} - -template ACE_INLINE ACE_LOCK & -ACE_Hash_Map_Manager_Ex::mutex (void) -{ - ACE_TRACE ("ACE_Hash_Map_Manager_Ex::mutex"); - return this->lock_; -} - -template ACE_INLINE u_long -ACE_Hash_Map_Manager_Ex::hash (const EXT_ID &ext_id) -{ - return this->hash_key_ (ext_id); -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::equal (const EXT_ID &id1, - const EXT_ID &id2) -{ - return this->compare_keys_ (id1, id2); -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::bind_i (const EXT_ID &ext_id, - const INT_ID &int_id) -{ - ACE_Hash_Map_Entry *temp; - - return this->bind_i (ext_id, int_id, temp); -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::bind (const EXT_ID &ext_id, - const INT_ID &int_id) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->bind_i (ext_id, int_id); -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::bind (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_Hash_Map_Entry *&entry) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->bind_i (ext_id, int_id, entry); -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::trybind_i (const EXT_ID &ext_id, - INT_ID &int_id) -{ - ACE_Hash_Map_Entry *temp; - - int result = this->trybind_i (ext_id, int_id, temp); - if (result == 1) - int_id = temp->int_id_; - return result; -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::trybind (const EXT_ID &ext_id, - INT_ID &int_id) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->trybind_i (ext_id, int_id); -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::trybind (const EXT_ID &ext_id, - INT_ID &int_id, - ACE_Hash_Map_Entry *&entry) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->trybind_i (ext_id, int_id, entry); -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::unbind_i (const EXT_ID &ext_id) -{ - INT_ID int_id; - - return this->unbind_i (ext_id, int_id); -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::unbind (const EXT_ID &ext_id, - INT_ID &int_id) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->unbind_i (ext_id, int_id); -} - -template -ACE_INLINE int -ACE_Hash_Map_Manager_Ex::unbind ( - typename ACE_Hash_Map_Manager_Ex::iterator pos) -{ - return this->unbind (&(*pos)); -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::unbind (const EXT_ID &ext_id) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->unbind_i (ext_id) == -1 ? -1 : 0; -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::unbind (ACE_Hash_Map_Entry *entry) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->unbind_i (entry) == -1 ? -1 : 0; -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::find_i (const EXT_ID &ext_id, - INT_ID &int_id) -{ - ACE_Hash_Map_Entry *entry; - - size_t dummy; - if (this->shared_find (ext_id, entry, dummy) == -1) - return -1; - else - { - int_id = entry->int_id_; - return 0; - } -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::find_i (const EXT_ID &ext_id) -{ - ACE_Hash_Map_Entry *entry; - - size_t dummy; - return this->shared_find (ext_id, entry, dummy); -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::find (const EXT_ID &ext_id, - INT_ID &int_id) const -{ - ACE_Hash_Map_Manager_Ex *nc_this = - const_cast *> - (this); - - ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return nc_this->find_i (ext_id, int_id); -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::find (const EXT_ID &ext_id) const -{ - ACE_Hash_Map_Manager_Ex *nc_this = - const_cast *> - (this); - - ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return nc_this->find_i (ext_id); -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::find_i (const EXT_ID &ext_id, - ACE_Hash_Map_Entry *&entry) -{ - size_t dummy; - return this->shared_find (ext_id, entry, dummy); -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::find (const EXT_ID &ext_id, - ACE_Hash_Map_Entry *&entry) const -{ - ACE_Hash_Map_Manager_Ex *nc_this = - const_cast *> - (this); - - ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return nc_this->find_i (ext_id, entry); -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::rebind_i (const EXT_ID &ext_id, - const INT_ID &int_id) -{ - ACE_Hash_Map_Entry *node; - - return this->rebind_i (ext_id, - int_id, - node); -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::rebind_i (const EXT_ID &ext_id, - const INT_ID &int_id, - INT_ID &old_int_id) -{ - ACE_Hash_Map_Entry *node; - - return this->rebind_i (ext_id, - int_id, - old_int_id, - node); -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::rebind_i (const EXT_ID &ext_id, - const INT_ID &int_id, - EXT_ID &old_ext_id, - INT_ID &old_int_id) -{ - ACE_Hash_Map_Entry *node; - - return this->rebind_i (ext_id, - int_id, - old_ext_id, - old_int_id, - node); -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::rebind (const EXT_ID &ext_id, - const INT_ID &int_id) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->rebind_i (ext_id, int_id); -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::rebind (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_Hash_Map_Entry *&entry) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->rebind_i (ext_id, int_id, entry); -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::rebind (const EXT_ID &ext_id, - const INT_ID &int_id, - INT_ID &old_int_id) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->rebind_i (ext_id, int_id, old_int_id); -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::rebind (const EXT_ID &ext_id, - const INT_ID &int_id, - INT_ID &old_int_id, - ACE_Hash_Map_Entry *&entry) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->rebind_i (ext_id, int_id, old_int_id, entry); -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::rebind (const EXT_ID &ext_id, - const INT_ID &int_id, - EXT_ID &old_ext_id, - INT_ID &old_int_id) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->rebind_i (ext_id, int_id, old_ext_id, old_int_id); -} - -template ACE_INLINE int -ACE_Hash_Map_Manager_Ex::rebind (const EXT_ID &ext_id, - const INT_ID &int_id, - EXT_ID &old_ext_id, - INT_ID &old_int_id, - ACE_Hash_Map_Entry *&entry) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->rebind_i (ext_id, int_id, old_ext_id, old_int_id, entry); -} - -template ACE_INLINE -typename ACE_Hash_Map_Manager_Ex::iterator -ACE_Hash_Map_Manager_Ex::begin (void) -{ - return iterator (*this); -} - -template ACE_INLINE -typename ACE_Hash_Map_Manager_Ex::iterator -ACE_Hash_Map_Manager_Ex::end (void) -{ - return iterator (*this, 1); -} - -template ACE_INLINE -typename ACE_Hash_Map_Manager_Ex::const_iterator -ACE_Hash_Map_Manager_Ex::begin (void) const -{ - return const_iterator (*this); -} - -template ACE_INLINE -typename ACE_Hash_Map_Manager_Ex::const_iterator -ACE_Hash_Map_Manager_Ex::end (void) const -{ - return const_iterator (*this, 1); -} - -template ACE_INLINE -typename ACE_Hash_Map_Manager_Ex::reverse_iterator -ACE_Hash_Map_Manager_Ex::rbegin (void) -{ - return reverse_iterator (*this); -} - -template ACE_INLINE -typename ACE_Hash_Map_Manager_Ex::reverse_iterator -ACE_Hash_Map_Manager_Ex::rend (void) -{ - return reverse_iterator (*this, 1); -} - - template ACE_INLINE - typename ACE_Hash_Map_Manager_Ex::const_reverse_iterator - ACE_Hash_Map_Manager_Ex::rbegin (void) const - { - return const_reverse_iterator (*this); - } - - template ACE_INLINE - typename ACE_Hash_Map_Manager_Ex::const_reverse_iterator - ACE_Hash_Map_Manager_Ex::rend (void) const - { - return const_reverse_iterator (*this, 1); - } - -template ACE_INLINE -ACE_Hash_Map_Entry * -ACE_Hash_Map_Manager_Ex::table (void) -{ - return this->table_; -} - -template -ACE_INLINE void -ACE_Hash_Map_Manager_Ex::find ( - EXT_ID const &ext_id, - typename ACE_Hash_Map_Manager_Ex::iterator & pos) const -{ - ENTRY * entry = 0; - size_t index = 0; - - ACE_Hash_Map_Manager_Ex *nc_this = - const_cast *> - (this); - - ACE_READ_GUARD (ACE_LOCK, ace_mon, this->lock_); - - if (nc_this->shared_find (ext_id, entry, index) != -1) - pos = iterator (*nc_this, entry, index); - else - pos = nc_this->end (); -} - -// --------------------------------------------------------------------- - -template -ACE_INLINE -ACE_Hash_Map_Iterator_Base_Ex::ACE_Hash_Map_Iterator_Base_Ex ( - ACE_Hash_Map_Manager_Ex &mm, - bool head) - : map_man_ (&mm), - index_ (head ? -1 : (ssize_t) mm.total_size_), - next_ (0) -{ - if (mm.table_ != 0) - this->next_ = &mm.table_[head ? 0 : mm.total_size_ - 1]; -} - -template -ACE_INLINE -ACE_Hash_Map_Iterator_Base_Ex::ACE_Hash_Map_Iterator_Base_Ex ( - ACE_Hash_Map_Manager_Ex & mm, - ACE_Hash_Map_Entry * entry, - size_t index) - : map_man_ (&mm) - , index_ (static_cast (index)) - , next_ (entry) -{ -} - -template ACE_INLINE int -ACE_Hash_Map_Iterator_Base_Ex::next (ACE_Hash_Map_Entry *&entry) const -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex::next"); - - if (this->map_man_->table_ != 0 - && this->index_ < static_cast (this->map_man_->total_size_) - && this->index_ >= 0 - && this->next_ != &this->map_man_->table_[this->index_]) - { - entry = this->next_; - return 1; - } - else - return 0; -} - -template ACE_INLINE int -ACE_Hash_Map_Iterator_Base_Ex::done (void) const -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex::done"); - - return this->map_man_->table_ == 0 - || this->index_ >= static_cast (this->map_man_->total_size_) - || this->index_ < 0; -} - -template ACE_INLINE -ACE_Hash_Map_Entry & -ACE_Hash_Map_Iterator_Base_Ex::operator* (void) const -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex::operator*"); - ACE_Hash_Map_Entry *retv = 0; - - int result = this->next (retv); - - ACE_UNUSED_ARG (result); - ACE_ASSERT (result != 0); - - return *retv; -} - -template ACE_INLINE -ACE_Hash_Map_Entry * -ACE_Hash_Map_Iterator_Base_Ex::operator-> (void) const -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex::operator->"); - ACE_Hash_Map_Entry *retv = 0; - - int result = this->next (retv); - - ACE_UNUSED_ARG (result); - ACE_ASSERT (result != 0); - - return retv; -} - -// Returns the reference to the hash_map_manager_ex that is being -// iterated over. -template ACE_INLINE -ACE_Hash_Map_Manager_Ex& -ACE_Hash_Map_Iterator_Base_Ex::map (void) -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex::map"); - return *this->map_man_; -} - -template ACE_INLINE bool -ACE_Hash_Map_Iterator_Base_Ex::operator== (const ACE_Hash_Map_Iterator_Base_Ex &rhs) const -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex::operator=="); - return this->map_man_ == rhs.map_man_ - && this->index_ == rhs.index_ - && this->next_ == rhs.next_; -} - -template ACE_INLINE bool -ACE_Hash_Map_Iterator_Base_Ex::operator!= (const ACE_Hash_Map_Iterator_Base_Ex &rhs) const -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex::operator!="); - return this->next_ != rhs.next_ - || this->index_ != rhs.index_ - || this->map_man_ != rhs.map_man_; -} - -template ACE_INLINE -ACE_Hash_Map_Const_Iterator_Base_Ex::ACE_Hash_Map_Const_Iterator_Base_Ex (const ACE_Hash_Map_Manager_Ex &mm, - bool head) - : map_man_ (&mm), - index_ (head ? -1 : (ssize_t) mm.total_size_), - next_ (0) -{ - ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex::ACE_Hash_Map_Const_Iterator_Base_Ex"); - - if (mm.table_ != 0) - this->next_ = &mm.table_[head ? 0 : mm.total_size_ - 1]; -} - -template ACE_INLINE int -ACE_Hash_Map_Const_Iterator_Base_Ex::next (ACE_Hash_Map_Entry *&entry) const -{ - ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex::next"); - - if (this->map_man_->table_ != 0 - && this->index_ < (ssize_t) this->map_man_->total_size_ - && this->index_ >= 0 - && this->next_ != &this->map_man_->table_[this->index_]) - { - entry = this->next_; - return 1; - } - else - return 0; -} - -template ACE_INLINE int -ACE_Hash_Map_Const_Iterator_Base_Ex::done (void) const -{ - ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex::done"); - - return this->map_man_->table_ == 0 - || this->index_ >= (ssize_t) this->map_man_->total_size_ - || this->index_ < 0; -} - -template ACE_INLINE -ACE_Hash_Map_Entry & -ACE_Hash_Map_Const_Iterator_Base_Ex::operator* (void) const -{ - ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex::operator*"); - ACE_Hash_Map_Entry *retv = 0; - - int result = this->next (retv); - - ACE_UNUSED_ARG (result); - ACE_ASSERT (result != 0); - - return *retv; -} - -template ACE_INLINE -ACE_Hash_Map_Entry * -ACE_Hash_Map_Const_Iterator_Base_Ex::operator-> (void) const -{ - ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex::operator->"); - ACE_Hash_Map_Entry *retv = 0; - - int result = this->next (retv); - - ACE_UNUSED_ARG (result); - ACE_ASSERT (result != 0); - - return retv; -} - -// Returns the reference to the hash_map_manager_ex that is being -// iterated over. -template ACE_INLINE -const ACE_Hash_Map_Manager_Ex& -ACE_Hash_Map_Const_Iterator_Base_Ex::map (void) -{ - ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex::map"); - return *this->map_man_; -} - -template ACE_INLINE bool -ACE_Hash_Map_Const_Iterator_Base_Ex::operator== (const ACE_Hash_Map_Const_Iterator_Base_Ex &rhs) const -{ - ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex::operator=="); - return this->map_man_ == rhs.map_man_ - && this->index_ == rhs.index_ - && this->next_ == rhs.next_; -} - -template ACE_INLINE bool -ACE_Hash_Map_Const_Iterator_Base_Ex::operator!= (const ACE_Hash_Map_Const_Iterator_Base_Ex &rhs) const -{ - ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Base_Ex::operator!="); - return this->next_ != rhs.next_ - || this->index_ != rhs.index_ - || this->map_man_ != rhs.map_man_; -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Map_Iterator_Ex) - -template ACE_INLINE void -ACE_Hash_Map_Iterator_Ex::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Hash_Map_Iterator_Ex::dump"); - - this->dump_i (); -#endif /* ACE_HAS_DUMP */ -} - -template ACE_INLINE -ACE_Hash_Map_Iterator_Ex::ACE_Hash_Map_Iterator_Ex (ACE_Hash_Map_Manager_Ex &mm, - int tail) - : ACE_Hash_Map_Iterator_Base_Ex (mm, - tail == 0 ? 1 : 0) -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Ex::ACE_Hash_Map_Iterator_Ex"); - if (tail == 0) - this->forward_i (); -} - -template -ACE_INLINE -ACE_Hash_Map_Iterator_Ex::ACE_Hash_Map_Iterator_Ex ( - ACE_Hash_Map_Manager_Ex & mm, - ACE_Hash_Map_Entry * entry, - size_t index) - : ACE_Hash_Map_Iterator_Base_Ex (mm, - entry, - index) -{ -} - -template ACE_INLINE int -ACE_Hash_Map_Iterator_Ex::advance (void) -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Ex::advance"); - return this->forward_i (); -} - -template ACE_INLINE -ACE_Hash_Map_Iterator_Ex & -ACE_Hash_Map_Iterator_Ex::operator++ (void) -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Ex::operator++ (void)"); - - this->forward_i (); - return *this; -} - -template ACE_INLINE -ACE_Hash_Map_Iterator_Ex -ACE_Hash_Map_Iterator_Ex::operator++ (int) -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Ex::operator++ (int)"); - - ACE_Hash_Map_Iterator_Ex retv (*this); - ++*this; - return retv; -} - -template ACE_INLINE -ACE_Hash_Map_Iterator_Ex & -ACE_Hash_Map_Iterator_Ex::operator-- (void) -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Ex::operator-- (void)"); - - this->reverse_i (); - return *this; -} - -template ACE_INLINE -ACE_Hash_Map_Iterator_Ex -ACE_Hash_Map_Iterator_Ex::operator-- (int) -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Ex::operator-- (int)"); - - ACE_Hash_Map_Iterator_Ex retv (*this); - --*this; - return retv; -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Map_Const_Iterator_Ex) - -template ACE_INLINE void -ACE_Hash_Map_Const_Iterator_Ex::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex::dump"); - - this->dump_i (); -#endif /* ACE_HAS_DUMP */ -} - -template ACE_INLINE -ACE_Hash_Map_Const_Iterator_Ex::ACE_Hash_Map_Const_Iterator_Ex (const ACE_Hash_Map_Manager_Ex &mm, - int tail) - : ACE_Hash_Map_Const_Iterator_Base_Ex (mm, - tail == 0 ? 1 : 0) -{ - ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex::ACE_Hash_Map_Const_Iterator_Ex"); - if (tail == 0) - this->forward_i (); -} - -template ACE_INLINE int -ACE_Hash_Map_Const_Iterator_Ex::advance (void) -{ - ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex::advance"); - return this->forward_i (); -} - -template ACE_INLINE -ACE_Hash_Map_Const_Iterator_Ex & -ACE_Hash_Map_Const_Iterator_Ex::operator++ (void) -{ - ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex::operator++ (void)"); - - this->forward_i (); - return *this; -} - -template ACE_INLINE -ACE_Hash_Map_Const_Iterator_Ex -ACE_Hash_Map_Const_Iterator_Ex::operator++ (int) -{ - ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex::operator++ (int)"); - - ACE_Hash_Map_Const_Iterator_Ex retv (*this); - ++*this; - return retv; -} - -template ACE_INLINE -ACE_Hash_Map_Const_Iterator_Ex & -ACE_Hash_Map_Const_Iterator_Ex::operator-- (void) -{ - ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex::operator-- (void)"); - - this->reverse_i (); - return *this; -} - -template ACE_INLINE -ACE_Hash_Map_Const_Iterator_Ex -ACE_Hash_Map_Const_Iterator_Ex::operator-- (int) -{ - ACE_TRACE ("ACE_Hash_Map_Const_Iterator_Ex::operator-- (int)"); - - ACE_Hash_Map_Const_Iterator_Ex retv (*this); - --*this; - return retv; -} - -template ACE_INLINE -ACE_Hash_Map_Bucket_Iterator::ACE_Hash_Map_Bucket_Iterator (ACE_Hash_Map_Manager_Ex &mm, - const EXT_ID &ext_id, - int tail) - : map_man_ (&mm) -{ - ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator::ACE_Hash_Map_Bucket_Iterator"); - - this->index_ = this->map_man_->hash (ext_id) % this->map_man_->total_size_; - this->next_ = &this->map_man_->table_[this->index_]; - - if (tail == 0) - this->forward_i (); -} - -template ACE_INLINE -ACE_Hash_Map_Bucket_Iterator & -ACE_Hash_Map_Bucket_Iterator::operator++ (void) -{ - ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator::operator++ (void)"); - - this->forward_i (); - return *this; -} - -template ACE_INLINE -ACE_Hash_Map_Bucket_Iterator -ACE_Hash_Map_Bucket_Iterator::operator++ (int) -{ - ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator::operator++ (int)"); - - ACE_Hash_Map_Bucket_Iterator retv (*this); - ++*this; - return retv; -} - -template ACE_INLINE -ACE_Hash_Map_Bucket_Iterator & -ACE_Hash_Map_Bucket_Iterator::operator-- (void) -{ - ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator::operator-- (void)"); - - this->reverse_i (); - return *this; -} - -template ACE_INLINE -ACE_Hash_Map_Bucket_Iterator -ACE_Hash_Map_Bucket_Iterator::operator-- (int) -{ - ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator::operator-- (int)"); - - ACE_Hash_Map_Bucket_Iterator retv (*this); - --*this; - return retv; -} - -template int -ACE_Hash_Map_Bucket_Iterator::forward_i (void) -{ - ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator::forward_i"); - - this->next_ = this->next_->next_; - return this->next_ != &this->map_man_->table_[this->index_]; -} - -template int -ACE_Hash_Map_Bucket_Iterator::reverse_i (void) -{ - ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator::reverse_i"); - - this->next_ = this->next_->prev_; - return this->next_ != &this->map_man_->table_[this->index_]; -} - -template ACE_INLINE -ACE_Hash_Map_Entry & -ACE_Hash_Map_Bucket_Iterator::operator* (void) const -{ - ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator::operator*"); - - return *this->next_; -} - -template ACE_INLINE -ACE_Hash_Map_Entry * -ACE_Hash_Map_Bucket_Iterator::operator-> (void) const -{ - ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator::operator->"); - - return this->next_; -} - -template ACE_INLINE -ACE_Hash_Map_Manager_Ex & -ACE_Hash_Map_Bucket_Iterator::map (void) -{ - ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator::map"); - return *this->map_man_; -} - -template ACE_INLINE bool -ACE_Hash_Map_Bucket_Iterator::operator== (const ACE_Hash_Map_Bucket_Iterator &rhs) const -{ - ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator::operator=="); - return this->map_man_ == rhs.map_man_ - && this->index_ == rhs.index_ - && this->next_ == rhs.next_; -} - -template ACE_INLINE bool -ACE_Hash_Map_Bucket_Iterator::operator!= (const ACE_Hash_Map_Bucket_Iterator &rhs) const -{ - ACE_TRACE ("ACE_Hash_Map_Bucket_Iterator::operator!="); - return this->next_ != rhs.next_ - || this->index_ != rhs.index_ - || this->map_man_ != rhs.map_man_; -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Map_Reverse_Iterator_Ex) - -template ACE_INLINE void -ACE_Hash_Map_Reverse_Iterator_Ex::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex::dump"); - - this->dump_i (); -#endif /* ACE_HAS_DUMP */ -} - -template ACE_INLINE -ACE_Hash_Map_Reverse_Iterator_Ex::ACE_Hash_Map_Reverse_Iterator_Ex (ACE_Hash_Map_Manager_Ex &mm, bool head) - : ACE_Hash_Map_Iterator_Base_Ex (mm, head) -{ - ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex::ACE_Hash_Map_Reverse_Iterator_Ex"); - if (!head) - this->reverse_i (); -} - -template ACE_INLINE int -ACE_Hash_Map_Reverse_Iterator_Ex::advance (void) -{ - ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex::advance"); - return this->reverse_i (); -} - -template ACE_INLINE -ACE_Hash_Map_Reverse_Iterator_Ex & -ACE_Hash_Map_Reverse_Iterator_Ex::operator++ (void) -{ - ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex::operator++ (void)"); - - this->reverse_i (); - return *this; -} - -template ACE_INLINE -ACE_Hash_Map_Reverse_Iterator_Ex -ACE_Hash_Map_Reverse_Iterator_Ex::operator++ (int) -{ - ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex::operator++ (int)"); - - ACE_Hash_Map_Reverse_Iterator_Ex retv (*this); - ++*this; - return retv; -} - -template ACE_INLINE -ACE_Hash_Map_Reverse_Iterator_Ex & -ACE_Hash_Map_Reverse_Iterator_Ex::operator-- (void) -{ - ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex::operator-- (void)"); - - this->forward_i (); - return *this; -} - -template ACE_INLINE -ACE_Hash_Map_Reverse_Iterator_Ex -ACE_Hash_Map_Reverse_Iterator_Ex::operator-- (int) -{ - ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex::operator-- (int)"); - - ACE_Hash_Map_Reverse_Iterator_Ex retv (*this); - --*this; - return retv; -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Map_Const_Reverse_Iterator_Ex) - -template ACE_INLINE void -ACE_Hash_Map_Const_Reverse_Iterator_Ex::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Hash_Map_Const_Reverse_Iterator_Ex::dump"); - - this->dump_i (); -#endif /* ACE_HAS_DUMP */ -} - -template ACE_INLINE -ACE_Hash_Map_Const_Reverse_Iterator_Ex::ACE_Hash_Map_Const_Reverse_Iterator_Ex (const ACE_Hash_Map_Manager_Ex &mm, bool head) - : ACE_Hash_Map_Const_Iterator_Base_Ex (mm, head) -{ - ACE_TRACE ("ACE_Hash_Map_Const_Reverse_Iterator_Ex::ACE_Hash_Map_Const_Reverse_Iterator_Ex"); - if (!head) - this->reverse_i (); -} - -template ACE_INLINE int -ACE_Hash_Map_Const_Reverse_Iterator_Ex::advance (void) -{ - ACE_TRACE ("ACE_Hash_Map_Const_Reverse_Iterator_Ex::advance"); - return this->reverse_i (); -} - -template ACE_INLINE -ACE_Hash_Map_Const_Reverse_Iterator_Ex & -ACE_Hash_Map_Const_Reverse_Iterator_Ex::operator++ (void) -{ - ACE_TRACE ("ACE_Hash_Map_Const_Reverse_Iterator_Ex::operator++ (void)"); - - this->reverse_i (); - return *this; -} - -template ACE_INLINE -ACE_Hash_Map_Const_Reverse_Iterator_Ex -ACE_Hash_Map_Const_Reverse_Iterator_Ex::operator++ (int) -{ - ACE_TRACE ("ACE_Hash_Map_Const_Reverse_Iterator_Ex::operator++ (int)"); - - ACE_Hash_Map_Const_Reverse_Iterator_Ex retv (*this); - ++*this; - return retv; -} - -template ACE_INLINE -ACE_Hash_Map_Const_Reverse_Iterator_Ex & -ACE_Hash_Map_Const_Reverse_Iterator_Ex::operator-- (void) -{ - ACE_TRACE ("ACE_Hash_Map_Const_Reverse_Iterator_Ex::operator-- (void)"); - - this->forward_i (); - return *this; -} - -template ACE_INLINE -ACE_Hash_Map_Const_Reverse_Iterator_Ex -ACE_Hash_Map_Const_Reverse_Iterator_Ex::operator-- (int) -{ - ACE_TRACE ("ACE_Hash_Map_Const_Reverse_Iterator_Ex::operator-- (int)"); - - ACE_Hash_Map_Const_Reverse_Iterator_Ex retv (*this); - --*this; - return retv; -} - -template -ACE_Hash_Map_Manager::ACE_Hash_Map_Manager (ACE_Allocator *table_alloc, - ACE_Allocator *entry_alloc) - : ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_LOCK> (table_alloc, - entry_alloc) -{ -} - -template -ACE_Hash_Map_Manager::ACE_Hash_Map_Manager (size_t size, - ACE_Allocator *table_alloc, - ACE_Allocator *entry_alloc) - : ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_LOCK> (size, - table_alloc, - entry_alloc) -{ -} - -template int -ACE_Hash_Map_Manager::equal (const EXT_ID &id1, const EXT_ID &id2) -{ - return ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_LOCK>::equal (id1, id2); -} - -template u_long -ACE_Hash_Map_Manager::hash (const EXT_ID &ext_id) -{ - return ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_LOCK>::hash (ext_id); -} - -template -ACE_Hash_Map_Iterator::ACE_Hash_Map_Iterator (ACE_Hash_Map_Manager &mm, - int tail) - : ACE_Hash_Map_Iterator_Ex, ACE_Equal_To, ACE_LOCK> (mm, - tail) -{ -} - -template -ACE_Hash_Map_Iterator::ACE_Hash_Map_Iterator (const ACE_Hash_Map_Iterator_Ex, ACE_Equal_To, ACE_LOCK> &base) - : ACE_Hash_Map_Iterator_Ex, ACE_Equal_To, ACE_LOCK> (base) -{ -} - -template ACE_Hash_Map_Iterator & -ACE_Hash_Map_Iterator::operator= (const ACE_Hash_Map_Iterator_Ex, ACE_Equal_To, ACE_LOCK> &rhs) -{ - if (this != &rhs) - { - ACE_Hash_Map_Iterator_Ex, ACE_Equal_To, ACE_LOCK> &base = *this; - - base = rhs; - } - - return *this; -} - -template -ACE_Hash_Map_Const_Iterator::ACE_Hash_Map_Const_Iterator (const ACE_Hash_Map_Manager &mm, - int tail) - : ACE_Hash_Map_Const_Iterator_Ex, ACE_Equal_To, ACE_LOCK> (mm, - tail) -{ -} - -template -ACE_Hash_Map_Const_Iterator::ACE_Hash_Map_Const_Iterator (const ACE_Hash_Map_Const_Iterator_Ex, ACE_Equal_To, ACE_LOCK> &base) - : ACE_Hash_Map_Const_Iterator_Ex, ACE_Equal_To, ACE_LOCK> (base) -{ -} - -template ACE_Hash_Map_Const_Iterator & -ACE_Hash_Map_Const_Iterator::operator= (const ACE_Hash_Map_Const_Iterator_Ex, ACE_Equal_To, ACE_LOCK> &rhs) -{ - if (this != &rhs) - { - ACE_Hash_Map_Const_Iterator_Ex, ACE_Equal_To, ACE_LOCK> &base = *this; - - base = rhs; - } - - return *this; -} - -template -ACE_Hash_Map_Reverse_Iterator::ACE_Hash_Map_Reverse_Iterator (ACE_Hash_Map_Manager &mm, - bool head) - : ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Equal_To, ACE_LOCK> (mm, - head) -{ -} - -template -ACE_Hash_Map_Reverse_Iterator::ACE_Hash_Map_Reverse_Iterator (const ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Equal_To, ACE_LOCK> &base) - : ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Equal_To, ACE_LOCK> (base) -{ -} - -template ACE_Hash_Map_Reverse_Iterator & -ACE_Hash_Map_Reverse_Iterator::operator= (const ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Equal_To, ACE_LOCK> &rhs) -{ - ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Equal_To, ACE_LOCK> &base = *this; - - base = rhs; - - return *this; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Hash_Map_With_Allocator_T.cpp b/dep/acelite/ace/Hash_Map_With_Allocator_T.cpp deleted file mode 100644 index a5310e89fb3..00000000000 --- a/dep/acelite/ace/Hash_Map_With_Allocator_T.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// $Id: Hash_Map_With_Allocator_T.cpp 80826 2008-03-04 14:51:23Z wotte $ - -#ifndef ACE_HASH_MAP_WITH_ALLOCATOR_T_CPP -#define ACE_HASH_MAP_WITH_ALLOCATOR_T_CPP - -#include "ace/Hash_Map_With_Allocator_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (__ACE_INLINE__) -#include "ace/Hash_Map_With_Allocator_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Hash_Map_With_Allocator::ACE_Hash_Map_With_Allocator (ACE_Allocator *alloc) - : ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_Null_Mutex> (alloc) -{ - ACE_TRACE ("ACE_Hash_Map_With_Allocator::ACE_Hash_Map_With_Allocator"); -} - -template -ACE_Hash_Map_With_Allocator::ACE_Hash_Map_With_Allocator (size_t size, - ACE_Allocator *alloc) - : ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_Null_Mutex> (size, alloc) -{ - ACE_TRACE ("ACE_Hash_Map_With_Allocator::ACE_Hash_Map_With_Allocator"); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HASH_MAP_WITH_ALLOCATOR_T_CPP */ diff --git a/dep/acelite/ace/Hash_Map_With_Allocator_T.h b/dep/acelite/ace/Hash_Map_With_Allocator_T.h deleted file mode 100644 index bdfba00fb93..00000000000 --- a/dep/acelite/ace/Hash_Map_With_Allocator_T.h +++ /dev/null @@ -1,112 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Hash_Map_With_Allocator_T.h - * - * $Id: Hash_Map_With_Allocator_T.h 91743 2010-09-13 18:24:51Z johnnyw $ - * - * @author Marina Spivak - * @author Irfan Pyarali - */ -//============================================================================= - -#ifndef ACE_HASH_MAP_WITH_ALLOCATOR_T_H -#define ACE_HASH_MAP_WITH_ALLOCATOR_T_H -#include /**/ "ace/pre.h" - -#include "ace/Hash_Map_Manager_T.h" -#include "ace/Null_Mutex.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Hash_Map_With_Allocator - * - * @brief This class is a thin wrapper around ACE_Hash_Map_Manager, - * which comes handy when ACE_Hash_Map_Manager is to be used with a - * non-nil ACE_Allocator. This wrapper insures that the appropriate - * allocator is in place for every operation that accesses or - * updates the hash map. - * - * If we use ACE_Hash_Map_Manager with a shared memory allocator - * (or memory-mapped file allocator, for example), the allocator - * pointer used by ACE_Hash_Map_Manager gets stored with it, in - * shared memory (or memory-mapped file). Naturally, this will - * cause horrible problems, since only the first process to set - * that pointer will be guaranteed the address of the allocator - * is meaningful! That is why we need this wrapper, which - * insures that appropriate allocator pointer is in place for - * each call. - * - * At some point it would be a good idea to update this class to - * use the new "two allocator" technique provided by @c - * ACE_Hash_Map_Manager_Ex. - */ -template -class ACE_Hash_Map_With_Allocator : - public ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_Null_Mutex> -{ -public: - /// Constructor. - ACE_Hash_Map_With_Allocator (ACE_Allocator *alloc); - - /// Constructor that specifies hash table size. - ACE_Hash_Map_With_Allocator (size_t size, - ACE_Allocator *alloc); - - // = The following methods are Proxies to the corresponding methods - // in ACE_Hash_Map_Manager. Each method sets the allocator to - // the one specified by the invoking entity, and then calls the - // corresponding method in ACE_Hash_Map_Manager to do the - // actual work. - - int bind (const EXT_ID &, - const INT_ID &, - ACE_Allocator *alloc); - - int unbind (const EXT_ID &, - INT_ID &, - ACE_Allocator *alloc); - - int unbind (const EXT_ID &, - ACE_Allocator *alloc); - - int rebind (const EXT_ID &, - const INT_ID &, - EXT_ID &, - INT_ID &, - ACE_Allocator *alloc); - - int find (const EXT_ID &, - INT_ID &, - ACE_Allocator *alloc); - - /// Returns 0 if the @a ext_id is in the mapping, otherwise -1. - int find (const EXT_ID &ext_id, - ACE_Allocator *alloc); - - int close (ACE_Allocator *alloc); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Hash_Map_With_Allocator_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Hash_Map_With_Allocator_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Hash_Map_With_Allocator_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - - -#include /**/ "ace/post.h" -#endif /* ACE_HASH_MAP_WITH_ALLOCATOR_T_H */ diff --git a/dep/acelite/ace/Hash_Map_With_Allocator_T.inl b/dep/acelite/ace/Hash_Map_With_Allocator_T.inl deleted file mode 100644 index 99a603cfa9b..00000000000 --- a/dep/acelite/ace/Hash_Map_With_Allocator_T.inl +++ /dev/null @@ -1,82 +0,0 @@ -// -*- C++ -*- - -// $Id: Hash_Map_With_Allocator_T.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE int -ACE_Hash_Map_With_Allocator::close (ACE_Allocator *alloc) -{ - ACE_TRACE ("ACE_Hash_Map_With_Allocator::close"); - this->table_allocator_ = alloc; - this->entry_allocator_ = alloc; - return this->close_i (); -} - -template ACE_INLINE int -ACE_Hash_Map_With_Allocator::bind (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_Allocator *alloc) -{ - ACE_TRACE ("ACE_Hash_Map_With_Allocator::bind"); - this->table_allocator_ = alloc; - this->entry_allocator_ = alloc; - return this->bind_i (ext_id, int_id); -} - -template ACE_INLINE int -ACE_Hash_Map_With_Allocator::unbind (const EXT_ID &ext_id, - INT_ID &int_id, - ACE_Allocator *alloc) -{ - ACE_TRACE ("ACE_Hash_Map_With_Allocator::unbind"); - this->table_allocator_ = alloc; - this->entry_allocator_ = alloc; - return this->unbind_i (ext_id, int_id); -} - -template ACE_INLINE int -ACE_Hash_Map_With_Allocator::unbind (const EXT_ID &ext_id, - ACE_Allocator *alloc) -{ - ACE_TRACE ("ACE_Hash_Map_With_Allocator::unbind"); - this->table_allocator_ = alloc; - this->entry_allocator_ = alloc; - return this->unbind_i (ext_id); -} - -template ACE_INLINE int -ACE_Hash_Map_With_Allocator::rebind (const EXT_ID &ext_id, - const INT_ID &int_id, - EXT_ID &old_ext_id, - INT_ID &old_int_id, - ACE_Allocator *alloc) -{ - ACE_TRACE ("ACE_Hash_Map_With_Allocator::rebind"); - this->table_allocator_ = alloc; - this->entry_allocator_ = alloc; - return this->rebind_i (ext_id, int_id, old_ext_id, old_int_id); -} - -template ACE_INLINE int -ACE_Hash_Map_With_Allocator::find (const EXT_ID &ext_id, - INT_ID &int_id, - ACE_Allocator *alloc) -{ - ACE_TRACE ("ACE_Hash_Map_With_Allocator::find"); - this->table_allocator_ = alloc; - this->entry_allocator_ = alloc; - return this->find_i (ext_id, int_id); -} - -template ACE_INLINE int -ACE_Hash_Map_With_Allocator::find (const EXT_ID &ext_id, - ACE_Allocator *alloc) -{ - ACE_TRACE ("ACE_Hash_Map_With_Allocator::find"); - this->table_allocator_ = alloc; - this->entry_allocator_ = alloc; - return this->find_i (ext_id); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Hash_Multi_Map_Manager_T.cpp b/dep/acelite/ace/Hash_Multi_Map_Manager_T.cpp deleted file mode 100644 index 195e8ac03c2..00000000000 --- a/dep/acelite/ace/Hash_Multi_Map_Manager_T.cpp +++ /dev/null @@ -1,601 +0,0 @@ - -//============================================================================= -/** - * @file Hash_Multi_Map_Manager_T.cpp - * - * $Id: Hash_Multi_Map_Manager_T.cpp 93736 2011-04-05 12:38:35Z johnnyw $ - * - * @author Shanshan Jiang - */ -//============================================================================= - -#ifndef ACE_Hash_Multi_Map_Manager_T_CPP -#define ACE_Hash_Multi_Map_Manager_T_CPP - -#include "ace/Hash_Multi_Map_Manager_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (__ACE_INLINE__) -# include "ace/Hash_Multi_Map_Manager_T.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Malloc_Base.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Hash_Multi_Map_Entry::ACE_Hash_Multi_Map_Entry (ACE_Hash_Multi_Map_Entry *next, - ACE_Hash_Multi_Map_Entry *prev) - : next_ (next), - prev_ (prev) -{ -} - -template -ACE_Hash_Multi_Map_Entry::ACE_Hash_Multi_Map_Entry (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - ACE_Hash_Multi_Map_Entry *next, - ACE_Hash_Multi_Map_Entry *prev) - : ext_id_ (ext_id), - int_id_set_ (int_id_set), - next_ (next), - prev_ (prev) -{ -} - -template -ACE_Hash_Multi_Map_Entry::~ACE_Hash_Multi_Map_Entry (void) -{ -} - -template EXT_ID & -ACE_Hash_Multi_Map_Entry::key () -{ - return ext_id_; -} - -template ACE_Unbounded_Set & -ACE_Hash_Multi_Map_Entry::item () -{ - return int_id_set_; -} - -template void -ACE_Hash_Multi_Map_Entry::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("next_ = %d"), this->next_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("prev_ = %d"), this->prev_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template void -ACE_Hash_Multi_Map_Manager::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("total_size_ = %d"), this->total_size_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ncur_size_ = %d"), this->cur_size_)); - this->table_allocator_->dump (); - this->entry_allocator_->dump (); - this->lock_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -template int -ACE_Hash_Multi_Map_Manager::create_buckets (size_t size) -{ - size_t bytes = size * sizeof (ACE_Hash_Multi_Map_Entry); - void *ptr; - - ACE_ALLOCATOR_RETURN (ptr, - this->table_allocator_->malloc (bytes), - -1); - - this->table_ = (ACE_Hash_Multi_Map_Entry *) ptr; - - this->total_size_ = size; - - // Initialize each entry in the hash table to be a circular linked - // list with the dummy node in the front serving as the anchor of - // the list. - for (size_t i = 0; i < size; i++) - new (&this->table_[i]) ACE_Hash_Multi_Map_Entry (&this->table_[i], - &this->table_[i]); - return 0; -} - -template int -ACE_Hash_Multi_Map_Manager::open (size_t size, - ACE_Allocator *table_alloc, - ACE_Allocator *entry_alloc) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - // Calling this->close_i () to ensure we release previous allocated - // memory before allocating new one. - this->close_i (); - - if (table_alloc == 0) - table_alloc = ACE_Allocator::instance (); - - this->table_allocator_ = table_alloc; - - if (entry_alloc == 0) - entry_alloc = table_alloc; - - this->entry_allocator_ = entry_alloc; - - // This assertion is here to help track a situation that shouldn't - // happen, but did with Sun C++ 4.1 (before a change to this class - // was made: it used to have an enum that was supposed to be defined - // to be ACE_DEFAULT_MAP_SIZE, but instead was defined to be 0). - if (size == 0) - return -1; - - return this->create_buckets (size); -} - -template int -ACE_Hash_Multi_Map_Manager::close_i (void) -{ - // Protect against "double-deletion" in case the destructor also - // gets called. - if (this->table_ != 0) - { - // Remove all the entries. - this->unbind_all_i (); - - // Iterate through the buckets cleaning up the sentinels. - for (size_t i = 0; i < this->total_size_; i++) - { - // Destroy the dummy entry. - ACE_Hash_Multi_Map_Entry *entry = &this->table_[i]; - - // The second argument results in a no-op instead of - // deallocation. - ACE_DES_FREE_TEMPLATE2 (entry, ACE_NOOP, - ACE_Hash_Multi_Map_Entry, EXT_ID, INT_ID); - } - - // Reset size. - this->total_size_ = 0; - - // Free table memory. - this->table_allocator_->free (this->table_); - - // Should be done last... - this->table_ = 0; - } - - return 0; -} - -template int -ACE_Hash_Multi_Map_Manager::unbind_all_i (void) -{ - // Iterate through the entire map calling the destuctor of each - // . - for (size_t i = 0; i < this->total_size_; i++) - { - for (ACE_Hash_Multi_Map_Entry *temp_ptr = this->table_[i].next_; - temp_ptr != &this->table_[i]; - ) - { - ACE_Hash_Multi_Map_Entry *hold_ptr = temp_ptr; - temp_ptr = temp_ptr->next_; - - // Explicitly call the destructor. - ACE_DES_FREE_TEMPLATE2 (hold_ptr, this->entry_allocator_->free, - ACE_Hash_Multi_Map_Entry, EXT_ID, INT_ID); - } - - // Restore the sentinel. - this->table_[i].next_ = &this->table_[i]; - this->table_[i].prev_ = &this->table_[i]; - } - - this->cur_size_ = 0; - - return 0; -} - -template int -ACE_Hash_Multi_Map_Manager::bind_i (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_Hash_Multi_Map_Entry *&entry) -{ - size_t loc; - int result = this->shared_find (ext_id, entry, loc); - - ACE_Unbounded_Set int_id_set; - if (result == -1) - { - void *ptr; - // Not found. - ACE_ALLOCATOR_RETURN (ptr, - this->entry_allocator_->malloc (sizeof (ACE_Hash_Multi_Map_Entry)), - -1); - - int_id_set.insert (int_id); - - entry = new (ptr) ACE_Hash_Multi_Map_Entry (ext_id, - int_id_set, - this->table_[loc].next_, - &this->table_[loc]); - this->table_[loc].next_ = entry; - entry->next_->prev_ = entry; - this->cur_size_++; - return 0; - } - else - { - int_id_set = (*entry).int_id_set_; - - if (0 == int_id_set.insert (int_id)) - { - this->unbind_i (entry); - return this->bind_i (ext_id, int_id_set); - } - else - return 1; - } -} - -template int -ACE_Hash_Multi_Map_Manager::bind_i (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - ACE_Hash_Multi_Map_Entry *&entry) -{ - size_t loc; - int result = this->shared_find (ext_id, entry, loc); - - if (result == -1) - { - void *ptr; - // Not found. - ACE_ALLOCATOR_RETURN (ptr, - this->entry_allocator_->malloc (sizeof (ACE_Hash_Multi_Map_Entry)), - -1); - - entry = new (ptr) ACE_Hash_Multi_Map_Entry (ext_id, - int_id_set, - this->table_[loc].next_, - &this->table_[loc]); - this->table_[loc].next_ = entry; - entry->next_->prev_ = entry; - this->cur_size_++; - return 0; - } - else - return 1; -} - -template int -ACE_Hash_Multi_Map_Manager::trybind_i (const EXT_ID &ext_id, - ACE_Unbounded_Set &int_id_set, - ACE_Hash_Multi_Map_Entry *&entry) -{ - size_t loc; - int result = this->shared_find (ext_id, entry, loc); - - if (result == -1) - { - // Not found. - void *ptr; - ACE_ALLOCATOR_RETURN (ptr, - this->entry_allocator_->malloc (sizeof (ACE_Hash_Multi_Map_Entry)), - -1); - - entry = new (ptr) ACE_Hash_Multi_Map_Entry (ext_id, - int_id_set, - this->table_[loc].next_, - &this->table_[loc]); - this->table_[loc].next_ = entry; - entry->next_->prev_ = entry; - this->cur_size_++; - return 0; - } - else - return 1; -} - -template int -ACE_Hash_Multi_Map_Manager::unbind_i (const EXT_ID &ext_id, - ACE_Unbounded_Set &int_id_set) -{ - ACE_Hash_Multi_Map_Entry *temp; - - size_t loc; - int result = this->shared_find (ext_id, temp, loc); - - if (result == -1) - { - errno = ENOENT; - return -1; - } - - int_id_set = temp->int_id_set_; - - return this->unbind_i (temp); -} - -template int -ACE_Hash_Multi_Map_Manager::unbind_i (ACE_Hash_Multi_Map_Entry *entry) -{ - entry->next_->prev_ = entry->prev_; - entry->prev_->next_ = entry->next_; - - // Explicitly call the destructor. - ACE_DES_FREE_TEMPLATE2 (entry, this->entry_allocator_->free, - ACE_Hash_Multi_Map_Entry, EXT_ID, INT_ID); - - this->cur_size_--; - return 0; -} - -template int -ACE_Hash_Multi_Map_Manager::unbind_i (const EXT_ID &ext_id, - const INT_ID &int_id) -{ - ACE_Hash_Multi_Map_Entry *temp; - - size_t loc; - int result = this->shared_find (ext_id, temp, loc); - - if (result == -1) - { - errno = ENOENT; - return -1; - } - - ACE_Unbounded_Set int_id_set = (*temp).int_id_set_; - if (0 == int_id_set.remove (int_id)) - { - this->unbind_i (temp); - - if (0 != int_id_set.size ()) - return this->bind_i (ext_id, int_id_set); - else - return 0; - } - else - return -1; -} - - -template int -ACE_Hash_Multi_Map_Manager::shared_find (const EXT_ID &ext_id, - ACE_Hash_Multi_Map_Entry *&entry, - size_t &loc) -{ - loc = this->hash (ext_id) % this->total_size_; - - ACE_Hash_Multi_Map_Entry *temp = this->table_[loc].next_; - - while (temp != &this->table_[loc] && this->equal (temp->ext_id_, ext_id) == 0) - temp = temp->next_; - - if (temp == &this->table_[loc]) - { - errno = ENOENT; - return -1; - } - else - { - entry = temp; - return 0; - } -} - -template int -ACE_Hash_Multi_Map_Manager::rebind_i (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - ACE_Hash_Multi_Map_Entry *&entry) -{ - size_t dummy; - if (this->shared_find (ext_id, entry, dummy) == -1) - return this->bind_i (ext_id, int_id_set); - else - { - entry->ext_id_ = ext_id; - entry->int_id_set_ = int_id_set; - return 1; - } -} - -template int -ACE_Hash_Multi_Map_Manager::rebind_i (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - ACE_Unbounded_Set &old_int_id_set, - ACE_Hash_Multi_Map_Entry *&entry) -{ - size_t dummy; - if (this->shared_find (ext_id, entry, dummy) == -1) - return this->bind_i (ext_id, int_id_set); - else - { - old_int_id_set = entry->int_id_set_; - entry->ext_id_ = ext_id; - entry->int_id_set_ = int_id_set; - return 1; - } -} - -template int -ACE_Hash_Multi_Map_Manager::rebind_i (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - EXT_ID &old_ext_id, - ACE_Unbounded_Set &old_int_id_set, - ACE_Hash_Multi_Map_Entry *&entry) -{ - size_t dummy; - if (this->shared_find (ext_id, entry, dummy) == -1) - return this->bind_i (ext_id, int_id_set); - else - { - old_ext_id = entry->ext_id_; - old_int_id_set = entry->int_id_set_; - entry->ext_id_ = ext_id; - entry->int_id_set_ = int_id_set; - return 1; - } -} - -// ------------------------------------------------------------ - -ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Multi_Map_Iterator_Base) - -template void -ACE_Hash_Multi_Map_Iterator_Base::dump_i (void) const -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Iterator_Base::dump_i"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("index_ = %d "), this->index_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("next_ = %x"), this->next_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -} - -template int -ACE_Hash_Multi_Map_Iterator_Base::forward_i (void) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Iterator_Base::forward_i"); - - if (this->map_man_->table_ == 0) - return -1; - // Handle initial case specially. - else if (this->index_ == -1) - { - this->index_++; - return this->forward_i (); - } - else if (this->index_ >= static_cast (this->map_man_->total_size_)) - return 0; - - this->next_ = this->next_->next_; - if (this->next_ == &this->map_man_->table_[this->index_]) - { - while (++this->index_ < static_cast (this->map_man_->total_size_)) - { - this->next_ = this->map_man_->table_[this->index_].next_; - if (this->next_ != &this->map_man_->table_[this->index_]) - break; - } - } - - return this->index_ < static_cast (this->map_man_->total_size_); -} - -template int -ACE_Hash_Multi_Map_Iterator_Base::reverse_i (void) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Iterator_Base::reverse_i"); - - if (this->map_man_->table_ == 0) - return -1; - else if (this->index_ == static_cast (this->map_man_->total_size_)) - { - this->index_--; - return this->reverse_i (); - } - else if (this->index_ < 0) - return 0; - - this->next_ = this->next_->prev_; - if (this->next_ == &this->map_man_->table_[this->index_]) - { - while (--this->index_ >= 0) - { - this->next_ = this->map_man_->table_[this->index_].prev_; - if (this->next_ != &this->map_man_->table_[this->index_]) - break; - } - } - - return this->index_ >= 0; -} - -// ------------------------------------------------------------ - -ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Multi_Map_Const_Iterator_Base) - -template void -ACE_Hash_Multi_Map_Const_Iterator_Base::dump_i (void) const -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator_Base::dump_i"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("index_ = %d "), this->index_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("next_ = %x"), this->next_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -} - -template int -ACE_Hash_Multi_Map_Const_Iterator_Base::forward_i (void) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator_Base::forward_i"); - - if (this->map_man_->table_ == 0) - return -1; - // Handle initial case specially. - else if (this->index_ == -1) - { - this->index_++; - return this->forward_i (); - } - else if (this->index_ >= (ssize_t) this->map_man_->total_size_) - return 0; - - this->next_ = this->next_->next_; - if (this->next_ == &this->map_man_->table_[this->index_]) - { - while (++this->index_ < (ssize_t) this->map_man_->total_size_) - { - this->next_ = this->map_man_->table_[this->index_].next_; - if (this->next_ != &this->map_man_->table_[this->index_]) - break; - } - } - - return this->index_ < (ssize_t) this->map_man_->total_size_; -} - -template int -ACE_Hash_Multi_Map_Const_Iterator_Base::reverse_i (void) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator_Base::reverse_i"); - - if (this->map_man_->table_ == 0) - return -1; - else if (this->index_ == (ssize_t) this->map_man_->total_size_) - { - this->index_--; - return this->reverse_i (); - } - else if (this->index_ < 0) - return 0; - - this->next_ = this->next_->prev_; - if (this->next_ == &this->map_man_->table_[this->index_]) - { - while (--this->index_ >= 0) - { - this->next_ = this->map_man_->table_[this->index_].prev_; - if (this->next_ != &this->map_man_->table_[this->index_]) - break; - } - } - - return this->index_ >= 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_Hash_Multi_Map_Manager_T_CPP */ diff --git a/dep/acelite/ace/Hash_Multi_Map_Manager_T.h b/dep/acelite/ace/Hash_Multi_Map_Manager_T.h deleted file mode 100644 index ddbb093bfa4..00000000000 --- a/dep/acelite/ace/Hash_Multi_Map_Manager_T.h +++ /dev/null @@ -1,966 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Hash_Multi_Map_Manager_T.h - * - * $Id: Hash_Multi_Map_Manager_T.h 91693 2010-09-09 12:57:54Z johnnyw $ - * - * The code in Hash_Multi_Map_Manager_T.* was based on the code in - * Hash_Map_Manager_T.*. - * - * ACE_Hash_Multi_Map_Manager maps a key type to more than one value types. - * The template takes the key and value types as parameters. The bind and - * unbind operations can take a key and the value or the set of the values that - * is to be associated with that key. The find operation can take a key or a - * key and the value that is associated with the key. - * - * ACE_Hash_Multi_Map_Manager uses @c ACE_Unbounded_Set to store differet values - * with the same key. - * - * @author Shanshan Jiang - */ -//============================================================================= - -#ifndef ACE_HASH_MULTI_MAP_MANAGER_T_H -#define ACE_HASH_MULTI_MAP_MANAGER_T_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Default_Constants.h" -#include "ace/Functor_T.h" -#include "ace/Log_Msg.h" - -#include "ace/Unbounded_Set.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Hash_Multi_Map_Entry - * - * @brief Define an entry in the hash table. - */ -template -class ACE_Hash_Multi_Map_Entry -{ -public: - friend class ACE_Unbounded_Set; - - typedef ACE_Unbounded_Set VALUE_SET; - typedef ACE_Unbounded_Set_Iterator VALUE_SET_ITERATOR; - - // = Initialization and termination methods. - /// Constructor. - ACE_Hash_Multi_Map_Entry (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - ACE_Hash_Multi_Map_Entry *next = 0, - ACE_Hash_Multi_Map_Entry *prev = 0); - - /// Constructor. - ACE_Hash_Multi_Map_Entry (ACE_Hash_Multi_Map_Entry *next, - ACE_Hash_Multi_Map_Entry *prev); - - /// Destructor. - ~ACE_Hash_Multi_Map_Entry (void); - - /// Key accessor. - EXT_ID& key (void); - - /// Item accessor. - ACE_Unbounded_Set& item (void); - -public: - /// Key used to look up an entry. - /// @todo Should be private - EXT_ID ext_id_; - - /// The contents of the entry itself. - /// @todo Should be private - ACE_Unbounded_Set int_id_set_; - - /// Pointer to the next item in the bucket of overflow nodes. - ACE_Hash_Multi_Map_Entry *next_; - - /// Pointer to the prev item in the bucket of overflow nodes. - ACE_Hash_Multi_Map_Entry *prev_; - - /// Dump the state of an object. - void dump (void) const; -}; - -// Forward decl. -template -class ACE_Hash_Multi_Map_Iterator_Base; - -// Forward decl. -template -class ACE_Hash_Multi_Map_Const_Iterator_Base; - -// Forward decl. -template -class ACE_Hash_Multi_Map_Iterator; - -// Forward decl. -template -class ACE_Hash_Multi_Map_Const_Iterator; - -// Forward decl. -template -class ACE_Hash_Multi_Map_Reverse_Iterator; - -// Forward decl. -template -class ACE_Hash_Multi_Map_Bucket_Iterator; - -// Forward decl. -class ACE_Allocator; - -/** - * @class ACE_Hash_Multi_Map_Manager - * - * @brief Define a multi-map abstraction that efficiently associates the keys - * with their different values. - * - * This implementation of a multi-map uses a hash table. Key hashing - * is achieved through the @c HASH_KEY object and key comparison is - * achieved through the @c COMPARE_KEYS object. - * This class uses an @c ACE_Allocator to allocate memory. The - * user can make this a persistent class by providing an - * @c ACE_Allocator with a persistable memory pool. - */ - -template -class ACE_Hash_Multi_Map_Manager -{ -public: - friend class ACE_Hash_Multi_Map_Iterator_Base; - friend class ACE_Hash_Multi_Map_Iterator; - friend class ACE_Hash_Multi_Map_Const_Iterator_Base; - friend class ACE_Hash_Multi_Map_Const_Iterator; - friend class ACE_Hash_Multi_Map_Reverse_Iterator; - friend class ACE_Hash_Multi_Map_Bucket_Iterator; - - typedef EXT_ID - KEY; - typedef INT_ID - VALUE; - typedef ACE_LOCK lock_type; - typedef ACE_Hash_Multi_Map_Entry - ENTRY; - - // = ACE-style iterator typedefs. - typedef ACE_Hash_Multi_Map_Iterator - ITERATOR; - typedef ACE_Hash_Multi_Map_Const_Iterator - CONST_ITERATOR; - typedef ACE_Hash_Multi_Map_Reverse_Iterator - REVERSE_ITERATOR; - - // = STL-style iterator typedefs. - typedef ACE_Hash_Multi_Map_Iterator - iterator; - typedef ACE_Hash_Multi_Map_Const_Iterator - const_iterator; - typedef ACE_Hash_Multi_Map_Reverse_Iterator - reverse_iterator; - - // = Initialization and termination methods. - - /** - * Initialize a @c Hash_Multi_Map_Manager with default size elements. - * @param table_alloc is a pointer to a memory allocator used for - * table_, so it should supply size*sizeof ( - * ACE_Hash_Multi_Map_Entry<@c EXT_ID, @c INT_ID>). - * @param entry_alloc is a pointer to an additional allocator for - * entries, so it should be able to allocate 'size' / chunks - * of sizeof (ACE_Hash_Multi_Map_Entry<@c EXT_ID, @c INT_ID>) bytes - * each. - * If @a table_alloc is 0 it defaults to @c ACE_Allocator::instance(). - * If @a entry_alloc is 0 then it defaults to the same allocator as - * @a table_alloc. - */ - ACE_Hash_Multi_Map_Manager (ACE_Allocator *table_alloc = 0, - ACE_Allocator *entry_alloc = 0); - - /** - * Initialize a @c Hash_Multi_Map_Manager with @a size elements. - * @param size is the number of elements in a Hash_Multi_Map_Manager. - * @param table_alloc is a pointer to a memory allocator used for - * table_, so it should supply size*sizeof ( - * ACE_Hash_Multi_Map_Entry<@c EXT_ID, <@c INT_ID>). - * @param entry_alloc is a pointer to an additional allocator for - * entries, so it should be able to allocate 'size' / chunks - * of sizeof (ACE_Hash_Multi_Map_Entry<@c EXT_ID, @c INT_ID>) bytes - * each. - * If @a table_alloc is 0 it defaults to @c ACE_Allocator::instance(). - * If @a entry_alloc is 0 then it defaults to the same allocator as - * @a table_alloc. - */ - ACE_Hash_Multi_Map_Manager (size_t size, - ACE_Allocator *table_alloc = 0, - ACE_Allocator *entry_alloc = 0); - - /** - * Initialize a @c Hash_Multi_Map_Manager with @a size elements. - * @param size is the number of elements in a Hash_Multi_Map_Manager. - * @param table_alloc is a pointer to a memory allocator used for - * table_, so it should supply size*sizeof - * (ACE_Hash_Multi_Map_Entry<@c EXT_ID, <@c INT_ID>). - * @param entry_alloc is a pointer to an additional allocator for - * entries, so it should be able to allocate 'size' / chunks - * of sizeof (ACE_Hash_Multi_Map_Entry<@c EXT_ID, <@c INT_ID>) bytes - * each. - * If @a table_alloc is 0 it defaults to @c ACE_Allocator::instance(). - * If @a entry_alloc is 0 then it defaults to the same allocator as - * @a table_alloc. - * @return -1 on failure, 0 on success - */ - - int open (size_t size = ACE_DEFAULT_MAP_SIZE, - ACE_Allocator *table_alloc = 0, - ACE_Allocator *entry_alloc = 0); - - /// Close down a Hash_Multi_Map_Manager and release dynamically allocated - /// resources. - int close (void); - - /// Removes all the entries in Hash_Multi_Map_Manager. - int unbind_all (void); - - /// Cleanup the Hash_Multi_Map_Manager. - ~ACE_Hash_Multi_Map_Manager (void); - - /** - * Associate @a ext_id with @a int_id. If @a ext_id and @a int_id is already - * in the map then the @c ACE_Hash_Multi_Map_Entry is not changed. Returns 0 if - * a new entry is bound successfully, returns 1 if an attempt is made - * to bind an existing entry, and returns -1 if failures occur. - */ - int bind (const EXT_ID &ext_id, - const INT_ID &int_id); - - /** - * Same as a normal bind, except the map entry is also passed back - * to the caller. The entry in this case will either be the newly - * created entry, or the existing one. - */ - int bind (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_Hash_Multi_Map_Entry *&entry); - - /** - * Associate @a ext_id with @a int_id_set. If @a ext_id is already in the - * map then the @c ACE_Hash_Multi_Map_Entry is not changed. Returns 0 if a - * new entry is bound successfully, returns 1 if an attempt is made - * to bind an existing entry, and returns -1 if failures occur. - */ - int bind (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set); - - /** - * Same as a normal bind, except the map entry is also passed back - * to the caller. The entry in this case will either be the newly - * created entry, or the existing one. - */ - int bind (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - ACE_Hash_Multi_Map_Entry *&entry); - - /** - * Associate @a ext_id with @a int_id_set if and only if @a ext_id is - * not in the map. If @a ext_id is already in the map then the @a int_id_set - * parameter is assigned the existing value in the map. Returns 0 - * if a new entry is bound successfully, returns 1 if an attempt is - * made to bind an existing entry, and returns -1 if failures occur. - */ - int trybind (const EXT_ID &ext_id, - ACE_Unbounded_Set &int_id_set); - - /** - * Same as a normal trybind, except the map entry is also passed - * back to the caller. The entry in this case will either be the - * newly created entry, or the existing one. - */ - int trybind (const EXT_ID &ext_id, - ACE_Unbounded_Set &int_id_set, - ACE_Hash_Multi_Map_Entry *&entry); - - /** - * Reassociate @a ext_id with @a int_id_set. If @a ext_id is not in - * the map then behaves just like bind. Returns 0 if a new entry is - * bound successfully, returns 1 if an existing entry was rebound, - * and returns -1 if failures occur. - */ - int rebind (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set); - - /** - * Same as a normal rebind, except the map entry is also passed back - * to the caller. The entry in this case will either be the newly - * created entry, or the existing one. - */ - int rebind (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - ACE_Hash_Multi_Map_Entry *&entry); - - /** - * Associate @a ext_id with @a int_id_set. If @a ext_id is not in the map - * then behaves just like bind. Otherwise, store the old value of - * @a int_id_set into the "out" parameter and rebind the new parameters. - * Returns 0 if a new entry is bound successfully, returns 1 if an - * existing entry was rebound, and returns -1 if failures occur. - */ - int rebind (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - ACE_Unbounded_Set &old_int_id_set); - - /** - * Same as a normal rebind, except the map entry is also passed back - * to the caller. The entry in this case will either be the newly - * created entry, or the existing one. - */ - int rebind (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - ACE_Unbounded_Set &old_int_id_set, - ACE_Hash_Multi_Map_Entry *&entry); - - /** - * Associate @a ext_id with @a int_id_set. If @a ext_id is not in the map - * then behaves just like bind. Otherwise, store the old values - * of @a ext_id and @a int_id_set into the "out" parameters and rebind the - * new parameters. This is very useful if you need to have an - * atomic way of updating @c ACE_Hash_Multi_Map_Entry objects and you also - * need full control over memory allocation. Returns 0 if a new entry - * is bound successfully, returns 1 if an existing entry was rebound, - * and returns -1 if failures occur. - */ - int rebind (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - EXT_ID &old_ext_id, - ACE_Unbounded_Set &old_int_id_set); - - /** - * Same as a normal rebind, except the map entry is also passed back - * to the caller. The entry in this case will either be the newly - * created entry, or the existing one. - */ - int rebind (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - EXT_ID &old_ext_id, - ACE_Unbounded_Set &old_int_id_set, - ACE_Hash_Multi_Map_Entry *&entry); - - /// Locate @a ext_id and pass out parameter via @a int_id_set. - /// Return 0 if found, returns -1 if not found. - int find (const EXT_ID &ext_id, - ACE_Unbounded_Set &int_id_set) const; - - /// Locate @a ext_id and @a int_id. - /// Return 0 if found, returns -1 if not found. - int find (const EXT_ID &ext_id, - const INT_ID &int_id) const; - - /// Returns 0 if the @a ext_id is in the mapping, otherwise -1. - int find (const EXT_ID &ext_id) const; - - /// Locate @a ext_id and pass out parameter via @a entry. If found, - /// return 0, returns -1 if not found. - int find (const EXT_ID &ext_id, - ACE_Hash_Multi_Map_Entry *&entry) const; - - /** - * Unbind (remove) the @a ext_id from the map. Don't return the - * int_id to the caller (this is useful for collections where the - * int_ids are *not* dynamically allocated...) - */ - int unbind (const EXT_ID &ext_id); - - /// Break any association of @a ext_id. Returns the value of @a int_id_set - /// in case the caller needs to deallocate memory. Return 0 if the - /// unbind was successfully, and returns -1 if failures occur. - int unbind (const EXT_ID &ext_id, - ACE_Unbounded_Set &int_id_set); - - /// Break any association of @a ext_id and @a int_id. Return 0 if the - /// unbind was successfully, and returns -1 if failures occur. - int unbind (const EXT_ID &ext_id, - const INT_ID &int_id); - - /// Remove @a entry from map. Return 0 if the unbind was successfully, - /// and returns -1 if failures occur. - int unbind (ACE_Hash_Multi_Map_Entry *entry); - - /// Returns the current number of @c ACE_Hash_Multi_Map_Entry objects in the - /// hash table. - size_t current_size (void) const; - - /// Return the size of the array that's used to point to the - /// linked lists of @c ACE_Hash_Multi_Map_Entry objects in the hash table. - size_t total_size (void) const; - - /** - * Returns a reference to the underlying @c ACE_LOCK. This makes it - * possible to acquire the lock explicitly, which can be useful in - * some cases if you instantiate the @c ACE_Atomic_Op with an - * @c ACE_Recursive_Mutex or @c ACE_Process_Mutex, or if you need to - * guard the state of an iterator. - * @note The right name would be lock, but HP/C++ will choke on that! - */ - ACE_LOCK &mutex (void); - - /// Dump the state of an object. - void dump (void) const; - - // = STL styled iterator factory functions. - - /// Return forward iterator. - ACE_Hash_Multi_Map_Iterator begin (void); - ACE_Hash_Multi_Map_Iterator end (void); - - /// Return reverse iterator. - ACE_Hash_Multi_Map_Reverse_Iterator rbegin (void); - ACE_Hash_Multi_Map_Reverse_Iterator rend (void); - -protected: - // = The following methods do the actual work. - - /// Returns 1 if @a id1 == @a id2, else 0. This is defined as a - /// separate method to facilitate template specialization. - int equal (const EXT_ID &id1, const EXT_ID &id2); - - /// Compute the hash value of the @a ext_id. This is defined as a - /// separate method to facilitate template specialization. - u_long hash (const EXT_ID &ext_id); - - // = These methods assume locks are held by private methods. - - /// Performs bind. Must be called with locks held. - int bind_i (const EXT_ID &ext_id, - const INT_ID &int_id); - - /// Performs bind. Must be called with locks held. - int bind_i (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_Hash_Multi_Map_Entry *&entry); - - /// Performs bind. Must be called with locks held. - int bind_i (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set); - - /// Performs bind. Must be called with locks held. - int bind_i (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - ACE_Hash_Multi_Map_Entry *&entry); - - /// Performs trybind. Must be called with locks held. - int trybind_i (const EXT_ID &ext_id, - ACE_Unbounded_Set &int_id_set); - - /// Performs trybind. Must be called with locks held. - int trybind_i (const EXT_ID &ext_id, - ACE_Unbounded_Set &int_id_set, - ACE_Hash_Multi_Map_Entry *&entry); - - /// Performs rebind. Must be called with locks held. - int rebind_i (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set); - - /// Performs rebind. Must be called with locks held. - int rebind_i (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - ACE_Hash_Multi_Map_Entry *&entry); - - /// Performs rebind. Must be called with locks held. - int rebind_i (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - ACE_Unbounded_Set &old_int_id); - - /// Performs rebind. Must be called with locks held. - int rebind_i (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - ACE_Unbounded_Set &old_int_id_set, - ACE_Hash_Multi_Map_Entry *&entry); - - /// Performs rebind. Must be called with locks held. - int rebind_i (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - EXT_ID &old_ext_id, - ACE_Unbounded_Set &old_int_id_set); - - /// Performs rebind. Must be called with locks held. - int rebind_i (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - EXT_ID &old_ext_id, - ACE_Unbounded_Set &old_int_id_set, - ACE_Hash_Multi_Map_Entry *&entry); - - /// Performs a find of @a int_id_set using @a ext_id as the key. Must be - /// called with locks held. - int find_i (const EXT_ID &ext_id, - ACE_Unbounded_Set &int_id_set); - - /// Performs a find of @a ext_id and @a int_id. Must be - /// called with locks held. - int find_i (const EXT_ID &ext_id, - const INT_ID &int_id); - - /// Performs a find using @a ext_id as the key. Must be called with - /// locks held. - int find_i (const EXT_ID &ext_id); - - /// Performs a find using @a ext_id as the key. Must be called with - /// locks held. - int find_i (const EXT_ID &ext_id, - ACE_Hash_Multi_Map_Entry *&entry); - - /// Performs unbind. Must be called with locks held. - int unbind_i (const EXT_ID &ext_id, - ACE_Unbounded_Set &int_id_set); - - /// Performs unbind. Must be called with locks held. - int unbind_i (const EXT_ID &ext_id, - const INT_ID &int_id); - - /// Performs unbind. Must be called with locks held. - int unbind_i (const EXT_ID &ext_id); - - /// Performs unbind. Must be called with locks held. - int unbind_i (ACE_Hash_Multi_Map_Entry *entry); - - /** - * Resize the map. Must be called with locks held. - * @note This method should never be called more than once or else all the - * hashing will get screwed up as the size will change. - */ - int create_buckets (size_t size); - - /// Close down a Map_Manager. Must be called with - /// locks held. - int close_i (void); - - /// Removes all the entries in Map_Manager. Must be called with - /// locks held. - int unbind_all_i (void); - - /// Pointer to a memory allocator used for table_, so it should - /// supply size*sizeof (@c ACE_Hash_Multi_Map_Entry<@c EXT_ID, @c INT_ID>), - ACE_Allocator *table_allocator_; - - /// Addidtional allocator for entries, so it should be able to - /// allocate 'size' / chunks of sizeof - /// (@c ACE_Hash_Multi_Map_Entry<@c EXT_ID, @c INT_ID>) bytes each. - ACE_Allocator *entry_allocator_; - - /// Synchronization variable for the MT_SAFE - /// @c ACE_Hash_Multi_Map_Manager. - ACE_LOCK lock_; - - /// Function object used for hashing keys. - HASH_KEY hash_key_; - - /// Function object used for comparing keys. - COMPARE_KEYS compare_keys_; - -protected: - /// Returns the @c ACE_Hash_Multi_Map_Entry object that corresponds to - /// @a ext_id. - int shared_find (const EXT_ID &ext_id, - ACE_Hash_Multi_Map_Entry *&entry, - size_t &loc); - - /// Accessor of the underlying table - ACE_Hash_Multi_Map_Entry *table (void); - - /// Accessor of the current size attribute - size_t cur_size (void) const; - -private: - /** - * Array of the pointers to @c ACE_Hash_Multi_Map_Entry objects, each of - * which points to an @c ACE_Hash_Multi_Map_Entry that serves as the - * beginning of a linked list of @c EXT_ID that hash to that bucket. - */ - ACE_Hash_Multi_Map_Entry *table_; - - /// Total size of the hash table. - size_t total_size_; - - /// Current number of entries in the table - /// @note That this can be larger than total_size_ due to the - /// bucket chaining). - size_t cur_size_; - - // = Disallow these operations. - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Hash_Multi_Map_Manager &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Hash_Multi_Map_Manager (const ACE_Hash_Multi_Map_Manager &)) -}; - -/** - * @class ACE_Hash_Multi_Map_Iterator_Base - * - * @brief Base iterator for the @c ACE_Hash_Multi_Map_Manager - * - * This class factors out common code from its templatized - * subclasses. - */ -template -class ACE_Hash_Multi_Map_Iterator_Base -{ -public: - // = Initialization method. - /// Contructor. If @a head != 0, the iterator constructed is positioned - /// at the head of the map, it is positioned at the end otherwise. - ACE_Hash_Multi_Map_Iterator_Base (ACE_Hash_Multi_Map_Manager &mm, - int head); - - // = ITERATION methods. - - /// Pass back the @a next_entry that hasn't been seen in the Set. - /// Returns 0 when all items have been seen, else 1. - int next (ACE_Hash_Multi_Map_Entry *&next_entry) const; - - /// Returns 1 when all items have been seen, else 0. - int done (void) const; - - /// Returns a reference to the interal element this object is pointing to. - ACE_Hash_Multi_Map_Entry& operator* (void) const; - - /// Returns a pointer to the interal element this object is pointing to. - ACE_Hash_Multi_Map_Entry* operator-> (void) const; - - /// Returns reference the @c Hash_Multi_Map_Manager that is being iterated - /// over. - ACE_Hash_Multi_Map_Manager& map (void); - - /// Check if two iterators point to the same position - bool operator== (const ACE_Hash_Multi_Map_Iterator_Base &) const; - bool operator!= (const ACE_Hash_Multi_Map_Iterator_Base &) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Move forward by one element in the set. Returns 0 when there's - /// no more item in the set after the current items, else 1. - int forward_i (void); - - /// Move backward by one element in the set. Returns 0 when there's - /// no more item in the set before the current item, else 1. - int reverse_i (void); - - /// Dump the state of an object. - void dump_i (void) const; - - /// Map we are iterating over. - ACE_Hash_Multi_Map_Manager *map_man_; - - /// Keeps track of how far we've advanced in the table. - ssize_t index_; - - /// Keeps track of how far we've advanced in a linked list in each - /// table slot. - ACE_Hash_Multi_Map_Entry *next_; -}; - -/** - * @class ACE_Hash_Multi_Map_Const_Iterator_Base - * - * @brief Base const iterator for the @c ACE_Hash_Multi_Map_Manager - * - * This class factors out common code from its templatized - * subclasses. - */ -template -class ACE_Hash_Multi_Map_Const_Iterator_Base -{ -public: - // = Initialization method. - /// Contructor. If @a head != 0, the iterator constructed is positioned - /// at the head of the map, it is positioned at the end otherwise. - ACE_Hash_Multi_Map_Const_Iterator_Base (const ACE_Hash_Multi_Map_Manager &mm, - int head); - - // = ITERATION methods. - - /// Pass back the @a next_entry that hasn't been seen in the Set. - /// Returns 0 when all items have been seen, else 1. - int next (ACE_Hash_Multi_Map_Entry *&next_entry) const; - - /// Returns 1 when all items have been seen, else 0. - int done (void) const; - - /// Returns a reference to the interal element this object is pointing to. - ACE_Hash_Multi_Map_Entry& operator* (void) const; - - /// Returns a pointer to the interal element this object is pointing to. - ACE_Hash_Multi_Map_Entry* operator-> (void) const; - - /// Returns reference the @c Hash_Multi_Map_Manager that is being iterated - /// over. - const ACE_Hash_Multi_Map_Manager& map (void); - - /// Check if two iterators point to the same position - bool operator== (const ACE_Hash_Multi_Map_Const_Iterator_Base &) const; - bool operator!= (const ACE_Hash_Multi_Map_Const_Iterator_Base &) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Move forward by one element in the set. Returns 0 when there's - /// no more item in the set after the current items, else 1. - int forward_i (void); - - /// Move backward by one element in the set. Returns 0 when there's - /// no more item in the set before the current item, else 1. - int reverse_i (void); - - /// Dump the state of an object. - void dump_i (void) const; - - /// Map we are iterating over. - const ACE_Hash_Multi_Map_Manager *map_man_; - - /// Keeps track of how far we've advanced in the table. - ssize_t index_; - - /// Keeps track of how far we've advanced in a linked list in each - /// table slot. - ACE_Hash_Multi_Map_Entry *next_; -}; - -/** - * @class ACE_Hash_Multi_Map_Iterator - * - * @brief Forward iterator for the @c ACE_Hash_Multi_Map_Manager. - * - * This class does not perform any internal locking of the - * @c ACE_Hash_Multi_Map_Manager it is iterating upon since locking is - * inherently inefficient and/or error-prone within an STL-style - * iterator. If you require locking, you can explicitly use an - * @c ACE_GUARD or @c ACE_READ_GUARD on the @c ACE_Hash_Multi_Map_Manager's - * internal lock, which is accessible via its @c mutex method. - */ -template -class ACE_Hash_Multi_Map_Iterator : public ACE_Hash_Multi_Map_Iterator_Base -{ -public: - // = Initialization method. - ACE_Hash_Multi_Map_Iterator (ACE_Hash_Multi_Map_Manager &mm, - int tail = 0); - - // = Iteration methods. - /// Move forward by one element in the set. Returns 0 when all the - /// items in the set have been seen, else 1. - int advance (void); - - /// Dump the state of an object. - void dump (void) const; - - // = STL styled iteration, compare, and reference functions. - - /// Prefix advance. - ACE_Hash_Multi_Map_Iterator &operator++ (void); - - /// Postfix advance. - ACE_Hash_Multi_Map_Iterator operator++ (int); - - /// Prefix reverse. - ACE_Hash_Multi_Map_Iterator &operator-- (void); - - /// Postfix reverse. - ACE_Hash_Multi_Map_Iterator operator-- (int); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -/** - * @class ACE_Hash_Multi_Map_Const_Iterator - * - * @brief Const forward iterator for the @c ACE_Hash_Multi_Map_Manager. - * - * This class does not perform any internal locking of the - * @c ACE_Hash_Multi_Map_Manager it is iterating upon since locking is - * inherently inefficient and/or error-prone within an STL-style - * iterator. If you require locking, you can explicitly use an - * @c ACE_GUARD or @c ACE_READ_GUARD on the @c ACE_Hash_Multi_Map_Manager's - * internal lock, which is accessible via its @c mutex() method. - */ -template -class ACE_Hash_Multi_Map_Const_Iterator : public ACE_Hash_Multi_Map_Const_Iterator_Base -{ -public: - // = Initialization method. - ACE_Hash_Multi_Map_Const_Iterator (const ACE_Hash_Multi_Map_Manager &mm, - int tail = 0); - - // = Iteration methods. - /// Move forward by one element in the set. Returns 0 when all the - /// items in the set have been seen, else 1. - int advance (void); - - /// Dump the state of an object. - void dump (void) const; - - // = STL styled iteration, compare, and reference functions. - - /// Prefix advance. - ACE_Hash_Multi_Map_Const_Iterator &operator++ (void); - - /// Postfix advance. - ACE_Hash_Multi_Map_Const_Iterator operator++ (int); - - /// Prefix reverse. - ACE_Hash_Multi_Map_Const_Iterator &operator-- (void); - - /// Postfix reverse. - ACE_Hash_Multi_Map_Const_Iterator operator-- (int); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -/** - * @class ACE_Hash_Multi_Map_Bucket_Iterator - * - * @brief Forward iterator for the @c ACE_Hash_Multi_Map_Manager which - * only traverses a particular bucket. The particular bucket is - * specified by the @c EXT_ID parameter specified in the constructor. - * - * This class does not perform any internal locking of the - * @c ACE_Hash_Multi_Map_Manager it is iterating upon since locking is - * inherently inefficient and/or error-prone within an STL-style - * iterator. If you require locking, you can explicitly use an - * @c ACE_GUARD or @c ACE_READ_GUARD on the @c ACE_Hash_Multi_Map_Manager's - * internal lock, which is accessible via its @c mutex method. - * - * Note that a creation method for this new iterator cannot be added - * to the hash map, since this would require adding explicit template - * instantiations for bucket iterators on platforms with broken - * templates. - */ -template -class ACE_Hash_Multi_Map_Bucket_Iterator -{ -public: - // = Initialization method. - ACE_Hash_Multi_Map_Bucket_Iterator (ACE_Hash_Multi_Map_Manager &mm, - const EXT_ID &ext_id, - int tail = 0); - - // = STL styled iteration, compare, and reference functions. - - /// Prefix advance. - ACE_Hash_Multi_Map_Bucket_Iterator &operator++ (void); - - /// Postfix advance. - ACE_Hash_Multi_Map_Bucket_Iterator operator++ (int); - - /// Prefix reverse. - ACE_Hash_Multi_Map_Bucket_Iterator &operator-- (void); - - /// Postfix reverse. - ACE_Hash_Multi_Map_Bucket_Iterator operator-- (int); - - /// Returns a reference to the interal element this object is pointing to. - ACE_Hash_Multi_Map_Entry& operator* (void) const; - - /// Returns a pointer to the interal element this object is pointing to. - ACE_Hash_Multi_Map_Entry* operator-> (void) const; - - /// Returns reference the Hash_Multi_Map_Manager that is being iterated - /// over. - ACE_Hash_Multi_Map_Manager& map (void); - - /// Check if two iterators point to the same position - bool operator== (const ACE_Hash_Multi_Map_Bucket_Iterator &) const; - bool operator!= (const ACE_Hash_Multi_Map_Bucket_Iterator &) const; - -protected: - /// Move forward by one element in the set. Returns 0 when there's - /// no more item in the set after the current items, else 1. - int forward_i (void); - - /// Move backward by one element in the set. Returns 0 when there's - /// no more item in the set before the current item, else 1. - int reverse_i (void); - - /// Map we are iterating over. - ACE_Hash_Multi_Map_Manager *map_man_; - - /// Keeps track of how far we've advanced in the table. - ssize_t index_; - - /// Keeps track of how far we've advanced in a linked list in each - /// table slot. - ACE_Hash_Multi_Map_Entry *next_; -}; - -/** - * @class ACE_Hash_Multi_Map_Reverse_Iterator - * - * @brief Reverse iterator for the @c ACE_Hash_Multi_Map_Manager. - * - * This class does not perform any internal locking of the - * @c ACE_Hash_Multi_Map_Manager it is iterating upon since locking is - * inherently inefficient and/or error-prone within an STL-style - * iterator. If you require locking, you can explicitly use an - * @c ACE_GUARD or @c ACE_READ_GUARD on the @c ACE_Hash_Multi_Map_Manager's - * internal lock, which is accessible via its @c mutex method. - */ -template -class ACE_Hash_Multi_Map_Reverse_Iterator : public ACE_Hash_Multi_Map_Iterator_Base -{ -public: - // = Initialization method. - ACE_Hash_Multi_Map_Reverse_Iterator (ACE_Hash_Multi_Map_Manager &mm, - int head = 0); - - // = Iteration methods. - /// Move forward by one element in the set. Returns 0 when all the - /// items in the set have been seen, else 1. - int advance (void); - - /// Dump the state of an object. - void dump (void) const; - - // = STL styled iteration, compare, and reference functions. - - /// Prefix reverse. - ACE_Hash_Multi_Map_Reverse_Iterator &operator++ (void); - - /// Postfix reverse. - ACE_Hash_Multi_Map_Reverse_Iterator operator++ (int); - - /// Prefix advance. - ACE_Hash_Multi_Map_Reverse_Iterator &operator-- (void); - - /// Postfix advance. - ACE_Hash_Multi_Map_Reverse_Iterator operator-- (int); - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -# include "ace/Hash_Multi_Map_Manager_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Hash_Multi_Map_Manager_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Hash_Multi_Map_Manager_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_HASH_MULTI_MAP_MANAGER_T_H */ diff --git a/dep/acelite/ace/Hash_Multi_Map_Manager_T.inl b/dep/acelite/ace/Hash_Multi_Map_Manager_T.inl deleted file mode 100644 index 5bf8371ec99..00000000000 --- a/dep/acelite/ace/Hash_Multi_Map_Manager_T.inl +++ /dev/null @@ -1,994 +0,0 @@ -// -*- C++ -*- -// -// $Id: Hash_Multi_Map_Manager_T.inl 94520 2011-09-22 14:55:20Z johnnyw $ - -#include "ace/Guard_T.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE -ACE_Hash_Multi_Map_Manager::ACE_Hash_Multi_Map_Manager (size_t size, - ACE_Allocator *table_alloc, - ACE_Allocator *entry_alloc) - : table_allocator_ (table_alloc), - entry_allocator_ (entry_alloc), - table_ (0), - total_size_ (0), - cur_size_ (0) -{ - if (this->open (size, table_alloc, entry_alloc) == -1) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_Hash_Multi_Map_Manager\n"))); -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Manager::ACE_Hash_Multi_Map_Manager (ACE_Allocator *table_alloc, - ACE_Allocator *entry_alloc) - : table_allocator_ (table_alloc), - entry_allocator_ (entry_alloc), - table_ (0), - total_size_ (0), - cur_size_ (0) -{ - if (this->open (ACE_DEFAULT_MAP_SIZE, table_alloc, entry_alloc) == -1) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_Hash_Multi_Map_Manager\n"))); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::close (void) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->close_i (); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::unbind_all (void) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->unbind_all_i (); -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Manager::~ACE_Hash_Multi_Map_Manager (void) -{ - this->close (); -} - -template ACE_INLINE size_t -ACE_Hash_Multi_Map_Manager::current_size (void) const -{ - return this->cur_size_; -} - -template ACE_INLINE size_t -ACE_Hash_Multi_Map_Manager::total_size (void) const -{ - return this->total_size_; -} - -template ACE_INLINE ACE_LOCK & -ACE_Hash_Multi_Map_Manager::mutex (void) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Manager::mutex"); - return this->lock_; -} - -template ACE_INLINE u_long -ACE_Hash_Multi_Map_Manager::hash (const EXT_ID &ext_id) -{ - return this->hash_key_ (ext_id); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::equal (const EXT_ID &id1, - const EXT_ID &id2) -{ - return this->compare_keys_ (id1, id2); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::bind_i (const EXT_ID &ext_id, - const INT_ID &int_id) -{ - ACE_Hash_Multi_Map_Entry *temp = 0; - - return this->bind_i (ext_id, int_id, temp); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::bind_i (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set) -{ - ACE_Hash_Multi_Map_Entry *temp; - - return this->bind_i (ext_id, int_id_set, temp); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::bind (const EXT_ID &ext_id, - const INT_ID &int_id) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->bind_i (ext_id, int_id); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::bind (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_Hash_Multi_Map_Entry *&entry) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->bind_i (ext_id, int_id, entry); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::bind (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->bind_i (ext_id, int_id_set); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::bind (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - ACE_Hash_Multi_Map_Entry *&entry) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->bind_i (ext_id, int_id_set, entry); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::trybind_i (const EXT_ID &ext_id, - ACE_Unbounded_Set &int_id_set) -{ - ACE_Hash_Multi_Map_Entry *temp; - - int result = this->trybind_i (ext_id, int_id_set, temp); - if (result == 1) - int_id_set = temp->int_id_set_; - return result; -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::trybind (const EXT_ID &ext_id, - ACE_Unbounded_Set &int_id_set) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->trybind_i (ext_id, int_id_set); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::trybind (const EXT_ID &ext_id, - ACE_Unbounded_Set &int_id_set, - ACE_Hash_Multi_Map_Entry *&entry) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->trybind_i (ext_id, int_id_set, entry); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::unbind_i (const EXT_ID &ext_id) -{ - ACE_Unbounded_Set int_id_set; - - return this->unbind_i (ext_id, int_id_set); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::unbind (const EXT_ID &ext_id, - ACE_Unbounded_Set &int_id_set) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->unbind_i (ext_id, int_id_set); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::unbind (const EXT_ID &ext_id, - const INT_ID &int_id) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->unbind_i (ext_id, int_id); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::unbind (const EXT_ID &ext_id) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->unbind_i (ext_id) == -1 ? -1 : 0; -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::unbind (ACE_Hash_Multi_Map_Entry *entry) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->unbind_i (entry) == -1 ? -1 : 0; -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::find_i (const EXT_ID &ext_id, - ACE_Unbounded_Set &int_id_set) -{ - ACE_Hash_Multi_Map_Entry *entry; - - size_t dummy; - if (this->shared_find (ext_id, entry, dummy) == -1) - return -1; - else - { - int_id_set = entry->int_id_set_; - return 0; - } -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::find_i (const EXT_ID &ext_id, - const INT_ID &int_id) -{ - ACE_Hash_Multi_Map_Entry *entry; - - size_t dummy; - if (this->shared_find (ext_id, entry, dummy) == -1) - return -1; - else - { - if (0 == entry->int_id_set_.find (int_id)) - return 0; - else - return -1; - } -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::find_i (const EXT_ID &ext_id) -{ - ACE_Hash_Multi_Map_Entry *entry; - - size_t dummy; - return this->shared_find (ext_id, entry, dummy); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::find (const EXT_ID &ext_id, - ACE_Unbounded_Set &int_id_set) const -{ - ACE_Hash_Multi_Map_Manager *nc_this = - const_cast *> - (this); - - ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, nc_this->lock_, -1); - - return nc_this->find_i (ext_id, int_id_set); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::find (const EXT_ID &ext_id, - const INT_ID &int_id) const -{ - ACE_Hash_Multi_Map_Manager *nc_this = - const_cast *> - (this); - - ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, nc_this->lock_, -1); - - return nc_this->find_i (ext_id, int_id); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::find (const EXT_ID &ext_id) const -{ - ACE_Hash_Multi_Map_Manager *nc_this = - const_cast *> - (this); - - ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, nc_this->lock_, -1); - - return nc_this->find_i (ext_id); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::find_i (const EXT_ID &ext_id, - ACE_Hash_Multi_Map_Entry *&entry) -{ - size_t dummy; - return this->shared_find (ext_id, entry, dummy); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::find (const EXT_ID &ext_id, - ACE_Hash_Multi_Map_Entry *&entry) const -{ - ACE_Hash_Multi_Map_Manager *nc_this = - const_cast *> - (this); - - ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, nc_this->lock_, -1); - - return nc_this->find_i (ext_id, entry); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::rebind_i (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set) -{ - ACE_Hash_Multi_Map_Entry *node; - - return this->rebind_i (ext_id, - int_id_set, - node); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::rebind_i (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - ACE_Unbounded_Set &old_int_id_set) -{ - ACE_Hash_Multi_Map_Entry *node; - - return this->rebind_i (ext_id, - int_id_set, - old_int_id_set, - node); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::rebind_i (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - EXT_ID &old_ext_id, - ACE_Unbounded_Set &old_int_id_set) -{ - ACE_Hash_Multi_Map_Entry *node; - - return this->rebind_i (ext_id, - int_id_set, - old_ext_id, - old_int_id_set, - node); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::rebind (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->rebind_i (ext_id, int_id_set); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::rebind (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - ACE_Hash_Multi_Map_Entry *&entry) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->rebind_i (ext_id, int_id_set, entry); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::rebind (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - ACE_Unbounded_Set &old_int_id_set) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->rebind_i (ext_id, int_id_set, old_int_id_set); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::rebind (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - ACE_Unbounded_Set &old_int_id_set, - ACE_Hash_Multi_Map_Entry *&entry) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->rebind_i (ext_id, int_id_set, old_int_id_set, entry); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::rebind (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - EXT_ID &old_ext_id, - ACE_Unbounded_Set &old_int_id_set) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->rebind_i (ext_id, int_id_set, old_ext_id, old_int_id_set); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Manager::rebind (const EXT_ID &ext_id, - const ACE_Unbounded_Set &int_id_set, - EXT_ID &old_ext_id, - ACE_Unbounded_Set &old_int_id_set, - ACE_Hash_Multi_Map_Entry *&entry) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->rebind_i (ext_id, int_id_set, old_ext_id, old_int_id_set, entry); -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Iterator -ACE_Hash_Multi_Map_Manager::begin (void) -{ - return ACE_Hash_Multi_Map_Iterator (*this); -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Iterator -ACE_Hash_Multi_Map_Manager::end (void) -{ - return ACE_Hash_Multi_Map_Iterator (*this, 1); -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Reverse_Iterator -ACE_Hash_Multi_Map_Manager::rbegin (void) -{ - return ACE_Hash_Multi_Map_Reverse_Iterator (*this); -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Reverse_Iterator -ACE_Hash_Multi_Map_Manager::rend (void) -{ - return ACE_Hash_Multi_Map_Reverse_Iterator (*this, 1); -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Entry * -ACE_Hash_Multi_Map_Manager::table (void) -{ - return this->table_; -} - -template ACE_INLINE -size_t -ACE_Hash_Multi_Map_Manager::cur_size (void) const -{ - return this->cur_size_; -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Iterator_Base::ACE_Hash_Multi_Map_Iterator_Base (ACE_Hash_Multi_Map_Manager &mm, - int head) - : map_man_ (&mm), - index_ (head != 0 ? -1 : (ssize_t) mm.total_size_), - next_ (0) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Iterator_Base::ACE_Hash_Multi_Map_Iterator_Base"); - - if (mm.table_ != 0) - this->next_ = &mm.table_[head != 0 ? 0 : mm.total_size_ - 1]; -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Iterator_Base::next (ACE_Hash_Multi_Map_Entry *&entry) const -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Iterator_Base::next"); - - if (this->map_man_->table_ != 0 - && this->index_ < static_cast (this->map_man_->total_size_) - && this->index_ >= 0 - && this->next_ != &this->map_man_->table_[this->index_]) - { - entry = this->next_; - return 1; - } - else - return 0; -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Iterator_Base::done (void) const -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Iterator_Base::done"); - - return this->map_man_->table_ == 0 - || this->index_ >= static_cast (this->map_man_->total_size_) - || this->index_ < 0; -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Entry & -ACE_Hash_Multi_Map_Iterator_Base::operator* (void) const -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Iterator_Base::operator*"); - ACE_Hash_Multi_Map_Entry *retv = 0; - - int result = this->next (retv); - - ACE_UNUSED_ARG (result); - ACE_ASSERT (result != 0); - - return *retv; -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Entry * -ACE_Hash_Multi_Map_Iterator_Base::operator-> (void) const -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Iterator_Base::operator->"); - ACE_Hash_Multi_Map_Entry *retv = 0; - - int result = this->next (retv); - - ACE_UNUSED_ARG (result); - ACE_ASSERT (result != 0); - - return retv; -} - -// Returns the reference to the Hash_Multi_Map_manager_ex that is being -// iterated over. -template ACE_INLINE -ACE_Hash_Multi_Map_Manager& -ACE_Hash_Multi_Map_Iterator_Base::map (void) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Iterator_Base::map"); - return *this->map_man_; -} - -template ACE_INLINE bool -ACE_Hash_Multi_Map_Iterator_Base::operator== (const ACE_Hash_Multi_Map_Iterator_Base &rhs) const -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Iterator_Base::operator=="); - return this->map_man_ == rhs.map_man_ - && this->index_ == rhs.index_ - && this->next_ == rhs.next_; -} - -template ACE_INLINE bool -ACE_Hash_Multi_Map_Iterator_Base::operator!= (const ACE_Hash_Multi_Map_Iterator_Base &rhs) const -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Iterator_Base::operator!="); - return this->next_ != rhs.next_ - || this->index_ != rhs.index_ - || this->map_man_ != rhs.map_man_; -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Const_Iterator_Base::ACE_Hash_Multi_Map_Const_Iterator_Base (const ACE_Hash_Multi_Map_Manager &mm, - int head) - : map_man_ (&mm), - index_ (head != 0 ? -1 : (ssize_t) mm.total_size_), - next_ (0) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator_Base::ACE_Hash_Multi_Map_Const_Iterator_Base"); - - if (mm.table_ != 0) - this->next_ = &mm.table_[head != 0 ? 0 : mm.total_size_ - 1]; -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Const_Iterator_Base::next (ACE_Hash_Multi_Map_Entry *&entry) const -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator_Base::next"); - - if (this->map_man_->table_ != 0 - && this->index_ < (ssize_t) this->map_man_->total_size_ - && this->index_ >= 0 - && this->next_ != &this->map_man_->table_[this->index_]) - { - entry = this->next_; - return 1; - } - else - return 0; -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Const_Iterator_Base::done (void) const -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator_Base::done"); - - return this->map_man_->table_ == 0 - || this->index_ >= (ssize_t) this->map_man_->total_size_ - || this->index_ < 0; -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Entry & -ACE_Hash_Multi_Map_Const_Iterator_Base::operator* (void) const -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator_Base::operator*"); - ACE_Hash_Multi_Map_Entry *retv = 0; - - int result = this->next (retv); - - ACE_UNUSED_ARG (result); - ACE_ASSERT (result != 0); - - return *retv; -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Entry * -ACE_Hash_Multi_Map_Const_Iterator_Base::operator-> (void) const -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator_Base::operator->"); - ACE_Hash_Multi_Map_Entry *retv = 0; - - int result = this->next (retv); - - ACE_UNUSED_ARG (result); - ACE_ASSERT (result != 0); - - return retv; -} - -// Returns the reference to the Hash_Multi_Map_manager_ex that is being -// iterated over. -template ACE_INLINE -const ACE_Hash_Multi_Map_Manager& -ACE_Hash_Multi_Map_Const_Iterator_Base::map (void) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator_Base::map"); - return *this->map_man_; -} - -template ACE_INLINE bool -ACE_Hash_Multi_Map_Const_Iterator_Base::operator== (const ACE_Hash_Multi_Map_Const_Iterator_Base &rhs) const -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator_Base::operator=="); - return this->map_man_ == rhs.map_man_ - && this->index_ == rhs.index_ - && this->next_ == rhs.next_; -} - -template ACE_INLINE bool -ACE_Hash_Multi_Map_Const_Iterator_Base::operator!= (const ACE_Hash_Multi_Map_Const_Iterator_Base &rhs) const -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator_Base::operator!="); - return this->next_ != rhs.next_ - || this->index_ != rhs.index_ - || this->map_man_ != rhs.map_man_; -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Multi_Map_Iterator) - -template ACE_INLINE void -ACE_Hash_Multi_Map_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Hash_Multi_Map_Iterator::dump"); - - this->dump_i (); -#endif /* ACE_HAS_DUMP */ -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Iterator::ACE_Hash_Multi_Map_Iterator (ACE_Hash_Multi_Map_Manager &mm, - int tail) - : ACE_Hash_Multi_Map_Iterator_Base (mm, - tail == 0 ? 1 : 0) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Iterator::ACE_Hash_Multi_Map_Iterator"); - if (tail == 0) - this->forward_i (); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Iterator::advance (void) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Iterator::advance"); - return this->forward_i (); -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Iterator & -ACE_Hash_Multi_Map_Iterator::operator++ (void) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Iterator::operator++ (void)"); - - this->forward_i (); - return *this; -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Iterator -ACE_Hash_Multi_Map_Iterator::operator++ (int) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Iterator::operator++ (int)"); - - ACE_Hash_Multi_Map_Iterator retv (*this); - ++*this; - return retv; -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Iterator & -ACE_Hash_Multi_Map_Iterator::operator-- (void) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Iterator::operator-- (void)"); - - this->reverse_i (); - return *this; -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Iterator -ACE_Hash_Multi_Map_Iterator::operator-- (int) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Iterator::operator-- (int)"); - - ACE_Hash_Multi_Map_Iterator retv (*this); - --*this; - return retv; -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Multi_Map_Const_Iterator) - -template ACE_INLINE void -ACE_Hash_Multi_Map_Const_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator::dump"); - - this->dump_i (); -#endif /* ACE_HAS_DUMP */ -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Const_Iterator::ACE_Hash_Multi_Map_Const_Iterator (const ACE_Hash_Multi_Map_Manager &mm, - int tail) - : ACE_Hash_Multi_Map_Const_Iterator_Base (mm, - tail == 0 ? 1 : 0) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator::ACE_Hash_Multi_Map_Const_Iterator"); - if (tail == 0) - this->forward_i (); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Const_Iterator::advance (void) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator::advance"); - return this->forward_i (); -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Const_Iterator & -ACE_Hash_Multi_Map_Const_Iterator::operator++ (void) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator::operator++ (void)"); - - this->forward_i (); - return *this; -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Const_Iterator -ACE_Hash_Multi_Map_Const_Iterator::operator++ (int) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator::operator++ (int)"); - - ACE_Hash_Multi_Map_Const_Iterator retv (*this); - ++*this; - return retv; -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Const_Iterator & -ACE_Hash_Multi_Map_Const_Iterator::operator-- (void) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator::operator-- (void)"); - - this->reverse_i (); - return *this; -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Const_Iterator -ACE_Hash_Multi_Map_Const_Iterator::operator-- (int) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Const_Iterator::operator-- (int)"); - - ACE_Hash_Multi_Map_Const_Iterator retv (*this); - --*this; - return retv; -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Bucket_Iterator::ACE_Hash_Multi_Map_Bucket_Iterator (ACE_Hash_Multi_Map_Manager &mm, - const EXT_ID &ext_id, - int tail) - : map_man_ (&mm) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Bucket_Iterator::ACE_Hash_Multi_Map_Bucket_Iterator"); - - this->index_ = this->map_man_->hash (ext_id) % this->map_man_->total_size_; - this->next_ = &this->map_man_->table_[this->index_]; - - if (tail == 0) - this->forward_i (); -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Bucket_Iterator & -ACE_Hash_Multi_Map_Bucket_Iterator::operator++ (void) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Bucket_Iterator::operator++ (void)"); - - this->forward_i (); - return *this; -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Bucket_Iterator -ACE_Hash_Multi_Map_Bucket_Iterator::operator++ (int) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Bucket_Iterator::operator++ (int)"); - - ACE_Hash_Multi_Map_Bucket_Iterator retv (*this); - ++*this; - return retv; -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Bucket_Iterator & -ACE_Hash_Multi_Map_Bucket_Iterator::operator-- (void) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Bucket_Iterator::operator-- (void)"); - - this->reverse_i (); - return *this; -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Bucket_Iterator -ACE_Hash_Multi_Map_Bucket_Iterator::operator-- (int) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Bucket_Iterator::operator-- (int)"); - - ACE_Hash_Multi_Map_Bucket_Iterator retv (*this); - --*this; - return retv; -} - -template int -ACE_Hash_Multi_Map_Bucket_Iterator::forward_i (void) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Bucket_Iterator::forward_i"); - - this->next_ = this->next_->next_; - return this->next_ != &this->map_man_->table_[this->index_]; -} - -template int -ACE_Hash_Multi_Map_Bucket_Iterator::reverse_i (void) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Bucket_Iterator::reverse_i"); - - this->next_ = this->next_->prev_; - return this->next_ != &this->map_man_->table_[this->index_]; -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Entry & -ACE_Hash_Multi_Map_Bucket_Iterator::operator* (void) const -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Bucket_Iterator::operator*"); - - return *this->next_; -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Entry * -ACE_Hash_Multi_Map_Bucket_Iterator::operator-> (void) const -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Bucket_Iterator::operator->"); - - return this->next_; -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Manager & -ACE_Hash_Multi_Map_Bucket_Iterator::map (void) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Bucket_Iterator::map"); - return *this->map_man_; -} - -template ACE_INLINE bool -ACE_Hash_Multi_Map_Bucket_Iterator::operator== (const ACE_Hash_Multi_Map_Bucket_Iterator &rhs) const -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Bucket_Iterator::operator=="); - return this->map_man_ == rhs.map_man_ - && this->index_ == rhs.index_ - && this->next_ == rhs.next_; -} - -template ACE_INLINE bool -ACE_Hash_Multi_Map_Bucket_Iterator::operator!= (const ACE_Hash_Multi_Map_Bucket_Iterator &rhs) const -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Bucket_Iterator::operator!="); - return this->next_ != rhs.next_ - || this->index_ != rhs.index_ - || this->map_man_ != rhs.map_man_; -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Multi_Map_Reverse_Iterator) - -template ACE_INLINE void -ACE_Hash_Multi_Map_Reverse_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Hash_Multi_Map_Reverse_Iterator::dump"); - - this->dump_i (); -#endif /* ACE_HAS_DUMP */ -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Reverse_Iterator::ACE_Hash_Multi_Map_Reverse_Iterator (ACE_Hash_Multi_Map_Manager &mm, int head) - : ACE_Hash_Multi_Map_Iterator_Base (mm, head) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Reverse_Iterator::ACE_Hash_Multi_Map_Reverse_Iterator"); - if (head == 0) - this->reverse_i (); -} - -template ACE_INLINE int -ACE_Hash_Multi_Map_Reverse_Iterator::advance (void) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Reverse_Iterator::advance"); - return this->reverse_i (); -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Reverse_Iterator & -ACE_Hash_Multi_Map_Reverse_Iterator::operator++ (void) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Reverse_Iterator::operator++ (void)"); - - this->reverse_i (); - return *this; -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Reverse_Iterator -ACE_Hash_Multi_Map_Reverse_Iterator::operator++ (int) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Reverse_Iterator::operator++ (int)"); - - ACE_Hash_Multi_Map_Reverse_Iterator retv (*this); - ++*this; - return retv; -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Reverse_Iterator & -ACE_Hash_Multi_Map_Reverse_Iterator::operator-- (void) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Reverse_Iterator::operator-- (void)"); - - this->forward_i (); - return *this; -} - -template ACE_INLINE -ACE_Hash_Multi_Map_Reverse_Iterator -ACE_Hash_Multi_Map_Reverse_Iterator::operator-- (int) -{ - ACE_TRACE ("ACE_Hash_Multi_Map_Reverse_Iterator::operator-- (int)"); - - ACE_Hash_Multi_Map_Reverse_Iterator retv (*this); - --*this; - return retv; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Hashable.cpp b/dep/acelite/ace/Hashable.cpp deleted file mode 100644 index 24b2407242f..00000000000 --- a/dep/acelite/ace/Hashable.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//$Id: Hashable.cpp 93736 2011-04-05 12:38:35Z johnnyw $ - -#include "ace/Hashable.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Hashable.inl" -#endif /* __ACE_INLINE __ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Hashable::~ACE_Hashable (void) -{ -} - -unsigned long -ACE_Hashable::hash (void) const -{ - // In doing the check below, we take chance of paying a performance - // price when the hash value is zero. But, that will (hopefully) - // happen far less often than a non-zero value, so this caching - // strategy should pay off, esp. if hash computation is expensive - // relative to the simple comparison. - - if (this->hash_value_ == 0) - this->hash_value_ = this->hash_i (); - - return this->hash_value_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Hashable.h b/dep/acelite/ace/Hashable.h deleted file mode 100644 index 83f26ffee19..00000000000 --- a/dep/acelite/ace/Hashable.h +++ /dev/null @@ -1,65 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Hashable.h - * - * $Id: Hashable.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Doug Schmidt - */ -//============================================================================= - -#ifndef ACE_HASHABLE_H -#define ACE_HASHABLE_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Hashable - * - * @brief ACE_Hashable - */ -class ACE_Export ACE_Hashable -{ -public: - - /// Destructor. - virtual ~ACE_Hashable (void); - - /// Computes and returns hash value. This "caches" the hash value to - /// improve performance. - virtual unsigned long hash (void) const; - -protected: - /// Protected constructor. - ACE_Hashable (void); - - /// This is the method that actually performs the non-cached hash - /// computation. - virtual unsigned long hash_i (void) const = 0; - -protected: - - /// Pre-computed hash-value. - mutable unsigned long hash_value_; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Hashable.inl" -#endif /* __ACE_INLINE __ */ - -#include /**/ "ace/post.h" - -#endif /*ACE_HASHABLE_H*/ diff --git a/dep/acelite/ace/Hashable.inl b/dep/acelite/ace/Hashable.inl deleted file mode 100644 index 1fb6956cfed..00000000000 --- a/dep/acelite/ace/Hashable.inl +++ /dev/null @@ -1,12 +0,0 @@ -// -*- C++ -*- -// $Id: Hashable.inl 93736 2011-04-05 12:38:35Z johnnyw $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Hashable::ACE_Hashable (void) - : hash_value_ (0) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/High_Res_Timer.cpp b/dep/acelite/ace/High_Res_Timer.cpp deleted file mode 100644 index 81f8415aaa9..00000000000 --- a/dep/acelite/ace/High_Res_Timer.cpp +++ /dev/null @@ -1,523 +0,0 @@ -// $Id: High_Res_Timer.cpp 95788 2012-05-24 07:59:51Z johnnyw $ - -// Be very carefull before changing the calculations inside -// ACE_High_Res_Timer. The precision matters and we are using integer -// calculations not floating point. Also look good at the emulated 64 -// bit int class (inside Basic_Types{h,i,cpp} before changing -// anything. It's operator/ only returns 32 bits not 64 bits, among -// other things. - -#include "ace/High_Res_Timer.h" - -#if !defined (__ACE_INLINE__) -#include "ace/High_Res_Timer.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Stats.h" -#include "ace/OS_NS_stdio.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_sys_time.h" -#include "ace/OS_NS_time.h" -#include "ace/OS_NS_unistd.h" -#include "ace/OS_NS_stdlib.h" -#include "ace/Truncate.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_High_Res_Timer) - -ACE_END_VERSIONED_NAMESPACE_DECL - -// For Intel platforms, a scale factor is required for -// ACE_OS::gethrtime. We'll still set this to one to prevent division -// by zero errors. -#if (defined (ACE_WIN32) || defined (ACE_HAS_POWERPC_TIMER) || \ - defined (ACE_HAS_PENTIUM) || defined (ACE_HAS_ALPHA_TIMER)) && \ - !defined (ACE_HAS_HI_RES_TIMER) - -# include "ace/Guard_T.h" -# include "ace/Recursive_Thread_Mutex.h" -# include "ace/Object_Manager.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/// Initialize the global_scale_factor_ to 1. The first -/// ACE_High_Res_Timer instance construction will override this -/// value. -/* static */ -ACE_High_Res_Timer::global_scale_factor_type ACE_High_Res_Timer::global_scale_factor_ = 1u; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#else /* ! (ACE_WIN32 || ACE_HAS_POWERPC_TIMER || \ - ACE_HAS_PENTIUM || ACE_HAS_ALPHA_TIMER) || - ACE_HAS_HI_RES_TIMER */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - - // A scale_factor of 1000 converts nanosecond ticks to microseconds. - // That is, on these platforms, 1 tick == 1 nanosecond. - /* static */ - ACE_UINT32 ACE_High_Res_Timer::global_scale_factor_ = 1000u; - -ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ! (ACE_WIN32 || ACE_HAS_POWERPC_TIMER || \ - ACE_HAS_PENTIUM || ACE_HAS_ALPHA_TIMER) || - ACE_HAS_HI_RES_TIMER */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/// This is used to tell if the global_scale_factor_ has been -/// set, and if high resolution timers are supported. -/* static */ -int ACE_High_Res_Timer::global_scale_factor_status_ = 0; - -#if defined (ACE_LINUX) -// Determine the apparent CPU clock speed from /proc/cpuinfo -ACE_UINT32 -ACE_High_Res_Timer::get_cpuinfo (void) -{ - ACE_UINT32 scale_factor = 1u; - - // Get the BogoMIPS from /proc/cpuinfo. It works fine on Alpha and - // Pentium Pro. For other CPUs, it will be necessary to interpret - // the BogoMips, as described in the BogoMips mini-HOWTO. Note that - // this code assumes an order to the /proc/cpuinfo contents. The - // BogoMips rating had better come after CPU type and model info. -#if !defined (__alpha__) - bool supported = false; -#endif /* __alpha__ */ - - FILE *cpuinfo = ACE_OS::fopen (ACE_TEXT ("/proc/cpuinfo"), - ACE_TEXT ("r")); - - if (cpuinfo != 0) - { - char buf[128]; - - // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nReading /proc/cpuinfo..."))); - - while (ACE_OS::fgets (buf, sizeof buf, cpuinfo)) - { -#if defined (__alpha__) - ACE_UINT32 whole; - ACE_UINT32 fractional; - if (::sscanf (buf, - "BogoMIPS : %d.%d\n", - &whole, - &fractional) == 2 - || ::sscanf (buf, - "bogomips : %d.%d\n", - &whole, - &fractional) == 2) - { - scale_factor = whole; - break; - } -#else - double mhertz = 1; - double bmips = 1; - char arg[128]; - - // CPU type? - if (::sscanf (buf, "cpu : %s\n", arg) == 1) - { - // If this is an Alpha chip, then the BogoMips rating is - // usable... - if (ACE_OS::strncmp (arg, - "Alpha", - 5) == 0) - { - supported = true; - } - } - // Pentium CPU model? - else if (!supported - && ::sscanf (buf, "model name : Pentium %s\n", arg) == 1) - { - // But if we don't have the right kind of Intel chip, - // just quit. - if (ACE_OS::strcmp (arg, "II") == 0 - || ACE_OS::strcmp (arg, "III") == 0 - || ACE_OS::strcmp (arg, "IV") == 0 - || ACE_OS::strcmp (arg, "Pro") == 0) - { - supported = true; - } - } - else if (::sscanf (buf, "cpu MHz : %lf\n", &mhertz) == 1) - { - // If the line "cpu MHz : xxx" is present, then it's a - // reliable measure of the CPU speed - according to the - // kernel-source. It's possible to see a 0 value reported. - if (mhertz > 0.0) - { - scale_factor = (ACE_UINT32) (mhertz + 0.5); - break; - } - } - else if (::sscanf (buf, "bogomips : %lf\n", &bmips) == 1 - || ::sscanf (buf, "BogoMIPS : %lf\n", &bmips) == 1) - { - if (supported) - { - scale_factor = (ACE_UINT32) (bmips + 0.5); - // ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" setting the clock scale factor to %u"), scale_factor)); - } -#if 0 - else - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("\nThe BogoMIPS metric is not supported on this platform" - "\n\tReport the results of the clock calibration and" - "\n\tthe contents of /proc/cpuinfo to the ace-users mailing list"))); - } -#endif /* 0 */ - break; - } -#endif /* __alpha__ */ - } - - // ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (done)\n"))); - - ACE_OS::fclose (cpuinfo); - } - - return scale_factor; -} -#endif /* ACE_LINUX */ - - -ACE_High_Res_Timer::global_scale_factor_type -ACE_High_Res_Timer::global_scale_factor (void) -{ -#if (defined (ACE_WIN32) || defined (ACE_HAS_POWERPC_TIMER) || \ - defined (ACE_HAS_PENTIUM) || defined (ACE_HAS_ALPHA_TIMER)) && \ - !defined (ACE_HAS_HI_RES_TIMER) && \ - (defined (ACE_WIN32) || \ - defined (ghs) || defined (__GNUG__) || \ - defined (__INTEL_COMPILER)) - // Check if the global scale factor needs to be set, and do if so. - if (ACE_High_Res_Timer::global_scale_factor_status_ == 0) - { - // Grab ACE's static object lock. This doesn't have anything to - // do with static objects; it's just a convenient lock to use. - ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, - *ACE_Static_Object_Lock::instance (), 0)); - - // Double check - if (ACE_High_Res_Timer::global_scale_factor_status_ == 0) - { -# if defined (ACE_WIN32) - // This a higher-precision version, specific for Windows systems - LARGE_INTEGER freq; - if (::QueryPerformanceFrequency (&freq)) - { - ACE_High_Res_Timer::global_scale_factor(freq.QuadPart); - - ACE_High_Res_Timer::global_scale_factor_status_ = 1; - } - else - { - // High-Res timers not supported - ACE_High_Res_Timer::global_scale_factor_status_ = -1; - } - return ACE_High_Res_Timer::global_scale_factor_; -# elif defined (ACE_LINUX) - ACE_High_Res_Timer::global_scale_factor (ACE_High_Res_Timer::get_cpuinfo ()); -# endif /* ! ACE_WIN32 && ! (ACE_LINUX && __alpha__) */ - -# if !defined (ACE_WIN32) - if (ACE_High_Res_Timer::global_scale_factor_ <= 1u) - // Failed to retrieve CPU speed from system, so calculate it. - ACE_High_Res_Timer::calibrate (); -# endif // (ACE_WIN32) - } - } - - ACE_High_Res_Timer::global_scale_factor_status_ = 1; -#endif /* (ACE_WIN32 || ACE_HAS_POWERPC_TIMER || \ - ACE_HAS_PENTIUM || ACE_HAS_ALPHA_TIMER) && \ - ! ACE_HAS_HI_RES_TIMER && - ((WIN32 && ! WINCE) || ghs || __GNUG__) */ - - return ACE_High_Res_Timer::global_scale_factor_; -} - -ACE_High_Res_Timer::ACE_High_Res_Timer (void) -{ - ACE_TRACE ("ACE_High_Res_Timer::ACE_High_Res_Timer"); - - this->reset (); - - // Make sure that the global scale factor is set. - (void) global_scale_factor (); -} - -ACE_UINT32 -ACE_High_Res_Timer::calibrate (const ACE_UINT32 usec, - const u_int iterations) -{ - const ACE_Time_Value sleep_time (0, usec); - ACE_Stats delta_hrtime; - // In units of 100 usec, to avoid overflow. - ACE_Stats actual_sleeps; - - for (u_int i = 0; - i < iterations; - ++i) - { - ACE_Time_Value const actual_start = ACE_OS::gettimeofday (); - ACE_hrtime_t const start = ACE_OS::gethrtime (); - ACE_OS::sleep (sleep_time); - ACE_hrtime_t const stop = ACE_OS::gethrtime (); - ACE_Time_Value const actual_delta = - ACE_OS::gettimeofday () - actual_start; - - // Store the sample. - delta_hrtime.sample (ACE_Utils::truncate_cast (stop - start)); - actual_sleeps.sample (actual_delta.msec () * 100u); - } - - // Calculate the mean value of the samples, with no fractional - // precision. Use it for the global scale factor. - ACE_Stats_Value ticks (0); - delta_hrtime.mean (ticks); - - ACE_Stats_Value actual_sleep (0); - actual_sleeps.mean (actual_sleep); - - // The addition of 5 below rounds instead of truncates. - const ACE_UINT32 scale_factor = - (ticks.whole () / actual_sleep.whole () + 5) / - 10u /* usec/100 usec */; - ACE_High_Res_Timer::global_scale_factor (scale_factor); - - return scale_factor; -} - -void -ACE_High_Res_Timer::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_High_Res_Timer::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nglobal_scale_factor_: %u\n"), - global_scale_factor ())); - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT (":\nstart_.hi (): %8x; start_.lo (): %8x;\n") - ACE_TEXT ("end_.hi (): %8x; end_.lo (): %8x;\n") - ACE_TEXT ("total_.hi (): %8x; total_.lo (): %8x;\n") - ACE_TEXT ("start_incr_.hi () %8x; start_incr_.lo (): %8x;\n"), - static_cast (start_ >> 32), - static_cast (start_ & 0xfffffffful), - static_cast (end_ >> 32), - static_cast (end_ & 0xfffffffful), - static_cast (total_ >> 32), - static_cast (total_ & 0xfffffffful), - static_cast (start_incr_ >> 32), - static_cast (start_incr_ & 0xfffffffful))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -void -ACE_High_Res_Timer::reset (void) -{ - ACE_TRACE ("ACE_High_Res_Timer::reset"); - - this->start_ = 0; - this->end_ = 0; - this->total_ = 0; - this->start_incr_ = 0; -} - -void -ACE_High_Res_Timer::elapsed_time (ACE_Time_Value &tv) const -{ - this->hrtime_to_tv (tv, - ACE_High_Res_Timer::elapsed_hrtime (this->end_, this->start_)); -} - -#if defined (ACE_HAS_POSIX_TIME) -// Note... Win32 does not have ACE_HAS_POSIX_TIME, so the scale factor -// does not need to take into account the different units on Win32. - -void -ACE_High_Res_Timer::elapsed_time (struct timespec &elapsed_time) const -{ - // This implementation should be cleaned up. - - // Just grab the nanoseconds. That is, leave off all values above - // microsecond. This equation is right! Don't mess with me! (It - // first strips off everything but the portion less than 1 usec. - // Then it converts that to nanoseconds by dividing by the scale - // factor to convert to usec, and multiplying by 1000.) The cast - // avoids a MSVC 4.1 compiler warning about narrowing. - ACE_hrtime_t elapsed = - ACE_High_Res_Timer::elapsed_hrtime (this->end_, this->start_); - u_long nseconds = static_cast (elapsed % - global_scale_factor () * 1000u / - global_scale_factor ()); - - // Get just the microseconds (dropping any left over nanoseconds). - ACE_UINT32 useconds = (ACE_UINT32) (elapsed / global_scale_factor ()); - - elapsed_time.tv_sec = (time_t) (useconds / ACE_ONE_SECOND_IN_USECS); - // Transforms one second in microseconds into nanoseconds. - elapsed_time.tv_nsec = (time_t) ((useconds % ACE_ONE_SECOND_IN_USECS) * 1000u + nseconds); -} -#endif /* ACE_HAS_POSIX_TIME */ - -void -ACE_High_Res_Timer::elapsed_time_incr (ACE_Time_Value &tv) const -{ - this->hrtime_to_tv (tv, total_); -} - -void -ACE_High_Res_Timer::elapsed_time (ACE_hrtime_t &nanoseconds) const -{ -#if !defined (ACE_WIN32) - // Please do _not_ rearrange this equation. It is carefully - // designed and tested to avoid overflow on machines that don't have - // native 64-bit ints. In particular, division can be a problem. - // For more background on this, please see bugzilla #1024. - nanoseconds = ACE_High_Res_Timer::elapsed_hrtime (this->end_, this->start_) - * (1024000u / ACE_High_Res_Timer::global_scale_factor ()); - // Caution - Borland has a problem with >>=, so resist the temptation. - nanoseconds = nanoseconds >> 10; - // Right shift is implemented for non native 64-bit ints - // operator/ only for a 32 bit result ! -#else - // This a higher-precision version, specific for Windows systems - nanoseconds = - (ACE_High_Res_Timer::elapsed_hrtime (this->end_, this->start_) * ACE_HR_SCALE_CONVERSION * 1000u) / - ACE_High_Res_Timer::global_scale_factor (); -#endif -} - -void -ACE_High_Res_Timer::elapsed_time_incr (ACE_hrtime_t &nanoseconds) const -{ -#if !defined (ACE_WIN32) - // Same as above. - nanoseconds = this->total_ - * (1024000u / ACE_High_Res_Timer::global_scale_factor ()); - // Caution - Borland has a problem with >>=, so resist the temptation. - nanoseconds = nanoseconds >> 10; -#else - // This a higher-precision version, specific for Windows systems - nanoseconds = - this->total_ * 1000000000u / - ACE_High_Res_Timer::global_scale_factor (); -#endif -} - -void -ACE_High_Res_Timer::print_ave (const ACE_TCHAR *str, - const int count, - ACE_HANDLE handle) const -{ - ACE_TRACE ("ACE_High_Res_Timer::print_ave"); - - // Get the total number of nanoseconds elapsed. - ACE_hrtime_t total_nanoseconds; - this->elapsed_time (total_nanoseconds); - - // Separate to seconds and nanoseconds. - u_long total_secs = - static_cast (total_nanoseconds / (ACE_UINT32) ACE_ONE_SECOND_IN_NSECS); - ACE_UINT32 extra_nsecs = - static_cast (total_nanoseconds % (ACE_UINT32) ACE_ONE_SECOND_IN_NSECS); - - ACE_TCHAR buf[100]; - if (count > 1) - { - ACE_hrtime_t avg_nsecs = total_nanoseconds / (ACE_UINT32) count; - ACE_OS::sprintf (buf, - ACE_TEXT (" count = %d, total (secs %lu, usecs %u), avg usecs = %lu\n"), - count, - total_secs, - (extra_nsecs + 500u) / 1000u, - (u_long) ((avg_nsecs + 500u) / 1000u)); - } - else - ACE_OS::sprintf (buf, - ACE_TEXT (" total %3lu.%06lu secs\n"), - total_secs, - (extra_nsecs + 500lu) / 1000lu); - - ACE_OS::write (handle, - str, - ACE_OS::strlen (str)); - ACE_OS::write (handle, - buf, - ACE_OS::strlen (buf)); -} - -void -ACE_High_Res_Timer::print_total (const ACE_TCHAR *str, - const int count, - ACE_HANDLE handle) const -{ - ACE_TRACE ("ACE_High_Res_Timer::print_total"); - - // Get the total number of nanoseconds elapsed. - ACE_hrtime_t total_nanoseconds; - this->elapsed_time (total_nanoseconds); - - // Separate to seconds and nanoseconds. - u_long total_secs = - static_cast (total_nanoseconds / (ACE_UINT32) ACE_ONE_SECOND_IN_NSECS); - ACE_UINT32 extra_nsecs = - static_cast (total_nanoseconds % (ACE_UINT32) ACE_ONE_SECOND_IN_NSECS); - - ACE_TCHAR buf[100]; - if (count > 1) - { - ACE_hrtime_t avg_nsecs = this->total_ / (ACE_UINT32) count; - - ACE_OS::sprintf (buf, - ACE_TEXT (" count = %d, total (secs %lu, usecs %u), avg usecs = %lu\n"), - count, - total_secs, - (extra_nsecs + 500u) / 1000u, - (u_long) ((avg_nsecs + 500u) / 1000u)); - } - else - ACE_OS::sprintf (buf, - ACE_TEXT (" total %3lu.%06u secs\n"), - total_secs, - (extra_nsecs + 500u) / 1000u); - - ACE_OS::write (handle, - str, - ACE_OS::strlen (str)); - ACE_OS::write (handle, - buf, - ACE_OS::strlen (buf)); -} - -int -ACE_High_Res_Timer::get_env_global_scale_factor (const ACE_TCHAR *env) -{ - if (env != 0) - { - const char *env_value = ACE_OS::getenv (ACE_TEXT_ALWAYS_CHAR (env)); - if (env_value != 0) - { - int const value = ACE_OS::atoi (env_value); - if (value > 0) - { - ACE_High_Res_Timer::global_scale_factor (value); - return 0; - } - } - } - - return -1; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/High_Res_Timer.h b/dep/acelite/ace/High_Res_Timer.h deleted file mode 100644 index d01149bce87..00000000000 --- a/dep/acelite/ace/High_Res_Timer.h +++ /dev/null @@ -1,309 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file High_Res_Timer.h - * - * $Id: High_Res_Timer.h 95798 2012-05-31 07:58:55Z johnnyw $ - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_HIGH_RES_TIMER_H -#define ACE_HIGH_RES_TIMER_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Basic_Types.h" -#include "ace/OS_NS_time.h" -#include "ace/Time_Value.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_High_Res_Timer - * - * @brief A high resolution timer class wrapper that encapsulates - * OS-specific high-resolution timers, such as those found on - * Solaris, AIX, Win32/Pentium, and VxWorks. - * - * Most of the member functions don't return values. The only - * reason that one would fail is if high-resolution time isn't - * supported on the platform. To avoid impacting performance - * and complicating the interface, in that case, - * is used instead. - * The global scale factor is required for platforms that have - * high-resolution timers that return units other than - * microseconds, such as clock ticks. It is represented as a - * static u_long, can only be accessed through static methods, - * and is used by all instances of High Res Timer. The member - * functions that return or print times use the global scale - * factor. They divide the "time" that they get from - * by global_scale_factor_ to obtain the - * time in microseconds. Its units are therefore 1/microsecond. - * On Windows the global_scale_factor_ units are 1/millisecond. - * There's a macro which gives the - * units/second. Because it's possible that the units/second - * changes in the future, it's recommended to use it instead - * of a "hard coded" solution. - * Dependent on the platform and used class members, there's a - * maximum elapsed period before overflow (which is not checked). - * Look at the documentation with some members functions. - * On some (most?) implementations it's not recommended to measure - * "long" timeperiods, because the error's can accumulate fast. - * This is probably not a problem profiling code, but could be - * on if the high resolution timer class is used to initiate - * actions after a "long" timeout. - * On Solaris, a scale factor of 1000 should be used because its - * high-resolution timer returns nanoseconds. However, on Intel - * platforms, we use RDTSC which returns the number of clock - * ticks since system boot. For a 200MHz cpu, each clock tick - * is 1/200 of a microsecond; the global_scale_factor_ should - * therefore be 200 or 200000 if it's in unit/millisecond. - * On Windows ::QueryPerformanceCounter() is used, which can be a - * different implementation depending on the used windows HAL - * (Hardware Abstraction Layer). On some it uses the PC "timer chip" - * while it uses RDTSC on others. - * @note The elapsed time calculations in the print methods use - * ACE_hrtime_t values. Those methods do _not_ check for overflow! - * @note Gabe raises this issue regarding - * : on multi-processors, the processor that - * you query for your @c timer.stop() value might not be the one - * you queried for @c timer.start(). Its not clear how much - * divergence there would be, if any. - * This issue is not mentioned in the Solaris 2.5.1 gethrtime - * man page. - * A RDTSC NOTE: RDTSC is the Intel Pentium read-time stamp counter - * and is actualy a 64 bit clock cycle counter, which is increased - * with every cycle. It has a low overhead and can be read within - * 16 (pentium) or 32 (pentium II,III,...) cycles, but it doesn't - * serialize the processor, which could give wrong timings when - * profiling very short code fragments. - * Problematic is that some power sensitive devices - * (laptops for example, but probably also embedded devices), - * do change the cycle rate while running. - * Some pentiums can run on (at least) two clock frequency's. - * Another problem arises with multiprocessor computers, there - * are reports that the different RDTSC's are not always kept - * in sync. - * A windows "timer chip" NOTE: (8254-compatible real-time clock) - * When ::QueryPerformanceCounter() uses the 8254 it has a - * frequency off about 1.193 Mhz (or sometimes 3.579 Mhz?) and - * reading it requires some time (several thousand cycles). - */ -class ACE_Export ACE_High_Res_Timer -{ -public: -#if !defined (ACE_WIN32) - typedef ACE_UINT32 global_scale_factor_type; -#else - typedef ACE_UINT64 global_scale_factor_type; -#endif - - /** - * global_scale_factor_ is set to @a gsf. All High_Res_Timers use - * global_scale_factor_. This allows applications to set the scale - * factor just once for all High_Res_Timers. Check - * High_Res_Timer.cpp for the default global_scale_factors for - * several platforms. For many platforms (e.g., Solaris), the - * global_scale_factor_ is set to 1000 so that need - * not be set. Careful, a of 0 will cause division - * by zero exceptions. - * Depending on the platform its units are 1/microsecond or - * 1/millisecond. Use @c ACE_HR_SCALE_CONVERSION inside calculations - * instead a hardcoded value. - */ - static void global_scale_factor (global_scale_factor_type gsf); - - /// Returns the global_scale_factor. - static global_scale_factor_type global_scale_factor (void); - -#ifndef ACE_HR_SCALE_CONVERSION -# define ACE_HR_SCALE_CONVERSION (ACE_ONE_SECOND_IN_USECS) -#endif /* ACE_HR_SCALE_CONVERSION */ - - /** - * Sets the global_scale_factor to the value in the @a env - * environment variable. Returns 0 on success, -1 on failure. - * @note If @a env points to string "0" (value zero), this call will fail. - * This is basically a no-op on CE because there is no concept of - * environment variable on CE. - */ - static int get_env_global_scale_factor (const ACE_TCHAR *env - = ACE_TEXT ("ACE_SCALE_FACTOR")); - - /** - * Set (and return, for info) the global scale factor by sleeping - * for @a usec and counting the number of intervening clock cycles. - * Average over @a iterations of @a usec each. On some platforms, - * such as Pentiums, this is called automatically during the first - * ACE_High_Res_Timer construction with the default parameter - * values. An application can override that by calling calibrate - * with any desired parameter values _prior_ to constructing the - * first ACE_High_Res_Timer instance. - * Beware for platforms that can change the cycle rate on the fly. - */ - static ACE_UINT32 calibrate (const ACE_UINT32 usec = 500000, - const u_int iterations = 10); - - /// Initialize the timer. - ACE_High_Res_Timer (void); - - /// Destructor. - ~ACE_High_Res_Timer (void); - - /// Reinitialize the timer. - void reset (void); - - /// Start timing. - void start (const ACE_OS::ACE_HRTimer_Op = ACE_OS::ACE_HRTIMER_GETTIME); - - /// Stop timing. - void stop (const ACE_OS::ACE_HRTimer_Op = ACE_OS::ACE_HRTIMER_GETTIME); - - /// Set @a tv to the number of microseconds elapsed. - void elapsed_time (ACE_Time_Value &tv) const; - - /// Set @a nanoseconds to the number of nanoseconds elapsed. - /** - * Will overflow when measuring more than 194 day's. - */ - void elapsed_time (ACE_hrtime_t &nanoseconds) const; - -#if defined (ACE_HAS_POSIX_TIME) - /// Returns the elapsed (stop - start) time in a struct timespec - /// (sec, nsec). - void elapsed_time (struct timespec &) const; -#endif /* ACE_HAS_POSIX_TIME */ - - /// Sets @a usecs to the elapsed (stop - start) time in microseconds. - /** - * Will overflow on windows when measuring more than appox. 2^^54 ticks. - * Is still more than 48 days with a 4 Ghz counter. - */ - void elapsed_microseconds (ACE_hrtime_t &usecs) const; - - /// Start incremental timing. - void start_incr (const ACE_OS::ACE_HRTimer_Op = ACE_OS::ACE_HRTIMER_GETTIME); - - /// Stop incremental timing. - void stop_incr (const ACE_OS::ACE_HRTimer_Op = ACE_OS::ACE_HRTIMER_GETTIME); - - /// Set @a tv to the number of microseconds elapsed between all calls - /// to start_incr and stop_incr. - void elapsed_time_incr (ACE_Time_Value &tv) const; - - /// Set @a nanoseconds to the number of nanoseconds elapsed between all calls - /// to start_incr and stop_incr. - void elapsed_time_incr (ACE_hrtime_t &nanoseconds) const; - - /// Print total time. - /// @note only use @c print_total if incremental timings had been used! - void print_total (const ACE_TCHAR *message, - const int iterations = 1, - ACE_HANDLE handle = ACE_STDOUT) const; - - /// Print average time. - void print_ave (const ACE_TCHAR *message, - const int iterations = 1, - ACE_HANDLE handle = ACE_STDOUT) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - /** - * Get the current "time" as the high resolution counter at this time. - * This is intended to be useful for supplying to a ACE_Timer_Queue - * as the gettimeofday function, thereby basing the timer calculations - * on the high res timer rather than wall clock time. - */ - static ACE_Time_Value gettimeofday_hr (void); - - /** - * @deprecated THIS FUNCTION IS DEPRECATED. PLEASE USE - * INSTEAD! Calls - * passing . This function can be used to parameterize - * objects such as . If - * is not set, and we're on a platform that - * requires (e.g., Win32), - * ACE_OS::gettimeofday will be used instead of . - * This allows applications on Intel to use even - * when is not set. However, setting the - * appropriately will result in the finest - * resolution possible. - */ - static ACE_Time_Value gettimeofday (const ACE_OS::ACE_HRTimer_Op = - ACE_OS::ACE_HRTIMER_GETTIME); - - /// Converts an @a hrt to @a tv using global_scale_factor_. - static void hrtime_to_tv (ACE_Time_Value &tv, - const ACE_hrtime_t hrt); - -#if defined (ACE_LINUX) - /** - * This is used to find out the Mhz of the machine for the scale - * factor. If there are any problems getting it, we just return 1 - * (the default). - */ - static ACE_UINT32 get_cpuinfo (void); -#endif /* defined (ACE_LINUX) */ - -private: - /** - * For internal use: gets the high-resolution time using - * . Except on platforms that require that the - * be set, such as ACE_WIN32, uses the - * low-resolution clock if the has not been - * set. - */ - static ACE_hrtime_t gettime (const ACE_OS::ACE_HRTimer_Op = - ACE_OS::ACE_HRTIMER_GETTIME); - - /// Calculate the difference between two ACE_hrtime_t values. It is assumed - /// that the end time is later than start time, so if end is a smaller - /// value, the time counter has wrapped around. - static ACE_hrtime_t elapsed_hrtime (const ACE_hrtime_t end, - const ACE_hrtime_t start); - - /// Starting time. - ACE_hrtime_t start_; - - /// Ending time. - ACE_hrtime_t end_; - - /// Total elapsed time. - ACE_hrtime_t total_; - - /// Start time of incremental timing. - ACE_hrtime_t start_incr_; - - /// Converts ticks to microseconds. That is, ticks / - /// global_scale_factor_ == microseconds. - static global_scale_factor_type global_scale_factor_; - - /** - * Indicates the status of the global scale factor, - * 0 = hasn't been set - * 1 = been set - * -1 = HR timer not supported - */ - static int global_scale_factor_status_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/High_Res_Timer.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_HIGH_RES_TIMER_H */ diff --git a/dep/acelite/ace/High_Res_Timer.inl b/dep/acelite/ace/High_Res_Timer.inl deleted file mode 100644 index c22c47cc3f3..00000000000 --- a/dep/acelite/ace/High_Res_Timer.inl +++ /dev/null @@ -1,167 +0,0 @@ -// -*- C++ -*- */ -// $Id: High_Res_Timer.inl 95798 2012-05-31 07:58:55Z johnnyw $ - -#include "ace/Global_Macros.h" - -#if defined (ACE_WIN32) -# include "ace/OS_NS_sys_time.h" -#endif /* ACE_WIN32 */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/// Be very careful before changing the calculations inside -/// ACE_High_Res_Timer. The precision matters and we are using integer -/// calculations not floating point. -ACE_INLINE void -ACE_High_Res_Timer::hrtime_to_tv (ACE_Time_Value &tv, - const ACE_hrtime_t hrt) -{ -#if !defined (ACE_WIN32) - // The following are based on the units of global_scale_factor_ - // being 1/microsecond. Therefore, dividing by it converts - // clock ticks to microseconds. - tv.sec ((time_t) (hrt / (ACE_UINT32) ACE_HR_SCALE_CONVERSION / - global_scale_factor ())); - - // hrt = (tv.sec * ACE_ONE_SECOND_IN_USECS + tv.usec) * global_scale_factor_ - // tv.usec = hrt / global_scale_factor_ - tv.sec * ACE_ONE_SECOND_IN_USECS - // That first term will be lossy, so factor out global_scale_factor_: - // tv.usec = (hrt - tv.sec * ACE_ONE_SECOND_IN_USECS * global_scale_factor_)/ - // global_scale_factor - ACE_hrtime_t tmp = tv.sec (); - tmp *= ((ACE_UINT32) ACE_HR_SCALE_CONVERSION * global_scale_factor ()); - tv.usec ((suseconds_t) ((hrt - tmp) / global_scale_factor ())); -#else - // This a higher-precision version, specific for Windows systems - // The following are based on the units of global_scale_factor_ - // being 1/microsecond. Therefore, dividing by it converts - // clock ticks to microseconds. - tv.sec ((time_t) (hrt / global_scale_factor () )); - - // Calculate usec, first calculate the seconds in hrtime - ACE_High_Res_Timer::global_scale_factor_type tmp = tv.sec (); - tmp *= global_scale_factor (); - tv.usec ((suseconds_t) ((hrt - tmp) * ACE_HR_SCALE_CONVERSION / global_scale_factor ())); -#endif -} - - -ACE_INLINE ACE_Time_Value -ACE_High_Res_Timer::gettimeofday (const ACE_OS::ACE_HRTimer_Op op) -{ -#if defined (ACE_WIN32) - // Get the global scale factor if there isn't one yet. - if (ACE_High_Res_Timer::global_scale_factor_status_ == 0) - ACE_High_Res_Timer::global_scale_factor (); - - // If there isn't a high-res timer, use gettimeofday (); - if (ACE_High_Res_Timer::global_scale_factor_status_ == -1) - return ACE_OS::gettimeofday (); -#endif /* ACE_WIN32 */ - - ACE_Time_Value tv; - ACE_High_Res_Timer::hrtime_to_tv (tv, ACE_OS::gethrtime (op)); - return tv; -} - -/// Get the current high res timer as the time of day. This is intended -/// to be used for a gettimeofday replacement in ACE_Timer_Queue and -/// derived classes so the timers will be based on high res timers rather -/// than wall clock time. It uses the ACE_High_Res_Timer::gettimeofday -/// function, which is deprecated. If it gets removed, please move the -/// code down here, intact. -ACE_INLINE ACE_Time_Value -ACE_High_Res_Timer::gettimeofday_hr (void) -{ - return ACE_High_Res_Timer::gettimeofday (); -} - - -ACE_INLINE ACE_hrtime_t -ACE_High_Res_Timer::gettime (const ACE_OS::ACE_HRTimer_Op op) -{ -#if defined (ACE_WIN32) - // Get the global scale factor if there isn't one yet. - if (ACE_High_Res_Timer::global_scale_factor_status_ == 0) - ACE_High_Res_Timer::global_scale_factor (); - - // If there isn't a high-res timer, use gettimeofday (); - if (ACE_High_Res_Timer::global_scale_factor_status_ == -1) - { - ACE_Time_Value const tv = ACE_OS::gettimeofday (); - // Return the time in microseconds because the global_scale_factor_ - // is 1. - return tv.sec () * ACE_ONE_SECOND_IN_USECS + tv.usec (); - } -#endif /* ACE_WIN32 */ - - return ACE_OS::gethrtime (op); -} - -ACE_INLINE ACE_hrtime_t -ACE_High_Res_Timer::elapsed_hrtime (const ACE_hrtime_t end, - const ACE_hrtime_t start) -{ - if (end > start) - return end - start; - return (~start + 1 + end); // Wrapped-around counter diff -} - -ACE_INLINE -ACE_High_Res_Timer::~ACE_High_Res_Timer (void) -{ -} - -ACE_INLINE void -ACE_High_Res_Timer::start (const ACE_OS::ACE_HRTimer_Op op) -{ - ACE_TRACE ("ACE_High_Res_Timer::start"); - this->start_ = ACE_High_Res_Timer::gettime (op); -} - -ACE_INLINE void -ACE_High_Res_Timer::stop (const ACE_OS::ACE_HRTimer_Op op) -{ - ACE_TRACE ("ACE_High_Res_Timer::stop"); - this->end_ = ACE_High_Res_Timer::gettime (op); -} - -ACE_INLINE void -ACE_High_Res_Timer::start_incr (const ACE_OS::ACE_HRTimer_Op op) -{ - ACE_TRACE ("ACE_High_Res_Timer::start_incr"); - this->start_incr_ = ACE_High_Res_Timer::gettime (op); -} - -ACE_INLINE void -ACE_High_Res_Timer::stop_incr (const ACE_OS::ACE_HRTimer_Op op) -{ - ACE_TRACE ("ACE_High_Res_Timer::stop_incr"); - this->total_ += - ACE_High_Res_Timer::elapsed_hrtime (ACE_High_Res_Timer::gettime (op), - this->start_incr_); -} - -ACE_INLINE void -ACE_High_Res_Timer::elapsed_microseconds (ACE_hrtime_t &usecs) const -{ - -#if !defined (ACE_WIN32) - ACE_hrtime_t elapsed = ACE_High_Res_Timer::elapsed_hrtime (this->end_, - this->start_); - usecs = (ACE_hrtime_t) (elapsed / global_scale_factor ()); -#else - usecs = (ACE_High_Res_Timer::elapsed_hrtime (this->end_, this->start_) * - ACE_HR_SCALE_CONVERSION) / - global_scale_factor (); -#endif -} - -ACE_INLINE void -ACE_High_Res_Timer::global_scale_factor ( - ACE_High_Res_Timer::global_scale_factor_type gsf) -{ - global_scale_factor_ = gsf; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/ICMP_Socket.cpp b/dep/acelite/ace/ICMP_Socket.cpp deleted file mode 100644 index 04ac2611d75..00000000000 --- a/dep/acelite/ace/ICMP_Socket.cpp +++ /dev/null @@ -1,180 +0,0 @@ -// $Id: ICMP_Socket.cpp 93560 2011-03-16 13:54:49Z johnnyw $ - -#include "ace/ICMP_Socket.h" - -#if defined (ACE_HAS_ICMP_SUPPORT) && (ACE_HAS_ICMP_SUPPORT == 1) - -#include "ace/ACE.h" -#include "ace/Log_Msg.h" -#include "ace/OS_NS_netdb.h" -#include "ace/OS_NS_sys_socket.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE (ACE_ICMP_Socket) - - -void -ACE_ICMP_Socket::dump (void) const -{ - ACE_TRACE ("ACE_ICMP_Socket::dump"); -} - -ACE_ICMP_Socket::ACE_ICMP_Socket (void) -{ - ACE_TRACE ("ACE_ICMP_Socket::ACE_ICMP_Socket"); -} - -ssize_t -ACE_ICMP_Socket::send (void const * buf, - size_t n, - ACE_Addr const & addr, - int flags) const -{ - ACE_TRACE ("ACE_ICMP_Socket::send"); - - return ACE_OS::sendto (this->get_handle (), - (char const *) buf, - n, - flags, - (sockaddr const *) addr.get_addr (), - addr.get_size ()); -} - -ssize_t -ACE_ICMP_Socket::recv (void * buf, - size_t n, - ACE_Addr & addr, - int flags) const -{ - ACE_TRACE ("ACE_ICMP_Socket::recv"); - - int addr_len = addr.get_size (); - ssize_t status = ACE_OS::recvfrom (this->get_handle (), - (char *) buf, - n, - flags, - (sockaddr *) addr.get_addr (), - (int*) &addr_len); - addr.set_size (addr_len); - - return status; -} - -ssize_t -ACE_ICMP_Socket::recv (void * buf, - size_t n, - int flags, - ACE_Time_Value const * timeout) const -{ - ACE_TRACE ("ACE_ICMP_Socket::recv"); - - return ACE::recv (this->get_handle (), - buf, - n, - flags, - timeout); -} - -int -ACE_ICMP_Socket::open (ACE_Addr const & local, - int protocol, - int reuse_addr) -{ - ACE_TRACE ("ACE_ICMP_Socket::open"); - - // Check if icmp protocol is supported on this host - int proto_number = -1; - protoent *proto = 0; - - if (! (proto = ACE_OS::getprotobyname ("icmp"))) - { - ACE_ERROR_RETURN - ((LM_ERROR, - ACE_TEXT ("(%P|%t) ACE_ICMP_Socket::open: %p; %s\n"), - ACE_TEXT ("getprotobyname"), - ACE_TEXT ("ICMP protocol is not properly configured ") - ACE_TEXT ("or not supported.")), - -1); - } - proto_number = proto->p_proto; - - if (proto_number != IPPROTO_ICMP || proto_number != protocol) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("(%P|%t) ACE::ICMP_Socket::open - ") - ACE_TEXT ("only IPPROTO_ICMP protocol is ") - ACE_TEXT ("currently supported.\n")), - -1); - } - - if (ACE_SOCK::open (SOCK_RAW, - AF_INET, - protocol, - reuse_addr) == -1) - { - return -1; - } - - return this->shared_open (local); -} - -int -ACE_ICMP_Socket::shared_open (ACE_Addr const & local) -{ - ACE_TRACE ("ACE_ICMP_Socket::shared_open"); - - int error = 0; - if (local == ACE_Addr::sap_any) - { - if (ACE::bind_port (this->get_handle ()) == -1) - { - error = 1; - } - } - else if (ACE_OS::bind (this->get_handle (), - reinterpret_cast (local.get_addr ()), - local.get_size ()) == -1) - { - error = 1; - } - - if (error != 0) - { - this->close (); - } - - return error ? -1 : 0; -} - -unsigned short -ACE_ICMP_Socket::calculate_checksum (unsigned short * paddress, - int len) -{ - int nleft = len; - int sum = 0; - unsigned short * w = paddress; - unsigned short answer = 0; - while (nleft > 1) - { - sum += *w++; - nleft -= 2; - } - - if (nleft == 1) - { - *((unsigned char *) &answer) = *((unsigned char *) w); - sum += answer; - } - - // add back carry outs from top 16 bits to low 16 bits - sum = (sum >> 16) + (sum & 0xffff); // add hi 16 to low 16 - sum += (sum >> 16); // add carry - answer = ~sum; // truncate to 16 bits - - return (answer); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_ICMP_SUPPORT == 1 */ diff --git a/dep/acelite/ace/ICMP_Socket.h b/dep/acelite/ace/ICMP_Socket.h deleted file mode 100644 index 251ec307a4b..00000000000 --- a/dep/acelite/ace/ICMP_Socket.h +++ /dev/null @@ -1,110 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file ICMP_Socket.h - * - * $Id: ICMP_Socket.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Robert S. Iakobashvili - * @author Gonzalo A. Diethelm - */ -//============================================================================= - -#ifndef ACE_ICMP_SOCKET_H -#define ACE_ICMP_SOCKET_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_ICMP_SUPPORT) && (ACE_HAS_ICMP_SUPPORT == 1) - -#include "ace/SOCK.h" -#include "ace/Time_Value.h" -#include "ace/os_include/netinet/os_in.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_ICMP_Socket - * - * @brief An abstract class that forms the basis for usage of the ICMP - * protocol (that is, support for things such as ping). - */ -class ACE_Export ACE_ICMP_Socket : public ACE_SOCK -{ -public: - // = Initialization methods. - - /** - * @name Data transfer routines. - * - * Data transfer routines. - */ - //@{ - - /// Send an @a n byte @a buf to the datagram socket (uses - /// @c sendto(3) ). - ssize_t send (void const * buf, - size_t n, - ACE_Addr const & addr, - int flags = 0) const; - - /// Receive an @a n byte @a buf from the datagram socket - /// (uses @c recvfrom(3) ). - ssize_t recv (void * buf, - size_t n, - ACE_Addr & addr, - int flags = 0) const; - - /// TODO: comment - ssize_t recv (void * buf, - size_t n, - int flags, - ACE_Time_Value const * timeout) const; - - //@} - - /// Wrapper around the BSD-style @c socket system call (no QoS). - int open (ACE_Addr const & local = ACE_Addr::sap_any, - int protocol = IPPROTO_ICMP, - int reuse_addr = 0); - - /// Dump the state of object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - - // Protected constructors, so the class can only be derived from. - - /// Default constructor. - ACE_ICMP_Socket (void); - - /// Constructor that takes a local listening address. - ACE_ICMP_Socket (ACE_Addr const & local, - int protocol = IPPROTO_ICMP, - int reuse_addr = 0); - - /// Wrapper around BSD-style @c bind system call. - int shared_open (ACE_Addr const & local); - - /// Calculates check-sum. - unsigned short calculate_checksum (unsigned short* paddress, - int len); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_ICMP_SUPPORT == 1 */ - -#include /**/ "ace/post.h" - -#endif /* ACE_ICMP_SOCKET_H */ diff --git a/dep/acelite/ace/INET_Addr.cpp b/dep/acelite/ace/INET_Addr.cpp deleted file mode 100644 index a41b0e4406f..00000000000 --- a/dep/acelite/ace/INET_Addr.cpp +++ /dev/null @@ -1,1139 +0,0 @@ -// $Id: INET_Addr.cpp 95533 2012-02-14 22:59:17Z wotte $ - -// Defines the Internet domain address family address format. - -#include "ace/INET_Addr.h" - -#if !defined (__ACE_INLINE__) -#include "ace/INET_Addr.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/Log_Msg.h" -#include "ace/OS_NS_stdio.h" -#include "ace/OS_NS_errno.h" -#include "ace/OS_NS_stdlib.h" -#include "ace/OS_Memory.h" -#include "ace/OS_NS_arpa_inet.h" -#include "ace/OS_NS_netdb.h" -#include "ace/OS_NS_unistd.h" -#include "ace/OS_NS_sys_socket.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_INET_Addr) - -// Transform the current address into string format. - -int -ACE_INET_Addr::addr_to_string (ACE_TCHAR s[], - size_t size, - int ipaddr_format) const -{ - ACE_TRACE ("ACE_INET_Addr::addr_to_string"); - - // XXX Can we (should we) include the scope id for IPv6 addresses? - char hoststr[MAXHOSTNAMELEN+1]; - - bool result = false; - if (ipaddr_format == 0) - result = (this->get_host_name (hoststr, MAXHOSTNAMELEN+1) == 0); - else - result = (this->get_host_addr (hoststr, MAXHOSTNAMELEN+1) != 0); - - if (!result) - return -1; - - size_t total_len = - ACE_OS::strlen (hoststr) - + 5 // ACE_OS::strlen ("65535"), Assuming the max port number. - + 1 // sizeof (':'), addr/port sep - + 1; // sizeof ('\0'), terminating NUL -#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - ACE_TCHAR const *format = ACE_TEXT("%ls:%d"); -#else - ACE_TCHAR const *format = ACE_TEXT("%s:%d"); -#endif /* !ACE_WIN32 && ACE_USES_WCHAR */ -#if defined (ACE_HAS_IPV6) - if (ACE_OS::strchr (hoststr, ACE_TEXT (':')) != 0) - { - total_len += 2; // ACE_OS::strlen ("[]") IPv6 addr frames -# if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - format = ACE_TEXT("[%ls]:%d"); -# else - format = ACE_TEXT("[%s]:%d"); -# endif /* !ACE_WIN32 && ACE_USES_WCHAR */ - } -#endif // ACE_HAS_IPV6 - - if (size < total_len) - return -1; - else - ACE_OS::sprintf (s, format, - ACE_TEXT_CHAR_TO_TCHAR (hoststr), - this->get_port_number ()); - return 0; -} - -void -ACE_INET_Addr::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_INET_Addr::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - - ACE_TCHAR s[ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 16]; - this->addr_to_string(s, ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 16); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s"), s)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -// Compare two addresses for inequality. - -bool -ACE_INET_Addr::operator != (const ACE_INET_Addr &sap) const -{ - ACE_TRACE ("ACE_INET_Addr::operator !="); - return !((*this) == sap); -} - -// Compare two addresses for equality. - -bool -ACE_INET_Addr::operator == (const ACE_INET_Addr &sap) const -{ - ACE_TRACE ("ACE_INET_Addr::operator =="); - - if (this->get_type () != sap.get_type () - || this->get_size () != sap.get_size ()) - return false; - - return (ACE_OS::memcmp (&this->inet_addr_, - &sap.inet_addr_, - this->get_size ()) == 0); -} - -bool -ACE_INET_Addr::is_ip_equal (const ACE_INET_Addr &sap) const -{ - if (this->get_type () != sap.get_type () - || this->get_size () != sap.get_size ()) - return false; - -#if defined (ACE_HAS_IPV6) - if (this->get_type () == PF_INET6) - { - const unsigned int *addr = - reinterpret_cast(this->ip_addr_pointer()); - const unsigned int *saddr = - reinterpret_cast(sap.ip_addr_pointer()); - return (addr[0] == saddr[0] && - addr[1] == saddr[1] && - addr[2] == saddr[2] && - addr[3] == saddr[3]); - } - else -#endif /* ACE_HAS_IPV6 */ - return this->get_ip_address () == sap.get_ip_address(); -} - - -u_long -ACE_INET_Addr::hash (void) const -{ -#if defined (ACE_HAS_IPV6) - if (this->get_type () == PF_INET6) - { - const unsigned int *addr = (const unsigned int*)this->ip_addr_pointer(); - return addr[0] + addr[1] + addr[2] + addr[3] + this->get_port_number(); - } - else -#endif /* ACE_HAS_IPV6 */ - return this->get_ip_address () + this->get_port_number (); -} - -ACE_INET_Addr::ACE_INET_Addr (void) - : ACE_Addr (determine_type (), sizeof (inet_addr_)) -{ - // ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); - this->reset (); -} - -int -ACE_INET_Addr::set (const ACE_INET_Addr &sa) -{ - ACE_TRACE ("ACE_INET_Addr::set"); - - if (sa.get_type () == AF_ANY) - // Ugh, this is really a base class, so don't copy it. - ACE_OS::memset (&this->inet_addr_, 0, sizeof (this->inet_addr_)); - else - { - // It's ok to make the copy. - ACE_OS::memcpy (&this->inet_addr_, - &sa.inet_addr_, - sa.get_size ()); - - this->set_type (sa.get_type()); - this->set_size (sa.get_size()); - } - - return 0; -} - -// Transform the string into the current addressing format. - -int -ACE_INET_Addr::string_to_addr (const char s[], int address_family) -{ - ACE_TRACE ("ACE_INET_Addr::string_to_addr"); - int result; - char *ip_buf = 0; - char *ip_addr = 0; - - // Need to make a duplicate since we'll be overwriting the string. - ACE_ALLOCATOR_RETURN (ip_buf, - ACE_OS::strdup (s), - -1); - ip_addr = ip_buf; - // We use strrchr because of IPv6 addresses. - char *port_p = ACE_OS::strrchr (ip_addr, ':'); -#if defined (ACE_HAS_IPV6) - // Check for extended IPv6 format : '[' ']' ':' - if (ip_addr[0] == '[') - { - // find closing bracket - char *cp_pos = ACE_OS::strchr (ip_addr, ']'); - // check for port separator after closing bracket - // if not found leave it, error will come later - if (cp_pos) - { - *cp_pos = '\0'; // blank out ']' - ++ip_addr; // skip over '[' - if (cp_pos[1] == ':') - port_p = cp_pos + 1; - else - port_p = cp_pos; // leads to error on missing port - } - } -#endif /* ACE_HAS_IPV6 */ - - if (port_p == 0) // Assume it's a port number. - { - char *endp = 0; - long const port = ACE_OS::strtol (ip_addr, &endp, 10); - - if (*endp == '\0') // strtol scanned the entire string - all digits - { - if (port < 0 || port > ACE_MAX_DEFAULT_PORT) - result = -1; - else - result = this->set (u_short (port), ACE_UINT32 (INADDR_ANY)); - } - else // port name - result = this->set (ip_addr, ACE_UINT32 (INADDR_ANY)); - } - else - { - *port_p = '\0'; ++port_p; // skip over ':' - - char *endp = 0; - long port = ACE_OS::strtol (port_p, &endp, 10); - - if (*endp == '\0') // strtol scanned the entire string - all digits - { - if (port < 0 || port > ACE_MAX_DEFAULT_PORT) - result = -1; - else - result = this->set (u_short (port), ip_addr, 1, address_family); - } - else - result = this->set (port_p, ip_addr); - } - - ACE_OS::free (ACE_MALLOC_T (ip_buf)); - return result; -} - -int -ACE_INET_Addr::set (const char address[], int address_family) -{ - ACE_TRACE ("ACE_INET_Addr::set"); - return this->string_to_addr (address, address_family); -} - -ACE_INET_Addr::ACE_INET_Addr (const char address[], int address_family) - : ACE_Addr (determine_type (), sizeof (inet_addr_)) -{ - ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); - this->reset (); - this->set (address, address_family); -} - -#if defined (ACE_HAS_WCHAR) -ACE_INET_Addr::ACE_INET_Addr (const wchar_t address[], int address_family) - : ACE_Addr (determine_type (), sizeof (inet_addr_)) -{ - ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); - this->reset (); - this->set (address, address_family); -} - -#endif /* ACE_HAS_WCHAR */ - -// Copy constructor. - -ACE_INET_Addr::ACE_INET_Addr (const ACE_INET_Addr &sa) - : ACE_Addr (sa.get_type (), sa.get_size()) -{ - ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); - this->reset (); - this->set (sa); -} - -// Initializes a ACE_INET_Addr from a PORT_NUMBER and a 32 bit Internet -// address. - -int -ACE_INET_Addr::set (u_short port_number, - ACE_UINT32 inet_address, - int encode, - int map) -{ - ACE_TRACE ("ACE_INET_Addr::set"); - this->set_address (reinterpret_cast (&inet_address), - sizeof inet_address, - encode, map); - this->set_port_number (port_number, encode); - - return 0; -} - - -// Initializes a ACE_INET_Addr from a PORT_NUMBER and the remote -// HOST_NAME. - -int -ACE_INET_Addr::set (u_short port_number, - const char host_name[], - int encode, - int address_family) -{ - ACE_TRACE ("ACE_INET_Addr::set"); - - // Yow, someone gave us a NULL host_name! - if (host_name == 0) - { - errno = EINVAL; - return -1; - } - - ACE_OS::memset ((void *) &this->inet_addr_, - 0, - sizeof this->inet_addr_); - -#if defined (ACE_HAS_IPV6) - // Let the IPv4 case fall through to the non-IPv6-capable section. - // We don't need the additional getaddrinfo() capability and the Linux - // getaddrinfo() is substantially slower than gethostbyname() w/ - // large vlans. -# if defined (ACE_USES_IPV4_IPV6_MIGRATION) - if (address_family == AF_UNSPEC && !ACE::ipv6_enabled ()) - address_family = AF_INET; -# endif /* ACE_USES_IPV4_IPV6_MIGRATION */ - if (address_family != AF_INET) - { -# if defined (ACE_HAS_GETHOSTBYNAME2) - hostent hentry; - hostent *hp; - ACE_HOSTENT_DATA buf; - int h_error = 0; // Not the same as errno! - - if (0 == ::gethostbyname2_r (host_name, AF_INET6, &hentry, - buf, sizeof(buf), &hp, &h_error)) - { - if (hp != 0) - { - struct sockaddr_in6 v6; - ACE_OS::memset (&v6, 0, sizeof (v6)); - v6.sin6_family = AF_INET6; - (void) ACE_OS::memcpy ((void *) &v6.sin6_addr, - hp->h_addr, - hp->h_length); - this->set_type (hp->h_addrtype); - this->set_addr (&v6, hp->h_length); - this->set_port_number (port_number, encode); - return 0; - } - } - errno = h_error; - if (address_family == AF_INET6) - return -1; -# else - struct addrinfo hints; - struct addrinfo *res = 0; - int error = 0; - ACE_OS::memset (&hints, 0, sizeof (hints)); - hints.ai_family = AF_INET6; - if ((error = ::getaddrinfo (host_name, 0, &hints, &res)) == 0) - { - this->set_type (res->ai_family); - this->set_addr (res->ai_addr, res->ai_addrlen); - this->set_port_number (port_number, encode); - ::freeaddrinfo (res); - return 0; - } - if (address_family == AF_INET6) - { - if (res) - ::freeaddrinfo(res); - errno = error; - return -1; - } -# endif /* ACE_HAS_GETHOSTBYNAME2 */ - // Let AF_UNSPEC try again w/ IPv4. - } -#endif /* ACE_HAS_IPV6 */ - - // IPv6 not supported... insure the family is set to IPv4 - address_family = AF_INET; - this->set_type (address_family); - this->inet_addr_.in4_.sin_family = static_cast (address_family); -#ifdef ACE_HAS_SOCKADDR_IN_SIN_LEN - this->inet_addr_.in4_.sin_len = sizeof (this->inet_addr_.in4_); -#endif - struct in_addr addrv4; - if (ACE_OS::inet_aton (host_name, - &addrv4) == 1) - return this->set (port_number, - encode ? ACE_NTOHL (addrv4.s_addr) : addrv4.s_addr, - encode); - else - { - hostent hentry; - ACE_HOSTENT_DATA buf; - int h_error = 0; // Not the same as errno! - - hostent *hp = ACE_OS::gethostbyname_r (host_name, &hentry, - buf, &h_error); - if (hp == 0) - errno = h_error; - - if (hp == 0) - { - return -1; - } - else - { - (void) ACE_OS::memcpy ((void *) &addrv4.s_addr, - hp->h_addr, - hp->h_length); - return this->set (port_number, - encode ? ACE_NTOHL (addrv4.s_addr) : addrv4.s_addr, - encode); - } - } -} - -// Helper function to get a port number from a port name. - -static int get_port_number_from_name (const char port_name[], - const char protocol[]) -{ - // Maybe port_name is directly a port number? - char *endp = 0; - long port_number = ACE_OS::strtol (port_name, &endp, 10); - - if (*endp == '\0') - { - // port_name was really a number, and nothing else. - - // Check for overflow. - if (port_number < 0 || port_number > ACE_MAX_DEFAULT_PORT) - return -1; - - // Return the port number. NOTE: this number must - // be returned in network byte order! - u_short n = static_cast (port_number); - n = ACE_HTONS (n); - return n; - } - - // We try to resolve port number from its name. - -#if defined (ACE_LACKS_GETSERVBYNAME) - port_number = 0; - ACE_UNUSED_ARG (port_name); - ACE_UNUSED_ARG (protocol); -#else - port_number = -1; - servent sentry; - ACE_SERVENT_DATA buf; - servent *sp = ACE_OS::getservbyname_r (port_name, - protocol, - &sentry, - buf); - if (sp != 0) - port_number = sp->s_port; -#endif /* ACE_LACKS_GETSERVBYNAME */ - - return port_number; -} - -// Initializes a ACE_INET_Addr from a and the remote -// . - -int -ACE_INET_Addr::set (const char port_name[], - const char host_name[], - const char protocol[]) -{ - ACE_TRACE ("ACE_INET_Addr::set"); - - int const port_number = get_port_number_from_name (port_name, protocol); - if (port_number == -1) - { - ACE_NOTSUP_RETURN (-1); - } - - int address_family = PF_UNSPEC; -# if defined (ACE_HAS_IPV6) - if (ACE_OS::strcmp (protocol, "tcp6") == 0) - address_family = AF_INET6; -# endif /* ACE_HAS_IPV6 */ - - return this->set (static_cast (port_number), - host_name, 0, address_family); -} - -// Initializes a ACE_INET_Addr from a and a 32 bit -// Internet address. - -int -ACE_INET_Addr::set (const char port_name[], - ACE_UINT32 inet_address, - const char protocol[]) -{ - ACE_TRACE ("ACE_INET_Addr::set"); - - int const port_number = get_port_number_from_name (port_name, protocol); - if (port_number == -1) - { - ACE_NOTSUP_RETURN (-1); - } - - return this->set (static_cast (port_number), - inet_address, 0); -} - -// Creates a ACE_INET_Addr from a PORT_NUMBER and the remote -// HOST_NAME. - -ACE_INET_Addr::ACE_INET_Addr (u_short port_number, - const char host_name[], - int address_family) - : ACE_Addr (determine_type (), sizeof (inet_addr_)) -{ - ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); - ACE_OS::memset (&this->inet_addr_, 0, sizeof (this->inet_addr_)); - if (this->set (port_number, - host_name, - 1, - address_family) == -1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE_INET_Addr::ACE_INET_Addr: %p\n"), - ACE_TEXT_CHAR_TO_TCHAR ((host_name == 0) ? - "" : host_name))); -} - -#if defined (ACE_HAS_WCHAR) -ACE_INET_Addr::ACE_INET_Addr (u_short port_number, - const wchar_t host_name[], - int address_family) - : ACE_Addr (determine_type (), sizeof (inet_addr_)) -{ - ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); - ACE_OS::memset (&this->inet_addr_, 0, sizeof (this->inet_addr_)); - if (this->set (port_number, - host_name, - 1, - address_family) == -1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE_INET_Addr::ACE_INET_Addr: %p\n"), - ACE_TEXT_WCHAR_TO_TCHAR ((host_name == 0) ? - ACE_TEXT_WIDE ("") : - host_name))); -} -#endif /* ACE_HAS_WCHAR */ - -// Creates a ACE_INET_Addr from a sockaddr_in structure. - -int -ACE_INET_Addr::set (const sockaddr_in *addr, int len) -{ - ACE_TRACE ("ACE_INET_Addr::set"); - - if (addr->sin_family == AF_INET) - { - int maxlen = static_cast (sizeof (this->inet_addr_.in4_)); - if (len > maxlen) - len = maxlen; - ACE_OS::memcpy (&this->inet_addr_.in4_, addr, len); - this->base_set (AF_INET, len); - return 0; - } -#if defined (ACE_HAS_IPV6) - else if (addr->sin_family == AF_INET6) - { - int maxlen = static_cast (sizeof (this->inet_addr_.in6_)); - if (len > maxlen) - len = maxlen; - ACE_OS::memcpy (&this->inet_addr_.in6_, addr, len); - this->base_set (AF_INET6, len); - return 0; - } -#endif /* ACE_HAS_IPV6 */ - - errno = EAFNOSUPPORT; - return -1; -} - -// Return the address. - -void * -ACE_INET_Addr::get_addr (void) const -{ - ACE_TRACE ("ACE_INET_Addr::get_addr"); - return (void*)&this->inet_addr_; -} - -void -ACE_INET_Addr::set_addr (void *addr, int len) -{ - this->set_addr (addr, len, 0); -} - -// Set a pointer to the address. -void -ACE_INET_Addr::set_addr (void *addr, int /* len */, int map) -{ - ACE_TRACE ("ACE_INET_Addr::set_addr"); - struct sockaddr_in *getfamily = static_cast (addr); - - if (getfamily->sin_family == AF_INET) - { -#if defined (ACE_HAS_IPV6) - if (map) - this->set_type (AF_INET6); - else -#endif /* ACE_HAS_IPV6 */ - this->set_type (AF_INET); - this->set_port_number (getfamily->sin_port, 0); - this->set_address (reinterpret_cast (&getfamily->sin_addr), - sizeof (getfamily->sin_addr), - 0, map); - } -#if defined (ACE_HAS_IPV6) - else if (getfamily->sin_family == AF_INET6) - { - struct sockaddr_in6 *in6 = static_cast (addr); - this->set_port_number (in6->sin6_port, 0); - this->set_address (reinterpret_cast (&in6->sin6_addr), - sizeof (in6->sin6_addr), - 0); - this->inet_addr_.in6_.sin6_scope_id = in6->sin6_scope_id; - } -#endif // ACE_HAS_IPV6 -} - -// Creates a ACE_INET_Addr from a sockaddr_in structure. - -ACE_INET_Addr::ACE_INET_Addr (const sockaddr_in *addr, int len) - : ACE_Addr (determine_type (), sizeof (inet_addr_)) -{ - ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); - this->reset (); - this->set (addr, len); -} - -// Creates a ACE_INET_Addr from a PORT_NUMBER and an Internet address. - -ACE_INET_Addr::ACE_INET_Addr (u_short port_number, - ACE_UINT32 inet_address) - : ACE_Addr (determine_type (), sizeof (inet_addr_)) -{ - ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); - this->reset (); - if (this->set (port_number, inet_address) == -1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_INET_Addr::ACE_INET_Addr"))); -} - -// Creates a ACE_INET_Addr from a PORT_NAME and the remote -// HOST_NAME. - -ACE_INET_Addr::ACE_INET_Addr (const char port_name[], - const char host_name[], - const char protocol[]) - : ACE_Addr (determine_type (), sizeof (inet_addr_)) -{ - ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); - this->reset (); - if (this->set (port_name, - host_name, - protocol) == -1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE_INET_Addr::ACE_INET_Addr"))); -} - -#if defined (ACE_HAS_WCHAR) -ACE_INET_Addr::ACE_INET_Addr (const wchar_t port_name[], - const wchar_t host_name[], - const wchar_t protocol[]) - : ACE_Addr (determine_type (), sizeof (inet_addr_)) -{ - ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); - this->reset (); - if (this->set (port_name, - host_name, - protocol) == -1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE_INET_Addr::ACE_INET_Addr"))); -} -#endif /* ACE_HAS_WCHAR */ - -// Creates a ACE_INET_Addr from a PORT_NAME and an Internet address. - -ACE_INET_Addr::ACE_INET_Addr (const char port_name[], - ACE_UINT32 inet_address, - const char protocol[]) - : ACE_Addr (determine_type (), sizeof (inet_addr_)) -{ - ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); - this->reset (); - if (this->set (port_name, - ACE_HTONL (inet_address), - protocol) == -1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE_INET_Addr::ACE_INET_Addr"))); -} - -#if defined (ACE_HAS_WCHAR) -ACE_INET_Addr::ACE_INET_Addr (const wchar_t port_name[], - ACE_UINT32 inet_address, - const wchar_t protocol[]) - : ACE_Addr (determine_type (), sizeof (inet_addr_)) -{ - ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); - this->reset (); - if (this->set (port_name, - ACE_HTONL (inet_address), - protocol) == -1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE_INET_Addr::ACE_INET_Addr"))); -} -#endif /* ACE_HAS_WCHAR */ - -ACE_INET_Addr::~ACE_INET_Addr (void) -{ -} - -int -ACE_INET_Addr::get_host_name (char hostname[], - size_t len) const -{ - ACE_TRACE ("ACE_INET_Addr::get_host_name"); - - int result; - if (len > 1) - { - result = this->get_host_name_i (hostname,len); - if (result < 0) - { - if (result == -2) - // We know that hostname is nul-terminated - result = -1; - else - { - //result == -1; - // This could be worse than hostname[len -1] = '\0'? - hostname[0] = '\0'; - } - } - } - else - { - if (len == 1) - hostname[0] = '\0'; - result = -1; - } - - return result; -} - -#if defined (ACE_HAS_WCHAR) -int -ACE_INET_Addr::get_host_name (wchar_t hostname[], - size_t len) const -{ - ACE_TRACE ("ACE_INET_Addr::get_host_name"); - - char char_hostname [MAXHOSTNAMELEN + 1]; - - // We have a build in limitation of MAXHOSTNAMELEN - if (len > MAXHOSTNAMELEN + 1) - len = MAXHOSTNAMELEN + 1; - - // Call the char version - int result = this->get_host_name (char_hostname, len); - - // And copy it over, if successful - if (result == 0) - ACE_OS::strcpy (hostname, - ACE_Ascii_To_Wide (char_hostname).wchar_rep ()); - - return result; -} -#endif /* ACE_HAS_WCHAR */ - -// Return the character representation of the hostname. - -const char * -ACE_INET_Addr::get_host_name (void) const -{ - ACE_TRACE ("ACE_INET_Addr::get_host_name"); - - static char name[MAXHOSTNAMELEN + 1]; - if (this->get_host_name (name, MAXHOSTNAMELEN + 1) == -1) - ACE_OS::strcpy (name, ""); - return name; -} - -void -ACE_INET_Addr::set_port_number (u_short port_number, - int encode) -{ - ACE_TRACE ("ACE_INET_Addr::set_port_number"); - - if (encode) - port_number = ACE_HTONS (port_number); - -#if defined (ACE_HAS_IPV6) - if (this->get_type () == AF_INET6) - this->inet_addr_.in6_.sin6_port = port_number; - else -#endif /* ACE_HAS_IPV6 */ - this->inet_addr_.in4_.sin_port = port_number; -} - -// returns -2 when the hostname is truncated -int -ACE_INET_Addr::get_host_name_i (char hostname[], size_t len) const -{ - ACE_TRACE ("ACE_INET_Addr::get_host_name_i"); - -#if defined (ACE_HAS_IPV6) - if ((this->get_type () == PF_INET6 && - 0 == ACE_OS::memcmp (&this->inet_addr_.in6_.sin6_addr, - &in6addr_any, - sizeof (this->inet_addr_.in6_.sin6_addr))) - || - (this->get_type () == PF_INET && - this->inet_addr_.in4_.sin_addr.s_addr == INADDR_ANY)) -#else - if (this->inet_addr_.in4_.sin_addr.s_addr == INADDR_ANY) -#endif /* ACE_HAS_IPV6 */ - { - if (ACE_OS::hostname (hostname, len) == -1) - return -1; - else - return 0; - } - else - { - void* addr = this->ip_addr_pointer (); - int size = this->ip_addr_size (); - int type = this->get_type (); - -# if defined (ACE_HAS_IPV6) && defined (ACE_HAS_BROKEN_GETHOSTBYADDR_V4MAPPED) - // Most OS can not handle IPv6-mapped-IPv4 addresses (even - // though they are meant to) so map them back to IPv4 addresses - // before trying to resolve them - in_addr demapped_addr; - if (type == PF_INET6 && - (this->is_ipv4_mapped_ipv6 () || this->is_ipv4_compat_ipv6 ())) - { - ACE_OS::memcpy (&demapped_addr.s_addr, &this->inet_addr_.in6_.sin6_addr.s6_addr[12], 4); - addr = &demapped_addr; - size = sizeof(demapped_addr); - type = PF_INET; - } -# endif /* ACE_HAS_IPV6 */ - - int h_error; // Not the same as errno! - hostent hentry; - ACE_HOSTENT_DATA buf; - hostent * const hp = - ACE_OS::gethostbyaddr_r (static_cast (addr), - size, - type, - &hentry, - buf, - &h_error); - - if (hp == 0 || hp->h_name == 0) - return -1; - - if (ACE_OS::strlen (hp->h_name) >= len) - { - // We know the length, so use memcpy - if (len > 0) - { - ACE_OS::memcpy (hostname, hp->h_name, len - 1); - hostname[len-1]= '\0'; - } - errno = ENOSPC; - return -2; // -2 Means that we have a good string - // Using errno looks ok, but ENOSPC could be set on - // other places. - } - - ACE_OS::strcpy (hostname, hp->h_name); - return 0; - } -} - -int ACE_INET_Addr::set_address (const char *ip_addr, - int len, - int encode /* = 1 */, - int map /* = 0 */) -{ - ACE_TRACE ("ACE_INET_Addr::set_address"); - // This is really intended for IPv4. If the object is IPv4, or the type - // hasn't been set but it's a 4-byte address, go ahead. If this is an - // IPv6 object and is requested, refuse. - if (encode && len != 4) - { - errno = EAFNOSUPPORT; - return -1; - } - - if (len == 4) - { - ACE_UINT32 ip4 = *reinterpret_cast (ip_addr); - if (encode) - ip4 = ACE_HTONL (ip4); - - - if (this->get_type () == AF_INET && map == 0) { - this->base_set (AF_INET, sizeof (this->inet_addr_.in4_)); -#ifdef ACE_HAS_SOCKADDR_IN_SIN_LEN - this->inet_addr_.in4_.sin_len = sizeof (this->inet_addr_.in4_); -#endif - this->inet_addr_.in4_.sin_family = AF_INET; - this->set_size (sizeof (this->inet_addr_.in4_)); - ACE_OS::memcpy (&this->inet_addr_.in4_.sin_addr, - &ip4, - len); - } -#if defined (ACE_HAS_IPV6) - else if (map == 0) - { - // this->set_type (AF_INET); - this->base_set (AF_INET, sizeof (this->inet_addr_.in4_)); -#ifdef ACE_HAS_SOCKADDR_IN_SIN_LEN - this->inet_addr_.in4_.sin_len = sizeof (this->inet_addr_.in4_); -#endif - this->inet_addr_.in4_.sin_family = AF_INET; - this->set_size (sizeof (this->inet_addr_.in4_)); - ACE_OS::memcpy (&this->inet_addr_.in4_.sin_addr, - &ip4, len); - } - // If given an IPv4 address to copy to an IPv6 object, map it to - // an IPv4-mapped IPv6 address. - else - { - this->base_set (AF_INET6, sizeof (this->inet_addr_.in6_)); -#ifdef ACE_HAS_SOCKADDR_IN6_SIN6_LEN - this->inet_addr_.in6_.sin6_len = sizeof (this->inet_addr_.in6_); -#endif - this->inet_addr_.in6_.sin6_family = AF_INET6; - this->set_size (sizeof (this->inet_addr_.in6_)); - if (ip4 == ACE_HTONL (INADDR_ANY)) - { - in6_addr const ip6 = in6addr_any; - ACE_OS::memcpy (&this->inet_addr_.in6_.sin6_addr, - &ip6, - sizeof (ip6)); - return 0; - } - - // Build up a 128 bit address. An IPv4-mapped IPv6 address - // is defined as 0:0:0:0:0:ffff:IPv4_address. This is defined - // in RFC 1884 */ - ACE_OS::memset (&this->inet_addr_.in6_.sin6_addr, 0, 16); - this->inet_addr_.in6_.sin6_addr.s6_addr[10] = - this->inet_addr_.in6_.sin6_addr.s6_addr[11] = 0xff; - ACE_OS::memcpy - (&this->inet_addr_.in6_.sin6_addr.s6_addr[12], &ip4, 4); - } -#endif /* ACE_HAS_IPV6 */ - return 0; - } /* end if (len == 4) */ -#if defined (ACE_HAS_IPV6) - else if (len == 16) - { - if (this->get_type () != PF_INET6) - { - errno = EAFNOSUPPORT; - return -1; - } - // We protect ourselves up above so IPv6 must be possible here. - this->base_set (AF_INET6, sizeof (this->inet_addr_.in6_)); - this->inet_addr_.in6_.sin6_family = AF_INET6; -#ifdef ACE_HAS_SOCKADDR_IN6_SIN6_LEN - this->inet_addr_.in6_.sin6_len = sizeof (this->inet_addr_.in6_); -#endif - ACE_OS::memcpy (&this->inet_addr_.in6_.sin6_addr, ip_addr, len); - - return 0; - } /* end len == 16 */ -#endif /* ACE_HAS_IPV6 */ - - // Here with an unrecognized length. - errno = EAFNOSUPPORT; - return -1; - -} - -#if (defined (ACE_LINUX) || defined (ACE_WIN32)) && defined (ACE_HAS_IPV6) -int -ACE_INET_Addr::set_interface (const char *intf_name) -{ - if (this->get_type () == PF_INET6 && - (IN6_IS_ADDR_LINKLOCAL (&this->inet_addr_.in6_.sin6_addr) || - IN6_IS_ADDR_MC_LINKLOCAL (&this->inet_addr_.in6_.sin6_addr))) - { -#if defined (ACE_LINUX) - this->inet_addr_.in6_.sin6_scope_id = - ACE_OS::if_nametoindex (intf_name); -#else - this->inet_addr_.in6_.sin6_scope_id = - intf_name ? ACE_OS::atoi (intf_name) : 0; -#endif - // check to see if the interface lookup succeeded - if (this->inet_addr_.in6_.sin6_scope_id != 0) - return 0; - else - return -1; - } - else - return 0; - -} -#endif /* ACE_LINUX && ACE_HAS_IPV6 */ - -const char * -ACE_INET_Addr::get_host_addr (char *dst, int size) const -{ -#if defined (ACE_HAS_IPV6) - if (this->get_type () == AF_INET6) - { - // mcorino@remedy.nl - Aug-26, 2005 - // I don't think this should be done because it results in a decimal address - // representation which is not distinguishable from the IPv4 form which makes - // it impossible to resolve back to an IPv6 INET_Addr without prior knowledge - // that this was such an address to begin with. - - //if (IN6_IS_ADDR_V4MAPPED (&this->inet_addr_.in6_.sin6_addr)) - //{ - // ACE_UINT32 addr; - // addr = this->get_ip_address(); - // addr = ACE_HTONL (addr); - // return ACE_OS::inet_ntop (AF_INET, &addr, dst, size); - //} - -# if defined (ACE_WIN32) - if (0 == ::getnameinfo (reinterpret_cast (&this->inet_addr_.in6_), - this->get_size (), - dst, - size, - 0, 0, // Don't want service name - NI_NUMERICHOST)) - return dst; - ACE_OS::set_errno_to_wsa_last_error (); - return 0; -# else - const char *ch = ACE_OS::inet_ntop (AF_INET6, - &this->inet_addr_.in6_.sin6_addr, - dst, - size); -#if defined (ACE_LINUX) - if ((IN6_IS_ADDR_LINKLOCAL (&this->inet_addr_.in6_.sin6_addr) || - IN6_IS_ADDR_MC_LINKLOCAL (&this->inet_addr_.in6_.sin6_addr)) && - this->inet_addr_.in6_.sin6_scope_id != 0) - { - char scope_buf[32]; - ACE_OS::sprintf (scope_buf, "%%%u", this->inet_addr_.in6_.sin6_scope_id); - if ((ACE_OS::strlen (ch)+ACE_OS::strlen (scope_buf)) < (size_t)size) - { - ACE_OS::strcat (dst, scope_buf); - } - } -#endif - return ch; -# endif /* ACE_WIN32 */ - } -#endif /* ACE_HAS_IPV6 */ - - return ACE_OS::inet_ntop (AF_INET, - &this->inet_addr_.in4_.sin_addr, - dst, - size); -} - -// Return the dotted Internet address. -const char * -ACE_INET_Addr::get_host_addr (void) const -{ - ACE_TRACE ("ACE_INET_Addr::get_host_addr"); -#if defined (ACE_HAS_IPV6) - static char buf[INET6_ADDRSTRLEN]; - return this->get_host_addr (buf, INET6_ADDRSTRLEN); -#else /* ACE_HAS_IPV6 */ - static char buf[INET_ADDRSTRLEN]; - return this->get_host_addr (buf, INET_ADDRSTRLEN); -#endif /* !ACE_HAS_IPV6 */ -} - -// Return the 4-byte IP address, converting it into host byte order. -ACE_UINT32 -ACE_INET_Addr::get_ip_address (void) const -{ - ACE_TRACE ("ACE_INET_Addr::get_ip_address"); -#if defined (ACE_HAS_IPV6) - if (this->get_type () == AF_INET6) - { - if (IN6_IS_ADDR_V4MAPPED (&this->inet_addr_.in6_.sin6_addr) || - IN6_IS_ADDR_V4COMPAT (&this->inet_addr_.in6_.sin6_addr) ) - { - ACE_UINT32 addr; - // Return the last 32 bits of the address - char *thisaddrptr = (char*)this->ip_addr_pointer (); - thisaddrptr += 128/8 - 32/8; - ACE_OS::memcpy (&addr, thisaddrptr, sizeof (addr)); - return ACE_NTOHL (addr); - } - - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE_INET_Addr::get_ip_address: address is a IPv6 address not IPv4\n"))); - errno = EAFNOSUPPORT; - return 0; - } -#endif /* ACE_HAS_IPV6 */ - return ACE_NTOHL (ACE_UINT32 (this->inet_addr_.in4_.sin_addr.s_addr)); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/INET_Addr.h b/dep/acelite/ace/INET_Addr.h deleted file mode 100644 index 3272a96a566..00000000000 --- a/dep/acelite/ace/INET_Addr.h +++ /dev/null @@ -1,390 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file INET_Addr.h - * - * $Id: INET_Addr.h 95533 2012-02-14 22:59:17Z wotte $ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_INET_ADDR_H -#define ACE_INET_ADDR_H -#include /**/ "ace/pre.h" - -#include "ace/Sock_Connect.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Addr.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_INET_Addr - * - * @brief Defines a C++ wrapper facade for the Internet domain address - * family format. - */ -class ACE_Export ACE_INET_Addr : public ACE_Addr -{ -public: - // = Initialization methods. - - /// Default constructor. - ACE_INET_Addr (void); - - /// Copy constructor. - ACE_INET_Addr (const ACE_INET_Addr &); - - /// Creates an ACE_INET_Addr from a sockaddr_in structure. - ACE_INET_Addr (const sockaddr_in *addr, int len); - - /// Creates an ACE_INET_Addr from a @a port_number and the remote - /// @a host_name. The port number is assumed to be in host byte order. - /// To set a port already in network byte order, please @see set(). - /// Use address_family to select IPv6 (PF_INET6) vs. IPv4 (PF_INET). - ACE_INET_Addr (u_short port_number, - const char host_name[], - int address_family = AF_UNSPEC); - - /** - * Initializes an ACE_INET_Addr from the @a address, which can be - * "ip-number:port-number" (e.g., "tango.cs.wustl.edu:1234" or - * "128.252.166.57:1234"). If there is no ':' in the @a address it - * is assumed to be a port number, with the IP address being - * INADDR_ANY. - */ - explicit ACE_INET_Addr (const char address[], - int address_family = AF_UNSPEC); - - /** - * Creates an ACE_INET_Addr from a @a port_number and an Internet - * @a ip_addr. This method assumes that @a port_number and @a ip_addr - * are in host byte order. If you have addressing information in - * network byte order, @see set(). - */ - explicit ACE_INET_Addr (u_short port_number, - ACE_UINT32 ip_addr = INADDR_ANY); - - /// Uses getservbyname() to create an ACE_INET_Addr from a - /// @a port_name, the remote @a host_name, and the @a protocol. - ACE_INET_Addr (const char port_name[], - const char host_name[], - const char protocol[] = "tcp"); - - /** - * Uses getservbyname() to create an ACE_INET_Addr from a - * @a port_name, an Internet @a ip_addr, and the @a protocol. This - * method assumes that @a ip_addr is in host byte order. - */ - ACE_INET_Addr (const char port_name[], - ACE_UINT32 ip_addr, - const char protocol[] = "tcp"); - -#if defined (ACE_HAS_WCHAR) - ACE_INET_Addr (u_short port_number, - const wchar_t host_name[], - int address_family = AF_UNSPEC); - - explicit ACE_INET_Addr (const wchar_t address[], - int address_family = AF_UNSPEC); - - ACE_INET_Addr (const wchar_t port_name[], - const wchar_t host_name[], - const wchar_t protocol[] = ACE_TEXT_WIDE ("tcp")); - - ACE_INET_Addr (const wchar_t port_name[], - ACE_UINT32 ip_addr, - const wchar_t protocol[] = ACE_TEXT_WIDE ("tcp")); -#endif /* ACE_HAS_WCHAR */ - - /// Default dtor. - ~ACE_INET_Addr (void); - - // = Direct initialization methods. - - // These methods are useful after the object has been constructed. - - /// Initializes from another ACE_INET_Addr. - int set (const ACE_INET_Addr &); - - /** - * Initializes an ACE_INET_Addr from a @a port_number and the - * remote @a host_name. If @a encode is non-zero then @a port_number is - * converted into network byte order, otherwise it is assumed to be - * in network byte order already and are passed straight through. - * address_family can be used to select IPv4/IPv6 if the OS has - * IPv6 capability (ACE_HAS_IPV6 is defined). To specify IPv6, use - * the value AF_INET6. To specify IPv4, use AF_INET. - */ - int set (u_short port_number, - const char host_name[], - int encode = 1, - int address_family = AF_UNSPEC); - - /** - * Initializes an ACE_INET_Addr from a @a port_number and an Internet - * @a ip_addr. If @a encode is non-zero then the port number and IP address - * are converted into network byte order, otherwise they are assumed to be - * in network byte order already and are passed straight through. - * - * If @a map is non-zero and IPv6 support has been compiled in, - * then this address will be set to the IPv4-mapped IPv6 address of it. - */ - int set (u_short port_number, - ACE_UINT32 ip_addr = INADDR_ANY, - int encode = 1, - int map = 0); - - /// Uses getservbyname() to initialize an ACE_INET_Addr from a - /// @a port_name, the remote @a host_name, and the @a protocol. - int set (const char port_name[], - const char host_name[], - const char protocol[] = "tcp"); - - /** - * Uses getservbyname() to initialize an ACE_INET_Addr from a - * @a port_name, an @a ip_addr, and the @a protocol. This assumes that - * @a ip_addr is already in network byte order. - */ - int set (const char port_name[], - ACE_UINT32 ip_addr, - const char protocol[] = "tcp"); - - /** - * Initializes an ACE_INET_Addr from the @a addr, which can be - * "ip-number:port-number" (e.g., "tango.cs.wustl.edu:1234" or - * "128.252.166.57:1234"). If there is no ':' in the @a address it - * is assumed to be a port number, with the IP address being - * INADDR_ANY. - */ - int set (const char addr[], int address_family = AF_UNSPEC); - - /// Creates an ACE_INET_Addr from a sockaddr_in structure. - int set (const sockaddr_in *, - int len); - -#if defined (ACE_HAS_WCHAR) - int set (u_short port_number, - const wchar_t host_name[], - int encode = 1, - int address_family = AF_UNSPEC); - - int set (const wchar_t port_name[], - const wchar_t host_name[], - const wchar_t protocol[] = ACE_TEXT_WIDE ("tcp")); - - int set (const wchar_t port_name[], - ACE_UINT32 ip_addr, - const wchar_t protocol[] = ACE_TEXT_WIDE ("tcp")); - - int set (const wchar_t addr[], int address_family = AF_UNSPEC); -#endif /* ACE_HAS_WCHAR */ - - /// Return a pointer to the underlying network address. - virtual void *get_addr (void) const; - int get_addr_size(void) const; - - /// Set a pointer to the address. - virtual void set_addr (void *, int len); - - /// Set a pointer to the address. - virtual void set_addr (void *, int len, int map); - - /** - * Transform the current ACE_INET_Addr address into string format. - * If @a ipaddr_format is ttrue this produces "ip-number:port-number" - * (e.g., "128.252.166.57:1234"), whereas if @a ipaddr_format is false - * this produces "ip-name:port-number" (e.g., - * "tango.cs.wustl.edu:1234"). Returns -1 if the @a size of the - * @a buffer is too small, else 0. - */ - virtual int addr_to_string (ACE_TCHAR buffer[], - size_t size, - int ipaddr_format = 1) const; - - /** - * Initializes an ACE_INET_Addr from the @a address, which can be - * "ip-addr:port-number" (e.g., "tango.cs.wustl.edu:1234"), - * "ip-addr:port-name" (e.g., "tango.cs.wustl.edu:telnet"), - * "ip-number:port-number" (e.g., "128.252.166.57:1234"), or - * "ip-number:port-name" (e.g., "128.252.166.57:telnet"). If there - * is no ':' in the @a address it is assumed to be a port number, - * with the IP address being INADDR_ANY. - */ - virtual int string_to_addr (const char address[], - int address_family = AF_UNSPEC); - -#if defined (ACE_HAS_WCHAR) - /* - virtual int string_to_addr (const char address[]); - */ -#endif /* ACE_HAS_WCHAR */ - - /** - * Sets the port number without affecting the host name. If - * @a encode is enabled then @a port_number is converted into network - * byte order, otherwise it is assumed to be in network byte order - * already and are passed straight through. - */ - void set_port_number (u_short, - int encode = 1); - - /** - * Sets the address without affecting the port number. If - * @a encode is enabled then @a ip_addr is converted into network - * byte order, otherwise it is assumed to be in network byte order - * already and are passed straight through. The size of the address - * is specified in the @a len parameter. - * If @a map is non-zero, IPv6 support has been compiled in, and - * @a ip_addr is an IPv4 address, then this address is set to the IPv4-mapped - * IPv6 address of it. - */ - int set_address (const char *ip_addr, - int len, - int encode = 1, - int map = 0); - -#if (defined (ACE_LINUX) || defined (ACE_WIN32)) && defined (ACE_HAS_IPV6) - /** - * Sets the interface that should be used for this address. This only has - * an effect when the address is link local, otherwise it does nothing. - */ - int set_interface (const char *intf_name); -#endif /* (ACE_LINUX || ACE_WIN32) && ACE_HAS_IPV6 */ - - /// Return the port number, converting it into host byte-order. - u_short get_port_number (void) const; - - /** - * Return the character representation of the name of the host, - * storing it in the @a hostname (which is assumed to be - * @a hostnamelen bytes long). This version is reentrant. If - * @a hostnamelen is greater than 0 then @a hostname will be - * NUL-terminated even if -1 is returned. - */ - int get_host_name (char hostname[], - size_t hostnamelen) const; - -#if defined (ACE_HAS_WCHAR) - int get_host_name (wchar_t hostname[], - size_t hostnamelen) const; -#endif /* ACE_HAS_WCHAR */ - - /** - * Return the character representation of the hostname. This - * version is non-reentrant since it returns a pointer to a static - * data area. You should therefore either (1) do a "deep copy" of - * the address returned by get_host_name(), e.g., using strdup() or - * (2) use the "reentrant" version of get_host_name() described - * above. - */ - const char *get_host_name (void) const; - - /** - * Return the "dotted decimal" Internet address representation of - * the hostname storing it in the @a addr (which is assumed to be - * @a addr_size bytes long). This version is reentrant. - */ - const char *get_host_addr (char *addr, int addr_size) const; - - /** - * Return the "dotted decimal" Internet address representation of - * the hostname. This version is non-reentrant since it returns a - * pointer to a static data area. You should therefore either - * (1) do a "deep copy" of the address returned by get_host_addr(), e.g., - * using strdup() or (2) use the "reentrant" version of - * get_host_addr() described above. - */ - const char *get_host_addr (void) const; - - /// Return the 4-byte IP address, converting it into host byte - /// order. - ACE_UINT32 get_ip_address (void) const; - - /// Return @c true if the IP address is INADDR_ANY or IN6ADDR_ANY. - bool is_any (void) const; - - /// Return @c true if the IP address is IPv4/IPv6 loopback address. - bool is_loopback (void) const; - - /// Return @c true if the IP address is IPv4/IPv6 multicast address. - bool is_multicast (void) const; - -#if defined (ACE_HAS_IPV6) - /// Return @c true if the IP address is IPv6 linklocal address. - bool is_linklocal (void) const; - - /// Return @c true if the IP address is IPv4-mapped IPv6 address. - bool is_ipv4_mapped_ipv6 (void) const; - - /// Return @c true if the IP address is IPv4-compatible IPv6 address. - bool is_ipv4_compat_ipv6 (void) const; -#endif /* ACE_HAS_IPV6 */ - - /** - * Returns @c true if @c this is less than @a rhs. In this context, - * "less than" is defined in terms of IP address and TCP port - * number. This operator makes it possible to use @c ACE_INET_Addrs - * in STL maps. - */ - bool operator < (const ACE_INET_Addr &rhs) const; - - /// Compare two addresses for equality. The addresses are considered - /// equal if they contain the same IP address and port number. - bool operator == (const ACE_INET_Addr &SAP) const; - - /// Compare two addresses for inequality. - bool operator != (const ACE_INET_Addr &SAP) const; - - /// A variation of the equality operator, this method only compares the - /// IP address and ignores the port number. - bool is_ip_equal (const ACE_INET_Addr &SAP) const; - - /// Computes and returns hash value. - virtual u_long hash (void) const; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Insure that @a hostname is properly null-terminated. - int get_host_name_i (char hostname[], size_t hostnamelen) const; - - // Methods to gain access to the actual address of - // the underlying internet address structure. - void *ip_addr_pointer (void) const; - int ip_addr_size (void) const; - int determine_type (void) const; - - /// Initialize underlying inet_addr_ to default values - void reset (void); - - /// Underlying representation. - /// This union uses the knowledge that the two structures share the - /// first member, sa_family (as all sockaddr structures do). - union - { - sockaddr_in in4_; -#if defined (ACE_HAS_IPV6) - sockaddr_in6 in6_; -#endif /* ACE_HAS_IPV6 */ - } inet_addr_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/INET_Addr.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_INET_ADDR_H */ diff --git a/dep/acelite/ace/INET_Addr.inl b/dep/acelite/ace/INET_Addr.inl deleted file mode 100644 index eb3923185a2..00000000000 --- a/dep/acelite/ace/INET_Addr.inl +++ /dev/null @@ -1,252 +0,0 @@ -// -*- C++ -*- -// -// $Id: INET_Addr.inl 96017 2012-08-08 22:18:09Z mitza $ - - -#include "ace/OS_NS_string.h" -#include "ace/Global_Macros.h" -#include "ace/OS_NS_arpa_inet.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE void -ACE_INET_Addr::reset (void) -{ - ACE_OS::memset (&this->inet_addr_, 0, sizeof (this->inet_addr_)); - if (this->get_type() == AF_INET) - { -#ifdef ACE_HAS_SOCKADDR_IN_SIN_LEN - this->inet_addr_.in4_.sin_len = sizeof (this->inet_addr_.in4_); -#endif - this->inet_addr_.in4_.sin_family = AF_INET; - } -#if defined (ACE_HAS_IPV6) - else if (this->get_type() == AF_INET6) - { -#ifdef ACE_HAS_SOCKADDR_IN6_SIN6_LEN - this->inet_addr_.in6_.sin6_len = sizeof (this->inet_addr_.in6_); -#endif - this->inet_addr_.in6_.sin6_family = AF_INET6; - } -#endif /* ACE_HAS_IPV6 */ -} - -ACE_INLINE int -ACE_INET_Addr::determine_type (void) const -{ -#if defined (ACE_HAS_IPV6) -# if defined (ACE_USES_IPV4_IPV6_MIGRATION) - return ACE::ipv6_enabled () ? AF_INET6 : AF_INET; -# else - return AF_INET6; -# endif /* ACE_USES_IPV4_IPV6_MIGRATION */ -#else - return AF_INET; -#endif /* ACE_HAS_IPV6 */ -} - -ACE_INLINE void * -ACE_INET_Addr::ip_addr_pointer (void) const -{ -#if defined (ACE_HAS_IPV6) - if (this->get_type () == PF_INET) - return (void*)&this->inet_addr_.in4_.sin_addr; - else - return (void*)&this->inet_addr_.in6_.sin6_addr; -#else - return (void*)&this->inet_addr_.in4_.sin_addr; -#endif -} - -ACE_INLINE int -ACE_INET_Addr::ip_addr_size (void) const -{ - // Since this size value is used to pass to other host db-type - // functions (gethostbyaddr, etc.) the length is of int type. - // Thus, cast all these sizes back to int. They're all well - // within the range of an int anyway. -#if defined (ACE_HAS_IPV6) - if (this->get_type () == PF_INET) - return static_cast (sizeof this->inet_addr_.in4_.sin_addr); - else - return static_cast (sizeof this->inet_addr_.in6_.sin6_addr); -#else - return static_cast (sizeof this->inet_addr_.in4_.sin_addr.s_addr); -#endif /* ACE_HAS_IPV6 */ -} - -// Return the port number, converting it into host byte order... - -ACE_INLINE u_short -ACE_INET_Addr::get_port_number (void) const -{ - ACE_TRACE ("ACE_INET_Addr::get_port_number"); -#if defined (ACE_HAS_IPV6) - if (this->get_type () == PF_INET) - return ACE_NTOHS (this->inet_addr_.in4_.sin_port); - else - return ACE_NTOHS (this->inet_addr_.in6_.sin6_port); -#else -# if defined (ACE_VXWORKS) && ACE_VXWORKS >= 0x690 - return static_cast (ACE_NTOHS (this->inet_addr_.in4_.sin_port)); -# else - return ACE_NTOHS (this->inet_addr_.in4_.sin_port); -# endif -#endif /* ACE_HAS_IPV6 */ -} - -ACE_INLINE int -ACE_INET_Addr::get_addr_size (void) const -{ - ACE_TRACE ("ACE_INET_Addr::get_addr_size"); -#if defined (ACE_HAS_IPV6) - if (this->get_type () == PF_INET) - return sizeof this->inet_addr_.in4_; - else - return sizeof this->inet_addr_.in6_; -#else - return sizeof this->inet_addr_.in4_; -#endif /* ACE_HAS_IPV6 */ -} - -ACE_INLINE bool -ACE_INET_Addr::operator < (const ACE_INET_Addr &rhs) const -{ -#if defined (ACE_HAS_IPV6) - if (this->get_type() != rhs.get_type()) - { - return this->get_type() < rhs.get_type(); - } - - if (this->get_type() == PF_INET6) - { - int memval = ACE_OS::memcmp (this->ip_addr_pointer(), - rhs.ip_addr_pointer(), - this->ip_addr_size()); - - return memval < 0 - || (memval == 0 - && (this->get_port_number() < rhs.get_port_number() - || (this->get_port_number() == rhs.get_port_number() - && this->inet_addr_.in6_.sin6_scope_id < - rhs.inet_addr_.in6_.sin6_scope_id))); - } -#endif - - return this->get_ip_address () < rhs.get_ip_address () - || (this->get_ip_address () == rhs.get_ip_address () - && this->get_port_number () < rhs.get_port_number ()); -} - -#if defined (ACE_HAS_WCHAR) -ACE_INLINE int -ACE_INET_Addr::set (u_short port_number, - const wchar_t host_name[], - int encode, - int address_family) -{ - return this->set (port_number, - ACE_Wide_To_Ascii (host_name).char_rep (), - encode, - address_family); -} - -ACE_INLINE int -ACE_INET_Addr::set (const wchar_t port_name[], - const wchar_t host_name[], - const wchar_t protocol[]) -{ - return this->set (ACE_Wide_To_Ascii (port_name).char_rep (), - ACE_Wide_To_Ascii (host_name).char_rep (), - ACE_Wide_To_Ascii (protocol).char_rep ()); -} - -ACE_INLINE int -ACE_INET_Addr::set (const wchar_t port_name[], - ACE_UINT32 ip_addr, - const wchar_t protocol[]) -{ - return this->set (ACE_Wide_To_Ascii (port_name).char_rep (), - ip_addr, - ACE_Wide_To_Ascii (protocol).char_rep ()); -} - -ACE_INLINE int -ACE_INET_Addr::set (const wchar_t addr[], int address_family) -{ - return this->set (ACE_Wide_To_Ascii (addr).char_rep (), address_family); -} - -#endif /* ACE_HAS_WCHAR */ - -// Return @c true if the IP address is INADDR_ANY or IN6ADDR_ANY. -ACE_INLINE bool -ACE_INET_Addr::is_any (void) const -{ -#if defined (ACE_HAS_IPV6) - if (this->get_type () == AF_INET6) - return IN6_IS_ADDR_UNSPECIFIED (&this->inet_addr_.in6_.sin6_addr); -#endif /* ACE_HAS_IPV6 */ - - return (this->inet_addr_.in4_.sin_addr.s_addr == INADDR_ANY); -} - -// Return @c true if the IP address is IPv4/IPv6 loopback address. -ACE_INLINE bool -ACE_INET_Addr::is_loopback (void) const -{ -#if defined (ACE_HAS_IPV6) - if (this->get_type () == AF_INET6) - return IN6_IS_ADDR_LOOPBACK (&this->inet_addr_.in6_.sin6_addr); -#endif /* ACE_HAS_IPV6 */ - - // RFC 3330 defines loopback as any address with 127.x.x.x - return ((this->get_ip_address () & 0XFF000000) == (INADDR_LOOPBACK & 0XFF000000)); -} - -// Return @c true if the IP address is IPv4/IPv6 multicast address. -ACE_INLINE bool -ACE_INET_Addr::is_multicast (void) const -{ -#if defined (ACE_HAS_IPV6) - if (this->get_type() == AF_INET6) - return this->inet_addr_.in6_.sin6_addr.s6_addr[0] == 0xFF; -#endif /* ACE_HAS_IPV6 */ - return - (*static_cast ( - static_cast (&this->inet_addr_.in4_.sin_addr.s_addr)) & 0xf0) == 0xe0; -} - -#if defined (ACE_HAS_IPV6) -// Return @c true if the IP address is IPv6 linklocal address. -ACE_INLINE bool -ACE_INET_Addr::is_linklocal (void) const -{ - if (this->get_type () == AF_INET6) - return IN6_IS_ADDR_LINKLOCAL (&this->inet_addr_.in6_.sin6_addr); - - return false; -} - -// Return @c true if the IP address is IPv4 mapped IPv6 address. -ACE_INLINE bool -ACE_INET_Addr::is_ipv4_mapped_ipv6 (void) const -{ - if (this->get_type () == AF_INET6) - return IN6_IS_ADDR_V4MAPPED (&this->inet_addr_.in6_.sin6_addr); - - return false; -} - -// Return @c true if the IP address is IPv4-compatible IPv6 address. -ACE_INLINE bool -ACE_INET_Addr::is_ipv4_compat_ipv6 (void) const -{ - if (this->get_type () == AF_INET6) - return IN6_IS_ADDR_V4COMPAT (&this->inet_addr_.in6_.sin6_addr); - - return false; -} -#endif /* ACE_HAS_IPV6 */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/IOStream.cpp b/dep/acelite/ace/IOStream.cpp deleted file mode 100644 index 59d0191f49f..00000000000 --- a/dep/acelite/ace/IOStream.cpp +++ /dev/null @@ -1,663 +0,0 @@ -// $Id: IOStream.cpp 93359 2011-02-11 11:33:12Z mcorino $ - -#ifndef ACE_IOSTREAM_CPP -#define ACE_IOSTREAM_CPP - -#include "ace/IOStream.h" - -#if !defined (ACE_LACKS_ACE_IOSTREAM) - -# include "ace/OS_NS_errno.h" -# include "ace/OS_Memory.h" - -/////////////////////////////////////////////////////////////////////////// - -/* Here's a simple example of how iostream's non-virtual operators can - get you in a mess: - - class myiostream : public iostream - { - public: - myiostream& operator>> (String & s) - { - ... - } - }; - - ... - - int i; - String s; - myiostream foo (...); - - foo >> s; - // OK - // invokes myiostream::operator>> (String&) returning myiostream& - - foo >> i; - // OK - // invokes iostream::operator>> (int&) returning iostream& - - foo >> i >> s; - // BAD - // invokes iostream::operator>> (int&) then iostream::operator>> (String&) - // - // What has happened is that the first >> is invoked on the base class and returns - // a reference to iostream. The second >> has no idea of the ACE_IOStream and - // gets invoked on iostream. Probably NOT what you wanted! - - - // In order to make all of this work the way you want, you have to do this: - - class myiostream : public iostream - { - public: - myiostream& operator>> (int & i) - { - return ((myiostream&)iostream::operator>> (i)); - } - - myiostream& operator>> (String & s) - { - ... - } - }; - - ... - - int i; - String s; - myiostream foo (...); - - foo >> s; - // OK - // invokes myiostream::operator>> (String&) returning myiostream& - - foo >> i; - // OK - // invokes myiostream::operator>> (int&) returning myiostream& - - - foo >> i >> s; - // OK - // Because you provided operator>> (int&) in class myiostream, that - // function will be invoked by the first >>. Since it returns - // a myiostream&, the second >> will be invoked as desired. */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_HANDLE -ACE_Streambuf::get_handle (void) -{ - return 0; -} - -ACE_Time_Value * -ACE_Streambuf::recv_timeout (ACE_Time_Value *tv) -{ - ACE_Time_Value * rval = recv_timeout_; - if (tv) - { - recv_timeout_value_ = *tv; - recv_timeout_ = &recv_timeout_value_; - } - else - recv_timeout_ = 0; - - return rval; -} - -int -ACE_Streambuf::underflow (void) -{ - // If input mode is not set, any attempt to read from the stream is - // a failure. - - if (ACE_BIT_DISABLED (mode_, ios::in)) - return EOF; - - // If base () is empty then this is the first time any get/put - // operation has been attempted on the stream. - - if (!this->base ()) - { - // Set base () to use our private read buffer. The arguments are: - // beginning of the buffer (base ()) - // one-beyond the end of the buffer (ebase ()) - // should base () be deleted on destruction - // - // We have to say "no" to the third parameter because we want to - // explicitly handle deletion of the TWO buffers at destruction. - - setb (this->eback_saved_, - this->eback_saved_ + streambuf_size_, 0); - - // Remember that we are now in getMode. This will help us if - // we're called prior to a mode change as well as helping us - // when the mode does change. - this->cur_mode_ = this->get_mode_; - // Using the new values for base (), initialize the get area. - // This simply sets eback (), gptr () and egptr () described - // earlier. - setg (base (), base (), base ()); - - // Set the put buffer such that puts will be disabled. Any - // attempt to put data will now cause overflow to be invoked. - setp (0, 0); - } - else // base () has been initialized already... - { - // If we are in put_mode_ now, then it is time to switch to get_mode_ - // - // 1. get rid of any pending output - // 2. rearrange base () to use our half of the buffer - // 3. reset the mode - // - if (this->cur_mode_ == this->put_mode_) - { - // Dump any pending output to the peer. This is not really - // necessary because of the dual-buffer arrangement we've - // set up but intuitively it makes sense to send the pending - // data before we request data since the peer will probably - // need what we're sending before it can respond. - if (out_waiting () && syncout () == EOF) - return EOF; - - if( ! pbase() ) - { - delete [] pbase_saved_; - (void) reset_put_buffer(); - } - else - { - // We're about to disable put mode but before we do - // that, we want to preserve it's state. - this->pbase_saved_ = pbase (); - this->pptr_saved_ = pptr (); - this->epptr_saved_ = epptr (); - } - - // Disable put mode as described in the constructor. - setp (0, 0); - - // Like the case where base () is false, we now point base - // () to use our private get buffer. - setb (this->eback_saved_, - this->eback_saved_ + streambuf_size_, - 0); - - // And restore the previous state of the get pointers. - - setg (this->eback_saved_, this->gptr_saved_, - this->egptr_saved_); - - // Finally, set our mode so that we don't get back into this - // if () and so that overflow can operate correctly. - cur_mode_ = get_mode_; - } - - // There could be data in the input buffer if we switched to put - // mode before reading everything. In that case, we take this - // opportunity to feed it back to the iostream. - if (in_avail ()) - // Remember that we return an int so that we can give back - // EOF. The explicit cast prevents us from returning a signed - // char when we're not returning EOF. - return (u_char) *gptr (); - } - - // We really shouldn't be here unless there is a lack of data in the - // read buffer. So... go get some more data from the peer. - - int result = fillbuf (); - - // Fillbuf will give us EOF if there was an error with the peer. In - // that case, we can do no more input. - - if (EOF == result) - { - // Disable ourselves and return failure to the iostream. That - // should result in a call to have oursleves closed. - setg (0, 0, 0); - return EOF; - } - - // Return the next available character in the input buffer. Again, - // we protect against sign extension. - - return (u_char) *gptr (); -} - -// Much of this is similar to underflow. I'll just hit the highlights -// rather than repeating a lot of what you've already seen. - -int -ACE_Streambuf::overflow (int c) -{ - // Check to see if output is allowed at all. - if (! (mode_ & ios::out)) - return EOF; - - if (!base ()) - { - // Set base () to use put's private buffer. - // - setb (this->pbase_saved_, - this->pbase_saved_ + streambuf_size_, 0); - - // Set the mode for optimization. - this->cur_mode_ = this->put_mode_; - // Set the put area using the new base () values. - setp (base (), ebuf ()); - - // Disable the get area. - setg (0, 0, 0); - } - else // We're already reading or writing - { - // If we're coming out of get mode... - if (this->cur_mode_ == this->get_mode_) - { - // --> JCEJ 6/6/98 - if (! eback()) - { - /* Something has happened to cause the streambuf - to get rid of our get area. - We could probably do this a bit cleaner but - this method is sure to cleanup the bits and - pieces. - */ - delete [] eback_saved_; - (void) reset_get_buffer(); - } - else - { - // Save the current get mode values - this->eback_saved_ = eback (); - this->gptr_saved_ = gptr (); - this->egptr_saved_ = egptr (); - } - // <-- JCEJ 6/6/98 - - // then disable the get buffer - setg (0, 0, 0); - - // Reconfigure base () and restore the put pointers. - setb (pbase_saved_, pbase_saved_ + streambuf_size_, 0); - setp (base (), ebuf ()); - - // Save the new mode. - this->cur_mode_ = this->put_mode_; - } - - // If there is output to be flushed, do so now. We shouldn't - // get here unless this is the case... - - if (out_waiting () && EOF == syncout ()) - return EOF; - } - - // If we're not putting EOF, then we have to deal with the character - // that is being put. Perhaps we should do something special with EOF??? - - if (c != EOF) - { - // We've already written any data that may have been in the - // buffer, so we're guaranteed to have room in the buffer for - // this new information. So... we add it to the buffer and - // adjust our 'next' pointer acordingly. - *pptr () = (char) c; - pbump (1); - } - - return 0; -} - -// syncin - -int -ACE_Streambuf::syncin (void) -{ - // As discussed, there really isn't any way to sync input from a - // socket-like device. We specifially override this base-class - // function so that it won't do anything evil to us. - return 0; -} - -// syncout - -int -ACE_Streambuf::syncout (void) -{ - // Unlike syncin, syncout is a doable thing. All we have to do is - // write whatever is in the output buffer to the peer. flushbuf () - // is how we do it. - - if (flushbuf () == EOF) - return EOF; - else - return 0; -} - -int -ACE_Streambuf::sync (void) -{ - // sync () is fairly traditional in that it syncs both input and - // output. We could have omitted the call to syncin () but someday, - // we may want it to do something. - - syncin (); - - // Don't bother syncing the output unless there is data to be - // sent... - - if (out_waiting ()) - return syncout (); - else - return 0; -} - -// flushbuf - -int -ACE_Streambuf::flushbuf (void) -{ - // pptr () is one character beyond the last character put into the - // buffer. pbase () points to the beginning of the put buffer. - // Unless pptr () is greater than pbase () there is nothing to be - // sent to the peer. - - if (pptr () <= pbase ()) - return 0; - - // 4/12/97 -- JCEJ - // Kludge!!! - // If the remote side shuts down the connection, an attempt to send - // () to the remote will result in the message 'Broken Pipe' I think - // this is an OS message, I've tracked it down to the ACE_OS::write - // () function. That's the last one to be called before the - // message. I can only test this on Linux though, so I don't know - // how other systems will react. - // - // To get around this gracefully, I do a PEEK recv () with an - // immediate (nearly) timeout. recv () is much more graceful on - // it's failure. If we get -1 from recv () not due to timeout then - // we know we're SOL. - // - // Q: Is 'errno' threadsafe? Should the section below be a - // critical section? - // - // char tbuf[1]; - // ACE_Time_Value to (0,1); - // if (this->recv (tbuf, 1, MSG_PEEK, &to) == -1) - // { - // if (errno != ETIME) - // { - // perror ("OOPS preparing to send to peer"); - // return EOF; - // } - // } - // - // The correct way to handle this is for the application to trap - // (and ignore?) SIGPIPE. Thanks to Amos Shapira for reminding me - // of this. - - // Starting at the beginning of the buffer, send as much data as - // there is waiting. send guarantees that all of the data will be - // sent or an error will be returned. - - if (this->send (pbase (), pptr () - pbase ()) == -1) - return EOF; - - // Now that we've sent everything in the output buffer, we reset the - // buffer pointers to appear empty. - setp (base (), ebuf ()); - - return 0; -} - -int -ACE_Streambuf::get_one_byte (void) -{ - this->timeout_ = 0; - - // The recv function will return immediately if there is no data - // waiting. So, we use recv_n to wait for exactly one byte to come - // from the peer. Later, we can use recv to see if there is - // anything else in the buffer. (Ok, we could use flags to tell it - // to block but I like this better.) - - if (this->recv_n (base (), 1, MSG_PEEK, this->recv_timeout_) != 1) - { - if (errno == ETIME) - this->timeout_ = 1; - return EOF; - } - else - return 1; -} - -// This will be called when the read (get) buffer has been exhausted -// (ie -- gptr == egptr). - -int -ACE_Streambuf::fillbuf (void) -{ - // Invoke recv_n to get exactly one byte from the remote. This will - // block until something shows up. - - if (get_one_byte () == EOF) - return EOF; - - // Now, get whatever else may be in the buffer. This will return if - // there is nothing in the buffer. - - int bc = this->recv (base (), blen (), this->recv_timeout_); - - // recv will give us -1 if there was a problem. If there was - // nothing waiting to be read, it will give us 0. That isn't an - // error. - - if (bc < 0) - { - if (errno == ETIME) - this->timeout_ = 1; - return EOF; - } - - // Move the get pointer to reflect the number of bytes we just read. - - setg (base (), base (), base () + bc); - - // Return the byte-read-count including the one from . - return bc; -} - -ACE_Streambuf::ACE_Streambuf (u_int streambuf_size, int io_mode) - : eback_saved_ (0), // to avoid Purify UMR - pbase_saved_ (0), // to avoid Purify UMR - get_mode_ (1), - put_mode_ (2), - mode_ (io_mode), - streambuf_size_ (streambuf_size), - recv_timeout_ (0) -{ - (void)reset_get_buffer (); - (void)reset_put_buffer (); -} - -u_int -ACE_Streambuf::streambuf_size (void) -{ - return streambuf_size_; -} - -// Return the number of bytes not yet gotten. eback + get_waiting = -// gptr. - -u_int -ACE_Streambuf::get_waiting (void) -{ - return this->gptr_saved_ - this->eback_saved_; -} - -// Return the number of bytes in the get area (includes some already -// gotten); eback + get_avail = egptr. - -u_int -ACE_Streambuf::get_avail (void) -{ - return this->egptr_saved_ - this->eback_saved_; -} - -// Return the number of bytes to be 'put' onto the stream media. -// pbase + put_avail = pptr. - -u_int -ACE_Streambuf::put_avail (void) -{ - return this->pptr_saved_ - this->pbase_saved_; -} - -// Typical usage: -// -// u_int newGptr = otherStream->get_waiting (); -// u_int newEgptr = otherStream->get_avail (); -// char * newBuf = otherStream->reset_get_buffer (); -// char * oldgetbuf = myStream->reset_get_buffer (newBuf, otherStream->streambuf_size (), newGptr, newEgptr); -// -// 'myStream' now has the get buffer of 'otherStream' and can use it in any way. -// 'otherStream' now has a new, empty get buffer. - -char * -ACE_Streambuf::reset_get_buffer (char *newBuffer, - u_int _streambuf_size, - u_int _gptr, - u_int _egptr) -{ - char * rval = this->eback_saved_; - - // The get area is where the iostream will get data from. This is - // our read buffer. There are three pointers which describe the - // read buffer: - // - // eback () - The beginning of the buffer. Also the furthest - // point at which putbacks can be done. Hence the name. - // - // gptr () - Where the next character is to be got from. - // - // egptr () - One position beyond the last get-able character. - // - // So that we can switch quicky from read to write mode without - // any data copying, we keep copies of these three pointers in - // the variables below. Initially, they all point to the beginning - // of our read-dedicated buffer. - // - if (newBuffer) - { - if (streambuf_size_ != _streambuf_size) - return 0; - this->eback_saved_ = newBuffer; - } - else - ACE_NEW_RETURN (this->eback_saved_, - char[streambuf_size_], - 0); - - this->gptr_saved_ = this->eback_saved_ + _gptr; - this->egptr_saved_ = this->eback_saved_ + _egptr; - - // Disable the get area initially. This will cause underflow to be - // invoked on the first get operation. - setg (0, 0, 0); - - reset_base (); - - return rval; -} - -// Typical usage: -// -// u_int newPptr = otherStream->put_avail (); -// char * newBuf = otherStream->reset_put_buffer (); -// char * oldputbuf = otherStream->reset_put_buffer (newBuf, otherStream->streambuf_size (), newPptr); - -char * -ACE_Streambuf::reset_put_buffer (char *newBuffer, - u_int _streambuf_size, - u_int _pptr) -{ - char *rval = this->pbase_saved_; - - // The put area is where the iostream will put data that needs to be - // sent to the peer. This becomes our write buffer. The three - // pointers which maintain this area are: - // - // pbase () - The beginning of the put area. - // - // pptr () - Where the next character is to be put. - // - // epptr () - One beyond the last valid position for putting. - // - // Again to switch quickly between modes, we keep copies of - // these three pointers. - // - if (newBuffer) - { - if (streambuf_size_ != _streambuf_size) - return 0; - this->pbase_saved_ = newBuffer; - } - else - ACE_NEW_RETURN (this->pbase_saved_, - char[streambuf_size_], - 0); - - this->pptr_saved_ = this->pbase_saved_ + _pptr; - this->epptr_saved_ = this->pbase_saved_ + streambuf_size_; - - // Disable the put area. Overflow will be called by the first call - // to any put operator. - setp (0, 0); - - reset_base (); - - return rval; -} - -void -ACE_Streambuf::reset_base (void) -{ - // Until we experience the first get or put operation, we do not - // know what our current IO mode is. - this->cur_mode_ = 0; - - // The common area used for reading and writting is called "base". - // We initialize it this way so that the first get/put operation - // will have to "allocate" base. This allocation will set base to - // the appropriate specific buffer and set the mode to the correct - // value. - setb (0, 0); -} - -// If the default allocation strategey were used the common buffer -// would be deleted when the object destructs. Since we are providing -// separate read/write buffers, it is up to us to manage their memory. - -ACE_Streambuf::~ACE_Streambuf (void) -{ - delete [] this->eback_saved_; - delete [] this->pbase_saved_; -} - -u_char ACE_Streambuf::timeout (void) -{ - u_char rval = this->timeout_; - this->timeout_ = 0; - return rval; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* !ACE_LACKS_ACE_IOSTREAM */ -#endif /* ACE_IOSTREAM_CPP */ diff --git a/dep/acelite/ace/IOStream.h b/dep/acelite/ace/IOStream.h deleted file mode 100644 index 97bbc23b712..00000000000 --- a/dep/acelite/ace/IOStream.h +++ /dev/null @@ -1,504 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file IOStream.h - * - * $Id: IOStream.h 93359 2011-02-11 11:33:12Z mcorino $ - * - * @author James CE Johnson - * @author Jim Crossley - */ -//============================================================================= - -#ifndef ACE_IOSTREAM_H -#define ACE_IOSTREAM_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// Needed on Windows for streambuf -// FUZZ: disable check_for_streams_include -#include "ace/streams.h" - -// This is a temporary restriction - ACE_IOStream is only enabled if the -// compiler does not supply the standard C++ library (and standard iostreams) -// or, if it does, the platform is explicitly set to use old iostreams -// by its config.h file. -// This restriction is recorded in Bugzilla entry 857. -#if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && (ACE_HAS_STANDARD_CPP_LIBRARY == 1) -# if !defined (ACE_USES_OLD_IOSTREAMS) && !defined (ACE_LACKS_ACE_IOSTREAM) -# define ACE_LACKS_ACE_IOSTREAM -# endif /* !ACE_USES_OLD_IOSTREAMS && !ACE_LACKS_ACE_IOSTREAM */ -#endif /* ACE_HAS_STANDARD_CPP_LIBRARY */ - -#if !defined (ACE_LACKS_ACE_IOSTREAM) - -# if defined (ACE_HAS_STRING_CLASS) -# if defined (ACE_WIN32) && defined (_MSC_VER) -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef CString ACE_IOStream_String; -ACE_END_VERSIONED_NAMESPACE_DECL -# else -# if !defined (ACE_HAS_STDCPP_STL_INCLUDES) -#include /**/ -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef String ACE_IOStream_String; -ACE_END_VERSIONED_NAMESPACE_DECL -# else -# include /**/ - -# if defined(ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef std::string ACE_IOStream_String; -ACE_END_VERSIONED_NAMESPACE_DECL -# else -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef string ACE_IOStream_String; -ACE_END_VERSIONED_NAMESPACE_DECL -# endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ -# endif /* ! ACE_HAS_STDCPP_STL_INCLUDES */ -# endif /* ACE_WIN32 && defined (_MSC_VER) */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Export ACE_Quoted_String : public ACE_IOStream_String -{ -public: - inline ACE_Quoted_String (void) { *this = ""; } - inline ACE_Quoted_String (const char *c) { *this = ACE_IOStream_String (c); } - inline ACE_Quoted_String (const ACE_IOStream_String &s) { *this = s; } - inline ACE_Quoted_String &operator= (const ACE_IOStream_String& s) - { - return (ACE_Quoted_String &) ACE_IOStream_String::operator= (s); - } - inline ACE_Quoted_String &operator = (const char c) { - return (ACE_Quoted_String &) ACE_IOStream_String::operator= (c); - } - inline ACE_Quoted_String &operator = (const char *c) { - return (ACE_Quoted_String &) ACE_IOStream_String::operator= (c); - } - inline bool operator < (const ACE_Quoted_String &s) const { - return *(ACE_IOStream_String *) this < (ACE_IOStream_String) s; - } -# if defined (ACE_WIN32) && defined (_MSC_VER) - inline int length (void) { return this->GetLength (); } -# endif /* ACE_WIN32 && defined (_MSC_VER) */ -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -# endif /* ACE_HAS_STRING_CLASS */ - -# include "ace/Time_Value.h" -# include "ace/os_include/sys/os_types.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Streambuf - * - * @brief Create your custom streambuf by providing and ACE_*_Stream - * object to this template. I have tested it with - * ACE_SOCK_Stream and it should work fine for others as well. - * - * For any iostream object, the real work is done by the - * underlying streambuf class. That is what we create here. - * A streambuf has an internal buffer area into which data is - * read and written as the iostream requests and provides data. - * At some point during the read process, the iostream will - * realize that the streambuf has no more data. The underflow - * function of the streambuf is then called. - * Likewise, during the write process, the iostream will - * eventually notice that the streabuf's buffer has become full - * and will invoke the overflow function. - * The empty/full state of the read/write "buffers" are - * controled by two sets pointers. One set is dedicated to - * read, the other to write. These pointers, in turn, reference - * a common buffer that is to be shared by both read and write - * operations. It is this common buffer to which data is - * written and from which it is read. - * The common buffer is used by functions of the streambuf as - * well as the iostream. Because of this and the fact that it - * is "shared" by both read and write operators, there is a - * danger of data corruption if read and write operations are - * allowed to take place "at the same time". - * To prevent data corruption, we manipulate the read and write - * pointer sets so that the streambuf is in either a read-mode - * or write-mode at all times and can never be in both modes at - * the same time. - * In the constructor: set the read and write sets to NULL This - * causes the underflow or overflow operators to be invoked at - * the first IO activity of the iostream. - * In the underflow function we arrange for the common buffer to - * reference our read buffer and for the write pointer set to be - * disabled. If a write operation is performed by the iostream - * this will cause the overflow function to be invoked. - * In the overflow function we arrange for the common buffer to - * reference our write buffer and for the read pointer set to be - * disabled. This causes the underflow function to be invoked - * when the iostream "changes our mode". - * The overflow function will also invoke the send_n function to - * flush the buffered data to our peer. Similarly, the sync and - * syncout functions will cause send_n to be invoked to send the - * data. - * Since socket's and the like do not support seeking, there can - * be no method for "syncing" the input. However, since we - * maintain separate read/write buffers, no data is lost by - * "syncing" the input. It simply remains buffered. - */ -class ACE_Export ACE_Streambuf : public streambuf -{ -public: - - /** - * If the default allocation strategy were used the common buffer - * would be deleted when the object destructs. Since we are - * providing separate read/write buffers, it is up to us to manage - * their memory. - */ - virtual ~ACE_Streambuf (void); - - /// Get the current Time_Value pointer and provide a new one. - ACE_Time_Value *recv_timeout (ACE_Time_Value *tv = 0); - - /** - * Use this to allocate a new/different buffer for put operations. - * If you do not provide a buffer pointer, one will be allocated. - * That is the preferred method. If you do provide a buffer, the - * size must match that being used by the get buffer. If - * successful, you will receive a pointer to the current put buffer. - * It is your responsibility to delete this memory when you are done - * with it. - */ - char *reset_put_buffer (char *newBuffer = 0, - u_int _streambuf_size = 0, - u_int _pptr = 0 ); - - /// Return the number of bytes to be 'put' onto the stream media. - /// pbase + put_avail = pptr - u_int put_avail (void); - - /** - * Use this to allocate a new/different buffer for get operations. - * If you do not provide a buffer pointer, one will be allocated. - * That is the preferred method. If you do provide a buffer, the - * size must match that being used by the put buffer. If - * successful, you will receive a pointer to the current get buffer. - * It is your responsibility to delete this memory when you are done - * with it. - */ - char *reset_get_buffer (char *newBuffer = 0, - u_int _streambuf_size = 0, - u_int _gptr = 0, - u_int _egptr = 0); - - /// Return the number of bytes not yet gotten. eback + get_waiting = - /// gptr - u_int get_waiting (void); - - /// Return the number of bytes in the get area (includes some already - /// gotten); eback + get_avail = egptr - u_int get_avail (void); - - /// Query the streambuf for the size of its buffers. - u_int streambuf_size (void); - - /// Did we take an error because of an IO operation timeout? - /// @note Invoking this resets the flag. - u_char timeout (void); - -protected: - ACE_Streambuf (u_int streambuf_size, - int io_mode); - - /// Sync both input and output. See syncin/syncout below for - /// descriptions. - virtual int sync (void); - - // = Signatures for the underflow/overflow discussed above. - virtual int underflow (void); - - /// The overflow function receives the character which caused the - /// overflow. - virtual int overflow (int c = EOF); - - /// Resets the pointer and streambuf mode. This is used - /// internally when get/put buffers are allocatd. - void reset_base (void); - -protected: - // = Two pointer sets for manipulating the read/write areas. - char *eback_saved_; - char *gptr_saved_; - char *egptr_saved_; - char *pbase_saved_; - char *pptr_saved_; - char *epptr_saved_; - - // = With cur_mode_ we keep track of our current IO mode. - - // This helps us to optimize the underflow/overflow functions. - u_char cur_mode_; - const u_char get_mode_; - const u_char put_mode_; - - /// mode tells us if we're working for an istream, ostream, or - /// iostream. - int mode_; - - /// This defines the size of the input and output buffers. It can be - /// set by the object constructor. - const u_int streambuf_size_; - - /// Did we take an error because of an IO operation timeout? - u_char timeout_; - - /// We want to allow the user to provide Time_Value pointers to - /// prevent infinite blocking while waiting to receive data. - ACE_Time_Value recv_timeout_value_; - ACE_Time_Value *recv_timeout_; - - /** - * syncin is called when the input needs to be synced with the - * source file. In a filebuf, this results in the system - * call being used. We can't do that on socket-like connections, so - * this does basically nothing. That's safe because we have a - * separate read buffer to maintain the already-read data. In a - * filebuf, the single common buffer is used forcing the - * call. - */ - int syncin (void); - - /// syncout() is called when the output needs to be flushed. This is - /// easily done by calling the peer's send_n function. - int syncout (void); - - /// flushbuf() is the worker of syncout. It is a separate function - /// because it gets used sometimes in different context. - int flushbuf (void); - - /** - * fillbuf is called in a couple of places. This is the worker of - * underflow. It will attempt to fill the read buffer from the - * peer. - */ - int fillbuf (void); - - /** - * Used by fillbuf and others to get exactly one byte from the peer. - * recv_n is used to be sure we block until something is available. - * It is virtual because we really need to override it for - * datagram-derived objects. - */ - virtual int get_one_byte (void); - - /** - * Stream connections and "unconnected connections" (ie -- - * datagrams) need to work just a little differently. We derive - * custom Streambuf objects for them and provide these functions at - * that time. - */ - virtual ssize_t send (char *buf, - ssize_t len) = 0; - virtual ssize_t recv (char *buf, - ssize_t len, - ACE_Time_Value *tv = 0) = 0; - virtual ssize_t recv (char *buf, - ssize_t len, - int flags, - ACE_Time_Value *tv = 0) = 0; - virtual ssize_t recv_n (char *buf, - ssize_t len, - int flags = 0, - ACE_Time_Value *tv = 0) = 0; - - virtual ACE_HANDLE get_handle (void); - -# if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && (ACE_HAS_STANDARD_CPP_LIBRARY != 0) && !defined (ACE_USES_OLD_IOSTREAMS) - char *base (void) const - { - return cur_mode_ == get_mode_ ? eback_saved_ - : cur_mode_ == put_mode_ ? pbase_saved_ - : 0; - } - char *ebuf (void) const - { - return cur_mode_ == 0 ? 0 : base () + streambuf_size_; - } - - int blen (void) const - { - return streambuf_size_; - } - - void setb (char* b, char* eb, int /* a */=0) - { - setbuf (b, (eb - b)); - } - - int out_waiting (void) - { - return pptr () - pbase (); - } -# endif /* ACE_HAS_STANDARD_CPP_LIBRARY */ -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -/////////////////////////////////////////////////////////////////////////// - -// These typedefs are provided by G++ (on some systems?) without the -// trailing '_'. Since we can't count on 'em, I've defined them to -// what GNU wants here. -// -typedef ios& (*__manip_)(ios&); -typedef istream& (*__imanip_)(istream&); -typedef ostream& (*__omanip_)(ostream&); - -// Trying to do something like is shown below instead of using the -// __*manip typedefs causes Linux do segfault when "< and functions are used. - -#define GET_SIG(MT,DT) inline virtual MT& operator>> (DT v) -# if (defined (__SUNPRO_CC) && __SUNPRO_CC > 0x510) -#define GET_CODE { \ - if (ipfx (0)) \ - { \ - (*((istream*)this)) >> (v); \ - } \ - isfx (); \ - return *this; \ - } -# else -#define GET_CODE { \ - if (ipfx (0)) \ - { \ - iostream::operator>> (v); \ - } \ - isfx (); \ - return *this; \ - } -# endif -#define GET_PROT(MT,DT,CODE) GET_SIG(MT,DT) CODE -#define GET_FUNC(MT,DT) GET_PROT(MT,DT,GET_CODE) - -// This macro defines the put operator for class MT into datatype DT. -// We will use it below to quickly override most (all?) iostream put -// operators. Notice how the and functions are used. - -#define PUT_SIG(MT,DT) inline virtual MT& operator<< (DT v) -# if (defined (__SUNPRO_CC) && __SUNPRO_CC > 0x510) -#define PUT_CODE { \ - if (opfx ()) \ - { \ - (*((ostream *) this)) << (v); \ - } \ - osfx (); \ - return *this; \ - } -# else -#define PUT_CODE { \ - if (opfx ()) \ - { \ - iostream::operator<< (v); \ - } \ - osfx (); \ - return *this; \ - } -# endif -#define PUT_PROT(MT,DT,CODE) PUT_SIG(MT,DT) CODE -#define PUT_FUNC(MT,DT) PUT_PROT(MT,DT,PUT_CODE) - - -// These are necessary in case somebody wants to derive from us and -// override one of these with a custom approach. - -# if defined (ACE_LACKS_CHAR_RIGHT_SHIFTS) -#define GET_FUNC_SET0(MT,CODE,CODE2) \ - GET_PROT(MT,short &,CODE) \ - GET_PROT(MT,u_short &,CODE) \ - GET_PROT(MT,int &,CODE) \ - GET_PROT(MT,u_int &,CODE) \ - GET_PROT(MT,long &,CODE) \ - GET_PROT(MT,u_long &,CODE) \ - GET_PROT(MT,float &,CODE) \ - GET_PROT(MT,double &,CODE) \ - inline virtual MT& operator>>(__omanip_ func) CODE2 \ - inline virtual MT& operator>>(__manip_ func) CODE2 -# else -#define GET_FUNC_SET0(MT,CODE,CODE2) \ - GET_PROT(MT,short &,CODE) \ - GET_PROT(MT,u_short &,CODE) \ - GET_PROT(MT,int &,CODE) \ - GET_PROT(MT,u_int &,CODE) \ - GET_PROT(MT,long &,CODE) \ - GET_PROT(MT,u_long &,CODE) \ - GET_PROT(MT,float &,CODE) \ - GET_PROT(MT,double &,CODE) \ - GET_PROT(MT,char &,CODE) \ - GET_PROT(MT,u_char &,CODE) \ - GET_PROT(MT,char *,CODE) \ - GET_PROT(MT,u_char *,CODE) \ - inline virtual MT& operator>>(__omanip_ func) CODE2 \ - inline virtual MT& operator>>(__manip_ func) CODE2 -# endif - -#define PUT_FUNC_SET0(MT,CODE,CODE2) \ - PUT_PROT(MT,short,CODE) \ - PUT_PROT(MT,u_short,CODE) \ - PUT_PROT(MT,int,CODE) \ - PUT_PROT(MT,u_int,CODE) \ - PUT_PROT(MT,long,CODE) \ - PUT_PROT(MT,u_long,CODE) \ - PUT_PROT(MT,float,CODE) \ - PUT_PROT(MT,double,CODE) \ - PUT_PROT(MT,char,CODE) \ - PUT_PROT(MT,u_char,CODE) \ - PUT_PROT(MT,const char *,CODE) \ - PUT_PROT(MT,u_char *,CODE) \ - PUT_PROT(MT,void *,CODE) \ - inline virtual MT& operator<<(__omanip_ func) CODE2 \ - inline virtual MT& operator<<(__manip_ func) CODE2 - -# if defined (ACE_LACKS_SIGNED_CHAR) - #define GET_FUNC_SET1(MT,CODE,CODE2) GET_FUNC_SET0(MT,CODE,CODE2) - #define PUT_FUNC_SET1(MT,CODE,CODE2) PUT_FUNC_SET0(MT,CODE,CODE2) -# else - #define GET_FUNC_SET1(MT,CODE,CODE2) \ - GET_PROT(MT,signed char &,CODE) \ - GET_PROT(MT,signed char *,CODE) \ - GET_FUNC_SET0(MT,CODE,CODE2) - - #define PUT_FUNC_SET1(MT,CODE,CODE2) \ - PUT_FUNC(MT,signed char) \ - PUT_FUNC(MT,const signed char *) \ - PUT_FUNC_SET0(MT,CODE,CODE2) -# endif /* ACE_LACKS_SIGNED_CHAR */ - -#define GET_MANIP_CODE { if (ipfx ()) { (*func) (*this); } isfx (); return *this; } -#define PUT_MANIP_CODE { if (opfx ()) { (*func) (*this); } osfx (); return *this; } - -#define GET_FUNC_SET(MT) GET_FUNC_SET1(MT,GET_CODE,GET_MANIP_CODE) -#define PUT_FUNC_SET(MT) PUT_FUNC_SET1(MT,PUT_CODE,PUT_MANIP_CODE) -#define GETPUT_FUNC_SET(MT) GET_FUNC_SET(MT) PUT_FUNC_SET(MT) - -#define GET_SIG_SET(MT) GET_FUNC_SET1(MT,= 0;,= 0;) -#define PUT_SIG_SET(MT) PUT_FUNC_SET1(MT,= 0;,= 0;) -#define GETPUT_SIG_SET(MT) GET_SIG_SET(MT) PUT_SIG_SET(MT) - -// Include the templates here. -# include "ace/IOStream_T.h" -#endif /* !ACE_LACKS_ACE_IOSTREAM && ACE_USES_OLD_IOSTREAMS */ - -#include /**/ "ace/post.h" -#endif /* ACE_IOSTREAM_H */ diff --git a/dep/acelite/ace/IOStream_T.cpp b/dep/acelite/ace/IOStream_T.cpp deleted file mode 100644 index 3e7817d7c61..00000000000 --- a/dep/acelite/ace/IOStream_T.cpp +++ /dev/null @@ -1,247 +0,0 @@ -// $Id: IOStream_T.cpp 80826 2008-03-04 14:51:23Z wotte $ - -#ifndef ACE_IOSTREAM_T_CPP -#define ACE_IOSTREAM_T_CPP - -#include "ace/IOStream_T.h" -#include "ace/OS_Memory.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_ACE_IOSTREAM) - -#if !defined (__ACE_INLINE__) -#include "ace/IOStream_T.inl" -#endif /* !__ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// We will be given a STREAM by the iostream object which creates us. -// See the ACE_IOStream template for how that works. Like other -// streambuf objects, we can be input-only, output-only or both. - -template -ACE_Streambuf_T::ACE_Streambuf_T (STREAM *peer, - u_int streambuf_size, - int io_mode) - : ACE_Streambuf (streambuf_size, io_mode), - peer_ (peer) -{ - // A streambuf allows for unbuffered IO where every character is - // read as requested and written as provided. To me, this seems - // terribly inefficient for socket-type operations, so I've disabled - // it. All of the work would be done by the underflow/overflow - // functions anyway and I haven't implemented anything there to - // support unbuffered IO. - -#if !defined (ACE_LACKS_UNBUFFERED_STREAMBUF) - this->unbuffered (0); -#endif /* ! ACE_LACKS_UNBUFFERED_STREAMBUF */ - - // Linebuffered is similar to unbuffered. Again, I don't have any - // need for this and I don't see the advantage. I believe this - // would have to be supported by underflow/overflow to be effective. -#if !defined (ACE_LACKS_LINEBUFFERED_STREAMBUF) - this->linebuffered (0); -#endif /* ! ACE_LACKS_LINEBUFFERED_STREAMBUF */ -} - -template ssize_t -ACE_Streambuf_T::send (char *buf, ssize_t len) -{ - return peer_->send_n (buf,len); -} - -template ssize_t -ACE_Streambuf_T::recv (char *buf, - ssize_t len, - ACE_Time_Value *tv) -{ - return this->recv (buf, len, 0, tv); -} - -template ssize_t -ACE_Streambuf_T::recv (char *buf, - ssize_t len, - int flags, - ACE_Time_Value * tv) -{ - this->timeout_ = 0; - errno = ESUCCESS; - ssize_t rval = peer_->recv (buf, len, flags, tv); - if (errno == ETIME) - this->timeout_ = 1; - return rval; -} - -template ssize_t -ACE_Streambuf_T::recv_n (char *buf, - ssize_t len, - int flags, - ACE_Time_Value *tv) -{ - this->timeout_ = 0; - errno = ESUCCESS; - ssize_t rval = peer_->recv_n (buf, len, flags, tv); - if (errno == ETIME) - this->timeout_ = 1; - return rval; -} - -template ACE_HANDLE -ACE_Streambuf_T::get_handle (void) -{ - return peer_ ? peer_->get_handle () : 0; -} - -// The typical constructor. This will initiailze your STREAM and then -// setup the iostream baseclass to use a custom streambuf based on -// STREAM. - -template -ACE_IOStream::ACE_IOStream (STREAM &stream, - u_int streambuf_size) - : iostream (0), - STREAM (stream) -{ - ACE_NEW (streambuf_, - ACE_Streambuf_T ((STREAM *) this, - streambuf_size)); - iostream::init (this->streambuf_); -} - -template -ACE_IOStream::ACE_IOStream (u_int streambuf_size) - : iostream (0) -{ - ACE_NEW (this->streambuf_, - ACE_Streambuf_T ((STREAM *) this, - streambuf_size)); - iostream::init (this->streambuf_); -} - -// We have to get rid of the streambuf_ ourselves since we gave it to -// iostream () - -template -ACE_IOStream::~ACE_IOStream (void) -{ - delete this->streambuf_; -} - -// The only ambituity in the multiple inheritance is the close () -// function. - -template int -ACE_IOStream::close (void) -{ - return STREAM::close (); -} - -template ACE_IOStream & -ACE_IOStream::operator>> (ACE_Time_Value *&tv) -{ - ACE_Time_Value *old_tv = this->streambuf_->recv_timeout (tv); - tv = old_tv; - return *this; -} - -#if defined (ACE_HAS_STRING_CLASS) - -// A simple string operator. The base iostream has 'em for char* but -// that isn't always the best thing for a String. If we don't provide -// our own here, we may not get what we want. - -template ACE_IOStream & -ACE_IOStream::operator>> (ACE_IOStream_String &v) -{ - if (ipfx0 ()) - { - char c; - this->get (c); - - for (v = c; - this->get (c) && !isspace (c); - v += c) - continue; - } - - isfx (); - - return *this; -} - -template ACE_IOStream & -ACE_IOStream::operator<< (ACE_IOStream_String &v) -{ - if (opfx ()) - { -#if defined (ACE_WIN32) && defined (_MSC_VER) - for (int i = 0; i < v.GetLength (); ++i) -#else - for (u_int i = 0; i < (u_int) v.length (); ++i) -#endif /* ACE_WIN32 && defined (_MSC_VER) */ - this->put (v[i]); - } - - osfx (); - - return *this; -} - -// A more clever put operator for strings that knows how to deal with -// quoted strings containing back-quoted quotes. - -template STREAM & -operator>> (STREAM &stream, - ACE_Quoted_String &str) -{ - char c; - - if (!(stream >> c)) // eat space up to the first char - // stream.set (ios::eofbit|ios::failbit); - return stream; - - str = ""; // Initialize the string - - // if we don't have a quote, append until we see space - if (c != '"') - for (str = c; stream.get (c) && !isspace (c); str += c) - continue; - else - for (; stream.get (c) && c != '"'; str += c) - if (c == '\\') - { - stream.get (c); - if (c != '"') - str += '\\'; - } - - return stream; -} - -template STREAM & -operator<< (STREAM &stream, - ACE_Quoted_String &str) -{ - stream.put ('"'); - - for (u_int i = 0; i < str.length (); ++i) - { - if (str[i] == '"') - stream.put ('\\'); - stream.put (str[i]); - } - - stream.put ('"'); - - return stream; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_STRING_CLASS */ -#endif /* ACE_LACKS_ACE_IOSTREAM */ -#endif /* ACE_IOSTREAM_T_CPP */ diff --git a/dep/acelite/ace/IOStream_T.h b/dep/acelite/ace/IOStream_T.h deleted file mode 100644 index 6a6cda5703e..00000000000 --- a/dep/acelite/ace/IOStream_T.h +++ /dev/null @@ -1,297 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file IOStream_T.h - * - * $Id: IOStream_T.h 93359 2011-02-11 11:33:12Z mcorino $ - * - * @author James CE Johnson - * @author Jim Crossley - * - * This file should not be included directly by application - * code. Instead, it should include "ace/IOStream.h". That's because - * we only put some conditional compilations in that file. - */ -//============================================================================= - -#ifndef ACE_IOSTREAM_T_H -#define ACE_IOSTREAM_T_H -#include /**/ "ace/pre.h" - -#include "ace/IOStream.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_ACE_IOSTREAM) - -# include "ace/INET_Addr.h" -# include "ace/Global_Macros.h" - -# if defined (ACE_LACKS_IOSTREAM_FX) -# include "ace/os_include/os_ctype.h" -# endif /**/ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -# if defined (ACE_HAS_STRING_CLASS) -template STREAM & operator>> (STREAM &stream, ACE_Quoted_String &str); -template STREAM & operator<< (STREAM &stream, ACE_Quoted_String &str); -# endif /* defined (ACE_HAS_STRING_CLASS) */ - -template -class ACE_Streambuf_T : public ACE_Streambuf -{ -public: - /** - * We will be given a STREAM by the iostream object which creates - * us. See the ACE_IOStream template for how that works. Like - * other streambuf objects, we can be input-only, output-only or - * both. - */ - ACE_Streambuf_T (STREAM *peer, - u_int streambuf_size = ACE_STREAMBUF_SIZE, - int io_mode = ios::in | ios::out); - - virtual ssize_t send (char *buf, ssize_t len); - - virtual ssize_t recv (char *buf, - ssize_t len, - ACE_Time_Value *tv = 0); - - virtual ssize_t recv (char *buf, - ssize_t len, - int flags, - ACE_Time_Value * tv = 0); - - virtual ssize_t recv_n (char *buf, - ssize_t len, - int flags = 0, - ACE_Time_Value *tv = 0); - -protected: - virtual ACE_HANDLE get_handle (void); - - /// This will be our ACE_SOCK_Stream or similar object. - STREAM *peer_; -}; - -/** - * @class ACE_IOStream - * - * @brief A template adapter for creating an iostream-like object using - * an ACE IPC Stream for the actual I/O. Iostreams use an - * underlying streambuf object for the IO interface. The - * iostream class and derivatives provide you with a host of - * convenient operators that access the streambuf. - * - * We inherit all characteristics of iostream and your - * class. When you create a new class from this template, you - * can use it anywhere you would have used your original - * class. - * To create an iostream for your favorite ACE IPC class (e.g., - * ACE_SOCK_Stream), feed that class to this template's - * parameter, e.g., - * typedef ACE_Svc_Handler - * Service_Handler; - * Because the operators in the iostream class are not virtual, - * you cannot easily provide overloads in your custom - * ACE_IOStream classes. To make these things work correctly, - * you need to overload ALL operators of the ACE_IOStream you - * create. I've attempted to do that here to make things easier - * for you but there are no guarantees. - * In the iostream.cpp file is an example of why it is necessary - * to overload all of the get/put operators when you want to - * customize only one or two. - */ -template -class ACE_IOStream : public iostream, public STREAM -{ -public: - // = Initialization and termination methods. - ACE_IOStream (STREAM &stream, - u_int streambuf_size = ACE_STREAMBUF_SIZE); - - /** - * The default constructor. This will initialize your STREAM and - * then setup the iostream baseclass to use a custom streambuf based - * on STREAM. - */ - ACE_IOStream (u_int streambuf_size = ACE_STREAMBUF_SIZE); - - /// We have to get rid of the ourselves since we gave it - /// to the base class; - virtual ~ACE_IOStream (void); - - /// The only ambiguity in the multiple inheritance is the - /// function. - virtual int close (void); - - /** - * Returns 1 if we're at the end of the , i.e., if the - * connection has closed down or an error has occurred, else 0. - * Under the covers, calls the streambuf's @a timeout function - * which will reset the timeout flag. As as result, you should save - * the return of and check it instead of calling - * successively. - */ - int eof (void) const; - -# if defined (ACE_HAS_STRING_CLASS) - /** - * A simple string operator. The base has them for char* - * but that isn't always the best thing for a . If we don't - * provide our own here, we may not get what we want. - */ - virtual ACE_IOStream &operator>> (ACE_IOStream_String &v); - - /// The converse of the operator. - virtual ACE_IOStream &operator<< (ACE_IOStream_String &v); - -# endif /* ACE_HAS_STRING_CLASS */ - // = Using the macros to provide get/set operators. - GETPUT_FUNC_SET (ACE_IOStream) - -# if defined (ACE_LACKS_IOSTREAM_FX) - virtual int ipfx (int noskip = 0) - { - if (good ()) - { - if (tie () != 0) - tie ()->flush (); - if (!noskip && flags () & skipws) - { - int ch; - while (isspace (ch = rdbuf ()->sbumpc ())) - continue; - if (ch != EOF) - rdbuf ()->sputbackc (ch); - } - if (good ()) - return 1; - } -# if !defined (ACE_WIN32) - // MS VC++ 5.0 doesn't declare setstate. - setstate (failbit); -# endif /* !ACE_WIN32 */ - return (0); - } - virtual int ipfx0 (void) { return ipfx (0); } // Optimized ipfx(0) - virtual int ipfx1 (void) // Optimized ipfx(1) - { - if (good ()) - { - if (tie () != 0) - tie ()->flush (); - if (good ()) - return 1; - } -# if !defined (ACE_WIN32) - // MS VC++ 5.0 doesn't declare setstate. - setstate (failbit); -# endif /* !ACE_WIN32 */ - return (0); - } - virtual void isfx (void) { return; } - virtual int opfx (void) - { - if (good () && tie () != 0) - tie ()->flush (); - return good (); - } - virtual void osfx (void) { if (flags () & unitbuf) flush (); } -# else -# if defined (__GNUC__) - virtual int ipfx0 (void) { return iostream::ipfx0 (); } // Optimized ipfx(0) - virtual int ipfx1 (void) { return iostream::ipfx1 (); } // Optimized ipfx(1) -# else - virtual int ipfx0 (void) { return iostream::ipfx (0); } - virtual int ipfx1 (void) { return iostream::ipfx (1); } -# endif /* __GNUC__ */ - virtual int ipfx (int need = 0) { return iostream::ipfx (need); } - virtual void isfx (void) { iostream::isfx (); } - virtual int opfx (void) { return iostream::opfx (); } - virtual void osfx (void) { iostream::osfx (); } -# endif /* ACE_LACKS_IOSTREAM_FX */ - - /// Allow the programmer to provide a timeout for read operations. - /// Give it a pointer to NULL to block forever. - ACE_IOStream & operator>> (ACE_Time_Value *&tv); - -protected: - /// This is where all of the action takes place. The streambuf_ is - /// the interface to the underlying STREAM. - ACE_Streambuf_T *streambuf_; - -private: - // = Private methods. - - // We move these into the private section so that they cannot be - // used by the application programmer. This is necessary because - // streambuf_ will be buffering IO on the STREAM object. If these - // functions were used in your program, there is a danger of getting - // the datastream out of sync. - ACE_UNIMPLEMENTED_FUNC (ssize_t send (...)) - ACE_UNIMPLEMENTED_FUNC (ssize_t recv (...)) - ACE_UNIMPLEMENTED_FUNC (ssize_t send_n (...)) - ACE_UNIMPLEMENTED_FUNC (ssize_t recv_n (...)) -}; - -/** - * @class ACE_SOCK_Dgram_SC - * - * @brief "Dgram_SC" is short for "Datagram Self-Contained." - * - * Datagrams don't have the notion of a "peer". Each send and - * receive on a datagram can go to a different peer if you want. - * If you're using datagrams for stream activity, you probably - * want 'em all to go to (and come from) the same place. That's - * what this class is for. Here, we keep an address object so - * that we can remember who last sent us data. When we write - * back, we're then able to write back to that same address. - */ -template -class ACE_SOCK_Dgram_SC : public STREAM -{ -public: - ACE_SOCK_Dgram_SC (void); - ACE_SOCK_Dgram_SC (STREAM &source, - ACE_INET_Addr &dest); - ssize_t send_n (char *buf, ssize_t len); - ssize_t recv (char *buf, - ssize_t len, - ACE_Time_Value *tv = 0); - ssize_t recv (char *buf, - ssize_t len, - int flags, - ACE_Time_Value *tv = 0); - ssize_t recv_n (char *buf, - ssize_t len, - int flags = 0, - ACE_Time_Value *tv = 0); - int get_remote_addr (ACE_INET_Addr &addr) const; - -protected: - ACE_INET_Addr peer_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -# if defined (__ACE_INLINE__) -# include "ace/IOStream_T.inl" -# endif /* __ACE_INLINE__ */ - -# if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -# include "ace/IOStream_T.cpp" -# endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -# if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -# pragma implementation ("IOStream_T.cpp") -# endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ -#endif /* ACE_LACKS_ACE_IOSTREAM */ - -#include /**/ "ace/post.h" -#endif /* ACE_IOSTREAM_T_H */ diff --git a/dep/acelite/ace/IOStream_T.inl b/dep/acelite/ace/IOStream_T.inl deleted file mode 100644 index 513d6ecb1d2..00000000000 --- a/dep/acelite/ace/IOStream_T.inl +++ /dev/null @@ -1,123 +0,0 @@ -// -*- C++ -*- -// -// $Id: IOStream_T.inl 80826 2008-03-04 14:51:23Z wotte $ - -#include "ace/Handle_Set.h" -#include "ace/OS_NS_errno.h" -#include "ace/OS_NS_sys_select.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE int -ACE_IOStream::eof (void) const -{ - // Get the timeout value of the streambuf - ACE_Time_Value *timeout = this->streambuf_->recv_timeout (0); - - // Reset the timeout value of the streambuf. - (void) this->streambuf_->recv_timeout (timeout); - - char c; - int rval = this->streambuf_->recv_n (&c, - sizeof c, - MSG_PEEK, - timeout); - - // Timeout, not an eof - if (this->streambuf_->timeout()) - return 0; - - // No timeout, got enough data: not eof - if (rval == sizeof(char)) - return 0; - - // No timeout, not enough data: definately eof - return 1; -} - -template ACE_INLINE -ACE_SOCK_Dgram_SC::ACE_SOCK_Dgram_SC (void) -{ -} - -template ACE_INLINE -ACE_SOCK_Dgram_SC::ACE_SOCK_Dgram_SC (STREAM &source, - ACE_INET_Addr &dest) - : STREAM (source), - peer_ (dest) -{ -} - -template ACE_INLINE ssize_t -ACE_SOCK_Dgram_SC::send_n (char *buf, - ssize_t len) -{ - return STREAM::send (buf, len, peer_); -} - -template ACE_INLINE ssize_t -ACE_SOCK_Dgram_SC::recv (char *buf, - ssize_t len, - ACE_Time_Value *tv) -{ - //FUZZ: disable check_for_lack_ACE_OS - return recv (buf, len, 0, tv); - //FUZZ: enable check_for_lack_ACE_OS -} - -template ACE_INLINE ssize_t -ACE_SOCK_Dgram_SC::recv (char *buf, - ssize_t len, - int flags, - ACE_Time_Value *tv) -{ - if (tv != 0) - { - ACE_HANDLE handle = this->get_handle (); - ACE_Handle_Set handle_set; - - handle_set.set_bit (handle); - - switch (ACE_OS::select (int (handle) + 1, - (fd_set *) handle_set, // read_fds. - (fd_set *) 0, // write_fds. - (fd_set *) 0, // exception_fds. - tv)) - { - case 0: - errno = ETIME; - case -1: - return -1; - default: - ; // Do the 'recv' below - } - } - - int rval = STREAM::recv (buf, len, peer_, flags); -#if defined (ACE_WIN32) - if (rval == SOCKET_ERROR) - if (::WSAGetLastError () == WSAEMSGSIZE) - if (ACE_BIT_ENABLED (flags, MSG_PEEK)) - rval = len; -#endif /* ACE_WIN32 */ - return rval < len ? rval : len; -} - -template ACE_INLINE ssize_t -ACE_SOCK_Dgram_SC::recv_n (char *buf, - ssize_t len, - int flags, - ACE_Time_Value *tv) -{ - int rval = this->recv (buf, len, flags, tv); - return rval; -} - -template ACE_INLINE int -ACE_SOCK_Dgram_SC::get_remote_addr (ACE_INET_Addr &addr) const -{ - addr = peer_; - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/IO_Cntl_Msg.cpp b/dep/acelite/ace/IO_Cntl_Msg.cpp deleted file mode 100644 index b9badd5c179..00000000000 --- a/dep/acelite/ace/IO_Cntl_Msg.cpp +++ /dev/null @@ -1,7 +0,0 @@ -// $Id: IO_Cntl_Msg.cpp 92069 2010-09-28 11:38:59Z johnnyw $ - -#include "ace/IO_Cntl_Msg.h" - -#if !defined (__ACE_INLINE__) -#include "ace/IO_Cntl_Msg.inl" -#endif /* __ACE_INLINE__ */ diff --git a/dep/acelite/ace/IO_Cntl_Msg.h b/dep/acelite/ace/IO_Cntl_Msg.h deleted file mode 100644 index 1b20f53d46a..00000000000 --- a/dep/acelite/ace/IO_Cntl_Msg.h +++ /dev/null @@ -1,112 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file IO_Cntl_Msg.h - * - * $Id: IO_Cntl_Msg.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Doug Schmidt - */ -//========================================================================== - - -#ifndef ACE_IO_CNTL_MSG_H -#define ACE_IO_CNTL_MSG_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" -#include "ace/os_include/os_stddef.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_IO_Cntl_Msg - * - * @brief Data format for IOCTL messages - */ -class ACE_Export ACE_IO_Cntl_Msg -{ -public: - enum - { - /// Set the low water mark. - SET_LWM = 1, - /// Get the low water mark. - GET_LWM = 2, - /// Set the high water mark. - SET_HWM = 3, - /// Get the high water mark. - GET_HWM = 4, - /// Link modules - MOD_LINK = 5, - /// Unlink modules - MOD_UNLINK = 6 - }; - - typedef unsigned short ACE_IO_Cntl_Cmds; - - // = Initialization method. - /// Initialize the control message. - ACE_IO_Cntl_Msg (ACE_IO_Cntl_Cmds c); - - // = Get/set methods - - /// Get command. - ACE_IO_Cntl_Cmds cmd (void); - - /// Set command. - void cmd (ACE_IO_Cntl_Cmds c); - - /// Get count. - size_t count (void); - - /// Set count. - void count (size_t c); - - /// Get error. - int error (void); - - /// Set error. - void error (int e); - - /// Get return value. - int rval (void); - - /// Set return value. - void rval (int r); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Command. - ACE_IO_Cntl_Cmds cmd_; - - /// Count. - size_t count_; - - /// Error. - int error_; - - /// Return value - int rval_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/IO_Cntl_Msg.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_IO_CNTL_MSG_H */ diff --git a/dep/acelite/ace/IO_Cntl_Msg.inl b/dep/acelite/ace/IO_Cntl_Msg.inl deleted file mode 100644 index 6b8558e0806..00000000000 --- a/dep/acelite/ace/IO_Cntl_Msg.inl +++ /dev/null @@ -1,61 +0,0 @@ -// -*- C++ -*- -// -// $Id: IO_Cntl_Msg.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_IO_Cntl_Msg::ACE_IO_Cntl_Msg (ACE_IO_Cntl_Cmds c) -{ - this->cmd_ = c; -} - -ACE_INLINE ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds -ACE_IO_Cntl_Msg::cmd (void) -{ - return this->cmd_; -} - -ACE_INLINE void -ACE_IO_Cntl_Msg::cmd (ACE_IO_Cntl_Cmds c) -{ - this->cmd_ = c; -} - -ACE_INLINE size_t -ACE_IO_Cntl_Msg::count (void) -{ - return this->count_; -} - -ACE_INLINE void -ACE_IO_Cntl_Msg::count (size_t c) -{ - this->count_ = c; -} - -ACE_INLINE int -ACE_IO_Cntl_Msg::error (void) -{ - return this->error_; -} - -ACE_INLINE void -ACE_IO_Cntl_Msg::error (int e) -{ - this->error_ = e; -} - -ACE_INLINE int -ACE_IO_Cntl_Msg::rval (void) -{ - return this->rval_; -} - -ACE_INLINE void -ACE_IO_Cntl_Msg::rval (int r) -{ - this->rval_ = r; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/IO_SAP.cpp b/dep/acelite/ace/IO_SAP.cpp deleted file mode 100644 index d4bca8c88a1..00000000000 --- a/dep/acelite/ace/IO_SAP.cpp +++ /dev/null @@ -1,140 +0,0 @@ -// $Id: IO_SAP.cpp 93736 2011-04-05 12:38:35Z johnnyw $ - -#include "ace/IO_SAP.h" - -#include "ace/Log_Msg.h" -#include "ace/OS_NS_unistd.h" -#include "ace/OS_NS_errno.h" -#include "ace/OS_NS_fcntl.h" -#include "ace/os_include/os_signal.h" - -#if !defined (__ACE_INLINE__) -#include "ace/IO_SAP.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_IO_SAP) - -// This is the do-nothing constructor. It does not perform a -// ACE_OS::open system call. - -ACE_IO_SAP::ACE_IO_SAP (void) - : handle_ (ACE_INVALID_HANDLE) -{ - ACE_TRACE ("ACE_IO_SAP::ACE_IO_SAP"); -} - -void -ACE_IO_SAP::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_IO_SAP::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("handle_ = %d"), this->handle_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\npid_ = %d"), this->pid_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -// Cache for the process ID. -pid_t ACE_IO_SAP::pid_ = 0; - -int -ACE_IO_SAP::enable (int value) const -{ - ACE_TRACE ("ACE_IO_SAP::enable"); - /* First-time in initialization. */ - if (ACE_IO_SAP::pid_ == 0) - ACE_IO_SAP::pid_ = ACE_OS::getpid (); - - switch (value) - { -#if defined (SIGURG) - case SIGURG: - case ACE_SIGURG: -#if defined (F_SETOWN) - return ACE_OS::fcntl (this->handle_, - F_SETOWN, - ACE_IO_SAP::pid_); -#else - ACE_NOTSUP_RETURN (-1); -#endif /* F_SETOWN */ -#endif /* SIGURG */ -#if defined (SIGIO) - case SIGIO: - case ACE_SIGIO: -#if defined (F_SETOWN) && defined (FASYNC) - if (ACE_OS::fcntl (this->handle_, - F_SETOWN, - ACE_IO_SAP::pid_) == -1 - || ACE::set_flags (this->handle_, - FASYNC) == -1) - return -1; - break; -#else - ACE_NOTSUP_RETURN (-1); -#endif /* F_SETOWN && FASYNC */ -#else // <== - ACE_NOTSUP_RETURN (-1); -#endif /* SIGIO <== */ - case ACE_NONBLOCK: - if (ACE::set_flags (this->handle_, - ACE_NONBLOCK) == -1) - return -1; - break; - default: - return -1; - } - - return 0; -} - -int -ACE_IO_SAP::disable (int value) const -{ - ACE_TRACE ("ACE_IO_SAP::disable"); - - switch (value) - { -#if defined (SIGURG) - case SIGURG: - case ACE_SIGURG: -#if defined (F_SETOWN) - if (ACE_OS::fcntl (this->handle_, - F_SETOWN, 0) == -1) - return -1; - break; -#else - ACE_NOTSUP_RETURN (-1); -#endif /* F_SETOWN */ -#endif /* SIGURG */ -#if defined (SIGIO) - case SIGIO: - case ACE_SIGIO: -#if defined (F_SETOWN) && defined (FASYNC) - if (ACE_OS::fcntl (this->handle_, - F_SETOWN, - 0) == -1 - || ACE::clr_flags (this->handle_, FASYNC) == -1) - return -1; - break; -#else - ACE_NOTSUP_RETURN (-1); -#endif /* F_SETOWN && FASYNC */ -#else // <== - ACE_NOTSUP_RETURN (-1); -#endif /* SIGIO <== */ - case ACE_NONBLOCK: - if (ACE::clr_flags (this->handle_, - ACE_NONBLOCK) == -1) - return -1; - break; - default: - return -1; - } - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/IO_SAP.h b/dep/acelite/ace/IO_SAP.h deleted file mode 100644 index b460c2346aa..00000000000 --- a/dep/acelite/ace/IO_SAP.h +++ /dev/null @@ -1,96 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file IO_SAP.h - * - * $Id: IO_SAP.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Doug Schmidt - */ -//============================================================================= - - -#ifndef ACE_IO_SAP_H -#define ACE_IO_SAP_H -#include /**/ "ace/pre.h" - -#include "ace/Flag_Manip.h" -#include "ace/os_include/sys/os_types.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_IO_SAP - * - * @brief Defines the methods for the base class of the ACE_IO_SAP - * abstraction, which includes ACE_FILE and ACE_DEV. - */ -class ACE_Export ACE_IO_SAP -{ -public: - enum - { - /// Be consistent with Winsock - INVALID_HANDLE = -1 - }; - - /// Default dtor. - ~ACE_IO_SAP (void); - - /// Interface for ioctl. - int control (int cmd, void *) const; - - // = Common I/O handle options related to files. - - /** - * Enable asynchronous I/O (ACE_SIGIO), urgent data (ACE_SIGURG), - * non-blocking I/O (ACE_NONBLOCK), or close-on-exec (ACE_CLOEXEC), - * which is passed as the @a value. - */ - int enable (int value) const; - - /** - * Disable asynchronous I/O (ACE_SIGIO), urgent data (ACE_SIGURG), - * non-blocking I/O (ACE_NONBLOCK), or close-on-exec (ACE_CLOEXEC), - * which is passed as the @a value. - */ - int disable (int value) const; - - /// Get the underlying handle. - ACE_HANDLE get_handle (void) const; - - /// Set the underlying handle. - void set_handle (ACE_HANDLE handle); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// Ensure that ACE_IO_SAP is an abstract base class. - ACE_IO_SAP (void); - -private: - /// Underlying I/O handle. - ACE_HANDLE handle_; - - /// Cache the process ID. - static pid_t pid_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/IO_SAP.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_IO_SAP_H */ diff --git a/dep/acelite/ace/IO_SAP.inl b/dep/acelite/ace/IO_SAP.inl deleted file mode 100644 index 4c3182fa609..00000000000 --- a/dep/acelite/ace/IO_SAP.inl +++ /dev/null @@ -1,41 +0,0 @@ -// -*- C++ -*- -// $Id: IO_SAP.inl 93736 2011-04-05 12:38:35Z johnnyw $ - -#include "ace/OS_NS_stropts.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_IO_SAP::~ACE_IO_SAP (void) -{ - ACE_TRACE ("ACE_IO_SAP::~ACE_IO_SAP"); -} - -// Used to return the underlying handle_. - -ACE_INLINE ACE_HANDLE -ACE_IO_SAP::get_handle (void) const -{ - ACE_TRACE ("ACE_IO_SAP::get_handle"); - return this->handle_; -} - -// Used to set the underlying handle_. - -ACE_INLINE void -ACE_IO_SAP::set_handle (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_IO_SAP::set_handle"); - this->handle_ = handle; -} - -// Provides access to the ACE_OS::ioctl system call. - -ACE_INLINE int -ACE_IO_SAP::control (int cmd, void *arg) const -{ - ACE_TRACE ("ACE_IO_SAP::control"); - return ACE_OS::ioctl (this->handle_, cmd, arg); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/IPC_SAP.cpp b/dep/acelite/ace/IPC_SAP.cpp deleted file mode 100644 index bdd0f8a3cd3..00000000000 --- a/dep/acelite/ace/IPC_SAP.cpp +++ /dev/null @@ -1,193 +0,0 @@ -// $Id: IPC_SAP.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/IPC_SAP.h" - -#include "ace/Log_Msg.h" -#include "ace/OS_NS_unistd.h" -#include "ace/os_include/os_signal.h" -#include "ace/OS_NS_errno.h" -#include "ace/OS_NS_fcntl.h" - -#if !defined (__ACE_INLINE__) -#include "ace/IPC_SAP.inl" -#endif /* __ACE_INLINE__ */ - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_IPC_SAP) - -void -ACE_IPC_SAP::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_IPC_SAP::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("handle_ = %d"), this->handle_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\npid_ = %d"), this->pid_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -// Cache for the process ID. -pid_t ACE_IPC_SAP::pid_ = 0; - -// This is the do-nothing constructor. It does not perform a -// ACE_OS::socket system call. - -ACE_IPC_SAP::ACE_IPC_SAP (void) - : handle_ (ACE_INVALID_HANDLE) -{ - // ACE_TRACE ("ACE_IPC_SAP::ACE_IPC_SAP"); -} - -int -ACE_IPC_SAP::enable (int value) const -{ - ACE_TRACE ("ACE_IPC_SAP::enable"); - - // First-time in initialization. - if (ACE_IPC_SAP::pid_ == 0) - ACE_IPC_SAP::pid_ = ACE_OS::getpid (); - -#if defined (ACE_WIN32) || defined (ACE_VXWORKS) - switch (value) - { - case ACE_NONBLOCK: - { - // nonblocking argument (1) - // blocking: (0) - int nonblock = 1; - return ACE_OS::ioctl (this->handle_, - FIONBIO, - &nonblock); - } - default: - ACE_NOTSUP_RETURN (-1); - } -#else /* ! ACE_WIN32 && ! ACE_VXWORKS */ - switch (value) - { -#if defined (SIGURG) - case SIGURG: - case ACE_SIGURG: -#if defined (F_SETOWN) - return ACE_OS::fcntl (this->handle_, - F_SETOWN, - ACE_IPC_SAP::pid_); -#else - ACE_NOTSUP_RETURN (-1); -#endif /* F_SETOWN */ -#endif /* SIGURG */ -#if defined (SIGIO) - case SIGIO: - case ACE_SIGIO: -#if defined (F_SETOWN) && defined (FASYNC) - if (ACE_OS::fcntl (this->handle_, - F_SETOWN, - ACE_IPC_SAP::pid_) == -1 - || ACE::set_flags (this->handle_, - FASYNC) == -1) - return -1; - break; -#else - ACE_NOTSUP_RETURN (-1); -#endif /* F_SETOWN && FASYNC */ -#endif /* SIGIO <== */ -#if defined (F_SETFD) - case ACE_CLOEXEC: - // Enables the close-on-exec flag. - if (ACE_OS::fcntl (this->handle_, - F_SETFD, - 1) == -1) - return -1; - break; -#endif /* F_SETFD */ - case ACE_NONBLOCK: - if (ACE::set_flags (this->handle_, - ACE_NONBLOCK) == ACE_INVALID_HANDLE) - return -1; - break; - default: - return -1; - } - return 0; -#endif /* ! ACE_WIN32 && ! ACE_VXWORKS */ - - /* NOTREACHED */ -} - -int -ACE_IPC_SAP::disable (int value) const -{ - ACE_TRACE ("ACE_IPC_SAP::disable"); - -#if defined (ACE_WIN32) || defined (ACE_VXWORKS) - switch (value) - { - case ACE_NONBLOCK: - // nonblocking argument (1) - // blocking: (0) - { - int nonblock = 0; - return ACE_OS::ioctl (this->handle_, - FIONBIO, - &nonblock); - } - default: - ACE_NOTSUP_RETURN (-1); - } -#else /* ! ACE_WIN32 && ! ACE_VXWORKS */ - switch (value) - { -#if defined (SIGURG) - case SIGURG: - case ACE_SIGURG: -#if defined (F_SETOWN) - return ACE_OS::fcntl (this->handle_, - F_SETOWN, - 0); -#else - ACE_NOTSUP_RETURN (-1); -#endif /* F_SETOWN */ -#endif /* SIGURG */ -#if defined (SIGIO) - case SIGIO: - case ACE_SIGIO: -#if defined (F_SETOWN) && defined (FASYNC) - if (ACE_OS::fcntl (this->handle_, - F_SETOWN, - 0) == -1 - || ACE::clr_flags (this->handle_, - FASYNC) == -1) - return -1; - break; -#else - ACE_NOTSUP_RETURN (-1); -#endif /* F_SETOWN && FASYNC */ -#endif /* SIGIO <== */ -#if defined (F_SETFD) - case ACE_CLOEXEC: - // Disables the close-on-exec flag. - if (ACE_OS::fcntl (this->handle_, - F_SETFD, - 0) == -1) - return -1; - break; -#endif /* F_SETFD */ - case ACE_NONBLOCK: - if (ACE::clr_flags (this->handle_, - ACE_NONBLOCK) == -1) - return -1; - break; - default: - return -1; - } - return 0; -#endif /* ! ACE_WIN32 && ! ACE_VXWORKS */ - /* NOTREACHED */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/IPC_SAP.h b/dep/acelite/ace/IPC_SAP.h deleted file mode 100644 index 43a2125c575..00000000000 --- a/dep/acelite/ace/IPC_SAP.h +++ /dev/null @@ -1,96 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file IPC_SAP.h - * - * $Id: IPC_SAP.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_IPC_SAP_H -#define ACE_IPC_SAP_H -#include /**/ "ace/pre.h" - -#include "ace/Flag_Manip.h" -#include "ace/os_include/sys/os_types.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_IPC_SAP - * - * @brief Defines the member functions for the base class of the - * ACE_IPC_SAP abstraction. - */ -class ACE_Export ACE_IPC_SAP -{ -public: - - /// Interface for . - int control (int cmd, void *) const; - - // = Common I/O handle options related to sockets. - - /** - * Enable asynchronous I/O (ACE_SIGIO), urgent data (ACE_SIGURG), - * non-blocking I/O (ACE_NONBLOCK), or close-on-exec (ACE_CLOEXEC), - * which is passed as the @a value. - */ - int enable (int value) const; - - /** - * Disable asynchronous I/O (ACE_SIGIO), urgent data (ACE_SIGURG), - * non-blocking I/O (ACE_NONBLOCK), or close-on-exec (ACE_CLOEXEC), - * which is passed as the @a value. - */ - int disable (int value) const; - - /// Get the underlying handle. - ACE_HANDLE get_handle (void) const; - - /// Set the underlying handle. - void set_handle (ACE_HANDLE handle); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - - // = Ensure that ACE_IPC_SAP is an abstract base class. - /// Default constructor. - ACE_IPC_SAP (void); - - /// Protected destructor. - /** - * Not a virtual destructor. Protected destructor to prevent - * operator delete() from being called through a base class - * ACE_IPC_SAP pointer/reference. - */ - ~ACE_IPC_SAP (void); - -private: - /// Underlying I/O handle. - ACE_HANDLE handle_; - - /// Cache the process ID. - static pid_t pid_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/IPC_SAP.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_IPC_SAP_H */ diff --git a/dep/acelite/ace/IPC_SAP.inl b/dep/acelite/ace/IPC_SAP.inl deleted file mode 100644 index 5e80486902a..00000000000 --- a/dep/acelite/ace/IPC_SAP.inl +++ /dev/null @@ -1,40 +0,0 @@ -// -*- C++ -*- -// -// $Id: IPC_SAP.inl 80826 2008-03-04 14:51:23Z wotte $ - -#include "ace/OS_NS_stropts.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_IPC_SAP::~ACE_IPC_SAP (void) -{ - // ACE_TRACE ("ACE_IPC_SAP::~ACE_IPC_SAP"); -} - -ACE_INLINE ACE_HANDLE -ACE_IPC_SAP::get_handle (void) const -{ - ACE_TRACE ("ACE_IPC_SAP::get_handle"); - return this->handle_; -} - -// Used to set the underlying handle_. - -ACE_INLINE void -ACE_IPC_SAP::set_handle (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_IPC_SAP::set_handle"); - this->handle_ = handle; -} - -// Provides access to the ACE_OS::ioctl system call. - -ACE_INLINE int -ACE_IPC_SAP::control (int cmd, void *arg) const -{ - ACE_TRACE ("ACE_IPC_SAP::control"); - return ACE_OS::ioctl (this->handle_, cmd, arg); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/If_Then_Else.h b/dep/acelite/ace/If_Then_Else.h deleted file mode 100644 index eca1d9dd83a..00000000000 --- a/dep/acelite/ace/If_Then_Else.h +++ /dev/null @@ -1,89 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file If_Then_Else.h - * - * @c ACE::If_Then_Else traits template based on the @c IfThenElse - * template described in the book "C++ Templates" by Vandevoorde and - * Josuttis. - * - * $Id: If_Then_Else.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Ossama Othman - */ -//============================================================================= - -#ifndef ACE_IF_THEN_ELSE_H -#define ACE_IF_THEN_ELSE_H - -#include "ace/config-lite.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace ACE -{ - - /** - * @struct If_Then_Else - * - * @brief Compile-time selection of type based on a boolean value. - * - * This primary template selects the second or third argument based - * on the value of the boolean first argument. - * - * Usage example: - * - * \code - * - * template - * class Foo - * { - * public: - * // Set "TheType" to be the larger of "T" and "int". - * typedef typename If_Then_Else<(sizeof (T) > sizeof (int)), - * T, - * int>::result_type TheType; - * }; - * - * \endcode - * - * @note This merely a forward declaration since we really only care - * about the partial specializations below. - */ - template - struct If_Then_Else; - - /** - * @struct If_Then_Else - * - * @brief Select of type @a Ta if boolean value is @c true. - * - * This partial specialization selects the type @a Ta if the boolean - * first argument is @c true. - */ - template - struct If_Then_Else - { - typedef Ta result_type; - }; - - /** - * @struct If_Then_Else - * - * @brief Select of type @a Tb if boolean value is @c false. - * - * This partial specialization selects the type @a Tb if the boolean - * first argument is @c false. - */ - template - struct If_Then_Else - { - typedef Tb result_type; - }; - -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_IF_THEN_ELSE_H */ diff --git a/dep/acelite/ace/Init_ACE.cpp b/dep/acelite/ace/Init_ACE.cpp deleted file mode 100644 index f3ea96866e4..00000000000 --- a/dep/acelite/ace/Init_ACE.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// $Id: Init_ACE.cpp 91368 2010-08-16 13:03:34Z mhengstmengel $ -#include "ace/Init_ACE.h" - -#include "ace/Object_Manager.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -unsigned int ACE::init_fini_count_ = 0; - -int -ACE::init (void) -{ - // Don't use ACE_TRACE, because Object_Manager might not have been - // instantiated yet. - // ACE_TRACE ("ACE::init"); - - ++ACE::init_fini_count_; - - return ACE_Object_Manager::instance ()->init (); -} - -int -ACE::fini (void) -{ - ACE_TRACE ("ACE::fini"); - - if (ACE::init_fini_count_ > 0) - { - if (--ACE::init_fini_count_ == 0) - return ACE_Object_Manager::instance ()->fini (); - else - // Wait for remaining fini () calls. - return 1; - } - else - // More ACE::fini () calls than ACE::init () calls. Bad - // application! - return -1; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Init_ACE.h b/dep/acelite/ace/Init_ACE.h deleted file mode 100644 index 2bbaafc3e9f..00000000000 --- a/dep/acelite/ace/Init_ACE.h +++ /dev/null @@ -1,70 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Init_ACE.h - * - * $Id: Init_ACE.h 88794 2010-02-01 19:15:36Z schmidt $ - * - * Initialize and finalize the ACE library services. You can - * generally execute the @a ACE::init() and @a ACE::fini() sequence - * multiple times, but be aware that nothing that ACE controls (e.g., - * singletons, thread-specific services, loaded services, etc.) will - * survive the @a ACE::fini(). - */ -//============================================================================= - - -#ifndef ACE_INIT_ACE_H -#define ACE_INIT_ACE_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace ACE -{ - /** - * This method initializes the ACE library services and initializes - * ACE's internal resources. Applications should not instantiate - * ACE classes or call methods on objects of these classes until @a - * ACE::init() returns successfully. - - * @return Returns 0 on success, -1 on failure, and 1 if it had - * already been called. - */ - extern ACE_Export int init (void); - - /** - * Finalize the ACE library services and releases ACE's internal - * resources. In general, do not instantiate ACE classes or call - * methods on objects of these classes after @a ACE::fini() has been - * called. - * - * @return Returns 0 on success, -1 on failure, and 1 if it had already been - * called. - */ - extern ACE_Export int fini (void); - - // private: - // Used internally, so not exported. - - /** - * Counter to match / calls. must increment it; - * must decrement it. then does nothing until it - * reaches 0. - */ - extern unsigned int init_fini_count_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* ACE_INIT_ACE_H */ diff --git a/dep/acelite/ace/Intrusive_Auto_Ptr.cpp b/dep/acelite/ace/Intrusive_Auto_Ptr.cpp deleted file mode 100644 index 4f9890353c1..00000000000 --- a/dep/acelite/ace/Intrusive_Auto_Ptr.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// $Id: Intrusive_Auto_Ptr.cpp 81166 2008-03-31 15:00:23Z iliyan $ - -#ifndef ACE_INTRUSIVE_AUTO_PTR_CPP -#define ACE_INTRUSIVE_AUTO_PTR_CPP - -#include "ace/Intrusive_Auto_Ptr.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Intrusive_Auto_Ptr.inl" -#endif /* __ACE_INLINE __ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Intrusive_Auto_Ptr::~ACE_Intrusive_Auto_Ptr (void) -{ - reset (0); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* !ACE_INTRUSIVE_AUTO_PTR_CPP */ diff --git a/dep/acelite/ace/Intrusive_Auto_Ptr.h b/dep/acelite/ace/Intrusive_Auto_Ptr.h deleted file mode 100644 index 9c6ad348236..00000000000 --- a/dep/acelite/ace/Intrusive_Auto_Ptr.h +++ /dev/null @@ -1,165 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Intrusive_Auto_Ptr.h - * - * $Id: Intrusive_Auto_Ptr.h 81388 2008-04-23 14:02:05Z johnnyw $ - * - * @author Iliyan Jeliazkov - * - * @note Modeled on http://www.boost.org/boost/intrusive_ptr.hpp - */ -//============================================================================= - -#ifndef ACE_INTRUSIVE_AUTO_PTR_H -#define ACE_INTRUSIVE_AUTO_PTR_H - -#include /**/ "ace/pre.h" - -#include "ace/Auto_Ptr.h" -#include "ace/Atomic_Op.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward decl. -template class ACE_Intrusive_Auto_Ptr; - -/** - * @class ACE_Intrusive_Auto_Ptr - * - * @brief This class implements support for a reference counted - * auto_ptr. It assumes reference counting abilities of the - * parameterizing class. - * - * Assigning or copying instances of an ACE_Intrusive_Auto_Ptr will - * automatically increment the reference count. When the last instance - * that references a ACE_Intrusive_Auto_Ptr instance is destroyed or - * overwritten, it will invoke delete on its underlying pointer. - * - * The ACE_Intrusive_Auto_Ptr works by maintaining a reference to a - * separate representation object, ACE_Intrusive_Auto_Ptr_Rep. That - * separate representation object contains the reference count and the - * actual pointer value. - */ -template -class ACE_Intrusive_Auto_Ptr -{ -protected: - - /// Used to define a proper boolean conversion for "if (sp) ..." - static void unspecified_bool(ACE_Intrusive_Auto_Ptr***){}; - typedef void (*unspecified_bool_type)(ACE_Intrusive_Auto_Ptr***); - -public: - - /// Enables "if (sp) ..." - operator unspecified_bool_type() const - { - return rep_ == 0 ? 0: unspecified_bool; - } - - - // = Initialization and termination methods. - - /// Constructor that initializes an ACE_Intrusive_Auto_Ptr to - /// the specified pointer value. - ACE_Intrusive_Auto_Ptr (X *p = 0, bool addref = true); - - /// Copy constructor binds the new ACE_Intrusive_Auto_Ptr to the - /// representation object referenced by @a r. - /// An ACE_Intrusive_Auto_Ptr_Rep is created if necessary. - ACE_Intrusive_Auto_Ptr (const ACE_Intrusive_Auto_Ptr &r); - - // Derived class copy ctor - template ACE_Intrusive_Auto_Ptr(const ACE_Intrusive_Auto_Ptr & rhs); - - /// Destructor. Releases the reference to the underlying representation. - /// If the release of that reference causes its reference count to reach 0, - /// the representation object will also be destroyed. - virtual ~ACE_Intrusive_Auto_Ptr (void); - - /// Assignment operator that binds the current object and @a r to the same - /// ACE_Intrusive_Auto_Ptr_Rep. An ACE_Intrusive_Auto_Ptr_Rep - /// is created if necessary. - void operator = (const ACE_Intrusive_Auto_Ptr &r); - - /// Redirection operator - X *operator-> (void) const; - - /// Accessor method. - X &operator *() const; - - /// Releases the reference to the underlying representation object. - /// @retval The pointer value prior to releasing it. - X *release (void); - - /// Releases the current pointer value and then sets a new - /// pointer value specified by @a p. - void reset (X *p = 0); - - /// Get the pointer value. - X *get (void) const; - - /// Get the reference count value. - long count (void) const; - - /// Returns @c true if this object does not contain a valid pointer. - // bool null (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - - /// Protect operations on the ACE_Intrusive_Auto_Ptr. - X *rep_; -}; - - /// Equality operator that returns @c true if both - /// ACE_Intrusive_Auto_Ptr objects point to the same underlying - /// representation. It does not compare the actual pointers. - /** - * @note It also returns @c true if both objects have just been - * instantiated and not used yet. - */ -template -bool operator==(ACE_Intrusive_Auto_Ptr const & a, ACE_Intrusive_Auto_Ptr const & b); - -/// Inequality operator, which is the opposite of equality. -template -bool operator!=(ACE_Intrusive_Auto_Ptr const & a, ACE_Intrusive_Auto_Ptr const & b); - -template -bool operator==(ACE_Intrusive_Auto_Ptr const & a, U * b); - -template -bool operator!=(ACE_Intrusive_Auto_Ptr & a, U * b); - -template -bool operator==(T * a, ACE_Intrusive_Auto_Ptr const & b); - -template -bool operator!=(T * a, ACE_Intrusive_Auto_Ptr const & b); - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Intrusive_Auto_Ptr.inl" -#endif /* __ACE_INLINE __ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Intrusive_Auto_Ptr.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Intrusive_Auto_Ptr.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* ACE_INTRUSIVE_AUTO_PTR_H */ diff --git a/dep/acelite/ace/Intrusive_Auto_Ptr.inl b/dep/acelite/ace/Intrusive_Auto_Ptr.inl deleted file mode 100644 index 4feb83db7b1..00000000000 --- a/dep/acelite/ace/Intrusive_Auto_Ptr.inl +++ /dev/null @@ -1,147 +0,0 @@ -// -*- C++ -*- -// -// $Id: Intrusive_Auto_Ptr.inl 81219 2008-04-02 20:23:32Z iliyan $ - -#include "ace/Guard_T.h" -#include "ace/Log_Msg.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE -ACE_Intrusive_Auto_Ptr::ACE_Intrusive_Auto_Ptr (X *p, bool addref) - : rep_ (p) -{ - if (rep_ != 0 && addref) - X::intrusive_add_ref (rep_); -} - -template ACE_INLINE -ACE_Intrusive_Auto_Ptr::ACE_Intrusive_Auto_Ptr (const ACE_Intrusive_Auto_Ptr &r) - : rep_ (r.rep_) -{ - if (rep_ != 0) - X::intrusive_add_ref (rep_); -} - -template ACE_INLINE X * -ACE_Intrusive_Auto_Ptr::operator-> (void) const -{ - return this->rep_; -} - -template ACE_INLINE X & -ACE_Intrusive_Auto_Ptr::operator *() const -{ - return *this->rep_; -} - -template ACE_INLINE X* -ACE_Intrusive_Auto_Ptr::get (void) const -{ - // We return the ACE_Future_rep. - return this->rep_; -} - -template ACE_INLINE X * -ACE_Intrusive_Auto_Ptr::release (void) -{ - X *p = this->rep_; - if (this->rep_ != 0) - X::intrusive_remove_ref (this->rep_); - - this->rep_ = 0; - return p; -} - -template ACE_INLINE void -ACE_Intrusive_Auto_Ptr::reset (X *p) -{ - // Avoid deleting the underlying auto_ptr if assigning the same actual - // pointer value. - if (this->rep_ == p) - return; - - X *old_rep = this->rep_; - this->rep_ = p; - - if (this->rep_ != 0) - X::intrusive_add_ref (this->rep_); - - if (old_rep != 0) - X::intrusive_remove_ref (old_rep); - - return; -} - -template ACE_INLINE void -ACE_Intrusive_Auto_Ptr::operator = (const ACE_Intrusive_Auto_Ptr &rhs) -{ - // do nothing when aliasing - if (this->rep_ == rhs.rep_) - return; - - // assign a zero - if (rhs.rep_ == 0) - { - X::intrusive_remove_ref (rhs.rep_); - this->rep_ = 0; - return; - } - - // bind to the same as . - X *old_rep = this->rep_; - this->rep_ = rhs.rep_; - X::intrusive_add_ref (this->rep_); - X::intrusive_remove_ref (old_rep); -} - -// Copy derived class constructor -template template ACE_INLINE -ACE_Intrusive_Auto_Ptr::ACE_Intrusive_Auto_Ptr (const ACE_Intrusive_Auto_Ptr & rhs) -{ - // note implicit cast from U* to T* so illegal copy will generate a - // compiler warning here - this->rep_ = rhs.operator-> (); - X::intrusive_add_ref(this->rep_); -} - - /// Equality operator that returns @c true if both - /// ACE_Intrusive_Auto_Ptr objects point to the same underlying - /// representation. It does not compare the actual pointers. - /** - * @note It also returns @c true if both objects have just been - * instantiated and not used yet. - */ -template ACE_INLINE bool operator==(ACE_Intrusive_Auto_Ptr const & a, ACE_Intrusive_Auto_Ptr const & b) -{ - return a.get() == b.get(); -} - - /// Inequality operator, which is the opposite of equality. - template ACE_INLINE bool operator!=(ACE_Intrusive_Auto_Ptr const & a, ACE_Intrusive_Auto_Ptr const & b) -{ - return a.get() != b.get(); -} - - template ACE_INLINE bool operator==(ACE_Intrusive_Auto_Ptr const & a, U * b) -{ - return a.get() == b; -} - - template ACE_INLINE bool operator!=(ACE_Intrusive_Auto_Ptr & a, U * b) -{ - return a.get() != b; -} - - template ACE_INLINE bool operator==(T * a, ACE_Intrusive_Auto_Ptr const & b) -{ - return a == b.get(); -} - - template ACE_INLINE bool operator!=(T * a, ACE_Intrusive_Auto_Ptr const & b) -{ - return a != b.get(); -} - - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Intrusive_List.cpp b/dep/acelite/ace/Intrusive_List.cpp deleted file mode 100644 index 4b64ef1e857..00000000000 --- a/dep/acelite/ace/Intrusive_List.cpp +++ /dev/null @@ -1,122 +0,0 @@ -// $Id: Intrusive_List.cpp 92069 2010-09-28 11:38:59Z johnnyw $ - -#ifndef ACE_INTRUSIVE_LIST_CPP -#define ACE_INTRUSIVE_LIST_CPP - -#include "ace/Intrusive_List.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (__ACE_INLINE__) -#include "ace/Intrusive_List.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Intrusive_List::ACE_Intrusive_List (void) - : head_ (0) - , tail_ (0) -{ -} - -template -ACE_Intrusive_List::~ACE_Intrusive_List (void) -{ -} - -template void -ACE_Intrusive_List::push_back (T *node) -{ - if (this->tail_ == 0) - { - this->tail_ = node; - this->head_ = node; - node->next (0); - node->prev (0); - } - else - { - this->tail_->next (node); - node->prev (this->tail_); - node->next (0); - this->tail_ = node; - } -} - -template void -ACE_Intrusive_List::push_front (T *node) -{ - if (this->head_ == 0) - { - this->tail_ = node; - this->head_ = node; - node->next (0); - node->prev (0); - } - else - { - this->head_->prev (node); - node->next (this->head_); - node->prev (0); - this->head_ = node; - } -} - -template T * -ACE_Intrusive_List::pop_front (void) -{ - T *node = this->head_; - if (node != 0) - { - this->unsafe_remove (node); - } - return node; -} - -template T * -ACE_Intrusive_List::pop_back (void) -{ - T *node = this->tail_; - if (node != 0) - { - this->unsafe_remove (node); - } - return node; -} - -template void -ACE_Intrusive_List::remove (T *node) -{ - for (T *i = this->head_; i != 0; i = i->next ()) - { - if (node == i) - { - this->unsafe_remove (node); - return; - } - } -} - -template void -ACE_Intrusive_List::unsafe_remove (T *node) -{ - if (node->prev () != 0) - node->prev ()->next (node->next ()); - else - this->head_ = node->next (); - - if (node->next () != 0) - node->next ()->prev (node->prev ()); - else - this->tail_ = node->prev (); - - node->next (0); - node->prev (0); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_INTRUSIVE_LIST_CPP */ diff --git a/dep/acelite/ace/Intrusive_List.h b/dep/acelite/ace/Intrusive_List.h deleted file mode 100644 index b5f32f6839c..00000000000 --- a/dep/acelite/ace/Intrusive_List.h +++ /dev/null @@ -1,140 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file Intrusive_List.h - * - * $Id: Intrusive_List.h 91688 2010-09-09 11:21:50Z johnnyw $ - * - * @author Carlos O'Ryan - */ -//============================================================================= - -#ifndef ACE_INTRUSIVE_LIST_H -#define ACE_INTRUSIVE_LIST_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Intrusive_List - * - * @brief Implement an intrusive double linked list - * - * Intrusive lists assume that the elements they contain the pointers - * required to build the list. They are useful as light-weight - * containers and free-lists. - * - * The template argument T must implement the following methods: - * - * - T* T::next () const; - * - void T::next (T *); - * - T* T::prev () const; - * - void T::prev (T* ); - * - * A simple way to satisfy the Intrusive_List requirements would be to - * implement a helper class: - * - * class My_Object : public ACE_Intrusive_List_Node {
- * ....
- * };
- * - * typedef ACE_Intrusive_List My_Object_List; - * - * However, ACE is supported on platforms that would surely get - * confused using such templates. - * - * @todo The ACE_Message_Queue is an example of an intrusive list (or - * queue) but it is not implemented in terms of this class. - * - */ -template -class ACE_Intrusive_List -{ -public: - // = Initialization and termination methods. - /// Constructor. Use user specified allocation strategy - /// if specified. - ACE_Intrusive_List (void); - - /// Destructor. - ~ACE_Intrusive_List (void); - - // = Check boundary conditions. - - /// Returns true if the container is empty, otherwise returns false. - bool is_empty (void) const; - - /// Insert an element at the beginning of the list - void push_front (T *node); - - /// Insert an element at the end of the list - void push_back (T *node); - - /// Remove the element at the beginning of the list - T *pop_front (void); - - /// Remove the element at the end of the list - T *pop_back (void); - - /// Get the element at the head of the queue - T *head (void) const; - - /// Get the element at the tail of the queue - T *tail (void) const; - - /// Remove a element from the list - /** - * Verify that the element is still in the list before removing it. - */ - void remove (T *node); - - /// Swap two lists - void swap(ACE_Intrusive_List & rhs); - - /// Remove a element from the list without checking - /** - * No attempts are performed to check if T* really belongs to the - * list. The effects of removing an invalid element are unspecified - */ - void unsafe_remove (T *node); - -private: - /** @name Disallow copying - * - */ - //@{ - ACE_Intrusive_List (const ACE_Intrusive_List &); - ACE_Intrusive_List& operator= (const ACE_Intrusive_List &); - //@} - -private: - /// Head of the list - T *head_; - - /// Tail of the list - T *tail_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Intrusive_List.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Intrusive_List.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Intrusive_List.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_INTRUSIVE_LIST_H */ diff --git a/dep/acelite/ace/Intrusive_List.inl b/dep/acelite/ace/Intrusive_List.inl deleted file mode 100644 index 851400937b1..00000000000 --- a/dep/acelite/ace/Intrusive_List.inl +++ /dev/null @@ -1,34 +0,0 @@ -// -*- C++ -*- -// -// $Id: Intrusive_List.inl 91688 2010-09-09 11:21:50Z johnnyw $ - -#include - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE bool -ACE_Intrusive_List::is_empty (void) const -{ - return this->head_ == 0; -} - -template ACE_INLINE T * -ACE_Intrusive_List::head (void) const -{ - return this->head_; -} - -template ACE_INLINE T * -ACE_Intrusive_List::tail (void) const -{ - return this->tail_; -} - -template ACE_INLINE void -ACE_Intrusive_List::swap(ACE_Intrusive_List & rhs) -{ - std::swap(head_, rhs.head_); - std::swap(tail_, rhs.tail_); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Intrusive_List_Node.cpp b/dep/acelite/ace/Intrusive_List_Node.cpp deleted file mode 100644 index 1e14537a4d2..00000000000 --- a/dep/acelite/ace/Intrusive_List_Node.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// $Id: Intrusive_List_Node.cpp 80826 2008-03-04 14:51:23Z wotte $ - -#ifndef ACE_INTRUSIVE_LIST_NODE_CPP -#define ACE_INTRUSIVE_LIST_NODE_CPP - -#include "ace/Intrusive_List_Node.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (__ACE_INLINE__) -#include "ace/Intrusive_List_Node.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Intrusive_List_Node::ACE_Intrusive_List_Node (void) - : prev_ (0) - , next_ (0) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_INTRUSIVE_LIST_NODE_CPP */ diff --git a/dep/acelite/ace/Intrusive_List_Node.h b/dep/acelite/ace/Intrusive_List_Node.h deleted file mode 100644 index dcfbd89e751..00000000000 --- a/dep/acelite/ace/Intrusive_List_Node.h +++ /dev/null @@ -1,84 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Intrusive_List_Node.h - * - * $Id: Intrusive_List_Node.h 83968 2008-12-04 08:11:41Z johnnyw $ - * - * @author Carlos O'Ryan - */ -//============================================================================= - -#ifndef ACE_INTRUSIVE_LIST_NODE_H -#define ACE_INTRUSIVE_LIST_NODE_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Intrusive_List_Node - * - * @brief Implement the requirements for ACE_Intrusive_List - * - * The class should be used as follows: - * - * class My_Object : public ACE_Intrusive_List_Node {
- * ....
- * };
- * - * However, ACE is supported on platforms that would surely get - * confused using such templates, the class is provided as a helper - * for our lucky users that only need portability to modern C++ - * compilers. - */ -template -class ACE_Intrusive_List_Node -{ -public: - /** @name Accesors and modifiers to the next and previous pointers - * - */ - //@{ - T *prev (void) const; - void prev (T *); - T *next (void) const; - void next (T *); - //@} - -protected: - /// Constructor - /** - * The constructor is protected, because only derived classes should - * be instantiated. - */ - ACE_Intrusive_List_Node (void); - -private: - /// Head and tail of the list - T *prev_; - T *next_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Intrusive_List_Node.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Intrusive_List_Node.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Intrusive_List_Node.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_INTRUSIVE_LIST_NODE_H */ diff --git a/dep/acelite/ace/Intrusive_List_Node.inl b/dep/acelite/ace/Intrusive_List_Node.inl deleted file mode 100644 index 52c4f7dec1b..00000000000 --- a/dep/acelite/ace/Intrusive_List_Node.inl +++ /dev/null @@ -1,31 +0,0 @@ -// -*- C++ -*- -// -// $Id: Intrusive_List_Node.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template ACE_INLINE T* -ACE_Intrusive_List_Node::prev (void) const -{ - return this->prev_; -} - -template ACE_INLINE void -ACE_Intrusive_List_Node::prev (T *x) -{ - this->prev_ = x; -} - -template ACE_INLINE T* -ACE_Intrusive_List_Node::next (void) const -{ - return this->next_; -} - -template ACE_INLINE void -ACE_Intrusive_List_Node::next (T *x) -{ - this->next_ = x; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/LOCK_SOCK_Acceptor.cpp b/dep/acelite/ace/LOCK_SOCK_Acceptor.cpp deleted file mode 100644 index 2140454bc0a..00000000000 --- a/dep/acelite/ace/LOCK_SOCK_Acceptor.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// $Id: LOCK_SOCK_Acceptor.cpp 82723 2008-09-16 09:35:44Z johnnyw $ - -#ifndef ACE_LOCK_SOCK_ACCEPTOR_CPP -#define ACE_LOCK_SOCK_ACCEPTOR_CPP - -#include "ace/Guard_T.h" -#include "ace/LOCK_SOCK_Acceptor.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template int -ACE_LOCK_SOCK_Acceptor::accept (ACE_SOCK_Stream &stream, - ACE_Addr *remote_address, - ACE_Time_Value *timeout, - bool restart, - bool reset_new_handle) const -{ - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->lock_, -1); - - return ACE_SOCK_Acceptor::accept (stream, - remote_address, - timeout, - restart, - reset_new_handle); -} - -template ACE_LOCK & -ACE_LOCK_SOCK_Acceptor::lock (void) -{ - return this->lock_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_LOCK_SOCK_ACCEPTOR_CPP */ diff --git a/dep/acelite/ace/LOCK_SOCK_Acceptor.h b/dep/acelite/ace/LOCK_SOCK_Acceptor.h deleted file mode 100644 index 6eff834eb13..00000000000 --- a/dep/acelite/ace/LOCK_SOCK_Acceptor.h +++ /dev/null @@ -1,67 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file LOCK_SOCK_Acceptor.h - * - * $Id: LOCK_SOCK_Acceptor.h 82723 2008-09-16 09:35:44Z johnnyw $ - * - * @author James Hu and Irfan Pyarali - */ -//============================================================================= - - -#ifndef ACE_LOCK_SOCK_ACCEPTOR_H -#define ACE_LOCK_SOCK_ACCEPTOR_H -#include /**/ "ace/pre.h" - -#include "ace/SOCK_Acceptor.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_LOCK_SOCK_Acceptor - * - * @brief Specialize ACE_SOCK_Acceptor to lock around ; - * - * This class is necessary since some OS platforms (e.g., - * Solaris 2.5) do not allow multiple threads/processes to - * simultaneously call on the same listen-mode - * port/socket. Thus, we need to protect against multiple - * concurrent accesses by using the appropriate type of lock. - */ -template -class ACE_LOCK_SOCK_Acceptor : public ACE_SOCK_Acceptor -{ -public: - /// Accept the connection under the control of the . - int accept (ACE_SOCK_Stream &new_stream, - ACE_Addr *remote_addr = 0, - ACE_Time_Value *timeout = 0, - bool restart = true, - bool reset_new_handle = false) const; - - /// Return a reference to the lock. - ACE_LOCK &lock (void); - -protected: - /// Type of locking mechanism. - ACE_LOCK lock_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/LOCK_SOCK_Acceptor.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("LOCK_SOCK_Acceptor.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_LOCK_SOCK_ACCEPTOR_H */ diff --git a/dep/acelite/ace/LSOCK.cpp b/dep/acelite/ace/LSOCK.cpp deleted file mode 100644 index 71af231952d..00000000000 --- a/dep/acelite/ace/LSOCK.cpp +++ /dev/null @@ -1,185 +0,0 @@ -// $Id: LSOCK.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/LSOCK.h" - - - -#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) - -#include "ace/Log_Msg.h" -#include "ace/OS_NS_sys_socket.h" - -#if !defined (__ACE_INLINE__) -#include "ace/LSOCK.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_LSOCK) - -void -ACE_LSOCK::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_LSOCK::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("aux_handle_ = %d"), this->aux_handle_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -#if defined (ACE_HAS_MSG) -// This routine sends an open file descriptor to handle_>. - -ssize_t -ACE_LSOCK::send_handle (const ACE_HANDLE handle) const -{ - ACE_TRACE ("ACE_LSOCK::send_handle"); - u_char a[2]; - iovec iov; - msghdr send_msg; -#if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG) - char cmsgbuf[ACE_BSD_CONTROL_MSG_LEN]; - cmsghdr *cmsgptr = (cmsghdr *) cmsgbuf; -#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */ - - a[0] = 0xab; - a[1] = 0xcd; - iov.iov_base = (char *) a; - iov.iov_len = sizeof a; - send_msg.msg_iov = &iov; - send_msg.msg_iovlen = 1; - send_msg.msg_name = 0; - send_msg.msg_namelen = 0; - -#if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG) - cmsgptr->cmsg_level = SOL_SOCKET; - cmsgptr->cmsg_type = SCM_RIGHTS; - cmsgptr->cmsg_len = sizeof cmsgbuf; - send_msg.msg_control = cmsgbuf; - send_msg.msg_controllen = sizeof cmsgbuf; - ACE_HANDLE *ph = (ACE_HANDLE *) CMSG_DATA (cmsgptr); - *ph = handle; - send_msg.msg_flags = 0; -#else - send_msg.msg_accrights = (char *) &handle; - send_msg.msg_accrightslen = sizeof handle; -#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */ - - return ACE_OS::sendmsg (this->get_handle (), &send_msg, 0); -} - -// This file receives an open file descriptor from handle_>. -// Note, this routine returns -1 if problems occur, 0 if we recv a -// message that does not have file descriptor in it, and 1 otherwise. - -ssize_t -ACE_LSOCK::recv_handle (ACE_HANDLE &handle, char *pbuf, ssize_t *len) const -{ - ACE_TRACE ("ACE_LSOCK::recv_handle"); - u_char a[2]; - iovec iov; - msghdr recv_msg; - -#if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG) - char cmsgbuf[ACE_BSD_CONTROL_MSG_LEN]; -#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */ - - if (pbuf != 0 && len != 0) - { - iov.iov_base = pbuf; - iov.iov_len = *len; - } - else - { - iov.iov_base = (char *) a; - iov.iov_len = sizeof a; - } - - recv_msg.msg_iov = &iov; - recv_msg.msg_iovlen = 1; - recv_msg.msg_name = 0; - recv_msg.msg_namelen = 0; -#if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG) - recv_msg.msg_control = cmsgbuf; - recv_msg.msg_controllen = sizeof cmsgbuf; -#else - recv_msg.msg_accrights = (char *) &handle; - recv_msg.msg_accrightslen = sizeof handle; -#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */ - -#if defined (ACE_HAS_STREAMS) - - ssize_t nbytes = ACE_OS::recvmsg (this->get_handle (), &recv_msg, 0); - - if (nbytes != ACE_INVALID_HANDLE) - { - if (len != 0) - *len = nbytes; - - if (nbytes == sizeof a - && ((u_char *) iov.iov_base)[0] == 0xab - && ((u_char *) iov.iov_base)[1] == 0xcd) - { -#if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG) - cmsghdr *cmsgptr = (cmsghdr *) cmsgbuf; - handle = *(ACE_HANDLE *) CMSG_DATA (cmsgptr); -#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */ - return 1; - } - else - return 0; - } -#else - ssize_t nbytes = ACE_OS::recvmsg (this->get_handle (), - &recv_msg, - MSG_PEEK); - - if (nbytes != ACE_INVALID_HANDLE) - { - if (nbytes == sizeof a - && ((u_char *) iov.iov_base)[0] == 0xab - && ((u_char *) iov.iov_base)[1] == 0xcd) - { -#if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG) - // Close down the socket that was returned by the MSG_PEEK. - cmsghdr *cmsgptr = (cmsghdr *) cmsgbuf; - ACE_HANDLE * ph = (ACE_HANDLE *) CMSG_DATA (cmsgptr); - ACE_OS::closesocket (*ph); - recv_msg.msg_control = cmsgbuf; - recv_msg.msg_controllen = sizeof cmsgbuf; -#else - recv_msg.msg_accrights = (char *) &handle; - recv_msg.msg_accrightslen = sizeof handle; -#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */ - - if (ACE_OS::recvmsg (this->get_handle (), - &recv_msg, 0) == ACE_INVALID_HANDLE) - return ACE_INVALID_HANDLE; - else - { -#if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG) - cmsghdr *cmsgptr = (cmsghdr *) cmsgbuf; - ACE_HANDLE * ph = (ACE_HANDLE *) CMSG_DATA (cmsgptr); - handle = *ph; -#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */ - return 1; - } - } - else - { - if (len != 0) - *len = nbytes; - return 0; - } - } -#endif /* ACE_HAS_STREAMS */ - else - return ACE_INVALID_HANDLE; -} -#endif /* ACE_HAS_MSG */ - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ diff --git a/dep/acelite/ace/LSOCK.h b/dep/acelite/ace/LSOCK.h deleted file mode 100644 index 7cf7abc478c..00000000000 --- a/dep/acelite/ace/LSOCK.h +++ /dev/null @@ -1,84 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file LSOCK.h - * - * $Id: LSOCK.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Doug Schmidt - */ -//============================================================================= - - -#ifndef ACE_LOCAL_SOCK_H -#define ACE_LOCAL_SOCK_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) - -#include "ace/SOCK.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_LSOCK - * - * @brief Create a Local ACE_SOCK, which is used for passing file - * descriptors. - */ -class ACE_Export ACE_LSOCK -{ -public: -#if defined (ACE_HAS_MSG) - /// Send an open FD to another process. - ssize_t send_handle (const ACE_HANDLE handle) const; - - /// Recv an open FD from another process. - ssize_t recv_handle (ACE_HANDLE &handles, - char *pbuf = 0, - ssize_t *len = 0) const; -#endif /* ACE_HAS_MSG */ - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - // = Ensure that ACE_LSOCK is an abstract base class - - /// Default constructor. - ACE_LSOCK (void); - - /// Initialize based on @a handle. - ACE_LSOCK (ACE_HANDLE handle); - - /// Get handle. - ACE_HANDLE get_handle (void) const; - - /// Set handle. - void set_handle (ACE_HANDLE handle); - -private: - /// An auxiliary handle used to avoid virtual base classes... - ACE_HANDLE aux_handle_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/LSOCK.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ -#include /**/ "ace/post.h" -#endif /* ACE_LOCAL_SOCK_H */ diff --git a/dep/acelite/ace/LSOCK.inl b/dep/acelite/ace/LSOCK.inl deleted file mode 100644 index 6bf726ad28c..00000000000 --- a/dep/acelite/ace/LSOCK.inl +++ /dev/null @@ -1,43 +0,0 @@ -// -*- C++ -*- -// -// $Id: LSOCK.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Simple-minded constructor. - -ACE_INLINE -ACE_LSOCK::ACE_LSOCK (void) - : aux_handle_ (ACE_INVALID_HANDLE) -{ - ACE_TRACE ("ACE_LSOCK::ACE_LSOCK"); -} - -// Sets the underlying file descriptor. - -ACE_INLINE void -ACE_LSOCK::set_handle (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_LSOCK::set_handle"); - this->aux_handle_ = handle; -} - -// Gets the underlying file descriptor. - -ACE_INLINE ACE_HANDLE -ACE_LSOCK::get_handle (void) const -{ - ACE_TRACE ("ACE_LSOCK::get_handle"); - return this->aux_handle_; -} - -// Sets the underlying file descriptor. - -ACE_INLINE -ACE_LSOCK::ACE_LSOCK (ACE_HANDLE handle) - : aux_handle_ (handle) -{ - ACE_TRACE ("ACE_LSOCK::ACE_LSOCK"); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/LSOCK_Acceptor.cpp b/dep/acelite/ace/LSOCK_Acceptor.cpp deleted file mode 100644 index 10c5acf5540..00000000000 --- a/dep/acelite/ace/LSOCK_Acceptor.cpp +++ /dev/null @@ -1,143 +0,0 @@ -// $Id: LSOCK_Acceptor.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/LSOCK_Acceptor.h" - -#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) - -#include "ace/Log_Msg.h" -#include "ace/OS_NS_unistd.h" -#include "ace/OS_NS_sys_socket.h" - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_LSOCK_Acceptor) - -// Return the local endpoint address. - -int -ACE_LSOCK_Acceptor::get_local_addr (ACE_Addr &a) const -{ - ACE_TRACE ("ACE_LSOCK_Acceptor::get_local_addr"); - - ACE_UNIX_Addr& target = dynamic_cast (a); - - target = this->local_addr_; - - return 0; -} - -void -ACE_LSOCK_Acceptor::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_LSOCK_Acceptor::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - this->local_addr_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -// Do nothing routine for constructor. - -ACE_LSOCK_Acceptor::ACE_LSOCK_Acceptor (void) -{ - ACE_TRACE ("ACE_LSOCK_Acceptor::ACE_LSOCK_Acceptor"); -} - -int -ACE_LSOCK_Acceptor::open (const ACE_Addr &remote_sap, - int reuse_addr, - int protocol_family, - int backlog, - int protocol) -{ - ACE_TRACE ("ACE_LSOCK_Acceptor::open"); - this->local_addr_ = *((ACE_UNIX_Addr *) &remote_sap); // This is a gross hack... - return ACE_SOCK_Acceptor::open (remote_sap, reuse_addr, - protocol_family, backlog, protocol); -} - -// General purpose routine for performing server ACE_SOCK creation. - -ACE_LSOCK_Acceptor::ACE_LSOCK_Acceptor (const ACE_Addr &remote_sap, - int reuse_addr, - int protocol_family, - int backlog, - int protocol) -{ - ACE_TRACE ("ACE_LSOCK_Acceptor::ACE_LSOCK_Acceptor"); - if (this->open (remote_sap, - reuse_addr, - protocol_family, - backlog, - protocol) == -1) - ACE_ERROR ((LM_ERROR, - "ACE_LSOCK_Acceptor::ACE_LSOCK_Acceptor")); -} - -// General purpose routine for accepting new connections. - -int -ACE_LSOCK_Acceptor::accept (ACE_LSOCK_Stream &new_stream, - ACE_Addr *remote_addr, - ACE_Time_Value *timeout, - bool restart, - bool reset_new_handle) const -{ - ACE_TRACE ("ACE_LSOCK_Acceptor::accept"); - - int in_blocking_mode = 0; - if (this->shared_accept_start (timeout, - restart, - in_blocking_mode) == -1) - return -1; - else - { - sockaddr *addr = 0; - int len = 0; - - if (remote_addr != 0) - { - len = remote_addr->get_size (); - addr = (sockaddr *) remote_addr->get_addr (); - } - - do - new_stream.set_handle (ACE_OS::accept (this->get_handle (), - addr, - &len)); - while (new_stream.get_handle () == ACE_INVALID_HANDLE - && restart != 0 - && errno == EINTR - && timeout == 0); - - // Reset the size of the addr, which is only necessary for UNIX - // domain sockets. - if (new_stream.get_handle () != ACE_INVALID_HANDLE - && remote_addr != 0) - remote_addr->set_size (len); - } - - return this->shared_accept_finish (new_stream, - in_blocking_mode, - reset_new_handle); -} - -// Close down the UNIX domain stream and remove the rendezvous point -// from the file system. - -int -ACE_LSOCK_Acceptor::remove (void) -{ - ACE_TRACE ("ACE_LSOCK_Acceptor::remove"); - int result = this->close (); - return ACE_OS::unlink (this->local_addr_.get_path_name ()) == -1 - || result == -1 ? -1 : 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ diff --git a/dep/acelite/ace/LSOCK_Acceptor.h b/dep/acelite/ace/LSOCK_Acceptor.h deleted file mode 100644 index b10c55c5d20..00000000000 --- a/dep/acelite/ace/LSOCK_Acceptor.h +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file LSOCK_Acceptor.h - * - * $Id: LSOCK_Acceptor.h 82723 2008-09-16 09:35:44Z johnnyw $ - * - * @author Doug Schmidt - */ -//============================================================================= - - -#ifndef ACE_LOCAL_SOCK_ACCEPTOR_H -#define ACE_LOCAL_SOCK_ACCEPTOR_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) - -#include "ace/SOCK_Acceptor.h" -#include "ace/UNIX_Addr.h" -#include "ace/LSOCK_Stream.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Forward decl. -class ACE_Reactor; - -/** - * @class ACE_LSOCK_Acceptor - * - * @brief Defines the format and interface for the acceptor side of the - * local ACE_SOCK ACE_Stream. - */ -class ACE_Export ACE_LSOCK_Acceptor : public ACE_SOCK_Acceptor -{ -public: - // = Initialization methods. - /// Default constructor. - ACE_LSOCK_Acceptor (void); - - /// Initiate a passive mode socket. - ACE_LSOCK_Acceptor (const ACE_Addr &local_sap, - int reuse_addr = 0, - int protocol_family = PF_UNIX, - int backlog = ACE_DEFAULT_BACKLOG, - int protocol = 0); - - /// Initiate a passive mode socket. - int open (const ACE_Addr &local_sap, - int reuse_addr = 0, - int protocol_family = PF_UNIX, - int backlog = ACE_DEFAULT_BACKLOG, - int protocol = 0); - - /// Accept a new data transfer connection. - int accept (ACE_LSOCK_Stream &new_ipc_sap, - ACE_Addr * = 0, - ACE_Time_Value *timeout = 0, - bool restart = true, - bool reset_new_handle = false) const; - - /// Close down the ACE_LSOCK and remove the rendezvous point from the - /// file system. - int remove (void); - - /// Return the local endpoint address. - int get_local_addr (ACE_Addr &) const; - - // = Meta-type info - typedef ACE_UNIX_Addr PEER_ADDR; - typedef ACE_LSOCK_Stream PEER_STREAM; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - /// Address of our rendezvous point. - ACE_UNIX_Addr local_addr_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ -#include /**/ "ace/post.h" -#endif /* ACE_LOCAL_SOCK_ACCEPTOR_H */ diff --git a/dep/acelite/ace/LSOCK_CODgram.cpp b/dep/acelite/ace/LSOCK_CODgram.cpp deleted file mode 100644 index 8c6e967ba3f..00000000000 --- a/dep/acelite/ace/LSOCK_CODgram.cpp +++ /dev/null @@ -1,62 +0,0 @@ -// $Id: LSOCK_CODgram.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/LSOCK_CODgram.h" -#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) - -#include "ace/Log_Msg.h" - - - -#if !defined (__ACE_INLINE__) -#include "ace/LSOCK_CODgram.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_LSOCK_CODgram) - -void -ACE_LSOCK_CODgram::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_LSOCK_CODgram::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_SOCK_CODgram::dump (); - ACE_LSOCK::dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -/* Here's the general-purpose open routine. */ - -int -ACE_LSOCK_CODgram::open (const ACE_Addr &remote, - const ACE_Addr &local, - int protocol_family, - int protocol) -{ - ACE_TRACE ("ACE_LSOCK_CODgram::open"); - if (ACE_SOCK_CODgram::open (remote, local, protocol_family, - protocol) == -1) - return -1; - ACE_LSOCK::set_handle (this->get_handle ()); - return 0; -} - -/* Create a local ACE_SOCK datagram. */ - -ACE_LSOCK_CODgram::ACE_LSOCK_CODgram (const ACE_Addr &remote, - const ACE_Addr &local, - int protocol_family, - int protocol) -{ - ACE_TRACE ("ACE_LSOCK_CODgram::ACE_LSOCK_CODgram"); - if (this->open (remote, local, protocol_family, - protocol) == -1) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_LSOCK_CODgram"))); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ diff --git a/dep/acelite/ace/LSOCK_CODgram.h b/dep/acelite/ace/LSOCK_CODgram.h deleted file mode 100644 index c2858a8ed70..00000000000 --- a/dep/acelite/ace/LSOCK_CODgram.h +++ /dev/null @@ -1,109 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file LSOCK_CODgram.h - * - * $Id: LSOCK_CODgram.h 84419 2009-02-11 22:28:11Z shuston $ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - - -#ifndef ACE_LOCAL_SOCK_CODGRAM_H -#define ACE_LOCAL_SOCK_CODGRAM_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) - -#include "ace/LSOCK.h" -#include "ace/SOCK_CODgram.h" -#include "ace/Addr.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_LSOCK_CODgram - * - * @brief Defines a fully specified (sometimes called "connected") UNIX-domain - * datagram abstraction. - * - * ACE_LSOCK_CODgram provides a way to use a UNIX-domain datagram socket in - * a situation where the local and peer addresses are fully known in advance. - * The "connection-oriented" part of "CODgram" is a misnomer. There is no - * connection used on this type of socket. It merely specifies that both - * endpoint addresses are known in advance of use. Furthermore, this class - * is more suited for use cases where a local endpoint wishes to communicate - * with a single, known peer and may or may not have a specified local address. - * - * If your use case requires receiving datagrams from multiple peers without - * previously known addresses, consider using ACE_LSOCK_Dgram instead. - */ -class ACE_Export ACE_LSOCK_CODgram : public ACE_SOCK_CODgram, public ACE_LSOCK -{ -public: - /// Default constructor; requires a call to open() prior to communication. - ACE_LSOCK_CODgram (void); - - /** - * @name Initialization methods - */ - //@{ - /** - * Initialize a fully-specified datagram socket. - * - * @param remote_sap Remote/peer address. This should be an ACE_UNIX_Addr - * object. It specifies where all sent datagrams will - * be sent to. - * @param local_sap Local address. The local address to receive datagrams - * at. If not specified, an unused address is selected. - * If specified, should be an ACE_UNIX_Addr object. - * - * @sa ACE_UNIX_Addr - */ - ACE_LSOCK_CODgram (const ACE_Addr &remote_sap, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int protocol_family = PF_UNIX, - int protocol = 0); - - /** - * Initialize a fully-specified datagram socket. - * - * @retval 0 if no error. - * @retval -1 on error; check errno for an error reason. - */ - int open (const ACE_Addr &remote_sap, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int protocol_family = PF_UNIX, - int protocol = 0); - //@} - - /// Get underlying handle. - ACE_HANDLE get_handle (void) const; - - /// Set underlying handle. - void set_handle (ACE_HANDLE); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/LSOCK_CODgram.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ -#include /**/ "ace/post.h" -#endif /* ACE_LOCAL_SOCK_CODGRAM_H */ diff --git a/dep/acelite/ace/LSOCK_CODgram.inl b/dep/acelite/ace/LSOCK_CODgram.inl deleted file mode 100644 index 02870c65ab6..00000000000 --- a/dep/acelite/ace/LSOCK_CODgram.inl +++ /dev/null @@ -1,30 +0,0 @@ -// -*- C++ -*- -// -// $Id: LSOCK_CODgram.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Do nothing constructor. - -ACE_INLINE -ACE_LSOCK_CODgram::ACE_LSOCK_CODgram (void) -{ - ACE_TRACE ("ACE_LSOCK_CODgram::ACE_LSOCK_CODgram"); -} - -ACE_INLINE void -ACE_LSOCK_CODgram::set_handle (ACE_HANDLE h) -{ - ACE_TRACE ("ACE_LSOCK_CODgram::set_handle"); - this->ACE_SOCK_CODgram::set_handle (h); - this->ACE_LSOCK::set_handle (h); -} - -ACE_INLINE ACE_HANDLE -ACE_LSOCK_CODgram::get_handle (void) const -{ - ACE_TRACE ("ACE_LSOCK_CODgram::get_handle"); - return this->ACE_SOCK_CODgram::get_handle (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/LSOCK_Connector.cpp b/dep/acelite/ace/LSOCK_Connector.cpp deleted file mode 100644 index 66e1d8851e6..00000000000 --- a/dep/acelite/ace/LSOCK_Connector.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// $Id: LSOCK_Connector.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/LSOCK_Connector.h" -#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) - -#include "ace/Log_Msg.h" - - - -#if !defined (__ACE_INLINE__) -#include "ace/LSOCK_Connector.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_LSOCK_Connector) - -void -ACE_LSOCK_Connector::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_LSOCK_Connector::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_LSOCK_Connector::ACE_LSOCK_Connector (void) -{ - ACE_TRACE ("ACE_LSOCK_Connector::ACE_LSOCK_Connector"); -} - -// Establish a connection. -ACE_LSOCK_Connector::ACE_LSOCK_Connector (ACE_LSOCK_Stream &new_stream, - const ACE_UNIX_Addr &remote_sap, - ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - int reuse_addr, - int flags, - int perms) - : ACE_SOCK_Connector (new_stream, - remote_sap, - timeout, - local_sap, - reuse_addr, - flags, - perms) -{ - ACE_TRACE ("ACE_LSOCK_Connector::ACE_LSOCK_Connector"); - // This is necessary due to the weird inheritance relationships of - // ACE_LSOCK_Stream. - new_stream.set_handle (new_stream.get_handle ()); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ diff --git a/dep/acelite/ace/LSOCK_Connector.h b/dep/acelite/ace/LSOCK_Connector.h deleted file mode 100644 index 03d0fd0a5b1..00000000000 --- a/dep/acelite/ace/LSOCK_Connector.h +++ /dev/null @@ -1,91 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file LSOCK_Connector.h - * - * $Id: LSOCK_Connector.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Doug Schmidt - */ -//============================================================================= - -#ifndef ACE_LOCAL_SOCK_CONNECTOR_H -#define ACE_LOCAL_SOCK_CONNECTOR_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) - -#include "ace/SOCK_Connector.h" -#include "ace/LSOCK_Stream.h" -#include "ace/UNIX_Addr.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_LSOCK_Connector - * - * @brief Defines the format and interface for the connector side of - * the ACE_LSOCK_Stream. - */ -class ACE_Export ACE_LSOCK_Connector : public ACE_SOCK_Connector -{ -public: - // = Initialization methods. - /// Default constructor. - ACE_LSOCK_Connector (void); - - /** - * Actively connect and produce a @a new_stream if things go well. - * All arguments are relayed to the ACE_SOCK_Connector constructor - * for handling. - * @see ACE_SOCK_Connector(). - */ - ACE_LSOCK_Connector (ACE_LSOCK_Stream &new_stream, - const ACE_UNIX_Addr &remote_sap, - ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = 0, - int perms = 0); - - /** - * Actively connect and produce a @a new_stream if things go well. - * The @c ACE_SOCK_Connector::connect() method is called to perform - * the actual connection attempt. - * @see ACE_SOCK_Connector::connect(). - */ - int connect (ACE_LSOCK_Stream &new_stream, - const ACE_UNIX_Addr &remote_sap, - ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = 0, - int perms = 0); - - // = Meta-type info - typedef ACE_UNIX_Addr PEER_ADDR; - typedef ACE_LSOCK_Stream PEER_STREAM; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/LSOCK_Connector.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ -#include /**/ "ace/post.h" -#endif /* ACE_LOCAL_SOCK_CONNECTOR_H */ diff --git a/dep/acelite/ace/LSOCK_Connector.inl b/dep/acelite/ace/LSOCK_Connector.inl deleted file mode 100644 index 31e79c9690a..00000000000 --- a/dep/acelite/ace/LSOCK_Connector.inl +++ /dev/null @@ -1,27 +0,0 @@ -// -*- C++ -*- -// -// $Id: LSOCK_Connector.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Establish a connection. -ACE_INLINE int -ACE_LSOCK_Connector::connect (ACE_LSOCK_Stream &new_stream, - const ACE_UNIX_Addr &remote_sap, - ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - int reuse_addr, - int flags, - int perms) -{ - ACE_TRACE ("ACE_LSOCK_Connector::connect"); - int result = ACE_SOCK_Connector::connect (new_stream, remote_sap, - timeout, local_sap, - reuse_addr, flags, perms); - if (result != -1) - // This is necessary due to the weird inheritance relationships of ACE_LSOCK_Stream. - new_stream.set_handle (new_stream.get_handle ()); - return result; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/LSOCK_Dgram.cpp b/dep/acelite/ace/LSOCK_Dgram.cpp deleted file mode 100644 index d681915f809..00000000000 --- a/dep/acelite/ace/LSOCK_Dgram.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// $Id: LSOCK_Dgram.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/LSOCK_Dgram.h" -#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) - -#include "ace/Log_Msg.h" - - - -#if !defined (__ACE_INLINE__) -#include "ace/LSOCK_Dgram.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_LSOCK_Dgram) - -void -ACE_LSOCK_Dgram::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_LSOCK_Dgram::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_SOCK_Dgram::dump (); - ACE_LSOCK::dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -// The "do nothing" constructor. - -ACE_LSOCK_Dgram::ACE_LSOCK_Dgram (void) -{ - ACE_TRACE ("ACE_LSOCK_Dgram::ACE_LSOCK_Dgram"); -} - -// Here's the general-purpose open routine. - -int -ACE_LSOCK_Dgram::open (const ACE_Addr &local, - int protocol_family, - int protocol) -{ - ACE_TRACE ("ACE_LSOCK_Dgram::open"); - if (ACE_SOCK_Dgram::open (local, - protocol_family, - protocol) == -1) - return -1; - ACE_LSOCK::set_handle (this->ACE_SOCK_Dgram::get_handle ()); - return 0; -} - -// Create a local ACE_SOCK datagram. - -ACE_LSOCK_Dgram::ACE_LSOCK_Dgram (const ACE_Addr &local, - int protocol_family, - int protocol) -{ - ACE_TRACE ("ACE_LSOCK_Dgram::ACE_LSOCK_Dgram"); - if (this->open (local, - protocol_family, - protocol) == -1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_LSOCK_Dgram"))); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ diff --git a/dep/acelite/ace/LSOCK_Dgram.h b/dep/acelite/ace/LSOCK_Dgram.h deleted file mode 100644 index e21a3ce9e62..00000000000 --- a/dep/acelite/ace/LSOCK_Dgram.h +++ /dev/null @@ -1,74 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file LSOCK_Dgram.h - * - * $Id: LSOCK_Dgram.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Doug Schmidt - */ -//============================================================================= - - -#ifndef ACE_LOCAL_SOCK_DGRAM_H -#define ACE_LOCAL_SOCK_DGRAM_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) - -#include "ace/SOCK_Dgram.h" -#include "ace/LSOCK.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_LSOCK_Dgram - * - * @brief Create a Local ACE_SOCK datagram. - */ -class ACE_Export ACE_LSOCK_Dgram : public ACE_SOCK_Dgram, public ACE_LSOCK -{ -public: - // = Initialization methods. - /// Default constructor. - ACE_LSOCK_Dgram (void); - - /// Initiate a local dgram. - ACE_LSOCK_Dgram (const ACE_Addr &local, - int protocol_family = PF_UNIX, - int protocol = 0); - - /// Initiate a local dgram. - int open (const ACE_Addr &local, - int protocol_family = PF_UNIX, - int protocol = 0); - - /// Get handle. - ACE_HANDLE get_handle (void) const; - - /// Set handle. - void set_handle (ACE_HANDLE); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/LSOCK_Dgram.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ -#include /**/ "ace/post.h" -#endif /* ACE_LOCAL_SOCK_DGRAM_H */ diff --git a/dep/acelite/ace/LSOCK_Dgram.inl b/dep/acelite/ace/LSOCK_Dgram.inl deleted file mode 100644 index 3174adf00da..00000000000 --- a/dep/acelite/ace/LSOCK_Dgram.inl +++ /dev/null @@ -1,22 +0,0 @@ -// -*- C++ -*- -// -// $Id: LSOCK_Dgram.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE void -ACE_LSOCK_Dgram::set_handle (ACE_HANDLE h) -{ - ACE_TRACE ("ACE_LSOCK_Dgram::set_handle"); - this->ACE_SOCK_Dgram::set_handle (h); - this->ACE_LSOCK::set_handle (h); -} - -ACE_INLINE ACE_HANDLE -ACE_LSOCK_Dgram::get_handle (void) const -{ - ACE_TRACE ("ACE_LSOCK_Dgram::get_handle"); - return this->ACE_SOCK_Dgram::get_handle (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/LSOCK_Stream.cpp b/dep/acelite/ace/LSOCK_Stream.cpp deleted file mode 100644 index 34475132d73..00000000000 --- a/dep/acelite/ace/LSOCK_Stream.cpp +++ /dev/null @@ -1,137 +0,0 @@ -// $Id: LSOCK_Stream.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/LSOCK_Stream.h" -#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) - -#include "ace/Log_Msg.h" -#include "ace/OS_NS_sys_socket.h" - - - -#if !defined (__ACE_INLINE__) -#include "ace/LSOCK_Stream.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_LSOCK_Stream) - -int -ACE_LSOCK_Stream::get_local_addr (ACE_Addr &addr) const -{ - ACE_TRACE ("ACE_LSOCK_Stream::get_local_addr"); - - // Perform the downcast since had better be an - // . - ACE_UNIX_Addr *rhs_unix_addr = dynamic_cast (&addr); - ACE_UNIX_Addr lhs_unix_addr; - - if (rhs_unix_addr == 0) - return -1; - else if (ACE_SOCK::get_local_addr (lhs_unix_addr) == -1) - return -1; - else - { - *rhs_unix_addr = lhs_unix_addr; - return 0; - } -} - -int -ACE_LSOCK_Stream::get_remote_addr (ACE_Addr &addr) const -{ - ACE_TRACE ("ACE_LSOCK_Stream::get_remote_addr"); - - return this->get_local_addr (addr); -} - -void -ACE_LSOCK_Stream::dump (void) const -{ - ACE_TRACE ("ACE_LSOCK_Stream::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_SOCK_Stream::dump (); - ACE_LSOCK::dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -} - -#if defined (ACE_HAS_MSG) - -// Send a readv-style vector of buffers, along with an open I/O -// handle. - -ssize_t -ACE_LSOCK_Stream::send_msg (const iovec iov[], - size_t n, - ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_LSOCK_Stream::send_msg"); - msghdr send_msg; -#if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG) - char cmsgbuf[ACE_BSD_CONTROL_MSG_LEN]; - cmsghdr *cmsgptr = (cmsghdr *) cmsgbuf; -#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */ - - send_msg.msg_iov = const_cast (iov); - send_msg.msg_iovlen = n; - send_msg.msg_name = 0; - send_msg.msg_namelen = 0; - -#if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG) - cmsgptr->cmsg_level = SOL_SOCKET; - cmsgptr->cmsg_type = SCM_RIGHTS; - cmsgptr->cmsg_len = sizeof cmsgbuf; - send_msg.msg_control = cmsgbuf; - send_msg.msg_controllen = sizeof cmsgbuf; - *(ACE_HANDLE *) CMSG_DATA (cmsgptr) = handle; - send_msg.msg_flags = 0 ; -#else - send_msg.msg_accrights = (char *) &handle; - send_msg.msg_accrightslen = sizeof handle; -#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */ - - return ACE_OS::sendmsg (this->ACE_SOCK_Stream::get_handle (), - &send_msg, 0); -} - -// Read a readv-style vector of buffers, along with an open I/O -// handle. - -ssize_t -ACE_LSOCK_Stream::recv_msg (iovec iov[], - size_t n, - ACE_HANDLE &handle) -{ - ACE_TRACE ("ACE_LSOCK_Stream::recv_msg"); - msghdr recv_msg; -#if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG) - char cmsgbuf[ACE_BSD_CONTROL_MSG_LEN]; - cmsghdr *cmsgptr = (cmsghdr *) cmsgbuf; -#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */ - - recv_msg.msg_iov = (iovec *) iov; - recv_msg.msg_iovlen = n; - recv_msg.msg_name = 0; - recv_msg.msg_namelen = 0; - -#if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG) - recv_msg.msg_control = cmsgbuf; - recv_msg.msg_controllen = sizeof cmsgbuf; - ssize_t result = ACE_OS::recvmsg (this->ACE_SOCK_Stream::get_handle (), - &recv_msg, 0); - handle = *(ACE_HANDLE*) CMSG_DATA (cmsgptr) ; - return result; -#else - recv_msg.msg_accrights = (char *) &handle; - recv_msg.msg_accrightslen = sizeof handle; - - return ACE_OS::recvmsg (this->ACE_SOCK_Stream::get_handle (), - &recv_msg, 0); -#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */ -} -#endif /* ACE_HAS_MSG */ - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ diff --git a/dep/acelite/ace/LSOCK_Stream.h b/dep/acelite/ace/LSOCK_Stream.h deleted file mode 100644 index bdaed30a39d..00000000000 --- a/dep/acelite/ace/LSOCK_Stream.h +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file LSOCK_Stream.h - * - * $Id: LSOCK_Stream.h 92140 2010-10-04 12:37:52Z johnnyw $ - * - * @author Doug Schmidt - */ -//============================================================================= - - -#ifndef ACE_LOCAL_SOCK_STREAM_H -#define ACE_LOCAL_SOCK_STREAM_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) - -#include "ace/SOCK_Stream.h" -#include "ace/UNIX_Addr.h" -#include "ace/LSOCK.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_LSOCK_Stream - * - * @brief Create a Local ACE_SOCK stream. - */ -class ACE_Export ACE_LSOCK_Stream : public ACE_SOCK_Stream, public ACE_LSOCK -{ -public: - // = Send/recv methods. - /// Send iovecs via ::writev(). - ssize_t send_msg (const iovec iov[], - size_t n, - ACE_HANDLE handle); - - /// Send iovecs via ::writev(). - ssize_t recv_msg (iovec iov[], - size_t n, - ACE_HANDLE &handle); - - /// Get handle. - ACE_HANDLE get_handle (void) const; - - /// Overrides set_handle() from the base classes. - void set_handle (ACE_HANDLE fd); - - // = Meta-type info - typedef ACE_UNIX_Addr PEER_ADDR; - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - /// This method simply returns the "local" addr. - int get_local_addr (ACE_Addr &) const; - - /// This method returns the "local" addr since it's the same value - /// for UNIX domain sockets. - int get_remote_addr (ACE_Addr &) const; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/LSOCK_Stream.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ -#include /**/ "ace/post.h" -#endif /* ACE_LOCAL_SOCK_STREAM_H */ diff --git a/dep/acelite/ace/LSOCK_Stream.inl b/dep/acelite/ace/LSOCK_Stream.inl deleted file mode 100644 index 0d9421115f2..00000000000 --- a/dep/acelite/ace/LSOCK_Stream.inl +++ /dev/null @@ -1,25 +0,0 @@ -// -*- C++ -*- -// -// $Id: LSOCK_Stream.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Sets both the file descriptors... Overrides handle from the base -// classes. - -ACE_INLINE void -ACE_LSOCK_Stream::set_handle (ACE_HANDLE fd) -{ - ACE_TRACE ("ACE_LSOCK_Stream::set_handle"); - this->ACE_SOCK_Stream::set_handle (fd); - this->ACE_LSOCK::set_handle (fd); -} - -ACE_INLINE ACE_HANDLE -ACE_LSOCK_Stream::get_handle (void) const -{ - ACE_TRACE ("ACE_LSOCK_Stream::get_handle"); - return this->ACE_SOCK_Stream::get_handle (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Lib_Find.cpp b/dep/acelite/ace/Lib_Find.cpp deleted file mode 100644 index 6c63df21b55..00000000000 --- a/dep/acelite/ace/Lib_Find.cpp +++ /dev/null @@ -1,777 +0,0 @@ -// $Id: Lib_Find.cpp 95630 2012-03-22 13:04:47Z johnnyw $ - -#include "ace/Lib_Find.h" -#include "ace/Log_Msg.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_errno.h" -#include "ace/OS_NS_stdio.h" -#include "ace/OS_NS_unistd.h" -#include "ace/OS_NS_stdlib.h" -#include "ace/OS_Memory.h" -#include "ace/OS_NS_fcntl.h" - -#if defined (ACE_WIN32) -# include "ace/OS_NS_strings.h" -#endif /* ACE_WIN32 */ - -#if defined (ACE_OPENVMS) -#include "ace/RB_Tree.h" -#include "ace/Thread_Mutex.h" -#include "ace/Singleton.h" - -#include /**/ "descrip.h" -#include /**/ "chfdef.h" -#include /**/ "stsdef.h" -#include /**/ "libdef.h" - -extern "C" int LIB$FIND_IMAGE_SYMBOL(...); - -/** - * @internal - * - * Implements a class to register symbols and addresses for use with DLL - * symbol retrieval. - * - * OpenVMS restricts symbol length to 31 characters encoding any symbols - * longer than that. In these cases dlsym() only works with the encoded - * names. - * This creates serious problems for the service configurator framework - * where the factory method names often exceed 31 chars and where loading - * is based on retrieval of method pointers using the *full* name. - * For OpenVMS we therefor added this singleton class and the - * ACE_Dynamic_Svc_Registrar class which registers full names and function - * pointers with this singleton at the time the static ACE_Dynamic_Svc_Registrar - * object is created in a (service) DLL. - * By forcing the DLL to load using a common symbol ("NULL") we trigger static - * object creation *before* the full names are referenced. - * Symbol references will be resolved as follows on OpenVMS: - * - first try directly from DLL using the RTL dlsym() function and if that fails; - * - try to find symbol in singleton registry. - */ -class ACE_LD_Symbol_Registry -{ -public: - - typedef ACE_RB_Tree, - ACE_Thread_Mutex> - TREE; - - void register_symbol (const ACE_TCHAR* symname, void* symaddr); - - void* find_symbol (const ACE_TCHAR* symname); - - ACE_LD_Symbol_Registry () {} -private: - - TREE symbol_registry_; -}; - -void -ACE_LD_Symbol_Registry::register_symbol (const ACE_TCHAR* symname, - void* symaddr) -{ - int const result = symbol_registry_.bind (symname, symaddr); - if (result == 1) - { - ACE_DEBUG((LM_INFO, ACE_TEXT ("ACE_LD_Symbol_Registry:") - ACE_TEXT (" duplicate symbol %s registered\n"), - ACE_TEXT_ALWAYS_CHAR (symname))); - } - else if (result == -1) - { - ACE_ERROR((LM_ERROR, ACE_TEXT ("ACE_LD_Symbol_Registry:") - ACE_TEXT (" failed to register symbol %s\n"), - ACE_TEXT_ALWAYS_CHAR (symname))); - } -} - -void* -ACE_LD_Symbol_Registry::find_symbol (const ACE_TCHAR* symname) -{ - void* symaddr = 0; - int const result = symbol_registry_.find (symname, symaddr); - - return (result == 0 ? symaddr : 0); -} - -/// Declare a process wide singleton -ACE_SINGLETON_DECLARE (ACE_Singleton, - ACE_LD_Symbol_Registry, - ACE_Thread_Mutex) - -typedef ACE_Singleton - ACE_LD_SYMBOL_REGISTRY; - -#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION) -template ACE_Singleton * - ACE_Singleton::singleton_; -#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */ -#endif - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -int -ACE::ldfind (const ACE_TCHAR* filename, - ACE_TCHAR pathname[], - size_t maxpathnamelen) -{ - ACE_TRACE ("ACE::ldfind"); -#if defined (ACE_OPENVMS) - if (ACE_OS::strlen(filename) >= maxpathnamelen) - { - errno = ENOMEM; - return -1; - } - - dsc$descriptor nameDsc; - nameDsc.dsc$b_class = DSC$K_CLASS_S; - nameDsc.dsc$b_dtype = DSC$K_DTYPE_T; - nameDsc.dsc$w_length = ACE_OS::strlen(filename); - nameDsc.dsc$a_pointer = (char*)filename; - - char symbol[] = "NULL"; - dsc$descriptor symbolDsc; - symbolDsc.dsc$b_class = DSC$K_CLASS_S; - symbolDsc.dsc$b_dtype = DSC$K_DTYPE_T; - symbolDsc.dsc$w_length = ACE_OS::strlen(symbol); - symbolDsc.dsc$a_pointer = symbol; - - int symbolValue; - int result; - try - { - result = LIB$FIND_IMAGE_SYMBOL(&nameDsc, &symbolDsc, &symbolValue, 0, 0); - } - catch (chf$signal_array& sig) - { - result = sig.chf$l_sig_name; - } - - int severity = result & STS$M_SEVERITY; - int conditionId = result & STS$M_COND_ID; - if (severity == STS$K_SUCCESS || severity == STS$K_WARNING || severity == STS$K_INFO || - (severity == STS$K_ERROR && conditionId == (LIB$_KEYNOTFOU & STS$M_COND_ID))) - { - ACE_OS::strcpy(pathname, filename); - return 0; - } - - if (ACE_OS::strlen(filename) + ACE_OS::strlen(ACE_DLL_PREFIX) >= maxpathnamelen) - { - errno = ENOMEM; - return -1; - } - - - ACE_OS::strcpy(pathname, ACE_DLL_PREFIX); - ACE_OS::strcat(pathname, filename); - nameDsc.dsc$w_length = ACE_OS::strlen(pathname); - nameDsc.dsc$a_pointer = pathname; - try - { - result = LIB$FIND_IMAGE_SYMBOL(&nameDsc, &symbolDsc, &symbolValue, 0, 0); - } - catch (chf$signal_array& sig) - { - result = sig.chf$l_sig_name; - } - - severity = result & STS$M_SEVERITY; - conditionId = result & STS$M_COND_ID; - if (severity == STS$K_SUCCESS || severity == STS$K_WARNING || severity == STS$K_INFO || - (severity == STS$K_ERROR && conditionId == (LIB$_KEYNOTFOU & STS$M_COND_ID))) - { - return 0; - } - errno = ENOENT; - return -1; -#endif /* ACE_OPENVMS */ - -#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) && \ - !defined (ACE_HAS_PHARLAP) - ACE_TCHAR expanded_filename[MAXPATHLEN]; - if (ACE_TEXT_ExpandEnvironmentStrings (filename, - expanded_filename, - sizeof expanded_filename - / sizeof (ACE_TCHAR))) - filename = expanded_filename; -#endif /* ACE_WIN32 && !ACE_HAS_WINCE && !ACE_HAS_PHARLAP */ - - ACE_TCHAR tempcopy[MAXPATHLEN + 1]; - ACE_TCHAR searchpathname[MAXPATHLEN + 1]; -#if defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK) - ACE_TCHAR decorator[] = ACE_LD_DECORATOR_STR; - ACE_TCHAR searchfilename[MAXPATHLEN + sizeof(decorator) / sizeof (ACE_TCHAR)]; -#else - ACE_TCHAR searchfilename[MAXPATHLEN + 1]; -#endif /* ACE_LD_DECORATOR_STR && !ACE_DISABLE_DEBUG_DLL_CHECK */ - - // Create a copy of filename to work with. - if (ACE_OS::strlen (filename) + 1 - > (sizeof tempcopy / sizeof (ACE_TCHAR))) - { - errno = ENOMEM; - return -1; - } - else - ACE_OS::strcpy (tempcopy, filename); - - // Insert canonical directory separators. - ACE_TCHAR *separator_ptr; - -#if (ACE_DIRECTORY_SEPARATOR_CHAR != '/') - // Make all the directory separators "canonical" to simplify - // subsequent code. - ACE::strrepl (tempcopy, ACE_DIRECTORY_SEPARATOR_CHAR, '/'); -#endif /* ACE_DIRECTORY_SEPARATOR_CHAR */ - - // Separate filename from pathname. - separator_ptr = ACE_OS::strrchr (tempcopy, '/'); - - // This is a relative path. - if (separator_ptr == 0) - { - searchpathname[0] = '\0'; - ACE_OS::strcpy (searchfilename, tempcopy); - } - else // This is an absolute path. - { - ACE_OS::strcpy (searchfilename, separator_ptr + 1); - separator_ptr[1] = '\0'; - ACE_OS::strcpy (searchpathname, tempcopy); - } - - bool has_suffix = false; - - // Check to see if this has an appropriate DLL suffix for the OS - // platform. - ACE_TCHAR *s = ACE_OS::strrchr (searchfilename, '.'); - - const ACE_TCHAR *dll_suffix = ACE_DLL_SUFFIX; - - if (s != 0) - { - // If we have a dot, we have a suffix - has_suffix = true; - - // Check whether this matches the appropriate platform-specific - // suffix. -#if defined (ACE_WIN32) - // Use on any platform with - // case-insensitive filenames. - if (ACE_OS::strcasecmp (s, dll_suffix) != 0) -#else - if (ACE_OS::strcmp (s, dll_suffix) != 0) -#endif /* ACE_WIN32 */ - { - ACE_ERROR ((LM_WARNING, - ACE_TEXT ("Warning: improper suffix for a ") - ACE_TEXT ("shared library on this platform: %s\n"), - s)); - } - } - - // Make sure we've got enough space in searchfilename. - if (ACE_OS::strlen (searchfilename) - + ACE_OS::strlen (ACE_DLL_PREFIX) - + (has_suffix ? 0 : ACE_OS::strlen (dll_suffix)) - >= (sizeof searchfilename / sizeof (ACE_TCHAR))) - { - errno = ENOMEM; - return -1; - } - -#if defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK) - size_t const len_searchfilename = ACE_OS::strlen (searchfilename); - if (!has_suffix) - ACE_OS::strcpy (searchfilename + len_searchfilename, decorator); - - for (int tag = 1; tag >= 0; tag --) - { - if (tag == 0) - searchfilename [len_searchfilename] = 0; - -#endif /* ACE_LD_DECORATOR_STR && !ACE_DISABLE_DEBUG_DLL_CHECK */ - // Use absolute pathname if there is one. - if (ACE_OS::strlen (searchpathname) > 0) - { - if (ACE_OS::strlen (searchfilename) - + ACE_OS::strlen (searchpathname) >= maxpathnamelen) - { - errno = ENOMEM; - return -1; - } - else - { -#if (ACE_DIRECTORY_SEPARATOR_CHAR != '/') - // Revert to native path name separators. - ACE::strrepl (searchpathname, - '/', - ACE_DIRECTORY_SEPARATOR_CHAR); -#endif /* ACE_DIRECTORY_SEPARATOR_CHAR */ - // First, try matching the filename *without* adding a - // prefix. - ACE_OS::sprintf (pathname, - ACE_TEXT ("%s%s%s"), - searchpathname, - searchfilename, - has_suffix ? ACE_TEXT ("") : dll_suffix); - if (ACE_OS::access (pathname, F_OK) == 0) - return 0; - - // Second, try matching the filename *with* adding a prefix. - ACE_OS::sprintf (pathname, - ACE_TEXT ("%s%s%s%s"), - searchpathname, - ACE_DLL_PREFIX, - searchfilename, - has_suffix ? ACE_TEXT ("") : dll_suffix); - if (ACE_OS::access (pathname, F_OK) == 0) - return 0; - } - } - - // Use relative filenames via LD_LIBRARY_PATH or PATH (depending on - // OS platform). - else - { -#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) - ACE_TCHAR *file_component = 0; - DWORD pathlen = - ACE_TEXT_SearchPath (0, - searchfilename, - dll_suffix, - static_cast (maxpathnamelen), - pathname, - &file_component); - if (pathlen >= maxpathnamelen) - { - errno = ENOMEM; - return -1; - } - else if (pathlen > 0) - return 0; - - // In case not found we should try again with the ACE_DLL_PREFIX - // prefixed - ACE_OS::strcpy (searchfilename, ACE_DLL_PREFIX); - ACE_OS::strcat (searchfilename, tempcopy); - pathlen = - ACE_TEXT_SearchPath (0, - searchfilename, - dll_suffix, - static_cast (maxpathnamelen), - pathname, - &file_component); - if (pathlen >= maxpathnamelen) - { - errno = ENOMEM; - return -1; - } - else if (pathlen > 0) - return 0; -#else - ACE_TCHAR *ld_path = 0; -# if defined ACE_DEFAULT_LD_SEARCH_PATH - ld_path = const_cast (ACE_DEFAULT_LD_SEARCH_PATH); -# else -# if defined (ACE_WIN32) || !defined (ACE_USES_WCHAR) - ld_path = ACE_OS::getenv (ACE_LD_SEARCH_PATH); -# else - // Wide-char, non-Windows only offers char * getenv. So capture - // it, translate to wide-char, and continue. - ACE_Ascii_To_Wide wide_ldpath - (ACE_OS::getenv (ACE_TEXT_ALWAYS_CHAR (ACE_LD_SEARCH_PATH))); - ld_path = wide_ldpath.wchar_rep (); -# endif /* ACE_WIN32 || !ACE_USES_WCHAR */ -# endif /* ACE_DEFAULT_LD_SEARCH_PATH */ - -#if defined (ACE_HAS_WINCE) - ACE_TCHAR *ld_path_temp = 0; - if (ld_path != 0) - { - ld_path_temp = (ACE_TCHAR *) - ACE_OS::malloc ((ACE_OS::strlen (ld_path) + 2) - * sizeof (ACE_TCHAR)); - if (ld_path_temp != 0) - { - ACE_OS::strcpy (ld_path_temp, - ACE_LD_SEARCH_PATH_SEPARATOR_STR); - - ACE_OS::strcat (ld_path_temp, ld_path); - ld_path = ld_path_temp; - } - else - { - ACE_OS::free ((void *) ld_path_temp); - ld_path = ld_path_temp = 0; - } - } -#endif /* ACE_HAS_WINCE */ - - if (ld_path != 0 - && (ld_path = ACE_OS::strdup (ld_path)) != 0) - { - // strtok has the strange behavior of not separating the - // string ":/foo:/bar" into THREE tokens. One would expect - // that the first iteration the token would be an empty - // string, the second iteration would be "/foo", and the - // third iteration would be "/bar". However, this is not - // the case; one only gets two iterations: "/foo" followed - // by "/bar". - - // This is especially a problem in parsing Unix paths - // because it is permissible to specify 'the current - // directory' as an empty entry. So, we introduce the - // following special code to cope with this: - - // Look at each dynamic lib directory in the search path. - - ACE_TCHAR *nextholder = 0; - const ACE_TCHAR *path_entry = - ACE::strsplit_r (ld_path, - ACE_LD_SEARCH_PATH_SEPARATOR_STR, - nextholder); - int result = 0; - - for (;;) - { - // Check if at end of search path. - if (path_entry == 0) - { - errno = ENOENT; - result = -1; - break; - } - else if (ACE_OS::strlen (path_entry) - + 1 - + ACE_OS::strlen (searchfilename) - >= maxpathnamelen) - { - errno = ENOMEM; - result = -1; - break; - } - // This works around the issue where a path might have - // an empty component indicating 'current directory'. - // We need to do it here rather than anywhere else so - // that the loop condition will still work. - else if (path_entry[0] == '\0') - path_entry = ACE_TEXT ("."); - - // First, try matching the filename *without* adding a - // prefix. - ACE_OS::sprintf (pathname, - ACE_TEXT ("%s%c%s%s"), - path_entry, - ACE_DIRECTORY_SEPARATOR_CHAR, - searchfilename, - has_suffix ? ACE_TEXT ("") : dll_suffix); - if (ACE_OS::access (pathname, F_OK) == 0) - break; - - // Second, try matching the filename *with* adding a - // prefix. - ACE_OS::sprintf (pathname, - ACE_TEXT ("%s%c%s%s%s"), - path_entry, - ACE_DIRECTORY_SEPARATOR_CHAR, - ACE_DLL_PREFIX, - searchfilename, - has_suffix ? ACE_TEXT ("") : dll_suffix); - if (ACE_OS::access (pathname, F_OK) == 0) - break; - - // Fetch the next item in the path - path_entry = - ACE::strsplit_r (0, - ACE_LD_SEARCH_PATH_SEPARATOR_STR, - nextholder); - } - -#if defined (ACE_HAS_WINCE) - if (ld_path_temp != 0) - ACE_OS::free (ld_path_temp); -#endif /* ACE_HAS_WINCE */ - ACE_OS::free ((void *) ld_path); -#if defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK) - if (result == 0 || tag == 0) -#endif /* ACE_LD_DECORATOR_STR && !ACE_DISABLE_DEBUG_DLL_CHECK */ - return result; - } -#endif /* ACE_WIN32 && !ACE_HAS_WINCE */ - } -#if defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK) - } -#endif /* ACE_LD_DECORATOR_STR && !ACE_DISABLE_DEBUG_DLL_CHECK */ - - errno = ENOENT; - return -1; -} - -FILE * -ACE::ldopen (const ACE_TCHAR *filename, - const ACE_TCHAR *type) -{ - ACE_TRACE ("ACE::ldopen"); - - ACE_TCHAR buf[MAXPATHLEN + 1]; - if (ACE::ldfind (filename, - buf, - sizeof (buf) /sizeof (ACE_TCHAR)) == -1) - return 0; - else - return ACE_OS::fopen (buf, type); -} - -ACE_TCHAR * -ACE::ldname (const ACE_TCHAR *entry_point) -{ - ACE_TRACE ("ACE::ldname"); - -#if defined(ACE_NEEDS_DL_UNDERSCORE) - size_t size = - 1 // leading '_' - + ACE_OS::strlen (entry_point) - + 1; - - ACE_TCHAR *new_name; - ACE_NEW_RETURN (new_name, - ACE_TCHAR[size], - 0); - - ACE_OS::strcpy (new_name, ACE_TEXT ("_")); - ACE_OS::strcat (new_name, entry_point); - - return new_name; -#else /* ACE_NEEDS_DL_UNDERSCORE */ - size_t size = - ACE_OS::strlen (entry_point) - + 1; - - ACE_TCHAR *new_name; - ACE_NEW_RETURN (new_name, - ACE_TCHAR[size], - 0); - - ACE_OS::strcpy (new_name, entry_point); - return new_name; -#endif /* ACE_NEEDS_DL_UNDERSCORE */ -} - -#if defined (ACE_OPENVMS) -void -ACE::ldregister (const ACE_TCHAR *entry_point, - void* entry_addr) -{ - ACE_LD_SYMBOL_REGISTRY::instance ()->register_symbol (entry_point, - entry_addr); -} - -void * -ACE::ldsymbol (ACE_SHLIB_HANDLE sh, const ACE_TCHAR *entry_point) -{ - void* symaddr = ACE_OS::dlsym (sh, entry_point); - // if not found through dlsym() try registry - if (symaddr == 0) - symaddr = ACE_LD_SYMBOL_REGISTRY::instance ()->find_symbol (entry_point); - - return symaddr; -} -#endif - -int -ACE::get_temp_dir (ACE_TCHAR *buffer, size_t buffer_len) -{ - int result; -#if defined (ACE_WIN32) - result = ACE_TEXT_GetTempPath (static_cast (buffer_len), - buffer); - - // Make sure to return -1 if there is an error - if ((result == 0 && ::GetLastError () != ERROR_SUCCESS) - || (result > static_cast (buffer_len))) - result = -1; - -#else /* ACE_WIN32 */ - - // NOTE! Non-Windows platforms don't deal with wide chars for env. - // variables, so do this narrow-char and convert to wide for the - // caller if necessary. - - // On non-win32 platforms, check to see what the TMPDIR environment - // variable is defined to be. If it doesn't exist, just use /tmp - const char *tmpdir = ACE_OS::getenv ("TMPDIR"); - - if (tmpdir == 0) - { -#if defined (ACE_DEFAULT_TEMP_DIR) - tmpdir = ACE_DEFAULT_TEMP_DIR; -#else - tmpdir = "/tmp"; -#endif - } - - size_t len = ACE_OS::strlen (tmpdir); - - // Check to see if the buffer is large enough for the string, - // another /, and its null character (hence the + 2) - if ((len + 2) > buffer_len) - { - result = -1; - } - else - { - ACE_OS::strcpy (buffer, ACE_TEXT_CHAR_TO_TCHAR (tmpdir)); - - // Add a trailing slash because we cannot assume there is already one - // at the end. And having an extra one should not cause problems. - buffer[len] = ACE_TEXT ('/'); - buffer[len + 1] = 0; - result = 0; - } -#endif /* ACE_WIN32 */ - return result; -} - -ACE_HANDLE -ACE::open_temp_file (const ACE_TCHAR *name, int mode, int perm) -{ -#if defined (ACE_WIN32) - ACE_UNUSED_ARG (perm); - ACE_HANDLE handle = ACE_OS::open (name, - mode, - FILE_SHARE_READ - | FILE_SHARE_WRITE - | FILE_SHARE_DELETE); -#else - // Open it. - ACE_HANDLE handle = ACE_OS::open (name, mode, perm); -#endif /* ACE_WIN32 */ - - if (handle == ACE_INVALID_HANDLE) - return ACE_INVALID_HANDLE; - - // Unlink it so that the file will be removed automatically when the - // process goes away. - if (ACE_OS::unlink (name) == -1) - { - ACE_OS::close (handle); - return ACE_INVALID_HANDLE; - } - else - // Return the handle. - return handle; -} - -size_t -ACE::strrepl (char *s, char search, char replace) -{ - ACE_TRACE ("ACE::strrepl"); - - size_t replaced = 0; - - for (size_t i = 0; s[i] != '\0'; i++) - if (s[i] == search) - { - s[i] = replace; - ++replaced; - } - - return replaced; -} - - -// Split a string up into 'token'-delimited pieces, ala Perl's -// "split". - -char * -ACE::strsplit_r (char *str, - const char *token, - char *&next_start) -{ - char *result = 0; - - if (str != 0) - next_start = str; - - if (next_start != 0) - { - char *tok_loc = ACE_OS::strstr (next_start, token); - - if (tok_loc != 0) - { - // Return the beginning of the string. - result = next_start; - - // Insure it's terminated. - *tok_loc = '\0'; - next_start = tok_loc + ACE_OS::strlen (token); - } - else - { - result = next_start; - next_start = (char *) 0; - } - } - - return result; -} - -#if defined (ACE_HAS_WCHAR) -wchar_t * -ACE::strsplit_r (wchar_t *str, - const wchar_t *token, - wchar_t *&next_start) -{ - wchar_t *result = 0; - - if (str != 0) - next_start = str; - - if (next_start != 0) - { - wchar_t *tok_loc = ACE_OS::strstr (next_start, token); - - if (tok_loc != 0) - { - // Return the beginning of the string. - result = next_start; - - // Insure it's terminated. - *tok_loc = '\0'; - next_start = tok_loc + ACE_OS::strlen (token); - } - else - { - result = next_start; - next_start = (wchar_t *) 0; - } - } - - return result; -} - -size_t -ACE::strrepl (wchar_t *s, wchar_t search, wchar_t replace) -{ - ACE_TRACE ("ACE::strrepl"); - - size_t replaced = 0; - - for (size_t i = 0; s[i] != '\0'; i++) - if (s[i] == search) - { - s[i] = replace; - ++replaced; - } - - return replaced; -} -#endif /* ACE_HAS_WCHAR */ - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Lib_Find.h b/dep/acelite/ace/Lib_Find.h deleted file mode 100644 index 1ed2d8e72bc..00000000000 --- a/dep/acelite/ace/Lib_Find.h +++ /dev/null @@ -1,131 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Lib_Find.h - * - * All the static function calls needed to search and open shared - * libraries. - * - * $Id: Lib_Find.h 93359 2011-02-11 11:33:12Z mcorino $ - */ -//============================================================================= - -#ifndef ACE_LIB_FIND_H -#define ACE_LIB_FIND_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" -#include /**/ "ace/ACE_export.h" -#include "ace/os_include/os_stdio.h" -#if defined (ACE_OPENVMS) -# include "ace/OS_NS_dlfcn.h" -#endif - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace ACE -{ - // = Methods for searching and opening shared libraries. - - /** - * Finds the file @a filename either using an absolute path or using - * a relative path in conjunction with ACE_LD_SEARCH_PATH (e.g., - * $LD_LIBRARY_PATH on UNIX or the directories scaned by Win32 API - * SearchPath on Win32). This function will add appropriate suffix - * (e.g., .dll on Win32 or .so on UNIX) according to the OS - * platform. In addition, this function will apply the appropriate - * prefix (e.g., "lib" on UNIX and "" on Win32) if the @a filename - * doesn't match directly. - */ - extern ACE_Export int ldfind (const ACE_TCHAR* filename, - ACE_TCHAR pathname[], - size_t maxpathnamelen); - - /** - * Uses @c ldfind to locate and open the appropriate @a filename and - * returns a pointer to the file, else it returns a NULL - * pointer. @a type specifies how the file should be open. - */ - extern ACE_Export FILE *ldopen (const ACE_TCHAR *filename, - const ACE_TCHAR *type); - - /** - * Transforms @a entry_point into a form that can be located in a - * dynamic library using . For example, with Win32/Borland - * extern "C" functions which use the default calling convention - * have a '_' prepended. Always returns a buffer that has been - * dynamically allocated using . - */ - extern ACE_Export ACE_TCHAR *ldname (const ACE_TCHAR *entry_point); - - -#if defined (ACE_OPENVMS) - /** - * Registers an @a entry_point and its address for later retrieval - * through the ACE::ldsymbol () method. - * For use in cases where the OS compiler encodes long symbolnames. - */ - extern ACE_Export void ldregister (const ACE_TCHAR *entry_point, - void* entry_addr); - - /** - * Looks up an @a entry_point address either from previously registered - * symbols or through ACE_OS::dlsym (). - * Returns 0 in case the entry_point is not found, otherwise nonzero. - * For use in cases where the OS compiler encodes long symbolnames. - */ - extern ACE_Export void *ldsymbol (ACE_SHLIB_HANDLE sh, - const ACE_TCHAR *entry_point); -#endif - - /** - * Returns the temporary directory including the trailing slash in - * @a buffer. Returns -1 for an error or if the buffer_len is not - * long enough. - */ - extern ACE_Export int get_temp_dir (ACE_TCHAR *buffer, size_t buffer_len); - - /// Opening the temp file. File is automagically unlinked when it is - /// closed. This is useful for have temp files. - extern ACE_Export ACE_HANDLE open_temp_file (const ACE_TCHAR *name, - int mode, - int perm = 0); - - // @@ Though the following functions dont come under the same category as - // above, these are used only in the functions in this class. So it makes - // more sense to move these functions too to this class. - // - /// Replace all instances of @a search in @a s with @a replace. Returns - /// the number of replacements made. - extern ACE_Export size_t strrepl (char *s, char search, char replace); - - /** - * Splits string @a s into pieces separated by the string @a token. - * @a next_start is an opaque cookie handed back by the call to store - * its state for the next invocation, thus making it re-entrant. - * This operates very similar to Perl's @c split function except that - * it returns pieces one at a time instead of into an array. - */ - extern ACE_Export char *strsplit_r (char *s, - const char *token, - char *&next_start); - -#if defined (ACE_HAS_WCHAR) - /// As strrepl, but for wide characters. - extern ACE_Export size_t strrepl (wchar_t *s, - wchar_t search, - wchar_t replace); - - /// As strsplit_r, but for wide characters. - extern ACE_Export wchar_t *strsplit_r (wchar_t *s, - const wchar_t *token, - wchar_t *&next_start); -#endif /* ACE_HAS_WCHAR */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_LIB_FIND_H */ - diff --git a/dep/acelite/ace/Local_Memory_Pool.cpp b/dep/acelite/ace/Local_Memory_Pool.cpp deleted file mode 100644 index abebb254634..00000000000 --- a/dep/acelite/ace/Local_Memory_Pool.cpp +++ /dev/null @@ -1,144 +0,0 @@ -// $Id: Local_Memory_Pool.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -// Local_Memory_Pool.cpp -#include "ace/Local_Memory_Pool.h" -#include "ace/Auto_Ptr.h" -#include "ace/OS_Memory.h" -#include "ace/Log_Msg.h" - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Local_Memory_Pool) - -void -ACE_Local_Memory_Pool::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Local_Memory_Pool::dump"); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Local_Memory_Pool::ACE_Local_Memory_Pool (const ACE_TCHAR *, - const OPTIONS *) -{ - ACE_TRACE ("ACE_Local_Memory_Pool::ACE_Local_Memory_Pool"); -} - -ACE_Local_Memory_Pool::~ACE_Local_Memory_Pool (void) -{ - // Free up all memory allocated by this pool. - this->release (); -} - -// Ask system for initial chunk of local memory. -void * -ACE_Local_Memory_Pool::init_acquire (size_t nbytes, - size_t &rounded_bytes, - int &first_time) -{ - ACE_TRACE ("ACE_Local_Memory_Pool::init_acquire"); - // Note that we assume that when ACE_Local_Memory_Pool is used, - // ACE_Malloc's constructor will only get called once. If this - // assumption doesn't hold, we are in deep trouble! - - first_time = 1; - return this->acquire (nbytes, rounded_bytes); -} - -void * -ACE_Local_Memory_Pool::acquire (size_t nbytes, - size_t &rounded_bytes) -{ - ACE_TRACE ("ACE_Local_Memory_Pool::acquire"); - rounded_bytes = this->round_up (nbytes); - - char *temp = 0; - ACE_NEW_RETURN (temp, - char[rounded_bytes], - 0); - - ACE_Auto_Basic_Array_Ptr cp (temp); - - if (this->allocated_chunks_.insert (cp.get ()) != 0) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("(%P|%t) insertion into set failed\n")), - 0); - - return cp.release (); -} - -int -ACE_Local_Memory_Pool::release (int) -{ - ACE_TRACE ("ACE_Local_Memory_Pool::release"); - - // Zap the memory we allocated. - for (ACE_Unbounded_Set::iterator i = this->allocated_chunks_.begin (); - i != this->allocated_chunks_.end (); - ++i) - delete [] *i; - this->allocated_chunks_.reset (); - return 0; -} - -int -ACE_Local_Memory_Pool::sync (ssize_t, int) -{ - ACE_TRACE ("ACE_Local_Memory_Pool::sync"); - return 0; -} - -int -ACE_Local_Memory_Pool::sync (void *, size_t, int) -{ - ACE_TRACE ("ACE_Local_Memory_Pool::sync"); - return 0; -} - -int -ACE_Local_Memory_Pool::protect (ssize_t, int) -{ - ACE_TRACE ("ACE_Local_Memory_Pool::protect"); - return 0; -} - -int -ACE_Local_Memory_Pool::protect (void *, size_t, int) -{ - ACE_TRACE ("ACE_Local_Memory_Pool::protect"); - return 0; -} - -#if defined (ACE_WIN32) -int -ACE_Local_Memory_Pool::seh_selector (void *) -{ - return 0; - // Continue propagate the structural exception up. -} -#endif /* ACE_WIN32 */ - -int -ACE_Local_Memory_Pool::remap (void *) -{ - return 0; - // Not much can be done. -} - -void * -ACE_Local_Memory_Pool::base_addr (void) const -{ - return 0; -} - -// Let the underlying new operator figure out the alignment... -size_t -ACE_Local_Memory_Pool::round_up (size_t nbytes) -{ - ACE_TRACE ("ACE_Local_Memory_Pool::round_up"); - return ACE::round_to_pagesize (nbytes); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Local_Memory_Pool.h b/dep/acelite/ace/Local_Memory_Pool.h deleted file mode 100644 index 4216a97a713..00000000000 --- a/dep/acelite/ace/Local_Memory_Pool.h +++ /dev/null @@ -1,133 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Local_Memory_Pool.h - * - * $Id: Local_Memory_Pool.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Dougls C. Schmidt - * @author Prashant Jain - */ -//============================================================================= - -#ifndef ACE_LOCAL_MEMORY_POOL_H -#define ACE_LOCAL_MEMORY_POOL_H -#include /**/ "ace/pre.h" - -#include "ace/os_include/sys/os_mman.h" /* Need PROT_RDWR */ -#include "ace/ACE.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Unbounded_Set.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Local_Memory_Pool_Options - * - * @brief Helper class for Local Memory Pool constructor options. - * - * This should be a nested class, but that breaks too many - * compilers. - */ -class ACE_Export ACE_Local_Memory_Pool_Options -{ -}; - -/** - * @class ACE_Local_Memory_Pool - * - * @brief Make a memory pool that is based on C++ new/delete. This is - * useful for integrating existing components that use new/delete - * into the ACE Malloc scheme... - */ -class ACE_Export ACE_Local_Memory_Pool -{ -public: - typedef ACE_Local_Memory_Pool_Options OPTIONS; - - /// Initialize the pool. - ACE_Local_Memory_Pool (const ACE_TCHAR *backing_store_name = 0, - const OPTIONS *options = 0); - - virtual ~ACE_Local_Memory_Pool (void); - - /// Ask system for initial chunk of local memory. - virtual void *init_acquire (size_t nbytes, - size_t &rounded_bytes, - int &first_time); - - /// Acquire at least @a nbytes from the memory pool. @a rounded_bytes is - /// the actual number of bytes allocated. - virtual void *acquire (size_t nbytes, - size_t &rounded_bytes); - - /// Instruct the memory pool to release all of its resources. - virtual int release (int destroy = 1); - - /** - * Sync @a len bytes of the memory region to the backing store - * starting at base_addr_>. If @a len == -1 then sync the - * whole region. - */ - virtual int sync (ssize_t len = -1, int flags = MS_SYNC); - - /// Sync @a len bytes of the memory region to the backing store - /// starting at @a add_. - virtual int sync (void *addr, size_t len, int flags = MS_SYNC); - - /** - * Change the protection of the pages of the mapped region to @a prot - * starting at base_addr_> up to @a len bytes. If @a len == -1 - * then change protection of all pages in the mapped region. - */ - virtual int protect (ssize_t len = -1, int prot = PROT_RDWR); - - /// Change the protection of the pages of the mapped region to @a prot - /// starting at @a addr up to @a len bytes. - virtual int protect (void *addr, size_t len, int prot = PROT_RDWR); - -#if defined (ACE_WIN32) - /** - * Win32 Structural exception selector. The return value decides - * how to handle memory pool related structural exceptions. Returns - * 1, 0, or , -1. - */ - virtual int seh_selector (void *); -#endif /* ACE_WIN32 */ - - /** - * Try to extend the virtual address space so that @a addr is now - * covered by the address mapping. Always returns 0 since we can't - * remap a local memory pool. - */ - virtual int remap (void *addr); - - /// Return the base address of this memory pool, 0 if base_addr - /// never changes. - virtual void *base_addr (void) const; - - /// Dump the state of an object. - virtual void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - /// List of memory that we have allocated. - ACE_Unbounded_Set allocated_chunks_; - - /// Implement the algorithm for rounding up the request to an - /// appropriate chunksize. - virtual size_t round_up (size_t nbytes); - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_LOCAL_MEMORY_POOL_H */ diff --git a/dep/acelite/ace/Local_Name_Space.cpp b/dep/acelite/ace/Local_Name_Space.cpp deleted file mode 100644 index 36b9a80552d..00000000000 --- a/dep/acelite/ace/Local_Name_Space.cpp +++ /dev/null @@ -1,167 +0,0 @@ -// $Id: Local_Name_Space.cpp 91287 2010-08-05 10:30:49Z johnnyw $ - -#include "ace/Local_Name_Space.h" -#include "ace/ACE.h" -#include "ace/RW_Process_Mutex.h" -#include "ace/SString.h" -#include "ace/OS_NS_string.h" -#include "ace/Truncate.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_NS_String::~ACE_NS_String (void) -{ - if (this->delete_rep_) - delete [] this->rep_; -} - -ACE_WCHAR_T * -ACE_NS_String::fast_rep (void) const -{ - ACE_TRACE ("ACE_NS_String::fast_rep"); - return this->rep_; -} - -ACE_NS_String::operator ACE_NS_WString () const -{ - ACE_TRACE ("ACE_NS_String::operator ACE_NS_WString"); - return ACE_NS_WString (this->rep_, - (this->len_ / sizeof (ACE_WCHAR_T)) - 1); -} - -size_t -ACE_NS_String::len (void) const -{ - ACE_TRACE ("ACE_NS_String::len"); - return this->len_; -} - -char * -ACE_NS_String::char_rep (void) const -{ - ACE_TRACE ("ACE_NS_String::char_rep"); - ACE_NS_WString w_string (this->rep_, - (this->len_ / sizeof (ACE_WCHAR_T)) - 1); - return w_string.char_rep (); -} - -ACE_NS_String::ACE_NS_String (void) - : len_ (0), - rep_ (0), - delete_rep_ (false) -{ - ACE_TRACE ("ACE_NS_String::ACE_NS_String"); -} - -ACE_NS_String::ACE_NS_String (const ACE_NS_WString &s) - : len_ ((s.length () + 1) * sizeof (ACE_WCHAR_T)), - rep_ (s.rep ()), - delete_rep_ (true) -{ - ACE_TRACE ("ACE_NS_String::ACE_NS_String"); -} - -int -ACE_NS_String::strstr (const ACE_NS_String &s) const -{ - ACE_TRACE ("ACE_NS_String::strstr"); - - if (this->len_ < s.len_) - // If they're larger than we are they can't be a substring of us! - return -1; - else if (this->len_ == s.len_) - // Check if we're equal. - return *this == s ? 0 : -1; - else - { - // They're smaller than we are... - const size_t len = (this->len_ - s.len_) / sizeof (ACE_WCHAR_T); - const size_t pat_len = s.len_ / sizeof (ACE_WCHAR_T) - 1; - - for (size_t i = 0; i <= len; ++i) - { - size_t j; - - for (j = 0; j < pat_len; ++j) - if (this->rep_[i + j] != s.rep_[j]) - break; - - if (j == pat_len) - // Found a match! Return the index. - return ACE_Utils::truncate_cast (i); - } - - return -1; - } -} - -bool -ACE_NS_String::operator == (const ACE_NS_String &s) const -{ - ACE_TRACE ("ACE_NS_String::operator =="); - return this->len_ == s.len_ - && ACE_OS::memcmp ((void *) this->rep_, - (void *) s.rep_, this->len_) == 0; -} - -bool -ACE_NS_String::operator != (const ACE_NS_String &s) const -{ - ACE_TRACE ("ACE_NS_String::operator !="); - return !this->operator == (s); -} - -ACE_NS_String::ACE_NS_String (ACE_WCHAR_T *dst, - const ACE_WCHAR_T *src, - size_t bytes) - : len_ (bytes), - rep_ (dst), - delete_rep_ (false) -{ - ACE_TRACE ("ACE_NS_String::ACE_NS_String"); - ACE_OS::memcpy (this->rep_, src, bytes); -} - -u_long -ACE_NS_String::hash (void) const -{ - return ACE::hash_pjw - (reinterpret_cast (const_cast (this->rep_)), - this->len_); -} - -ACE_NS_Internal::ACE_NS_Internal (void) - : value_ (), - type_ () -{ -} - -ACE_NS_Internal::ACE_NS_Internal (ACE_NS_String &value, const char *type) - : value_ (value), - type_ (type) -{ - ACE_TRACE ("ACE_NS_Internal::ACE_NS_Internal"); -} - -bool -ACE_NS_Internal::operator == (const ACE_NS_Internal &s) const -{ - ACE_TRACE ("ACE_NS_Internal::operator =="); - return this->value_ == s.value_; -} - -ACE_NS_String -ACE_NS_Internal::value (void) -{ - ACE_TRACE ("ACE_NS_Internal::value"); - return this->value_; -} - -const char * -ACE_NS_Internal::type (void) -{ - ACE_TRACE ("ACE_NS_Internal::type"); - return this->type_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Local_Name_Space.h b/dep/acelite/ace/Local_Name_Space.h deleted file mode 100644 index c9606d02bf2..00000000000 --- a/dep/acelite/ace/Local_Name_Space.h +++ /dev/null @@ -1,132 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Local_Name_Space.h - * - * $Id: Local_Name_Space.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Prashant Jain (pjain@cs.wustl.edu) - * @author Irfan Pyarali (irfan@wuerl.wustl.edu) - * @author Douglas C. Schmidt (schmidt@cs.wustl.edu). - */ -//============================================================================= - -#ifndef ACE_LOCAL_NAME_SPACE_H -#define ACE_LOCAL_NAME_SPACE_H - -#include /**/ "ace/pre.h" - -#include "ace/Malloc_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_NS_WString; - -/** - * @class ACE_NS_String - * - * @brief This class and ACE_NS_Internal are used as Adapters to work - * with the Map_Manager. - * - * In order to work correctly, this class must be able to - * convert back and forth with . - */ -class ACE_Export ACE_NS_String -{ -public: - // = Initialization. - /// Default "no-op" constructor. - ACE_NS_String (void); - - /// Initialization method. - ACE_NS_String (ACE_WCHAR_T *dst, - const ACE_WCHAR_T *src, - size_t len); - - /// Converts an ACE_NS_WString to an ACE_NS_String; - ACE_NS_String (const ACE_NS_WString &); - - /// Destructor - ~ACE_NS_String (void); - - /// Converts an ACE_NS_String to fresh copy of an ACE_NS_WString; - operator ACE_NS_WString () const; - - /// Return the ASCII character representation. - char *char_rep (void) const; - - /// Matches on substrings. - int strstr (const ACE_NS_String &) const; - - /// Compare an ACE_NS_String. - bool operator == (const ACE_NS_String &) const; - - /// Compare an ACE_NS_String. - bool operator != (const ACE_NS_String &) const; - - /// Returns length of the string - size_t len (void) const; - - /// Returns the underlying representation. - ACE_WCHAR_T *fast_rep (void) const; - - /// Returns a hash value for this string. - u_long hash (void) const; - -private: - /// Length of the string. - size_t len_; - - /// This actually points into shared/persistent memory. - ACE_WCHAR_T *rep_; - - /// Should rep_ be deleted when destructed (only used - /// for WString conversions) - bool delete_rep_; -}; - -/** - * @class ACE_NS_Internal - * - * @brief This class and ACE_NS_String are used as Adapters to work - * with the Map_Manager. - */ -class ACE_Export ACE_NS_Internal -{ -public: - /// No-op constructor. - ACE_NS_Internal (void); - - /// Constructor. - ACE_NS_Internal (ACE_NS_String &value, const char *type); - - /// Compare an ACE_NS_Internal - bool operator == (const ACE_NS_Internal &) const; - - /// Return value. - ACE_NS_String value (void); - - /// Return type. - const char *type (void); - -private: - /// Contains the value of the string. - ACE_NS_String value_; - - /// Contains the type of the string. - const char *type_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -// Include the ACE_Local_Name_Space templates stuff at this point. -#include "ace/Local_Name_Space_T.h" - -#include /**/ "ace/post.h" - -#endif /* ACE_LOCAL_NAME_SPACE_H */ diff --git a/dep/acelite/ace/Local_Name_Space_T.cpp b/dep/acelite/ace/Local_Name_Space_T.cpp deleted file mode 100644 index ee545e5dfbf..00000000000 --- a/dep/acelite/ace/Local_Name_Space_T.cpp +++ /dev/null @@ -1,966 +0,0 @@ -// $Id: Local_Name_Space_T.cpp 83170 2008-10-13 07:21:38Z johnnyw $ - -#ifndef ACE_LOCAL_NAME_SPACE_T_CPP -#define ACE_LOCAL_NAME_SPACE_T_CPP - -#include "ace/ACE.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Local_Name_Space.h" -#include "ace/Auto_Ptr.h" -#include "ace/Guard_T.h" -#include "ace/OS_NS_regex.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_unistd.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Name_Space_Map::ACE_Name_Space_Map (ALLOCATOR *alloc) - : MAP_MANAGER (alloc) -{ - ACE_TRACE ("ACE_Name_Space_Map::ACE_Name_Space_Map"); -} - -template int -ACE_Name_Space_Map::close (ALLOCATOR *alloc) -{ - ACE_TRACE ("ACE_Name_Space_Map::close"); - - this->table_allocator_ = alloc; - this->entry_allocator_ = alloc; - return this->close_i (); -} - -template int -ACE_Name_Space_Map::bind (const ACE_NS_String &ext_id, - const ACE_NS_Internal &int_id, - ALLOCATOR *alloc) -{ - ACE_TRACE ("ACE_Name_Space_Map::bind"); - - this->table_allocator_ = alloc; - this->entry_allocator_ = alloc; - return this->bind_i (ext_id, int_id); -} - -template int -ACE_Name_Space_Map::unbind (const ACE_NS_String &ext_id, - ACE_NS_Internal &int_id, - ALLOCATOR *alloc) -{ - ACE_TRACE ("ACE_Name_Space_Map::unbind"); - - this->table_allocator_ = alloc; - this->entry_allocator_ = alloc; - return this->unbind_i (ext_id, int_id); -} - -template int -ACE_Name_Space_Map::rebind (const ACE_NS_String &ext_id, - const ACE_NS_Internal &int_id, - ACE_NS_String &old_ext_id, - ACE_NS_Internal &old_int_id, - ALLOCATOR *alloc) -{ - ACE_TRACE ("ACE_Name_Space_Map::rebind"); - - this->table_allocator_ = alloc; - this->entry_allocator_ = alloc; - return this->rebind_i (ext_id, int_id, old_ext_id, old_int_id); -} - -template int -ACE_Name_Space_Map::find (const ACE_NS_String &ext_id, - ACE_NS_Internal &int_id, - ALLOCATOR *alloc) -{ - ACE_TRACE ("ACE_Name_Space_Map::find"); - - this->table_allocator_ = alloc; - this->entry_allocator_ = alloc; - return this->find_i (ext_id, int_id); -} - -#if defined (ACE_WIN32) -template int -ACE_Local_Name_Space::remap (EXCEPTION_POINTERS *ep) -{ - ACE_TRACE ("ACE_Local_Name_Space::remap"); - - void *addr = (void *) ep->ExceptionRecord->ExceptionInformation[1]; - - // The following requires Memory Pool to have ::remap() - // defined. Thus currently this will only work for - // ACE_MMap_Memory_Pool. - if (this->allocator_->alloc ().memory_pool ().remap (addr) == -1) - // Kick it upstairs... - return EXCEPTION_CONTINUE_SEARCH; - -#if __X86__ - // This is 80x86-specific. - ep->ContextRecord->Edi = (DWORD) addr; -#elif __MIPS__ - ep->ContextRecord->IntA0 = - ep->ContextRecord->IntV0 = (DWORD) addr; - ep->ContextRecord->IntT5 = ep->ContextRecord->IntA0 + 3; -#endif /* __X86__ */ - // Resume execution at the original point of "failure." - return EXCEPTION_CONTINUE_EXECUTION; -} -#endif /* ACE_WIN32 */ - -template int -ACE_Local_Name_Space::shared_bind ( - const ACE_NS_WString &name, - const ACE_NS_WString &value, - const char *type, - int rebind) -{ - // Note that we *must* use structured exception handling here - // because (1) we may need to commit virtual memory pages and (2) - // C++ exception handling doesn't support resumption. - int result = 0; - ACE_SEH_TRY - { - result = this->shared_bind_i (name, value, type, rebind); - } - ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ())) - { - } - return result; -} - -template int -ACE_Local_Name_Space::shared_bind_i ( - const ACE_NS_WString &name, - const ACE_NS_WString &value, - const char *type, - int rebind) -{ - - ACE_TRACE ("ACE_Local_Name_Space::shared_bind_i"); - const size_t name_len = (name.length () + 1) * sizeof (ACE_WCHAR_T); - const size_t value_len = (value.length () + 1) * sizeof (ACE_WCHAR_T); - const size_t type_len = ACE_OS::strlen (type) + 1; - const size_t total_len = name_len + value_len + type_len; - char *ptr = (char *) this->allocator_->malloc (total_len); - - if (ptr == 0) - return -1; - else - { - // Note that the value_rep *must* come first to make sure we can - // retrieve this pointer later on in unbind(). - ACE_WCHAR_T *value_rep = (ACE_WCHAR_T *) (ptr); - ACE_WCHAR_T *name_rep = (ACE_WCHAR_T *) (ptr + value_len); - char *new_type = (char *) (ptr + value_len + name_len); - - ACE_Auto_Basic_Array_Ptr name_urep (name.rep ()); - ACE_Auto_Basic_Array_Ptr value_urep (value.rep ()); - ACE_NS_String new_name (name_rep, name_urep.get (), name_len); - ACE_NS_String new_value (value_rep, value_urep.get (), value_len); - - ACE_OS::strcpy (new_type, type); - ACE_NS_Internal new_internal (new_value, new_type); - int result = -1; - - if (rebind == 0) - { - // Do a normal bind. This will fail if there's already an - // with the same name. - result = this->name_space_map_->bind (new_name, - new_internal, - this->allocator_); - - if (result == 1) - { - // Entry already existed so bind failed. Free our - // dynamically allocated memory. - this->allocator_->free ((void *) ptr); - return result; - } - } - else - { - // Do a rebind. If there's already any entry, this will - // return the existing and and - // overwrite the existing name binding. - ACE_NS_String old_name; - ACE_NS_Internal old_internal; - - result = this->name_space_map_->rebind (new_name, new_internal, - old_name, old_internal, - this->allocator_); - if (result == 1) - { - // Free up the memory we allocated in shared_bind(). - // Note that this assumes that the "value" pointer comes - // first and that the value, name, and type are - // contiguously allocated (see above for details) - this->allocator_->free ((void *) (old_internal.value ()).fast_rep ()); - } - } - - if (result == -1) - // Free our dynamically allocated memory. - this->allocator_->free ((void *) ptr); - else - // If bind() or rebind() succeed, they will automatically sync - // up the map manager entry. However, we must sync up our - // name/value memory. - this->allocator_->sync (ptr, total_len); - - return result; - } -} - -template int -ACE_Local_Name_Space::unbind ( - const ACE_NS_WString &name) -{ - // Note that we *must* use structured exception handling here - // because (1) we may need to commit virtual memory pages and (2) - // C++ exception handling doesn't support resumption. - int result = 0; - ACE_SEH_TRY - { - result = this->unbind_i (name); - } - ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ())) - { - } - return result; - -} - -template int -ACE_Local_Name_Space::unbind_i ( - const ACE_NS_WString &name) -{ - ACE_TRACE ("ACE_Local_Name_Space::unbind_i"); - - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1); - ACE_NS_String ns_name (name); - ACE_NS_Internal ns_internal; - if (this->name_space_map_->unbind (ns_name, - ns_internal, - this->allocator_) != 0) - return -1; - - // Free up the memory we allocated in shared_bind(). Note that this - // assumes that the "value" pointer comes first and that the value, - // name and type are contiguously allocated (see shared_bind() for - // details) - this->allocator_->free ((void *) (ns_internal.value ()).fast_rep ()); - return 0; -} - -template int -ACE_Local_Name_Space::bind ( - const ACE_NS_WString &name, - const ACE_NS_WString &value, - const char *type) -{ - ACE_TRACE ("ACE_Local_Name_Space::bind"); - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1); - - return this->shared_bind (name, value, type, 0); -} - -template int -ACE_Local_Name_Space::rebind ( - const ACE_NS_WString &name, - const ACE_NS_WString &value, - const char *type) -{ - ACE_TRACE ("ACE_Local_Name_Space::rebind"); - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1); - - return this->shared_bind (name, value, type, 1); -} - -template int -ACE_Local_Name_Space::resolve ( - const ACE_NS_WString &name, - ACE_NS_WString &value, - char *&type) -{ - // Note that we *must* use structured exception handling here - // because (1) we may need to commit virtual memory pages and (2) - // C++ exception handling doesn't support resumption. - int result = 0; - ACE_SEH_TRY - { - result = this->resolve_i (name, value, type); - } - ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ())) - { - } - return result; -} - - -template int -ACE_Local_Name_Space::resolve_i ( - const ACE_NS_WString &name, - ACE_NS_WString &value, - char *&type) -{ - ACE_TRACE ("ACE_Local_Name_Space::resolve_i"); - ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1); - - ACE_NS_String ns_name (name); - ACE_NS_Internal ns_internal; - ACE_NS_String nbc_string; // Note the classy variable name! :) - - if (this->name_space_map_->find (ns_name, - ns_internal, - this->allocator_) != 0) - return -1; - - // Calls conversion operator and then calls the ACE_NS_WString - // assignment operator to get a fresh copy. (*#*(@#&!*@!!*@&( HP - // compiler causes us to add an extra copy explicitly !! :) - nbc_string = ns_internal.value (); - value = nbc_string; - - // Gets type and then the actual reprsentation which is a - // ACE_WCHAR_T - const char *temp = ns_internal.type (); - - size_t len = ACE_OS::strlen (ns_internal.type ()); - // Makes a copy here. Caller needs to call delete to free up - // memory. - char *new_type = 0; - ACE_NEW_RETURN (new_type, - char [len + 1], - -1); - - ACE_OS::strsncpy (new_type, temp, len + 1); - type = new_type; - return 0; -} - -template int -ACE_Local_Name_Space::open ( - ACE_Naming_Context::Context_Scope_Type scope_in) -{ - ACE_TRACE ("ACE_Local_Name_Space::open"); - this->ns_scope_ = scope_in; - - return this->create_manager (); -} - -template -ACE_Local_Name_Space::ACE_Local_Name_Space (void) - : allocator_ (0), - name_space_map_ (0), - name_options_ (0) -{ - ACE_TRACE ("ACE_Local_Name_Space::ACE_Local_Name_Space"); -} - -template -ACE_Local_Name_Space::ACE_Local_Name_Space ( - ACE_Naming_Context::Context_Scope_Type scope_in, - ACE_Name_Options *name_options) - : name_options_ (name_options) -{ - ACE_TRACE ("ACE_Local_Name_Space::ACE_Local_Name_Space"); - if (this->open (scope_in) == -1) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_Local_Name_Space::ACE_Local_Name_Space"))); -} - -template -ACE_Local_Name_Space::~ACE_Local_Name_Space (void) -{ - ACE_TRACE ("ACE_Local_Name_Space::~ACE_Local_Name_Space"); - - // Remove the map. - delete this->allocator_; - delete this->lock_; -} - -template int -ACE_Local_Name_Space::create_manager (void) -{ - // Note that we *must* use structured exception handling here - // because (1) we may need to commit virtual memory pages and (2) - // C++ exception handling doesn't support resumption. - int result = 0; - ACE_SEH_TRY - { - result = this->create_manager_i (); - } - ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ())) - { - } - return result; -} - - -template int -ACE_Local_Name_Space::create_manager_i (void) -{ - ACE_TRACE ("ACE_Local_Name_Space::create_manager_i"); - // Get directory name - const ACE_TCHAR *dir = this->name_options_->namespace_dir (); - const ACE_TCHAR *database = this->name_options_->database (); - - // Use process name as the file name. - size_t len = ACE_OS::strlen (dir); - len += ACE_OS::strlen (ACE_DIRECTORY_SEPARATOR_STR); - len += ACE_OS::strlen (database) + 1; - - if (len >= MAXNAMELEN + MAXPATHLEN) - { - errno = ENAMETOOLONG; - return -1; - } - - ACE_OS::strcpy (this->context_file_, dir); - ACE_OS::strcat (this->context_file_, ACE_DIRECTORY_SEPARATOR_STR); - ACE_OS::strcat (this->context_file_, database); - - ACE_MEM_POOL_OPTIONS options (this->name_options_->base_address ()); - - ACE_TCHAR lock_name_for_local_name_space [MAXNAMELEN + MAXPATHLEN]; - ACE_TCHAR lock_name_for_backing_store [MAXPATHLEN + MAXNAMELEN]; - const ACE_TCHAR *postfix = database; - - size_t length = 0; - length = sizeof lock_name_for_local_name_space / sizeof (ACE_TCHAR); - ACE_OS::strsncpy (lock_name_for_local_name_space, - dir, - length); - - ACE_OS::strncat (lock_name_for_local_name_space, - ACE_DIRECTORY_SEPARATOR_STR, - length - ACE_OS::strlen (lock_name_for_local_name_space)); - ACE_OS::strncat (lock_name_for_local_name_space, - ACE_TEXT ("name_space_"), - length - ACE_OS::strlen (lock_name_for_local_name_space)); - ACE_OS::strncat (lock_name_for_local_name_space, - postfix, - length - ACE_OS::strlen (lock_name_for_local_name_space)); - - length = sizeof lock_name_for_backing_store / sizeof (ACE_TCHAR); - ACE_OS::strsncpy (lock_name_for_backing_store, - dir, - length); - ACE_OS::strncat (lock_name_for_backing_store, - ACE_DIRECTORY_SEPARATOR_STR, - length - ACE_OS::strlen (lock_name_for_backing_store)); - ACE_OS::strncat (lock_name_for_backing_store, - ACE_TEXT ("backing_store_"), - length - ACE_OS::strlen (lock_name_for_backing_store)); - ACE_OS::strncat (lock_name_for_backing_store, - postfix, - length - ACE_OS::strlen (ACE_TEXT ("backing_store_"))); - - // Create the allocator with the appropriate options. - ACE_NEW_RETURN (this->allocator_, - ALLOCATOR (this->context_file_, - lock_name_for_backing_store, - &options), -1); - - if (ACE_LOG_MSG->op_status ()) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("Allocator::Allocator\n")), - -1); - - ACE_NEW_RETURN (this->lock_, - ACE_LOCK (lock_name_for_local_name_space), - -1); - -#if !defined (ACE_LACKS_ACCESS) - // Now check if the backing store has been created successfully - if (ACE_OS::access (this->context_file_, F_OK) != 0) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("create_manager\n")), - -1); -#endif /* ACE_LACKS_ACCESS */ - - void *ns_map = 0; - - // This is the easy case since if we find the Name Server Map - // Manager we know it's already initialized. - if (this->allocator_->find (ACE_NAME_SERVER_MAP, ns_map) == 0) - { - this->name_space_map_ = (ACE_Name_Space_Map *) ns_map; - if (ACE::debug ()) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("name_space_map_ = %@, ns_map = %@\n"), - this->name_space_map_, ns_map)); - } - - // This is the hard part since we have to avoid potential race - // conditions... We will use the double check here - else - { - ACE_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1); - - // This is the easy case since if we find the Name Server Map - // Manager we know it's already initialized. - if (this->allocator_->find (ACE_NAME_SERVER_MAP, ns_map) == 0) - { - this->name_space_map_ = (ACE_Name_Space_Map *) ns_map; - if (ACE::debug ()) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("name_space_map_ = %@, ns_map = %@\n"), - this->name_space_map_, ns_map)); - } - else - { - size_t map_size = sizeof *this->name_space_map_; - ns_map = this->allocator_->malloc (map_size); - - // Initialize the map into its memory location (e.g., shared memory). - this->name_space_map_ = - new (ns_map) ACE_Name_Space_Map (this->allocator_); - - if (this->allocator_->bind (ACE_NAME_SERVER_MAP, ns_map) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("create_manager\n")), -1); - } - - if (ACE::debug ()) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("name_space_map_ = %@, ns_map = %@\n"), - this->name_space_map_, ns_map)); - } - - return 0; -} - -template int -ACE_Local_Name_Space::list_names_i ( - ACE_WSTRING_SET &set, - const ACE_NS_WString &pattern) -{ - ACE_TRACE ("ACE_Local_Name_Space::list_names_i"); - ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1); - - MAP_MANAGER::ITERATOR map_iterator (*this->name_space_map_); - MAP_MANAGER::ENTRY *map_entry; - - int result = 1; - - for (map_entry = 0; - map_iterator.next (map_entry) != 0; - map_iterator.advance()) - { - if (map_entry->ext_id_.strstr (pattern) != -1) - { - ACE_NS_WString entry (map_entry->ext_id_ ); - - if (set.insert (entry) == -1) - { - result = -1; - break; - } - else - result = 0; - } - } - - return result; -} - -template int -ACE_Local_Name_Space::list_values_i ( - ACE_WSTRING_SET &set, - const ACE_NS_WString &pattern) -{ - ACE_TRACE ("ACE_Local_Name_Space::list_values_i"); - ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1); - - MAP_MANAGER::ITERATOR map_iterator (*this->name_space_map_); - MAP_MANAGER::ENTRY *map_entry; - - int result = 1; - - for (map_entry = 0; - map_iterator.next (map_entry) != 0; - map_iterator.advance ()) - { - if (map_entry->int_id_.value ().strstr (pattern) != -1) - { - ACE_NS_WString entry (map_entry->int_id_.value ()); - - if (set.insert (entry) == -1) - { - result = -1; - break; - } - else - result = 0; - } - } - - return result; -} - -template int -ACE_Local_Name_Space::list_types_i ( - ACE_WSTRING_SET &set, - const ACE_NS_WString &pattern) -{ - ACE_TRACE ("ACE_Local_Name_Space::list_types_i"); - ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1); - - MAP_MANAGER::ITERATOR map_iterator (*this->name_space_map_); - MAP_MANAGER::ENTRY *map_entry; - - char *compiled_regexp = 0; - - // Note that char_rep() allocates memory so we need to delete it - char *pattern_rep = pattern.char_rep (); - - // Check for wildcard case first. - if (ACE_OS::strcmp ("", pattern_rep) == 0) - ACE_ALLOCATOR_RETURN (compiled_regexp, - ACE_OS::strdup (""), - -1); - else - // Compile the regular expression (the 0's cause ACE_OS::compile - // to allocate space). -#if defined (ACE_HAS_REGEX) - compiled_regexp = ACE_OS::compile (pattern_rep, 0, 0); -#else - // If we don't have regular expressions just use the pattern - // directly. - compiled_regexp = pattern_rep; -#endif /* ACE_HAS_REGEX */ - - int result = 1; - - for (map_entry = 0; - map_iterator.next (map_entry) != 0; - map_iterator.advance ()) - { - // Get the type - const char *type = map_entry->int_id_.type (); - - // Everything matches the wildcard. - if (ACE_OS::strcmp ("", pattern_rep) == 0 -#if defined (ACE_HAS_REGEX) - || ACE_OS::step (type, compiled_regexp) != 0) -#else - // If we don't have regular expressions just use strstr() for - // substring matching. - || ACE_OS::strstr (type, compiled_regexp) != 0) -#endif /* ACE_HAS_REGEX */ - - { - ACE_NS_WString entry (type); - - if (set.insert (entry) == -1) - { - result = -1; - break; - } - else - result = 0; - } - } -#if defined (ACE_HAS_REGEX) - if (compiled_regexp) - ACE_OS::free ((void *) compiled_regexp); -#endif /* ACE_HAS_REGEX */ - delete [] pattern_rep; // delete pattern_rep; - return result; -} - -template int -ACE_Local_Name_Space ::list_name_entries_i ( - ACE_BINDING_SET &set, - const ACE_NS_WString &pattern) -{ - ACE_TRACE ("ACE_Local_Name_Space::list_name_entries_i"); - ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1); - - MAP_MANAGER::ITERATOR map_iterator (*this->name_space_map_); - MAP_MANAGER::ENTRY *map_entry; - - for (map_entry = 0; - map_iterator.next (map_entry) != 0; - map_iterator.advance()) - { - if (map_entry->ext_id_.strstr (pattern) != -1) - { - ACE_Name_Binding entry (map_entry->ext_id_, - map_entry->int_id_.value (), - map_entry->int_id_.type ()); - - if (set.insert (entry) == -1) - return -1; - } - } - - return 0; -} - -template int -ACE_Local_Name_Space::list_value_entries_i ( - ACE_BINDING_SET &set, - const ACE_NS_WString &pattern) -{ - ACE_TRACE ("ACE_Local_Name_Space::list_value_entries_i"); - ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1); - - MAP_MANAGER::ITERATOR map_iterator (*this->name_space_map_); - MAP_MANAGER::ENTRY *map_entry; - - for (map_entry = 0; - map_iterator.next (map_entry) != 0; - map_iterator.advance ()) - { - if (map_entry->int_id_.value ().strstr (pattern) != -1) - { - ACE_Name_Binding entry (map_entry->ext_id_, - map_entry->int_id_.value (), - map_entry->int_id_.type ()); - - if (set.insert (entry) == -1) - return -1; - } - } - return 0; -} - -template int -ACE_Local_Name_Space::list_type_entries_i ( - ACE_BINDING_SET &set, - const ACE_NS_WString &pattern) -{ - ACE_TRACE ("ACE_Local_Name_Space::list_type_entries_i"); - ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1); - - MAP_MANAGER::ITERATOR map_iterator (*this->name_space_map_); - MAP_MANAGER::ENTRY *map_entry; - - char *compiled_regexp = 0; - // Note that char_rep() allocates memory so we need to delete it - char *pattern_rep = pattern.char_rep (); - - // Check for wildcard case first. - if (ACE_OS::strcmp ("", pattern_rep) == 0) - compiled_regexp = ACE_OS::strdup (""); - else - // Compile the regular expression (the 0's cause ACE_OS::compile - // to allocate space). -#if defined (ACE_HAS_REGEX) - compiled_regexp = ACE_OS::compile (pattern_rep, 0, 0); -#else /* If we don't have regular expressions just the pattern - directly. */ - compiled_regexp = pattern_rep; -#endif /* ACE_HAS_REGEX */ - - for (map_entry = 0; - map_iterator.next (map_entry) != 0; - map_iterator.advance ()) - { - // Get the type. - const char *type = map_entry->int_id_.type (); - - if (ACE_OS::strcmp ("", pattern_rep) == 0 // Everything matches - // the wildcard. -#if defined (ACE_HAS_REGEX) - || ACE_OS::step (type, compiled_regexp) != 0) -#else /* If we don't have regular expressions just use strstr() for - substring matching. */ - || ACE_OS::strstr (type, compiled_regexp) != 0) -#endif /* ACE_HAS_REGEX */ - { - ACE_Name_Binding entry (map_entry->ext_id_, - map_entry->int_id_.value (), - map_entry->int_id_.type ()); - - if (set.insert (entry) == -1) - return -1; - } - } -#if defined (ACE_HAS_REGEX) - if (compiled_regexp) - ACE_OS::free ((void *) compiled_regexp); -#endif /* ACE_HAS_REGEX */ - delete [] pattern_rep; // delete pattern_rep; - return 0; -} - -template void -ACE_Local_Name_Space::dump_i (void) const -{ - ACE_TRACE ("ACE_Local_Name_Space::dump_i"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - - MAP_MANAGER::ITERATOR map_iterator (*this->name_space_map_); - MAP_MANAGER::ENTRY *map_entry; - - for (map_entry = 0; - map_iterator.next (map_entry) != 0; - map_iterator.advance()) - { - char *key = map_entry->ext_id_.char_rep (); - char *value = map_entry->int_id_.value ().char_rep (); -#if !defined (ACE_NLOGGING) - const char *type = map_entry->int_id_.type (); -#endif /* ! ACE_NLOGGING */ - - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("key=%C\nvalue=%C\ntype=%C\n"), - key, value, type)); - // We need to delete key and value since char_rep allocates - // memory for them - delete [] key; - delete [] value; - } - - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -} - -template int -ACE_Local_Name_Space::list_names ( - ACE_WSTRING_SET &set, - const ACE_NS_WString &pattern) -{ - // Note that we *must* use structured exception handling here - // because (1) we may need to commit virtual memory pages and (2) - // C++ exception handling doesn't support resumption. - int result = 0; - ACE_SEH_TRY - { - result = this->list_names_i (set, pattern); - } - ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ())) - { - } - return result; -} - -template int -ACE_Local_Name_Space::list_values ( - ACE_WSTRING_SET &set, - const ACE_NS_WString &pattern) -{ - // Note that we *must* use structured exception handling here - // because (1) we may need to commit virtual memory pages and (2) - // C++ exception handling doesn't support resumption. - int result = 0; - ACE_SEH_TRY - { - result = this->list_values_i (set, pattern); - } - ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ())) - { - } - return result; -} - -template int -ACE_Local_Name_Space::list_types ( - ACE_WSTRING_SET &set, - const ACE_NS_WString &pattern) -{ - // Note that we *must* use structured exception handling here - // because (1) we may need to commit virtual memory pages and (2) - // C++ exception handling doesn't support resumption. - int result = 0; - ACE_SEH_TRY - { - result = this->list_types_i (set, pattern); - } - ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ())) - { - } - return result; -} - -template int -ACE_Local_Name_Space ::list_name_entries ( - ACE_BINDING_SET &set, - const ACE_NS_WString &pattern) -{ - // Note that we *must* use structured exception handling here - // because (1) we may need to commit virtual memory pages and (2) - // C++ exception handling doesn't support resumption. - int result = 0; - ACE_SEH_TRY - { - result = this->list_name_entries_i (set, pattern); - } - ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ())) - { - } - return result; -} - -template int -ACE_Local_Name_Space::list_value_entries ( - ACE_BINDING_SET &set, - const ACE_NS_WString &pattern) -{ - // Note that we *must* use structured exception handling here - // because (1) we may need to commit virtual memory pages and (2) - // C++ exception handling doesn't support resumption. - int result = 0; - ACE_SEH_TRY - { - result = this->list_value_entries_i (set, pattern); - } - ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ())) - { - } - return result; -} - -template int -ACE_Local_Name_Space::list_type_entries ( - ACE_BINDING_SET &set, - const ACE_NS_WString &pattern) -{ - // Note that we *must* use structured exception handling here - // because (1) we may need to commit virtual memory pages and (2) - // C++ exception handling doesn't support resumption. - int result = 0; - ACE_SEH_TRY - { - result = this->list_type_entries_i (set, pattern); - } - ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ())) - { - } - return result; -} - -template void -ACE_Local_Name_Space::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - // Note that we *must* use structured exception handling here - // because (1) we may need to commit virtual memory pages and (2) - // C++ exception handling doesn't support resumption. - - // This should really be a const cast - ACE_Local_Name_Space *fake_this = - (ACE_Local_Name_Space *) this; - ACE_UNUSED_ARG (fake_this); - - ACE_SEH_TRY - { - this->dump_i (); - } - ACE_SEH_EXCEPT (fake_this->remap (GetExceptionInformation ())) - { - } -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_LOCAL_NAME_SPACE_T_CPP */ diff --git a/dep/acelite/ace/Local_Name_Space_T.h b/dep/acelite/ace/Local_Name_Space_T.h deleted file mode 100644 index 33f9acc7602..00000000000 --- a/dep/acelite/ace/Local_Name_Space_T.h +++ /dev/null @@ -1,267 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Local_Name_Space_T.h - * - * $Id: Local_Name_Space_T.h 93359 2011-02-11 11:33:12Z mcorino $ - * - * @author Prashant Jain - * @author Irfan Pyarali and - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_LOCAL_NAME_SPACE_T_H -#define ACE_LOCAL_NAME_SPACE_T_H -#include /**/ "ace/pre.h" - -#include "ace/Name_Space.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Naming_Context.h" -#include "ace/SString.h" -#include "ace/Local_Name_Space.h" -#include "ace/Null_Mutex.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/// A short-hand name for our set of name/value/type tuples passed back -/// to callers. -typedef ACE_Unbounded_Set ACE_WSTRING_SET; - -ACE_END_VERSIONED_NAMESPACE_DECL - -# include "ace/Hash_Map_Manager_T.h" -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_Null_Mutex> MAP_MANAGER; -ACE_END_VERSIONED_NAMESPACE_DECL - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Name_Space_Map - * - * @brief This class serves as a Proxy that ensures our process always - * has the appropriate allocator in place for every operation - * that accesses or updates the Map Manager. - * - * We need this class because otherwise the ALLOCATOR - * pointer will be stored in the Map_Manager that resides within - * shared memory. Naturally, this will cause horrible problems - * since only the first process to set that pointer will be - * guaranteed the address of the ALLOCATOR is meaningful! - */ -template -class ACE_Name_Space_Map : public MAP_MANAGER -{ -public: - /// Constructor. - ACE_Name_Space_Map (ALLOCATOR *alloc); - - // = The following methods are Proxies to the underlying methods - // provided by ACE_Hash_Map_Manager. When they are called, they - // acquire the lock, set the allocator to the one specific to this - // process, and then call down to perform the intended operation. - int bind (const ACE_NS_String &, - const ACE_NS_Internal &, - ALLOCATOR *alloc); - - int unbind (const ACE_NS_String &, - ACE_NS_Internal &, - ALLOCATOR *alloc); - - int rebind (const ACE_NS_String &, - const ACE_NS_Internal &, - ACE_NS_String &, - ACE_NS_Internal &, - ALLOCATOR *alloc); - - int find (const ACE_NS_String &, - ACE_NS_Internal &, - ALLOCATOR *alloc); - - int close (ALLOCATOR *alloc); -}; - -/** - * @class ACE_Local_Name_Space - * - * @brief Maintaining accesses Local Name Server Database. Allows to - * add NameBindings, change them, remove them and resolve - * NameBindings. - * - * Manages a Naming Service for a local name space which - * includes bindings for node_local and host_local naming - * contexts. All strings are stored in wide character format. - * A Name Binding consists of a name (that's the key), a value - * string and an optional type string (no wide chars). - */ -template -class ACE_Local_Name_Space : public ACE_Name_Space -{ -public: - // = Initialization and termination methods. - /// "Do-nothing" constructor. - ACE_Local_Name_Space (void); - - /** - * Specifies the scope of this namespace, opens and memory-maps the - * associated file (if accessible) or contacts the dedicated name - * server process for NET_LOCAL namespace. - */ - ACE_Local_Name_Space (ACE_Naming_Context::Context_Scope_Type scope_in, - ACE_Name_Options *name_options); - - /** - * Specifies the scope of this namespace, opens and memory-maps the - * associated file (if accessible) or contacts the dedicated name - * server process for NET_LOCAL namespace. - */ - int open (ACE_Naming_Context::Context_Scope_Type scope_in); - - /// Destructor, do some cleanup :TBD: last dtor should "compress" - /// file - ~ACE_Local_Name_Space (void); - - /// Bind a new name to a naming context (Wide character strings). - virtual int bind (const ACE_NS_WString &name, - const ACE_NS_WString &value, - const char *type = ""); - - /** - * Overwrite the value or type of an existing name in a - * ACE_Local_Name_Space or bind a new name to the context, if it - * didn't exist yet. (Wide character strings interface). - */ - virtual int rebind (const ACE_NS_WString &name, - const ACE_NS_WString &value, - const char *type = ""); - - /// Delete a name from a ACE_Local_Name_Space (Wide character strings - /// Interface). - virtual int unbind (const ACE_NS_WString &name); - virtual int unbind_i (const ACE_NS_WString &name); - - /// Get value and type of a given name binding (Wide chars). The - /// caller is responsible for deleting @a type! - virtual int resolve (const ACE_NS_WString &name, - ACE_NS_WString &value, - char *&type); - virtual int resolve_i (const ACE_NS_WString &name, - ACE_NS_WString &value, - char *&type); - - /// Get a set of names matching a specified pattern (wchars). Matching - /// means the names must begin with the pattern string. - virtual int list_names (ACE_WSTRING_SET &set, - const ACE_NS_WString &pattern); - virtual int list_names_i (ACE_WSTRING_SET &set, - const ACE_NS_WString &pattern); - - /// Get a set of values matching a specified pattern (wchars). Matching - /// means the values must begin with the pattern string. - virtual int list_values (ACE_WSTRING_SET &set, - const ACE_NS_WString &pattern); - virtual int list_values_i (ACE_WSTRING_SET &set, - const ACE_NS_WString &pattern); - - /// Get a set of types matching a specified pattern (wchars). Matching - /// means the types must begin with the pattern string. - virtual int list_types (ACE_WSTRING_SET &set, - const ACE_NS_WString &pattern); - virtual int list_types_i (ACE_WSTRING_SET &set, - const ACE_NS_WString &pattern); - - /** - * Get a set of names matching a specified pattern (wchars). Matching - * means the names must begin with the pattern string. Returns the - * complete binding associated each pattern match. - */ - virtual int list_name_entries (ACE_BINDING_SET &set, - const ACE_NS_WString &pattern); - virtual int list_name_entries_i (ACE_BINDING_SET &set, - const ACE_NS_WString &pattern); - - /** - * Get a set of values matching a specified pattern (wchars). Matching - * means the values must begin with the pattern string. Returns the - * complete binding associated each pattern match. - */ - virtual int list_value_entries (ACE_BINDING_SET &set, - const ACE_NS_WString &pattern); - virtual int list_value_entries_i (ACE_BINDING_SET &set, - const ACE_NS_WString &pattern); - - /** - * Get a set of types matching a specified pattern (wchars). Matching - * means the types must begin with the pattern string. Returns the - * complete binding associated each pattern match. - */ - virtual int list_type_entries (ACE_BINDING_SET &set, - const ACE_NS_WString &pattern); - virtual int list_type_entries_i (ACE_BINDING_SET &set, - const ACE_NS_WString &pattern); - - /// Dump the state of the object - virtual void dump (void) const; - virtual void dump_i (void) const; - - // = I just know this is going to cause problems on some platform... - typedef ACE_Allocator_Adapter > - ALLOCATOR; - -private: -#if defined (ACE_WIN32) - /// Remap the backing store - int remap (EXCEPTION_POINTERS *ep); -#endif /* ACE_WIN32 */ - - /// Factor out code from bind() and rebind(). - int shared_bind (const ACE_NS_WString &name, - const ACE_NS_WString &value, - const char *type, int rebind); - int shared_bind_i (const ACE_NS_WString &name, - const ACE_NS_WString &value, - const char *type, int rebind); - - /// Allocate the appropriate type of map manager that stores the - /// key/value binding. - int create_manager (void); - int create_manager_i (void); - - /// Pointer to the allocator - ALLOCATOR *allocator_; - - /// Pointer to the allocated map manager. - ACE_Name_Space_Map *name_space_map_; - - /// Scope of this naming context (e.g., PROC_LOCAL, NODE_LOCAL, or - /// NET_LOCAL). - ACE_Naming_Context::Context_Scope_Type ns_scope_; - - /// Keep track of the options such as database name etc - ACE_Name_Options *name_options_; - - /// Name of the file used as the backing store. - ACE_TCHAR context_file_[MAXPATHLEN + MAXNAMELEN]; - - /// Synchronization variable. - ACE_LOCK *lock_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Local_Name_Space_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Local_Name_Space_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_LOCAL_NAME_SPACE_T_H */ diff --git a/dep/acelite/ace/Local_Tokens.cpp b/dep/acelite/ace/Local_Tokens.cpp deleted file mode 100644 index 5901bb18878..00000000000 --- a/dep/acelite/ace/Local_Tokens.cpp +++ /dev/null @@ -1,1619 +0,0 @@ -// $Id: Local_Tokens.cpp 91368 2010-08-16 13:03:34Z mhengstmengel $ - -#include "ace/Local_Tokens.h" - -#if defined (ACE_HAS_TOKENS_LIBRARY) - -#include "ace/Thread.h" -#include "ace/Token_Manager.h" -#include "ace/OS_NS_unistd.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Local_Tokens.inl" -#endif /* __ACE_INLINE__ */ - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -void -ACE_Tokens::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Tokens::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Tokens::dump:\n") - ACE_TEXT (" reference_cont_ = %d\n") - ACE_TEXT (" token_name_ = %s\n"), - reference_count_, token_name_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("waiters_\n"))); - this->waiters_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Tokens::ACE_Tokens (void) - : visited_ (0), - reference_count_ (0) -{ - ACE_TRACE ("ACE_Tokens::ACE_Tokens"); -} - -ACE_Tokens::~ACE_Tokens (void) -{ -} - -void -ACE_Tokens::make_owner (ACE_TPQ_Entry *caller) -{ - this->waiters_.remove (caller); - this->waiters_.enqueue (caller, 0); -} - -ACE_Token_Proxy_Queue * -ACE_Tokens::waiters () -{ - ACE_TRACE ("ACE_Tokens::waiters"); - return &this->waiters_; -} - -int -ACE_Tokens::no_of_waiters () -{ - ACE_TRACE ("ACE_Tokens::no_of_waiters"); - return this->waiters_.size (); -} - -#if defined (ACE_LACKS_INLINE_FUNCTIONS) -ACE_Null_Token::ACE_Null_Token (void) -{ -} - -ACE_Null_Token::~ACE_Null_Token (void) -{ -} -#endif /* ACE_LACKS_INLINE_FUNCTIONS */ - -void -ACE_TPQ_Entry::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_TPQ_Entry::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("ACE_TPQ_Entry::dump:\n") - ACE_TEXT (" nesting_level_ = %d\n") - ACE_TEXT (" client_id_ = %s\n"), - nesting_level_, - client_id_)); - - if (next_ != 0) - { - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("next:.\n"))); - next_->dump (); - } - - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_TPQ_Entry::dump end.\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_TPQ_Entry::ACE_TPQ_Entry (const ACE_Token_Proxy *new_proxy, - const ACE_TCHAR *client_id) - : cond_var_ (lock_), - next_ (0), - // This const typecast is safe. - proxy_ ((ACE_Token_Proxy *) new_proxy), - nesting_level_ (0), - sleep_hook_ (0) -{ - ACE_TRACE ("ACE_TPQ_Entry::ACE_TPQ_Entry"); - - if (client_id != 0) - this->client_id (client_id); - else - { - // Just make sure we have enough space. - ACE_TCHAR host_name[MAXHOSTNAMELEN]; - ACE_TCHAR name[(sizeof host_name / sizeof (ACE_TCHAR)) + 256]; - ACE_OS::hostname (host_name, sizeof host_name); - - ACE_thread_t thread_id = ACE_Thread::self (); - - // The cast is an attempt to get this to compile (and run, - // hopefully) regardless of the type of ACE_thread_t. - ACE_OS::sprintf (name, - ACE_TEXT ("/%s/%u/%lu"), - host_name, - static_cast (ACE_OS::getpid ()), - *reinterpret_cast (&thread_id)); - - this->client_id (name); - } -} - -ACE_TPQ_Entry::ACE_TPQ_Entry (void) - : cond_var_ (lock_), - proxy_ (0), - nesting_level_ (0), - sleep_hook_ (0) -{ - ACE_TRACE ("ACE_TPQ_Entry::ACE_TPQ_Entry null const."); -} - -ACE_TPQ_Entry::ACE_TPQ_Entry (const ACE_TPQ_Entry &rhs) -: cond_var_ (lock_) -{ - ACE_TRACE ("ACE_TPQ_Entry::ACE_TPQ_Entry copy const."); - *this = rhs; -} - -ACE_TPQ_Entry::~ACE_TPQ_Entry (void) -{ - ACE_TRACE ("ACE_TPQ_Entry::~ACE_TPQ_Entry"); -} - -void -ACE_TPQ_Entry::operator= (const ACE_TPQ_Entry& rhs) -{ - ACE_TRACE ("ACE_TPQ_Entry::operator="); - if (&rhs == this) - return; - this->proxy_ = rhs.proxy (); - this->nesting_level_ = rhs.nesting_level (); - this->client_id (rhs.client_id ()); - this->sleep_hook_ = rhs.sleep_hook (); -} - -void -ACE_TPQ_Entry::client_id (const ACE_TCHAR *id) -{ - ACE_TRACE ("ACE_TPQ_Entry::client_id"); - - if (id == 0) - return; - - ACE_OS::strsncpy (this->client_id_, - (ACE_TCHAR *) id, - ACE_MAXCLIENTIDLEN); -} - -ACE_TSS_TPQ_Entry::~ACE_TSS_TPQ_Entry (void) -{ -} - -void -ACE_TSS_TPQ_Entry::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_TSS_TPQ_Entry::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_TSS_TPQ_Entry::dump:\n") - ACE_TEXT (" client_id_ = %s\n"), - client_id_ == 0 ? ACE_TEXT ("0") : client_id_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("base:\n"))); - ACE_TPQ_ENTRY::dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_TSS_TPQ_Entry::ACE_TSS_TPQ_Entry (const ACE_Token_Proxy *proxy, - const ACE_TCHAR *client_id) -: proxy_ (proxy), - client_id_ (client_id) -{ - ACE_TRACE ("ACE_TSS_TPQ_Entry::ACE_TSS_TPQ_Entry"); -} - -ACE_TPQ_Entry * -ACE_TSS_TPQ_Entry::make_TSS_TYPE (void) const -{ - ACE_TRACE ("ACE_TSS_TPQ_Entry::make_TSS_TYPE"); - ACE_TPQ_Entry *temp; - - ACE_NEW_RETURN (temp, - ACE_TPQ_Entry (this->proxy_, - this->client_id_), - 0); - return temp; -} - -ACE_TSS_TPQ_Entry::operator ACE_TPQ_Entry * (void) -{ -#if !defined (ACE_NO_TSS_TOKENS) - return (ACE_TPQ_Entry *) (*((ACE_TSS *) this)); -#else - // Not sure this is the right thing to do, but it seems to work. - // The base class ALSO has a proxy_ and client_id_ members (weird?) - // which don't get initialised. The following two lines make this - // the same as the subclass, so that the slicing works . - ACE_TPQ_ENTRY::proxy ((ACE_Token_Proxy *)(this->proxy_)); - ACE_TPQ_ENTRY::client_id (this->client_id_); - return (ACE_TPQ_Entry *) this;; -#endif /* !ACE_NO_TSS_TOKENS */ -} - -ACE_TPQ_Iterator::ACE_TPQ_Iterator (ACE_Token_Proxy_Queue &q) - : current_ (q.head_) -{ - ACE_TRACE ("ACE_TPQ_Iterator::ACE_TPQ_Iterator"); -} - -int -ACE_TPQ_Iterator::next (ACE_TPQ_Entry *&next_item) -{ - ACE_TRACE ("ACE_TPQ_Iterator::next"); - - next_item = this->current_; - - return current_ != 0; -} - -int -ACE_TPQ_Iterator::done (void) const -{ - ACE_TRACE ("ACE_TPQ_Iterator::done"); - - return this->current_ == 0; -} - -void -ACE_TPQ_Iterator::advance (void) -{ - ACE_TRACE ("ACE_TPQ_Iterator::advance"); - - if (current_ != 0) - this->current_ = this->current_->next_; -} - -void -ACE_TPQ_Iterator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_TPQ_Iterator::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_TPQ_Iterator::dump:\n") - ACE_TEXT (" current_ = %d\n"), - (long) this->current_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("head_ and tail_\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -void -ACE_Token_Proxy_Queue::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Token_Proxy_Queue::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Token_Proxy_Queue::dump:\n") - ACE_TEXT (" size_ = %d\n"), - size_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("head_ and tail_\n"))); - if (this->head_ != 0) - this->head_->dump (); - - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Token_Proxy_Queue::dump end.\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Token_Proxy_Queue::ACE_Token_Proxy_Queue (void) - : head_ (0), - tail_ (0), - size_ (0) -{ - ACE_TRACE ("ACE_Token_Proxy_Queue::ACE_Token_Proxy_Queue"); -} - -void -ACE_Token_Proxy_Queue::enqueue (ACE_TPQ_Entry *tpq, - int position) -{ - ACE_TRACE ("ACE_Token_Proxy_Queue::enqueue"); - tpq->next_ = 0; - - ++this->size_; - - if (this->head_ == 0) - { - // make tpq the entire list - this->head_ = this->tail_ = tpq; - return; - } - - if (position == 0) - { - // make head of list - tpq->next_ = this->head_; - this->head_ = tpq; - return; - } - - if (position == -1) - { - // stick at back of list - this->tail_->next_ = tpq; - this->tail_ = tpq; - return; - } - - // walk through list to insertion point - ACE_TPQ_Entry *temp = head_; - - for (int x = position; - x > 1; - --x) - { - // end of queue? - if (temp->next_ == 0) - break; - // advance pointer - else - temp = temp->next_; - } - - // insert new tpq after temp - tpq->next_ = temp->next_; - temp->next_ = tpq; -} - -void -ACE_Token_Proxy_Queue::dequeue (void) -{ - ACE_TRACE ("ACE_Token_Proxy_Queue::dequeue"); - - if (head_ == 0) - return; - - ACE_TPQ_Entry *temp = this->head_; - - this->head_ = this->head_->next_; - - temp->next_ = 0; - - --this->size_; - - if (this->head_ == 0 && this->size_ != 0) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("incorrect size = %d\n"), - this->size_)); -} - -/* -int -ACE_Token_Proxy_Queue::member (const ACE_TCHAR *id) -{ - ACE_TRACE ("ACE_Token_Proxy_Queue::member"); - - for (ACE_TPQ_Entry *temp = this->head_; - temp != 0; - temp = temp->next_) - if (ACE_OS::strcmp (temp->client_id (), id) == 0) - // We found it! - return 1; - - // We didn't find it :-( - return 0; -} -*/ - -void -ACE_Token_Proxy_Queue::remove (const ACE_TPQ_Entry *remove_me) -{ - ACE_TRACE ("ACE_Token_Proxy_Queue::remove"); - // sanity - if ((remove_me == 0) || (this->head_ == 0)) - return; - - // is it the head? - if (this->head_ == remove_me) // pointer comparison. - { - this->head_ = this->head_->next_; - if (this->head_ == 0) - this->tail_ = 0; - - --this->size_; - return; - } - - ACE_TPQ_Entry *temp = this->head_; - ACE_TPQ_Entry *previous = 0; - - // is it in the middle or tail? - while (temp != 0) - { - if (temp == remove_me) - { - // previous should never be null since the first if - // conditional should always be false - previous->next_ = temp->next_; - // is it the tail? - if (this->tail_ == temp) - this->tail_ = previous; - - --this->size_; - return; - } - - previous = temp; - temp = temp->next_; - } - - // it wasn't in the list. - return; -} - -void -ACE_Mutex_Token::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Mutex_Token::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Mutex_Token::dump:\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("lock_\n"))); - lock_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("base:\n"))); - ACE_Tokens::dump (); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Mutex_Token::dump end.\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_Mutex_Token::ACE_Mutex_Token (const ACE_TCHAR *name) -{ - ACE_TRACE ("ACE_Mutex_Token::ACE_Mutex_Token"); - - ACE_OS::strsncpy (this->token_name_, - name, - ACE_MAXTOKENNAMELEN); -} - -ACE_Mutex_Token::~ACE_Mutex_Token (void) -{ - ACE_TRACE ("ACE_Mutex_Token::~ACE_Mutex_Token"); -} - -int -ACE_Mutex_Token::acquire (ACE_TPQ_Entry *caller, - int ignore_deadlock, - int notify) -{ - ACE_TRACE ("ACE_Mutex_Token::acquire"); - // We need to acquire two locks. This one to ensure that only one - // thread uses this token at a time. - ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon1, this->lock_, -1); - // This one to ensure an atomic transaction across all tokens. Note - // that this order is crucial too. It's resource coloring for other - // threads which may be calling this same token. - ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon2, ACE_Token_Manager::instance ()->mutex (), -1); - - // Does _anyone_ own the token? - if (this->owner () == 0) - { - // there are no waiters, so queue as the first waiter (the owner.) - this->waiters_.enqueue (caller, -1); - return 0; // success - } - - // Does the caller already own it? - if (this->is_owner (caller->client_id ())) - { - // Recursive acquisition. - caller->nesting_level (1); - return 0; // success - } - - // Check for deadlock. - if (!ignore_deadlock - && ACE_Token_Manager::instance ()->check_deadlock (caller->proxy ()) == 1) - { - errno = EDEADLK; - ACE_RETURN (-1); - } - - // Someone owns it. Sorry, you're getting queued up at the end of - // the waiter queue. - this->waiters_.enqueue (caller, -1); - - if (notify) - this->owner ()->call_sleep_hook (); - - errno = EWOULDBLOCK; - ACE_RETURN (-1); - - ACE_NOTREACHED (return -1); -} - -int -ACE_Mutex_Token::tryacquire (ACE_TPQ_Entry *caller) -{ - ACE_TRACE ("ACE_Mutex_Token::tryacquire"); - // We need to acquire two locks. This one to ensure that only one - // thread uses this token at a time. - ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon1, this->lock_, -1); - // This one to ensure an atomic transaction across all tokens. Note - // that this order is crucial too. It's resource coloring for other - // threads which may be calling this same token. - ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon2, ACE_Token_Manager::instance ()->mutex (), -1); - - // Does _anyone_ own the token? - if (this->owner () == 0) - { - this->waiters_.enqueue (caller, -1); - return 0; // success - } - // Does the caller already own it? - if (this->is_owner (caller->client_id ())) - { - // recursive acquisition - caller->nesting_level (1); - return 0; // success - } - else - // Someone owns it. Fail. - { - errno = EWOULDBLOCK; - ACE_RETURN (-1); - } - - ACE_NOTREACHED (return -1); -} - -int -ACE_Mutex_Token::renew (ACE_TPQ_Entry *caller, - int requeue_position) -{ - ACE_TRACE ("ACE_Mutex_Token::renew"); - ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_, -1); - - // Verify that the caller is the owner. - if (this->is_owner (caller->client_id ()) == 0) - { - errno = EACCES; - ACE_RETURN (-1); - } - - // The caller is the owner, so check to see if there are any - // waiters. If not, we just keep the token. == 1 means that there - // is only the owner. - if (this->waiters_.size () == 1 || requeue_position == 0) - return 0; - - // Requeue the caller. - this->waiters_.dequeue (); - - this->waiters_.enqueue (caller, requeue_position); - - // Notify new owner. - if (this->owner () != 0) - this->owner ()->proxy ()->token_acquired (this->owner ()); - - // Tell the caller that the operation would block. - errno = EWOULDBLOCK; - ACE_RETURN (-1); - - ACE_NOTREACHED (return -1); -} - -// Release the current holder of the token (which had -// better be the caller's thread!). - -int -ACE_Mutex_Token::release (ACE_TPQ_Entry *caller) -{ - ACE_TRACE ("ACE_Mutex_Token::release"); - ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_, -1); - - // Does anyone own the token? - if (this->owner () == 0) - { - errno = EACCES; - ACE_RETURN (-1); - } - - // Is the caller the owner. - if (this->is_owner (caller->client_id ())) - { - // Check the nesting level. - if (caller->nesting_level () > 0) - caller->nesting_level (-1); - else - { - this->waiters_.dequeue (); - // Notify new owner. - if (this->owner () != 0) - this->owner ()->proxy ()->token_acquired (this->owner ()); - } - } - else - this->remove (caller); - - return 0; -} - -int -ACE_Mutex_Token::owners (OWNER_STACK &stack, - const ACE_TCHAR *id) -{ - ACE_TRACE ("ACE_Mutex_Token::owners"); - if (this->owner () != 0) - { - stack.push (this->owner ()); - // If an is specified, return whether it is the owner being - // returned. - if (id != 0) - return this->owner ()->equal_client_id (id); - } - - return 0; -} - -int -ACE_Mutex_Token::is_waiting_for (const ACE_TCHAR *id) -{ - ACE_TRACE ("ACE_Mutex_Token::is_waiting_for"); - // If there is no owner, or is the owner, return false. - if ((this->owner () == 0) || this->is_owner (id)) - return 0; - - // Step through each waiter looking for . - ACE_TPQ_Iterator iterator (waiters_); - iterator.advance (); - for (ACE_TPQ_Entry *temp = 0; - iterator.next (temp) != 0; - iterator.advance ()) - { - if (temp->equal_client_id (id)) - return 1; - } - - return 0; -} - -int -ACE_Mutex_Token::is_owner (const ACE_TCHAR *id) -{ - ACE_TRACE ("ACE_Mutex_Token::is_owner"); - // If there is an owner, return whether it is . - if ((this->owner () != 0) && - this->owner ()->equal_client_id (id)) - return 1; - else - return 0; -} - -int -ACE_Mutex_Token::type (void) const -{ - ACE_TRACE ("ACE_Mutex_Token::type"); - return (int) ACE_Tokens::MUTEX; -} - -// ************************************************************ - -int -ACE_RW_Token::type (void) const -{ - ACE_TRACE ("ACE_RW_Token::type"); - return (int) ACE_Tokens::RWLOCK; -} - -void -ACE_RW_Token::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_RW_Token::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_RW_Token::dump:\n") - ACE_TEXT ("num_writers_ = %d\n"), num_writers_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("lock_\n"))); - this->lock_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("base:\n"))); - ACE_Tokens::dump (); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_RW_Token::dump end.\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -ACE_RW_Token::ACE_RW_Token (const ACE_TCHAR *name) -: num_writers_ (0) -{ - ACE_TRACE ("ACE_RW_Token::ACE_RW_Token"); - - ACE_OS::strsncpy (this->token_name_, - name, - ACE_MAXTOKENNAMELEN); -} - -ACE_RW_Token::~ACE_RW_Token (void) -{ - ACE_TRACE ("ACE_RW_Token::~ACE_RW_Token"); -} - -int -ACE_RW_Token::acquire (ACE_TPQ_Entry *caller, - int ignore_deadlock, - int notify) -{ - ACE_TRACE ("ACE_RW_Token::acquire"); - // We need to acquire two locks. This one to ensure that only one - // thread uses this token at a time. - ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon1, this->lock_, -1); - // This one to ensure an atomic transaction across all tokens. Note - // that this order is crucial too. It's resource coloring for other - // threads which may be calling this same token. - ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon2, ACE_Token_Manager::instance ()->mutex (), -1); - - if (caller->proxy ()->type () == ACE_RW_Token::WRITER) - this->num_writers_++; - - // Does _anyone_ own the token? - if (this->owner () == 0) - { - // There are no waiters, so queue as the first waiter (the owner). - this->waiters_.enqueue (caller, -1); - return 0; - } - - // Check for recursive acquisition. - if (this->is_owner (caller->client_id ())) - { - caller->nesting_level (1); - return 0; // Success. - } - - // Reader. - if (caller->proxy ()->type () == ACE_RW_Token::READER) - { - // Are there any writers? - if (this->num_writers_ == 0) - { - // Queue the caller at the end of the queue. - this->waiters_.enqueue (caller, -1); - return 0; - } - // Else failure. - } - - // Failure code. - - // Check for deadlock. - if (!ignore_deadlock && - ACE_Token_Manager::instance ()->check_deadlock (caller->proxy ()) == 1) - { - if (caller->proxy ()->type () == ACE_RW_Token::WRITER) - this->num_writers_--; - errno = EDEADLK; - ACE_RETURN (-1); - } - - // Queue the caller at the end of the queue. - this->waiters_.enqueue (caller, -1); - - if (notify) - { - // If it's a writer, just notify it. - if (this->owner ()->proxy ()->type () == ACE_RW_Token::WRITER) - this->owner ()->call_sleep_hook (); - else - { - // Call back all reader owners. - ACE_TPQ_Entry *temp = this->owner (); - do - { - temp->call_sleep_hook (); - temp = temp->next_; - } - while (temp != 0 && - temp->proxy ()->type () == ACE_RW_Token::READER); - } - } - - errno = EWOULDBLOCK; - ACE_RETURN (-1); - - ACE_NOTREACHED (return -1); -} - -int -ACE_RW_Token::tryacquire (ACE_TPQ_Entry *caller) -{ - ACE_TRACE ("ACE_RW_Token::tryacquire"); - // We need to acquire two locks. This one to ensure that only one - // thread uses this token at a time. - ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon1, this->lock_, -1); - // This one to ensure an atomic transaction across all tokens. Note - // that this order is crucial too. It's resource coloring for other - // threads which may be calling this same token. - ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon2, ACE_Token_Manager::instance ()->mutex (), -1); - - if (caller->proxy ()->type () == ACE_RW_Token::WRITER) - { - this->num_writers_++; - } - - // Does _anyone_ own the token? - if (this->owner () == 0) - { - // There are no waiters, so queue as the first waiter (the owner). - this->waiters_.enqueue (caller, -1); - return 0; - } - - // Check for recursive acquisition. - if (this->is_owner (caller->client_id ())) - { - caller->nesting_level (1); - return 0; // Success. - } - - // Reader. - if (caller->proxy ()->type () == ACE_RW_Token::READER) - { - // Are there any writers? - if (this->num_writers_ == 0) - { - // queue the caller at the end of the queue. - this->waiters_.enqueue (caller, -1); - return 0; - } - // Else, fail. - } - else // Writer. - // We're going to fail, so decrement the num_writers. - { - this->num_writers_--; - } - - - errno = EWOULDBLOCK; - ACE_RETURN (-1); - - ACE_NOTREACHED (return -1); -} - -int -ACE_RW_Token::renew (ACE_TPQ_Entry *caller, - int requeue_position) -{ - ACE_TRACE ("ACE_RW_Token::renew"); - ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_, -1); - - // Werify that the caller is the owner - if (this->is_owner (caller->client_id ()) == 0) - { - errno = EACCES; - ACE_RETURN (-1); - } - - // The caller is the owner, so check to see if there are any - // waiters. If not, we just keep the token. - if (this->waiters_.size () == 1 || requeue_position == 0) - return 0; - - // There are waiters, so remove the caller. - this->remove (caller); - - // Requeue the caller. - this->waiters_.enqueue (caller, requeue_position); - - if (caller->proxy ()->type () == ACE_RW_Token::READER) - { - // If the caller got queued before any writers, the caller is - // still the owner. - if (this->is_owner (caller->client_id ())) - return 0; // success - // else fallthrough and return would block. - } - // Writers will always have to block since waiters_.size () == 1 or - // requeue_position == 0. - - // Get a new owner. - this->notify_new_owner (caller); - - // Tell the caller that the operation would block. - errno = EWOULDBLOCK; - ACE_RETURN (-1); - - ACE_NOTREACHED (return -1); -} - -int -ACE_RW_Token::release (ACE_TPQ_Entry *caller) -{ - ACE_TRACE ("ACE_RW_Token::release"); - ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_, -1); - - // Check for errors. - if ((this->owner () == 0) || - (this->is_owner (caller->client_id ()) == 0)) - { - errno = EACCES; - ACE_RETURN (-1); - } - - if (caller->proxy ()->type () == ACE_RW_Token::WRITER) - num_writers_--; - - // Recursive release. - if (caller->nesting_level () > 0) - { - caller->nesting_level (-1); - return 0; - } - - // Remove the caller and notify the new owner(s). - this->remove (caller); - this->notify_new_owner (caller); - - return 0; -} - -void -ACE_RW_Token::notify_new_owner (ACE_TPQ_Entry *old_owner) -{ - ACE_TRACE ("ACE_RW_Token::notify_new_owner"); - - if (this->owner () == 0) - return; - - if (this->owner ()->proxy ()->type () == ACE_RW_Token::READER) - { - if (old_owner->proxy ()->type () == ACE_RW_Token::READER) - // the owners already know that they're owners - return; - - // The current owner is a reader and the previous owner was a - // writer, so notify all waiting readers up to the first writer. - // call back all reader owners. - ACE_TPQ_Iterator iterator (waiters_); - for (ACE_TPQ_Entry *temp = 0; - iterator.next (temp) != 0; - iterator.advance ()) - { - if (temp->proxy ()->type () == WRITER) - // We've gone through all the readers. - break; - - temp->proxy ()->token_acquired (temp); - } - } - else // writer - this->owner ()->proxy ()->token_acquired (this->owner ()); -} - - -int -ACE_RW_Token::owners (OWNER_STACK &stack, - const ACE_TCHAR *id) -{ - ACE_TRACE ("ACE_RW_Token::owners"); - - if (this->owner () == 0) - return 0; - - int id_is_owner = 0; - - // The first waiter is a writer, so there is only one owner. - if (this->owner ()->proxy ()->type () == WRITER) - { - stack.push (this->owner ()); - // If an is specified, return whether it is the owner being - // returned. - if ((id != 0) && - (ACE_OS::strcmp (id, this->owner ()->client_id ()) == 0)) - id_is_owner = 1; - } - // The first waiter is a reader, so there can be multiple owning - // readers. - else - { - ACE_TPQ_Iterator iterator (waiters_); - for (ACE_TPQ_Entry *temp = 0; - iterator.next (temp) != 0; - iterator.advance ()) - { - if (temp->proxy ()->type () == WRITER) - // We've gone through all the readers. - break; - - stack.push (temp); - - if (!id_is_owner && (id != 0) && - (ACE_OS::strcmp (id, temp->client_id ()) == 0)) - id_is_owner = 1; - } - } - - return id_is_owner; -} - -int -ACE_RW_Token::is_waiting_for (const ACE_TCHAR *id) -{ - ACE_TRACE ("ACE_RW_Token::is_waiting_for"); - // If there is no owner, or is the owner, return false. - if ((this->owner () == 0) || - this->is_owner (id)) - return 0; - - // Step through each waiter looking for . - ACE_TPQ_Iterator iterator (waiters_); - iterator.advance (); - for (ACE_TPQ_Entry *temp = 0; - iterator.next (temp) != 0; - iterator.advance ()) - { - if (temp->equal_client_id (id)) - return 1; - } - - return 0; -} - -int -ACE_RW_Token::is_owner (const ACE_TCHAR *id) -{ - ACE_TRACE ("ACE_RW_Token::is_owner"); - // If there is no owner, return false. - if (this->owner () == 0) - return 0; - - // A writer owns us. - if (this->owner ()->proxy ()->type () == ACE_RW_Token::WRITER) - return this->owner ()->equal_client_id (id); - - // Readers own us. - // Step through each owning reader looking for . - ACE_TPQ_Iterator iterator (waiters_); - for (ACE_TPQ_Entry *temp = 0; - iterator.next (temp) != 0; - iterator.advance ()) - { - if (temp->proxy ()->type () != ACE_RW_Token::READER) - break; - - if (temp->equal_client_id (id)) - return 1; - } - - return 0; -} - -void -ACE_Token_Proxy::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Token_Proxy::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Token_Proxy::dump:\n") - ACE_TEXT (" type = %d\n") - ACE_TEXT (" ignore_deadlock_ = %d\n") - ACE_TEXT (" debug_ = %d\n"), - (int) this->type (), ignore_deadlock_, debug_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("mutex_, and waiter_\n"))); - - if (this->token_ != 0) - this->token_->dump (); - - this->waiter_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Token_Proxy::dump end.\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -const ACE_TCHAR * -ACE_Token_Proxy::client_id (void) const -{ - ACE_TRACE ("ACE_Token_Proxy::client_id"); - // Thread-specific. - const ACE_TPQ_Entry *temp = this->waiter_.operator->(); - const ACE_TCHAR *id = temp->client_id (); - - if (id == 0) - return ACE_TEXT ("ERROR NO CLIENT ID"); - else - return id; -} - -void -ACE_Token_Proxy::client_id (const ACE_TCHAR *client_id) -{ - ACE_TRACE ("ACE_Token_Proxy::client_id"); - this->waiter_->client_id (client_id); -} - -const ACE_TCHAR * -ACE_Token_Proxy::owner_id (void) -{ - ACE_TRACE ("ACE_Token_Proxy::owner_id"); - return this->token_->owner_id (); -} - -const ACE_TCHAR * -ACE_Token_Proxy::name (void) const -{ - ACE_TRACE ("ACE_Token_Proxy::name"); - return this->token_->name (); -} - -#if defined (ACE_WIN32_VC8) -# pragma warning (push) -# pragma warning (disable:4355) /* Use of 'this' in initializer list */ -#endif -ACE_Token_Proxy::ACE_Token_Proxy (void) -: token_ (0), - waiter_ (this, 0) -{ - ACE_TRACE ("ACE_Token_Proxy::ACE_Token_Proxy"); -} - -// Notice the token_ (0). Do *not* copy the token pointer. This must -// be obtained through the token manager. Also, we don't copy any -// waiter info. A copied Proxy does *not* inherit client_id. - -ACE_Token_Proxy::ACE_Token_Proxy (const ACE_Token_Proxy &) - : token_ (0), - waiter_ (this, 0) -{ - ACE_TRACE ("ACE_Token_Proxy::ACE_Token_Proxy"); -} -#if defined (ACE_WIN32_VC8) -# pragma warning (pop) -#endif - -// @@ should I do a mutex_->release ()? -ACE_Token_Proxy::~ACE_Token_Proxy (void) -{ - ACE_TRACE ("ACE_Token_Proxy::~ACE_Token_Proxy"); - - if (token_ != 0) - // notify token manager that we are done with it so it can - // free it if necessary - ACE_Token_Manager::instance ()->release_token (token_); -} - -int -ACE_Token_Proxy::open (const ACE_TCHAR *token_name, - int ignore_deadlock, - int debug) -{ - ACE_TRACE ("ACE_Token_Proxy::open"); - - // Store some parameters. - this->ignore_deadlock_ = ignore_deadlock; - this->debug_ = debug; - - // Used in case a name was not specified. - ACE_TCHAR name[BUFSIZ]; - - // We must have a name. - if (token_name == 0) - { - ACE_OS::sprintf (name, ACE_TEXT ("token %lx"), - reinterpret_cast (this)); - token_name = name; - } - - // Get or create the underlying token. The Token Manager will call - // us back to set token_. - ACE_Token_Manager::instance ()->get_token (this, token_name); - - // Check for failed get or failed new. - if (this->token_ == 0) - { - errno = ENOMEM; - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Can't allocate mutex")), -1); - } - - return 0; -} - -int -ACE_Token_Proxy::acquire (int notify, - void (*sleep_hook)(void *), - ACE_Synch_Options &options) -{ - ACE_TRACE ("ACE_Token_Proxy::acquire"); - if (this->token_ == 0) - { - errno = ENOENT; - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Not open.\n")), -1); - } - - // Make sure no one calls our token_acquired until we have a chance - // to sleep first! If after we call an EWOULDBLOCK - // mutex_->acquire() below, but before we enter handle_options to - // wait on the cond_var, a thread tries to give take us off the - // waiter queue and signal us, IT WILL FIRST HAVE TO ACQUIRE THIS - // cond_var.mutex (). _This_ is why we acquire it. - this->waiter_->cond_var_.mutex ().acquire (); - - this->waiter_->sleep_hook (sleep_hook); - - if (this->token_->acquire (this->waiter_, this->ignore_deadlock_, notify) == -1) - // acquire failed - { - switch (errno) - { - case EDEADLK : - if (!ignore_deadlock_) - { - waiter_->cond_var_.mutex ().release (); - errno = EDEADLK; - ACE_RETURN (-1); - } - // Else, fallthrough and block! - - case EWOULDBLOCK : - if (this->debug_) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%t) waiting for %s, owner is %s, ") - ACE_TEXT ("total waiters == %d\n"), - this->name (), - this->token_->owner_id (), - token_->no_of_waiters ())); - - // no error, but would block, if error, return error (-1), - // otherwise, return whether we called the holder or not. - int return_value; - if (this->handle_options (options, - waiter_->cond_var_) == -1) - return_value = -1; - else - return_value = notify == 1; - - errno = EWOULDBLOCK; - ACE_RETURN (return_value); - - default : - waiter_->cond_var_.mutex ().release (); - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("Token Proxy acquire.")), - -1); - } - } - else - // we have the token - { - if (debug_) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%t) acquired %s\n"), - this->name ())); - waiter_->cond_var_.mutex ().release (); - } - - return 0; -} - -int -ACE_Token_Proxy::tryacquire (void (*sleep_hook)(void *)) -{ - ACE_TRACE ("ACE_Token_Proxy::tryacquire"); - if (this->token_ == 0) - { - errno = ENOENT; - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("Not open.\n")), - -1); - } - - this->waiter_->sleep_hook (sleep_hook); - - return this->token_->tryacquire (waiter_); -} - -int -ACE_Token_Proxy::renew (int requeue_position, - ACE_Synch_Options &options) -{ - ACE_TRACE ("ACE_Token_Proxy::renew"); - if (this->token_ == 0) - { - errno = ENOENT; - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("Not open.\n")), - -1); - } - - // Make sure no one calls our token_acquired until we have a chance - // to sleep first! - this->waiter_->cond_var_.mutex ().acquire (); - - if (this->token_->renew (this->waiter_, requeue_position) == -1) - { - // check for error - if (errno != EWOULDBLOCK) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("%p renew failed\n"), ACE_TEXT ("ACE_Token_Proxy")), -1); - - if (this->debug_) - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) renew blocking for %s, owner is %s\n"), - this->name (), - token_->owner_id ())); - - // no error, but would block, so block or return - return this->handle_options (options, waiter_->cond_var_); - } - else - // we have the token - { - if (this->debug_) - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) renewed %s\n"), - this->name ())); - waiter_->cond_var_.mutex ().release (); - return 0; - } -} - -int -ACE_Token_Proxy::handle_options (ACE_Synch_Options &options, - ACE_TOKEN_CONST::COND_VAR &cv) -{ - // Some operation failed with EWOULDBLOCK. - ACE_TRACE ("ACE_Token_Proxy::handle_options"); - - if (options[ACE_Synch_Options::USE_REACTOR] == 1) - // Asynchronous. - { - // Save/restore errno. - ACE_Errno_Guard error (errno); - cv.mutex ().release (); - ACE_RETURN (-1); - } - else - // Synchronous. - { - // Block on condition variable. - while (cv.wait ((ACE_Time_Value *) options.time_value ()) == -1) - { - // Note, this should obey whatever thread-specific - // interrupt policy is currently in place... - if (errno == EINTR) - continue; - // We come here if a timeout occurs or some serious - // ACE_Condition object error. - cv.mutex ().release (); - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("condition variable wait") - ACE_TEXT (" bombed.")), -1); - } - - if (this->debug_) - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) unblocking %s.\n"), - this->client_id ())); - cv.mutex ().release (); - return 0; // operation succeeded - } -} - -int -ACE_Token_Proxy::release (ACE_Synch_Options &) -{ - ACE_TRACE ("ACE_Token_Proxy::release"); - - if (this->token_ == 0) - { - errno = ENOENT; - if (debug_) - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Must open before releasing.\n"))); - ACE_RETURN (-1); - } - - if (this->token_->release (waiter_) != 0) - { - // Release failed. - this->token_->remove (this->waiter_); - if (debug_) - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) %p.\n"), ACE_TEXT ("release failed"))); - return -1; - } - else - { - if (this->debug_) - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) released %s, owner is %s\n"), - this->name (), - token_->owner_id ())); - - return 0; - } -} - -int -ACE_Token_Proxy::remove (ACE_Synch_Options &) -{ - ACE_TRACE ("ACE_Token_Proxy::remove"); - return 0; -} - -void -ACE_Token_Proxy::sleep_hook (void) -{ - ACE_TRACE ("ACE_Token_Proxy::sleep_hook"); - // Somebody wants our token! (Let'em wait...) - return; -} - -void -ACE_Token_Proxy::token_acquired (ACE_TPQ_Entry *e) -{ - ACE_TRACE ("ACE_Token_Proxy::token_acquired"); - e->cond_var_.mutex ().acquire (); - // We've been taken off the waiters list and given the token! - // This implementation signals the internal condition - // variable. Thus, if asynchronous acquires are used, this must be - // overriden to do something more useful! - e->cond_var_.signal (); - e->cond_var_.mutex ().release (); - - return; -} - -int -ACE_Token_Proxy::type (void) const -{ - ACE_TRACE ("ACE_Token_Proxy::type"); - return 0; -} - -int -ACE_Token_Proxy::acquire_read (int notify, - void (*sleep_hook)(void *), - ACE_Synch_Options &options) -{ - return this->acquire (notify, - sleep_hook, - options); -} - -int -ACE_Token_Proxy::acquire_write (int notify, - void (*sleep_hook)(void *), - ACE_Synch_Options &options) -{ - return this->acquire (notify, - sleep_hook, - options); -} - -int -ACE_Token_Proxy::tryacquire_read (void (*sleep_hook)(void *)) -{ - return this->tryacquire (sleep_hook); -} - -int -ACE_Token_Proxy::tryacquire_write (void (*sleep_hook)(void *)) -{ - return this->tryacquire (sleep_hook); -} - -ACE_Token_Name::ACE_Token_Name (const ACE_TCHAR *token_name) -{ - ACE_TRACE ("ACE_Token_Name::ACE_Token_Name"); - this->name (token_name); -} - -ACE_Token_Name::ACE_Token_Name (const ACE_Token_Name &rhs) -{ - ACE_TRACE ("ACE_Token_Name::ACE_Token_Name"); - this->name (rhs.name ()); -} - -ACE_Token_Name::~ACE_Token_Name () -{ - ACE_TRACE ("ACE_Token_Name::~ACE_Token_Name"); -} - -void -ACE_Token_Name::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Token_Name::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Token_Name::dump:\n") - ACE_TEXT (" token_name_ = %s\n"), - token_name_ == 0 ? ACE_TEXT ("no name") : token_name_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -// ************************************************************ - -ACE_Token_Proxy * -ACE_Local_Mutex::clone (void) const -{ - ACE_Token_Proxy *temp = 0; - ACE_NEW_RETURN (temp, - ACE_Local_Mutex (token_->name (), - ignore_deadlock_, - debug_), - 0); - return temp; -} - -ACE_Tokens * -ACE_Local_Mutex::create_token (const ACE_TCHAR *name) -{ - ACE_Tokens *temp = 0; - ACE_NEW_RETURN (temp, - ACE_Mutex_Token (name), - 0); - return temp; -} - -ACE_Local_Mutex::~ACE_Local_Mutex (void) -{ -} - -// ************************************************************ - -ACE_Local_RLock::~ACE_Local_RLock (void) -{ -} - -ACE_Tokens * -ACE_Local_RLock::create_token (const ACE_TCHAR *name) -{ - ACE_Tokens *temp = 0; - ACE_NEW_RETURN (temp, - ACE_RW_Token (name), - 0); - return temp; -} - -int -ACE_Local_RLock::type (void) const -{ - return ACE_RW_Token::READER; -} - -ACE_Token_Proxy * -ACE_Local_RLock::clone (void) const -{ - ACE_Token_Proxy *temp = 0; - ACE_NEW_RETURN (temp, - ACE_Local_RLock (token_->name (), - ignore_deadlock_, - debug_), - 0); - return temp; -} - -// ************************************************************ - -ACE_Local_WLock::~ACE_Local_WLock (void) -{ -} - -ACE_Tokens * -ACE_Local_WLock::create_token (const ACE_TCHAR *name) -{ - ACE_Tokens *temp = 0; - ACE_NEW_RETURN (temp, - ACE_RW_Token (name), - 0); - return temp; -} - -int -ACE_Local_WLock::type (void) const -{ - return ACE_RW_Token::WRITER; -} - -ACE_Token_Proxy * -ACE_Local_WLock::clone (void) const -{ - ACE_Token_Proxy *temp = 0; - ACE_NEW_RETURN (temp, - ACE_Local_WLock (token_->name (), - ignore_deadlock_, - debug_), - 0); - return temp; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/dep/acelite/ace/Local_Tokens.h b/dep/acelite/ace/Local_Tokens.h deleted file mode 100644 index 72e528bfd79..00000000000 --- a/dep/acelite/ace/Local_Tokens.h +++ /dev/null @@ -1,1123 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Local_Tokens.h - * - * $Id: Local_Tokens.h 93792 2011-04-07 11:48:50Z mcorino $ - * - * @author Karl-Heinz Dorn - * @author Douglas C. Schmidt - * @author Tim Harrison - * - * This file contains definitions for the following classes: - * - * public: - * 7. ACE_Token_Proxy - * 8. ACE_Null_Token : public ACE_Token_Proxy - * 9. ACE_Local_Mutex : public ACE_Token_Proxy - * *. ACE_Local_RLock : public ACE_Local_Mutex - * &. ACE_Local_WLock : public ACE_Local_Mutex - * private: - * 1. ACE_TOKEN_CONST - * 3. ACE_TPQ_Entry - * b. ACE_TSS_TPQ_Entry - * c. ACE_TPQ_Iterator - * 4. ACE_Token_Proxy_Queue - * 5. ACE_Tokens - * 6. ACE_Mutex_Token : public ACE_Tokens - * 12. ACE_RW_Token : public ACE_Tokens - * a. ACE_Token_Name - * - * Note that the locking classes defined in this file are *not* - * intended to be used as general-purpose synchronization - * mechanisms, such as mutexes or semaphores. Instead, you should - * use the ACE_Recursive_Thread_Mutex, ACE_Thread_Mutex, - * ACE_Thread_Semaphore, etc., that are defined in - * $ACE_ROOT/ace/Synch.h or the - * ACE_Token that's defined in $ACE_ROOT/ace/Token.h. - * - * - */ -//============================================================================= - -#ifndef ACE_LOCAL_MUTEX_H -#define ACE_LOCAL_MUTEX_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_TOKENS_LIBRARY) - -#include "ace/Synch_Traits.h" -#include "ace/Condition_Thread_Mutex.h" -#include "ace/TSS_T.h" -#include "ace/Containers.h" -#include "ace/Synch_Options.h" -#include "ace/Map_Manager.h" -#include "ace/Log_Msg.h" -#include "ace/OS_NS_string.h" -#include "ace/os_include/os_netdb.h" - -#if !(defined (ACE_HAS_THREADS) && defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)) -# define ACE_NO_TSS_TOKENS 1 -#endif /* !(defined (ACE_HAS_THREADS) && defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)) */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// 1. -/** - * @class ACE_TOKEN_CONST - * - * @brief Not a public interface. - * - * Constant definitions and typedefs for Token library. Mostly, - * this class is necessary to fight the compiler with order of - * declaration errors. - */ -// FUZZ: disable check_for_ACE_Guard -namespace ACE_TOKEN_CONST -{ -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - // ACE platform supports some form of threading. - typedef ACE_Condition_Thread_Mutex COND_VAR; - typedef ACE_Thread_Mutex MUTEX; - typedef ACE_Guard GUARD; -#else - typedef ACE_Null_Condition COND_VAR; - typedef ACE_Null_Mutex MUTEX; - typedef ACE_Guard GUARD; -#endif /* ACE_HAS_THREADS */ -} -// FUZZ: enable check_for_ACE_Guard - -// Forward decl. -class ACE_Token_Proxy; - -// 3.. -/** - * @class ACE_TPQ_Entry - * - * @brief Token Proxy Queue entry. Used in the ACE_Token_Proxy_Queue - * - * Not a public interface. - */ -class ACE_Export ACE_TPQ_Entry -{ - friend class ACE_Token_Manager; -public: - typedef void (*PTVF) (void *); - - /// Null constructor. - ACE_TPQ_Entry (void); - - /// Constructor. - ACE_TPQ_Entry (const ACE_Token_Proxy *proxy, - const ACE_TCHAR *client_id); - - /// Copy constructor. - ACE_TPQ_Entry (const ACE_TPQ_Entry &rhs); - - /// Destructor. - ~ACE_TPQ_Entry (void); - - /// Copy operator use by the queue. - void operator= (const ACE_TPQ_Entry &rhs); - - /// Get top of the queue. - ACE_Token_Proxy *proxy (void) const; - - /// Set top of the queue. - void proxy (ACE_Token_Proxy *); - - /// Get nesting level of the entry. - int nesting_level (void) const; - - /// Delta nesting level of the entry. - void nesting_level (int delta); - - /// Get client_id of the entry. - const ACE_TCHAR *client_id (void) const; - - /// Set client_id of the entry. - void client_id (const ACE_TCHAR *); - - /// Returns 1 if @a id == client id. Does not check for @a id == 0. - int equal_client_id (const ACE_TCHAR *id); - - /// One method for arg and sleep_hook. - void set (void (*sleep_hook)(void *)); - - /// Set sleep hook of the entry. - void sleep_hook (void (*sh)(void *)); - - /// Get sleep hook of the entry. - PTVF sleep_hook (void) const; - - /// Call the sleep hook function or method passing arg. - void call_sleep_hook (void); - - /// Dump the state of the class. - void dump (void) const; - - // = Used to block the thread if an acquire fails with EWOULDBLOCK. - ACE_TOKEN_CONST::COND_VAR cond_var_; - ACE_TOKEN_CONST::MUTEX lock_; - - /// Pointer to next in list. - ACE_TPQ_Entry *next_; - - /// Get whether this client is blocked waiting for a token. - int waiting (void) const; - - /// Set whether this client is blocked waiting for a token. - void waiting (int w); - -private: - /// This client is waiting for a token. - int waiting_; - - /// Proxy. - ACE_Token_Proxy *proxy_; - - /// Nesting level. - int nesting_level_; - - /// Arg. - void *arg_; - - /// Client id. - ACE_TCHAR client_id_[ACE_MAXCLIENTIDLEN]; - - /// Sleep hook. - void (*sleep_hook_)(void *); -}; - -// b.. -#if defined (ACE_NO_TSS_TOKENS) -typedef ACE_TPQ_Entry ACE_TPQ_ENTRY; -#else -typedef ACE_TSS ACE_TPQ_ENTRY; -#endif /* ACE_NO_TSS_TOKENS */ - -/** - * @class ACE_TSS_TPQ_Entry - * - * @brief ACE_TSS_TPQ_Entry - * - * Not a public interface. - */ -class ACE_Export ACE_TSS_TPQ_Entry : public ACE_TPQ_ENTRY -{ -public: - /// These are passed to the constructor of ACE_TPQ_Entry in - /// make_TSS_TYPE - ACE_TSS_TPQ_Entry (const ACE_Token_Proxy *proxy, - const ACE_TCHAR *client_id); - - /// Destructor. - virtual ~ACE_TSS_TPQ_Entry (void); - - /// Allows us to pass args to the construction of the TSS object. - virtual ACE_TPQ_Entry *make_TSS_TYPE (void) const; - - /// Operator overloading and inheritance don't mix. - operator ACE_TPQ_Entry *(void); - - /// Dump the state of the class. - void dump (void) const; - -#if defined (ACE_NO_TSS_TOKENS) - ACE_TPQ_Entry *operator-> (void) - { - return (ACE_TPQ_Entry *) this; - } -#endif /* ACE_NO_TSS_TOKENS */ - -private: - /// Private: should not be used - ACE_TSS_TPQ_Entry (const ACE_TSS_TPQ_Entry &); - void operator= (const ACE_TSS_TPQ_Entry &); - - // = These are passed to the constructor of ACE_TPQ_Entry in - // make_TSS_TYPE - - /// Proxy. - const ACE_Token_Proxy *proxy_; - - /// Client_id. - const ACE_TCHAR *client_id_; -}; - -class ACE_Token_Proxy_Queue; - -// c.. -/** - * @class ACE_TPQ_Iterator - * - * @brief Iterates through ACE_Token_Proxy_Queues. - * - * Not a public interface. - */ -class ACE_Export ACE_TPQ_Iterator -{ -public: - /// Constructor. - ACE_TPQ_Iterator (ACE_Token_Proxy_Queue &q); - - /// Destructor. - ~ACE_TPQ_Iterator (void); - - /// Pass back the @a next_item. - int next (ACE_TPQ_Entry *&next_item); - - /// Returns 1 when all items have been seen, else 0. - int done (void) const; - - /// Move forward by one element in the queue. - void advance (void); - - /// Dump the state of an object. - void dump (void) const; - -private: - ACE_TPQ_Entry *current_; -}; - -// 4.. -/** - * @class ACE_Token_Proxy_Queue - * - * @brief Token waiter list. - * - * Not a public interface. - * This queue holds all the token proxies waiting for ownership - * of a token. Along with the proxy reference, it also stores - * the nesting level, client id, and a magic cookie from the - * proxy. This queue stores the ACE_TPQ_Entries by pointer - * values. It DOES NOT make copies. Thus, the user is - * responsible to ensure that the TPQ's stick around. This is - * motivated by the need to reduce dynamic memory allocation. - */ -class ACE_Export ACE_Token_Proxy_Queue -{ -public: - friend class ACE_TPQ_Iterator; - - /// Constructor. - ACE_Token_Proxy_Queue (void); - - /// Destructor. - ~ACE_Token_Proxy_Queue (void); - - /** - * Enqueue a proxy, nesting level, client_id, and a magic cookie at - * the given position in the list. If the position is -1, we - * enqueue at the end of the list (I think). - */ - void enqueue (ACE_TPQ_Entry* new_entry, - int position); - - /// Top of the queue. - const ACE_TPQ_Entry* head (void); - -// int member (const ACE_TCHAR *id); - // Is this id in the waiter list? - - /// Remove the top waiter. - void dequeue (void); - - /// Remove the waiter whose proxy ref matches @a remove_me. - void remove (const ACE_TPQ_Entry *remove_me); - - /// The number of waiters. - int size (void); - - /// Dump the state of the class. - void dump (void) const; - -protected: - /// Head. - ACE_TPQ_Entry *head_; - - /// Tail. - ACE_TPQ_Entry *tail_; - - /// Size. - int size_; -}; - -// 5.. -/** - * @class ACE_Tokens - * - * @brief Abstract representation of ACE tokens. - * - * Not a public interface. - * Currently, I don't see a reason for providing an abstract - * interface at this level of the library. As of yet, no one - * uses ACE_Tokens derivatives through this abstract interface - * except for ACE_Token_Manager. It only uses the statistical - * methods which are shared by all Tokens. For that reason, it - * still makes since to have a common base class. However, - * acquire, renew, and release do not need to have matching - * interfaces throughout all Tokens. - * To add a new type of token (e.g. semaphore), this class must - * be subtyped to define the new semantics. See - * ACE_Token_Manager for details. - */ -class ACE_Export ACE_Tokens -{ -public: - - /// Null constructor. - ACE_Tokens (void); - - /// Destructor - virtual ~ACE_Tokens (void); - - /// No implementation. - virtual int acquire (ACE_TPQ_Entry *caller, - int ignore_deadlock, - int notify) = 0; - - /// No implementation. - virtual int tryacquire (ACE_TPQ_Entry *caller) = 0; - - /// No implementation. - virtual int renew (ACE_TPQ_Entry *caller, - int requeue_position) = 0; - - /// No implementation. - virtual int release (ACE_TPQ_Entry *caller) = 0; - - /// Move the caller to the front of the waiter list. This is for use - /// with remote mutexes and shadow mutexes. - void make_owner (ACE_TPQ_Entry *caller); - - /// Remove the caller from the waiter list. - void remove (ACE_TPQ_Entry *caller); - - // = Accessor methods. - - /// Stack of owners. - typedef ACE_Unbounded_Stack OWNER_STACK; - - /// Returns a stack of the current owners. Returns -1 on error, 0 on - /// success. If @a id is non-zero, returns 1 if id is an owner. - virtual int owners (OWNER_STACK &o, const ACE_TCHAR *id) = 0; - - /// Returns 1 if @a id is waiting for this token. 0 otherwise. - virtual int is_waiting_for (const ACE_TCHAR *id) = 0; - - /// Returns 1 if @a id is an owner of this token. 0 otherwise. - virtual int is_owner (const ACE_TCHAR *id) = 0; - - /// Return the queue of waiters. - virtual ACE_Token_Proxy_Queue *waiters (void); - - /// Return the number of proxies that are currently waiting to get - /// the token. - virtual int no_of_waiters (void); - - /// The current owner. - const ACE_TCHAR *owner_id (void); - - /// Token name. - const ACE_TCHAR* name (void); - - // = Reference counting. These are only called by the - // Token_Manager. - void inc_reference (void); - int dec_reference (void); - - /// Dump the state of the class. - void dump (void) const; - - /** - * These are the Token types supported by the library at ship time. - * There is no restriction on the number of Token types added by - * "3rd parties." These are only necessary for the Token Server. - */ - enum TOKEN_TYPES { MUTEX, RWLOCK }; - - /** - * Provides a manual RTTI mechanism. This method is used only by - * ACE_Token_Request so that the type of a token can be sent to a - * remote Token Server. - */ - virtual int type (void) const = 0; - - // = The following methods allow the deadlock detection algorithm to - // check if this token has been visited. - - /// Mark or unmark the token as visited. - void visit (int v); - - /// Check if the token has been visited. - int visited (void); - - /// All the data of the current owner. - ACE_TPQ_Entry *owner (void); - -protected: - - /// For the deadlock detection algorithm. - int visited_; - - /// Reference count. - int reference_count_; - - /// List of client's owning and waiting the token. - ACE_Token_Proxy_Queue waiters_; - - /// Name of token. - ACE_TCHAR token_name_[ACE_MAXTOKENNAMELEN]; -}; - -class ACE_Local_Mutex; - -// 6.. -/** - * @class ACE_Mutex_Token - * - * @brief Class that acquires, renews, and releases a process-local - * synchronization token. - * - * Not a public interface. - * This class is a more general-purpose synchronization mechanism - * than SunOS 5.x mutexes. For example, it implements "recursive - * mutex" semantics, where a thread that owns the token can - * reacquire it without deadlocking. In addition, threads that - * are blocked awaiting the token are serviced in strict FIFO - * order as other threads release the token (SunOS 5.x mutexes - * don't strictly enforce an acquisition order). - */ -class ACE_Export ACE_Mutex_Token : public ACE_Tokens -{ -public: - /// Constructor - explicit ACE_Mutex_Token (const ACE_TCHAR* name); - - /// Destructor - virtual ~ACE_Mutex_Token (void); - - // = Synchronization operations. - // With acquire, renew, and release, the caller must be specified so - // that multiple proxies (e.g. ACE_Local_Mutex) can use the same - // token. - - /** - * Returns 0 on success, -1 on failure with as - * the reason. If errnum == EWOULDBLOCK, and notify == 1, - * has been called on the current - * owner of the token. If ignore_deadlock is passed as 1 and errnum - * == EDEADLK, then deadlock was detected via ace_token_manager. - */ - virtual int acquire (ACE_TPQ_Entry *caller, - int ignore_deadlock, - int notify); - - /// Same as acquire, but fails if would block - virtual int tryacquire (ACE_TPQ_Entry *caller); - - /** - * An optimized method that efficiently reacquires the token if no - * other threads are waiting. This is useful for situations where - * you don't want to degrade the quality of service if there are - * other threads waiting to get the token. If == - * -1 and there are other threads waiting to obtain the token we are - * queued at the end of the list of waiters. If - * > -1 then it indicates how many entries to skip over before - * inserting our thread into the list of waiters (e.g., - * == 0 means "insert at front of the queue"). - * Renew has the rather odd semantics such that if there are other - * waiting threads it will give up the token even if the - * nesting_level_ > 1. I'm not sure if this is really the right - * thing to do (since it makes it possible for shared data to be - * changed unexpectedly) so use with caution... Returns 0 on - * success, -1 on failure with as the reason. - * If errnum == EWOULDBLOCK, and notify == 1, - * has been called on the current - * owner of the token. - */ - virtual int renew (ACE_TPQ_Entry *caller, - int requeue_position); - - /** - * Relinquish the token. If there are any waiters then the next one - * in line gets it. If the caller is not the owner, caller is - * removed from the waiter list. - */ - virtual int release (ACE_TPQ_Entry *caller); - - /// Dump the state of the class. - void dump (void) const; - - /// Returns ACE_Tokens::MUTEX. - virtual int type (void) const; - - /// Returns a stack of the current owners. Returns -1 on error, 0 on - /// success. If @a id is non-zero, returns 1 if id is an owner. - virtual int owners (OWNER_STACK &o, const ACE_TCHAR *id); - - /// Returns 1 if @a id is waiting for this token. 0 otherwise. - virtual int is_waiting_for (const ACE_TCHAR *id); - - /// Returns 1 if @a id is an owner of this token. 0 otherwise. - virtual int is_owner (const ACE_TCHAR *id); - -private: - /// ACE_Mutex_Token used to lock internal data structures. - ACE_TOKEN_CONST::MUTEX lock_; -}; - -// 12.. -/** - * @class ACE_RW_Token - * - * @brief Class that acquires, renews, and releases a process-local - * synchronization token. - * - * Not a public interface. - * This class is a more general-purpose synchronization mechanism - * than SunOS 5.x mutexes. For example, it implements "recursive - * mutex" semantics, where a thread that owns the token can - * reacquire it without deadlocking. In addition, threads that are - * blocked awaiting the token are serviced in strict FIFO order as - * other threads release the token (SunOS 5.x mutexes don't strictly - * enforce an acquisition order). - */ -class ACE_Export ACE_RW_Token : public ACE_Tokens -{ -public: - /// Constructor. - explicit ACE_RW_Token (const ACE_TCHAR* name); - - /// Destructor. - virtual ~ACE_RW_Token (void); - - // = Synchronization operations. - // With acquire, renew, and release, the caller must be specified so - // that multiple proxies (e.g. ACE_Local_Mutex) can use the same - // token. - - /** - * Returns 0 on success, -1 on failure with as - * the reason. If errnum == EWOULDBLOCK, and notify == 1, - * has been called on the current - * owner of the token. If @a ignore_deadlock is passed as 1 and errnum - * == EDEADLK, then deadlock was detected via ACE_Token_Manager. - */ - virtual int acquire (ACE_TPQ_Entry *caller, - int ignore_deadlock, - int notify); - - /// Same as acquire except fails on would block - virtual int tryacquire (ACE_TPQ_Entry *caller); - - /** - * An optimized method that efficiently reacquires the token if no - * other threads are waiting. This is useful for situations where - * you don't want to degrade the quality of service if there are - * other threads waiting to get the token. If == - * -1 and there are other threads waiting to obtain the token we are - * queued at the end of the list of waiters. If - * > -1 then it indicates how many entries to skip over before - * inserting our thread into the list of waiters (e.g., - * == 0 means "insert at front of the queue"). - * Renew has the rather odd semantics such that if there are other - * waiting threads it will give up the token even if the - * nesting_level_ > 1. I'm not sure if this is really the right - * thing to do (since it makes it possible for shared data to be - * changed unexpectedly) so use with caution... Returns 0 on - * success, -1 on failure with as the reason. - * If errnum == EWOULDBLOCK, and notify == 1, - * has been called on the current - * owner of the token. - */ - virtual int renew (ACE_TPQ_Entry *caller, - int requeue_position); - - /** - * Relinquish the token. If there are any waiters then the next one - * in line gets it. If the caller is not the owner, caller is - * removed from the waiter list. - */ - virtual int release (ACE_TPQ_Entry *caller); - - /// Dump the state of the class. - void dump (void) const; - - /// These are the types that proxies can be. - enum PROXY_TYPE { READER, WRITER }; - - /// Returns READER or WRITER. - virtual int type (void) const; - - /// Returns a stack of the current owners. Returns -1 on error, 0 on - /// success. If @a id is non-zero, returns 1 if id is an owner. - virtual int owners (OWNER_STACK &o, const ACE_TCHAR *id); - - /// Returns 1 if @a id is waiting for this token. 0 otherwise. - virtual int is_waiting_for (const ACE_TCHAR *id); - - /// Returns 1 if @a id is an owner of this token. 0 otherwise. - virtual int is_owner (const ACE_TCHAR *id); - -protected: - /// The number of waiting writers. - int num_writers_; - - /// ACE_Mutex_Token used to lock internal data structures. - ACE_TOKEN_CONST::MUTEX lock_; - - /// Sets the new owner. - void notify_new_owner (ACE_TPQ_Entry *caller); -}; - -// a.. -/** - * @class ACE_Token_Name - * - * @brief Allows Token_Manger to identify tokens. - * - * For now, this is just a string. We need a string class - * anyway to use in ACE_Map_Manager. Having this class - * (instead of ) allows us to easily change if - * needed. For instance, we may choose to identify tokens by - * name and *type* in the future. - */ -class ACE_Export ACE_Token_Name -{ -public: - /// Construction. - ACE_Token_Name (const ACE_TCHAR *token_name = 0); - - /// Copy construction. - ACE_Token_Name (const ACE_Token_Name &rhs); - - /// Destructor. - virtual ~ACE_Token_Name (void); - - /// Copy. - void operator= (const ACE_Token_Name &rhs); - - /// Comparison. - bool operator== (const ACE_Token_Name &rhs) const; - - /// Get the token name. - const ACE_TCHAR *name (void) const; - - /// Set the token name. - void name (const ACE_TCHAR *new_name); - - /// Dump the state of the class. - void dump (void) const; - -private: - /// Name of the token. - ACE_TCHAR token_name_[ACE_MAXTOKENNAMELEN]; -}; - -// 7.. -/** - * @class ACE_Token_Proxy - * - * @brief Abstract representation of ACE tokens. - * - * Interface for all Tokens in ACE. This class implements the - * synchronization needed for tokens (condition variables etc.) - * The algorithms for the operations (acquire, release, etc.) - * operate on the generic ACE_Tokens interface. Thus, the _type_ - * of token (mutex, rwlock) can be set at construction of - * ACE_Token_Proxy. You can use all Tokens in ACE through the - * ACE_Token_Proxy by passing the proper values at construction. - * Alternatively, there are class definitions which "know" how to - * do this (ACE_Local_Mutex, ACE_Local_RLock, ACE_Local_WLock). - * To add a new type of token (e.g. semaphore), this class is not - * changed. See ACE_Token_Manager for details. - * Tokens (e.g. ACE_Mutex_Token) assume that it can always call - * on a new token owner. This - * is not a problem for synchronous use of token proxies (that is, - * when acquires block until successful.) However, for - * implementations of the Token Server, which may use asynch - * operations, the proxy can not go away after an acquire until - * the token is acquired. This is not really a problem, but - * should be understood. - */ -class ACE_Export ACE_Token_Proxy -{ -public: - friend class ACE_Token_Manager; - friend class ACE_Token_Invariant_Manager; // For testing. - - // Initialization and termination methods. - /// Construction. - ACE_Token_Proxy (void); - - /// Destructor. - virtual ~ACE_Token_Proxy (void); - - /** - * Open the . - * @param name The string uniquely identifying the token. - * @param ignore_deadlock Can be 1 to disable deadlock notifications. - * @param debug Prints debug messages. - */ - virtual int open (const ACE_TCHAR *name, - int ignore_deadlock = 0, - int debug = 0); - - // = The following methods have implementations which are - // independent of the token semantics (mutex, rwlock, etc.) They - // forward operations to the underlying token and perform the - // necessary blocking semantics for operations (condition variables - // etc.) This allows reuse of the blocking code as well as having - // multiple proxies to the same token. - - /// Calls acquire on the token. Blocks the calling thread if would - /// block. - virtual int acquire (int notify = 0, - void (*sleep_hook)(void *) = 0, - ACE_Synch_Options &options = - ACE_Synch_Options::defaults); - - /// Calls renew on the token. Blocks the calling thread if would block. - virtual int renew (int requeue_position = -1, - ACE_Synch_Options &options = - ACE_Synch_Options::defaults); - - /// Calls renew on the token. - virtual int tryacquire (void (*sleep_hook)(void *) = 0); - - /// Calls release on the token. - virtual int release (ACE_Synch_Options &options = - ACE_Synch_Options::defaults); - - /// Calls remove on the token. - virtual int remove (ACE_Synch_Options &options = - ACE_Synch_Options::defaults); - - /// Since the locking mechanism doesn't support read locks then this - /// just calls . - virtual int acquire_read (int notify = 0, - void (*sleep_hook)(void *) = 0, - ACE_Synch_Options &options = - ACE_Synch_Options::defaults); - - /// Since the locking mechanism doesn't support write locks then this - /// just calls . - virtual int acquire_write (int notify = 0, - void (*sleep_hook)(void *) = 0, - ACE_Synch_Options &options = - ACE_Synch_Options::defaults); - - /// Since the locking mechanism doesn't support read locks then this - /// just calls . - virtual int tryacquire_read (void (*sleep_hook)(void *) = 0); - - /// Since the locking mechanism doesn't support write locks then this - /// just calls . - virtual int tryacquire_write (void (*sleep_hook)(void *) = 0); - - // = Utility methods. - - /// Get the client id of the proxy. This is implemented as - /// thread-specific data. - virtual const ACE_TCHAR *client_id (void) const; - - /** - * Set the client_id for the calling thread. I strongly recommend - * that this not be used unless you really know what you're doing. - * I use this in the Token Server, and it caused many headaches. - */ - virtual void client_id (const ACE_TCHAR *client_id); - - /** - * Return the name of the token. This is important for use within - * the token servers (local and remote) as well as with token - * collections. So, all derivations of ACE_Token_Proxy must be able to - * stringify some name. The name must uniquely identify a token. - * So, for instance, the token within the reactor should probably be - * called "Reactor Token." - */ - virtual const ACE_TCHAR *name (void) const; - - /** - * This should really be called . This is called - * by ACE_Token_xx's when another proxy enters the waiting list and - * requests that the current token holder be notified. - */ - virtual void sleep_hook (void); - - /// This is called when a queued (waiting) proxy is removed from the - /// waiters list and given the token. - virtual void token_acquired (ACE_TPQ_Entry *); - - /// The client id of the current token holder - virtual const ACE_TCHAR *owner_id (void); - - /// Return a dynamically allocated clone of the derived class. - virtual ACE_Token_Proxy *clone (void) const = 0; - - /// Dump the state of the class. - void dump (void) const; - - /** - * This method can be used be Tokens (e.g. Readers/Writer Tokens) to - * distinguish between Proxy types. For instance a Reader proxy - * should return a different type value than a Writer proxy. The - * default implementation returns 0. - */ - virtual int type (void) const; - -protected: - /// Duplication. - ACE_Token_Proxy (const ACE_Token_Proxy &); - - /// If this is set, we ignore deadlock. - int ignore_deadlock_; - - /// Print a bunch of debug messages. - int debug_; - - /// Reference to the actual logical token. Many ACE_Local_Mutex - /// proxies can reference the same ACE_Mutex_Token. - ACE_Tokens *token_; - - /// Handles cond_var waits. - int handle_options (ACE_Synch_Options &options, - ACE_TOKEN_CONST::COND_VAR &cv); - - /// Waiter info used for asynchronous transactions. - ACE_TSS_TPQ_Entry waiter_; - - /// Make the correct type of ACE_Tokens. This is called by the Token - /// Manager. - virtual ACE_Tokens *create_token (const ACE_TCHAR *name) = 0; -}; - -// 8.. -/** - * @class ACE_Null_Token - * - * @brief No op class for nonthreaded platform protocols. - */ -class ACE_Export ACE_Null_Token : public ACE_Token_Proxy -{ -public: -#if defined (ACE_LACKS_INLINE_FUNCTIONS) - // @@ Hopefully, we can remove this ridicules ifdef when CE's compiler becomes more normal. - /// Construction. - ACE_Null_Token (void); - - /// Destructor. - ~ACE_Null_Token (void); -#endif /* ACE_LACKS_INLINE_FUNCTION */ - - /// Acquire. - virtual int acquire (int /* notify */ = 0, - void (* /* sleep_hook */ )(void *) = 0, - ACE_Synch_Options & /* options */ = - ACE_Synch_Options::defaults) { return 0; } - - /// Renew. - virtual int renew (int /* requeue_position */ = -1, - ACE_Synch_Options & /* options */ = - ACE_Synch_Options::defaults) { return 0; } - - /// Try acquire. - virtual int tryacquire (void (* /* sleep_hook */)(void *) = 0) { return 0; } - - /// Release. - virtual int release (ACE_Synch_Options & /* options */ = - ACE_Synch_Options::defaults) { return 0; } - - /// Remove. - virtual int remove (ACE_Synch_Options & /* options */ = - ACE_Synch_Options::defaults) { return 0; } - - /// Return a dynamically allocated clone of the derived class. - virtual ACE_Token_Proxy *clone (void) const { return new ACE_Null_Token; } - - /// Dump the state of the class. - void dump (void) const; - - /// Do not allow the Token Manager to create us. - virtual ACE_Tokens *create_token (const ACE_TCHAR *) { return 0; } -}; - -// 9.. -/** - * @class ACE_Local_Mutex - * - * @brief Class that acquires, renews, and releases a synchronization - * token local to the process. - * - * This class is a more general-purpose synchronization mechanism - * than SunOS 5.x mutexes. For example, it implements "recursive - * mutex" semantics, where a thread that owns the token can - * reacquire it without deadlocking. In addition, threads that - * are blocked awaiting the token are serviced in strict FIFO - * order as other threads release the token (SunOS 5.x mutexes - * don't strictly enforce an acquisition order). Lastly, - * ACE_Local_Mutex performs deadlock detection on acquire calls. - * The interfaces for acquire, tryacquire, renew, release, - * etc. are defined in ACE_Token_Proxy. The semantics for - * ACE_Local_Mutex are that of a mutex. - */ -class ACE_Export ACE_Local_Mutex : public ACE_Token_Proxy -{ -public: - /** - * Constructor. - * @param token_name Uniquely id's the token. - * @param ignore_deadlock Will allow deadlock to occur (useful for testing). - * @param debug Prints a bunch of messages. - */ - ACE_Local_Mutex (const ACE_TCHAR *token_name = 0, - int ignore_deadlock = 0, - int debug = 0); - - /// Destructor - ~ACE_Local_Mutex (void); - - /// Dump the state of the class. - void dump (void) const; - - /// Return deep copy. - virtual ACE_Token_Proxy *clone (void) const; - -protected: - /// Return a new ACE_Local_Mutex. - virtual ACE_Tokens *create_token (const ACE_TCHAR *name); -}; - -// *. -/** - * @class ACE_Local_RLock - * - * @brief Class that acquires, renews, and releases a readers lock that - * is local to the process. - * - * This class implements the reader interface to canonical - * readers/writer locks. Multiple readers can hold the lock - * simultaneously when no writers have the lock. Alternatively, - * when a writer holds the lock, no other participants (readers - * or writers) may hold the lock. This class is a more - * general-purpose synchronization mechanism than SunOS 5.x - * RLocks. For example, it implements "recursive RLock" - * semantics, where a thread that owns the token can reacquire it - * without deadlocking. In addition, threads that are blocked - * awaiting the token are serviced in strict FIFO order as other - * threads release the token (SunOS 5.x RLockes don't strictly - * enforce an acquisition order). - * The interfaces for acquire, tryacquire, renew, release, - * etc. are defined in ACE_Token_Proxy. The semantics for - * ACE_Local_RLock are that of a readers/writers lock. Acquire - * for this class implies a reader acquisition. That is, - * multiple clients may acquire a lock for read only. - */ -class ACE_Export ACE_Local_RLock : public ACE_Token_Proxy -{ -public: - // = Initialization and termination. - - /** - * Constructor. - * @param token_name Uniquely id's the token. - * @param ignore_deadlock Will allow deadlock to occur (useful for testing). - * @param debug Prints a bunch of messages. - */ - ACE_Local_RLock (const ACE_TCHAR *token_name = 0, - int ignore_deadlock = 0, - int debug = 0); - - /// Destructor - ~ACE_Local_RLock (void); - - /// Dump the state of the class. - void dump (void) const; - - /// Returns ACE_RW_Token::RLOCK. - virtual int type (void) const; - - /// Return deep copy. - virtual ACE_Token_Proxy *clone (void) const; - -protected: - /// Return a new ACE_Local_Mutex. - virtual ACE_Tokens *create_token (const ACE_TCHAR *name); -}; - -// *. -/** - * @class ACE_Local_WLock - * - * @brief Class that acquires, renews, and releases a writer lock that - * is local to the process. - * - * This class implements the writer interface to canonical - * readers/writer locks. Multiple readers can hold the lock - * simultaneously when no writers have the lock. Alternatively, - * when a writer holds the lock, no other participants (readers - * or writers) may hold the lock. This class is a more - * general-purpose synchronization mechanism than SunOS 5.x - * WLock. For example, it implements "recursive WLock" - * semantics, where a thread that owns the token can reacquire it - * without deadlocking. In addition, threads that are blocked - * awaiting the token are serviced in strict FIFO order as other - * threads release the token (SunOS 5.x WLocks don't strictly - * enforce an acquisition order). - * The interfaces for acquire, tryacquire, renew, release, - * etc. are defined in ACE_Token_Proxy. The semantics for - * ACE_Local_WLock are that of a readers/writers lock. Acquire - * for this class implies a writer acquisition. That is, only - * one client may hold the lock for writing. - */ -class ACE_Export ACE_Local_WLock : public ACE_Token_Proxy -{ -public: - // = Initialization and termination. - - /** - * Constructor. - * @param token_name Uniquely id's the token. - * @param ignore_deadlock Will allow deadlock to occur (useful for testing). - * @param debug Prints a bunch of messages. - */ - ACE_Local_WLock (const ACE_TCHAR *token_name = 0, - int ignore_deadlock = 0, - int debug = 0); - - /// Destructor - ~ACE_Local_WLock (void); - - /// Dump the state of the class. - void dump (void) const; - - /// Returns ACE_RW_Token::WLOCK. - virtual int type (void) const; - - /// Return deep copy. - virtual ACE_Token_Proxy *clone (void) const; - -protected: - /// Return a new ACE_Local_Mutex. - ACE_Tokens *create_token (const ACE_TCHAR *name); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_TOKENS_LIBRARY */ - -#if defined (__ACE_INLINE__) -#include "ace/Local_Tokens.inl" -#endif /* __ACE_INLINE__ */ -#include /**/ "ace/post.h" -#endif /* ACE_LOCAL_MUTEX_H */ diff --git a/dep/acelite/ace/Local_Tokens.inl b/dep/acelite/ace/Local_Tokens.inl deleted file mode 100644 index 0c599630ff4..00000000000 --- a/dep/acelite/ace/Local_Tokens.inl +++ /dev/null @@ -1,275 +0,0 @@ -// -*- C++ -*- -// -// $Id: Local_Tokens.inl 92069 2010-09-28 11:38:59Z johnnyw $ - -#if defined (ACE_HAS_TOKENS_LIBRARY) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// ************************************************************ - -ACE_INLINE int -ACE_Token_Proxy_Queue::size (void) -{ - ACE_TRACE ("ACE_Token_Proxy_Queue::size"); - return this->size_; -} - -// ************************************************************ - -ACE_INLINE int -ACE_TPQ_Entry::waiting (void) const -{ - ACE_TRACE ("ACE_TPQ_Entry::waiting"); - return waiting_; -} - -ACE_INLINE void -ACE_TPQ_Entry::waiting (int v) -{ - ACE_TRACE ("ACE_TPQ_Entry::waiting"); - waiting_ = v; -} - -ACE_INLINE const ACE_TCHAR * -ACE_TPQ_Entry::client_id (void) const -{ - ACE_TRACE ("ACE_TPQ_Entry::client_id"); - return this->client_id_; -} - -ACE_INLINE ACE_Token_Proxy * -ACE_TPQ_Entry::proxy (void) const -{ - ACE_TRACE ("ACE_TPQ_Entry::proxy"); - return this->proxy_; -} - -ACE_INLINE void -ACE_TPQ_Entry::proxy (ACE_Token_Proxy *proxy) -{ - ACE_TRACE ("ACE_TPQ_Entry::proxy"); - this->proxy_ = proxy; -} - -ACE_INLINE -ACE_TPQ_Iterator::~ACE_TPQ_Iterator (void) -{ -} - -ACE_INLINE -ACE_Token_Proxy_Queue::~ACE_Token_Proxy_Queue (void) -{ -} - -ACE_INLINE void -ACE_Tokens::remove (ACE_TPQ_Entry *caller) -{ - this->waiters_.remove (caller); -} - -ACE_INLINE int -ACE_Tokens::dec_reference (void) -{ - ACE_TRACE ("ACE_Tokens::dec_reference"); - if (this->reference_count_ == 0) - { - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("dec_reference already zero"))); - return 0; - } - - return --this->reference_count_; -} - -ACE_INLINE void -ACE_Tokens::inc_reference (void) -{ - ACE_TRACE ("ACE_Tokens::inc_reference"); - ++this->reference_count_; -} - -ACE_INLINE const ACE_TPQ_Entry * -ACE_Token_Proxy_Queue::head (void) -{ - ACE_TRACE ("ACE_Token_Proxy_Queue::head"); - if (this->head_ == 0) - return 0; - else - return this->head_; -} - -// ************************************************** -// ************************************************** -// ************************************************** - -ACE_INLINE void -ACE_Tokens::visit (int v) -{ - ACE_TRACE ("ACE_Tokens::visit"); - visited_ = v; -} - -ACE_INLINE int -ACE_Tokens::visited (void) -{ - ACE_TRACE ("ACE_Tokens::visited"); - return visited_; -} - -ACE_INLINE ACE_TPQ_Entry * -ACE_Tokens::owner (void) -{ - ACE_TRACE ("ACE_Tokens::owner"); - return (ACE_TPQ_Entry *) this->waiters_.head (); -} - -ACE_INLINE const ACE_TCHAR* -ACE_Tokens::owner_id () -{ - ACE_TRACE ("ACE_Tokens::owner_id"); - if (this->owner () == 0) - return ACE_TEXT ("no owner"); - else - return this->owner ()->client_id (); -} - -ACE_INLINE const ACE_TCHAR* -ACE_Tokens::name (void) -{ - ACE_TRACE ("ACE_Tokens::name"); - return this->token_name_; -} - -// ************************************************************ - -ACE_INLINE int -ACE_TPQ_Entry::nesting_level (void) const -{ - ACE_TRACE ("ACE_TPQ_Entry::nesting_level"); - return this->nesting_level_; -} - -ACE_INLINE void -ACE_TPQ_Entry::nesting_level (int delta) -{ - ACE_TRACE ("ACE_TPQ_Entry::nesting_level"); - this->nesting_level_ += delta; -} - -ACE_INLINE ACE_TPQ_Entry::PTVF -ACE_TPQ_Entry::sleep_hook (void) const -{ - ACE_TRACE ("ACE_TPQ_Entry::sleep_hook"); - return this->sleep_hook_; -} - -ACE_INLINE void -ACE_TPQ_Entry::sleep_hook (void (*sh)(void *)) -{ - ACE_TRACE ("ACE_TPQ_Entry::sleep_hook"); - this->sleep_hook_ = sh; -} - -ACE_INLINE void -ACE_TPQ_Entry::call_sleep_hook (void) -{ - ACE_TRACE ("ACE_TPQ_Entry::call_sleep_hook"); - - // if a function has been registered, call it. - if (this->sleep_hook () != 0) - this->sleep_hook () ((void *) this->proxy ()); - else - // otherwise, call back the sleep_hook method - this->proxy ()->sleep_hook (); -} - -ACE_INLINE int -ACE_TPQ_Entry::equal_client_id (const ACE_TCHAR *id) -{ - ACE_TRACE ("ACE_TPQ_Entry::equal_client_id"); - return (ACE_OS::strcmp (this->client_id (), id) == 0); -} - -// ************************************************************ -// ************************************************************ -// ************************************************************ - -ACE_INLINE -ACE_Local_Mutex::ACE_Local_Mutex (const ACE_TCHAR *token_name, - int ignore_deadlock, - int debug) -{ - ACE_TRACE ("ACE_Local_Mutex::ACE_Local_Mutex"); - this->open (token_name, ignore_deadlock, debug); -} - -ACE_INLINE void -ACE_Token_Name::name (const ACE_TCHAR *new_name) -{ - ACE_TRACE ("ACE_Token_Name::name"); - - if (new_name == 0) - new_name = ACE_TEXT ("no name"); - - size_t n = ACE_OS::strlen (new_name) + 1; - - if (n >= ACE_MAXTOKENNAMELEN) - n = ACE_MAXTOKENNAMELEN - 1; - - ACE_OS::strsncpy (this->token_name_, (ACE_TCHAR *) new_name, n); -} - -ACE_INLINE const ACE_TCHAR* -ACE_Token_Name::name (void) const -{ - ACE_TRACE ("ACE_Token_Name::name"); - return this->token_name_; -} - -// ************************************************************ - -ACE_INLINE -ACE_Local_RLock::ACE_Local_RLock (const ACE_TCHAR *token_name, - int ignore_deadlock, - int debug) -{ - ACE_TRACE ("ACE_Local_RLock::ACE_Local_RLock"); - this->open (token_name, ignore_deadlock, debug); -} - -// ************************************************************ - -ACE_INLINE -ACE_Local_WLock::ACE_Local_WLock (const ACE_TCHAR *token_name, - int ignore_deadlock, - int debug) -{ - ACE_TRACE ("ACE_Local_WLock::ACE_Local_WLock"); - this->open (token_name, ignore_deadlock, debug); -} - -// ************************************************************ - - -ACE_INLINE void -ACE_Token_Name::operator= (const ACE_Token_Name &rhs) -{ - ACE_TRACE ("ACE_Token_Name::operator="); - if (&rhs == this) - return; - else - this->name (rhs.name ()); -} - -ACE_INLINE bool -ACE_Token_Name::operator== (const ACE_Token_Name &rhs) const -{ - ACE_TRACE ("ACE_Token_Name::operator=="); - - // the name and type must be the same - return (ACE_OS::strcmp (this->token_name_, rhs.name ()) == 0); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/dep/acelite/ace/Lock.cpp b/dep/acelite/ace/Lock.cpp deleted file mode 100644 index 800cea220f9..00000000000 --- a/dep/acelite/ace/Lock.cpp +++ /dev/null @@ -1,88 +0,0 @@ -// $Id: Lock.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/Lock.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Lock.inl" -#endif /* __ACE_INLINE__ */ - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Lock::~ACE_Lock (void) -{ -} - -ACE_Adaptive_Lock::ACE_Adaptive_Lock (void) - : lock_ (0) -{ -} - -ACE_Adaptive_Lock::~ACE_Adaptive_Lock (void) -{ -} - -int -ACE_Adaptive_Lock::remove (void) -{ - return this->lock_->remove (); -} - -int -ACE_Adaptive_Lock::acquire (void) -{ - return this->lock_->acquire (); -} - -int -ACE_Adaptive_Lock::tryacquire (void) -{ - return this->lock_->tryacquire (); -} - -int -ACE_Adaptive_Lock::release (void) -{ - return this->lock_->release (); -} - -int -ACE_Adaptive_Lock::acquire_read (void) -{ - return this->lock_->acquire_read (); -} - -int -ACE_Adaptive_Lock::acquire_write (void) -{ - return this->lock_->acquire_write (); -} - -int -ACE_Adaptive_Lock::tryacquire_read (void) -{ - return this->lock_->tryacquire_read (); -} - -int -ACE_Adaptive_Lock::tryacquire_write (void) -{ - return this->lock_->tryacquire_write (); -} - -int -ACE_Adaptive_Lock::tryacquire_write_upgrade (void) -{ - return this->lock_->tryacquire_write_upgrade (); -} - -void -ACE_Adaptive_Lock::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - // return this->lock_->dump (); -#endif /* ACE_HAS_DUMP */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Lock.h b/dep/acelite/ace/Lock.h deleted file mode 100644 index cbf41306df3..00000000000 --- a/dep/acelite/ace/Lock.h +++ /dev/null @@ -1,161 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Lock.h - * - * $Id: Lock.h 93792 2011-04-07 11:48:50Z mcorino $ - * - * Moved from Synch.h. - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_LOCK_H -#define ACE_LOCK_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Lock - * - * @brief This is the abstract base class that contains the uniform - * locking API that is supported by all the ACE synchronization - * mechanisms. - * - * This class is typically used in conjunction with the - * ACE_Lock_Adapter in order to provide a polymorphic - * interface to the ACE synchronization mechanisms (e.g., - * ACE_Mutex, ACE_Semaphore, ACE_RW_Mutex, etc). Note that - * the reason that all of ACE doesn't use polymorphic locks is - * that (1) they add ~20% extra overhead for virtual function - * calls and (2) objects with virtual functions can't be placed - * into shared memory. - */ -class ACE_Export ACE_Lock -{ -public: - /// CE needs a default constructor here. - ACE_Lock (void); - - /// Noop virtual destructor - virtual ~ACE_Lock (void); - - /** - * Explicitly destroy the lock. Note that only one thread should - * call this method since it doesn't protect against race - * conditions. - */ - virtual int remove (void) = 0; - - /// Block the thread until the lock is acquired. Returns -1 on - /// failure. - virtual int acquire (void) = 0; - - /** - * Conditionally acquire the lock (i.e., won't block). Returns -1 - * on failure. If we "failed" because someone else already had the - * lock, @c errno is set to @c EBUSY. - */ - virtual int tryacquire (void) = 0; - - /// Release the lock. Returns -1 on failure. - virtual int release (void) = 0; - - /** - * Block until the thread acquires a read lock. If the locking - * mechanism doesn't support read locks then this just calls - * acquire(). Returns -1 on failure. - */ - virtual int acquire_read (void) = 0; - - /** - * Block until the thread acquires a write lock. If the locking - * mechanism doesn't support read locks then this just calls - * acquire(). Returns -1 on failure. - */ - virtual int acquire_write (void) = 0; - - /** - * Conditionally acquire a read lock. If the locking mechanism - * doesn't support read locks then this just calls acquire(). - * Returns -1 on failure. If we "failed" because someone else - * already had the lock, @c errno is set to @c EBUSY. - */ - virtual int tryacquire_read (void) = 0; - - /** - * Conditionally acquire a write lock. If the locking mechanism - * doesn't support read locks then this just calls acquire(). - * Returns -1 on failure. If we "failed" because someone else - * already had the lock, @c errno is set to @c EBUSY. - */ - virtual int tryacquire_write (void) = 0; - - /** - * Conditionally try to upgrade a lock held for read to a write lock. - * If the locking mechanism doesn't support read locks then this just - * calls acquire(). Returns 0 on success, -1 on failure. - */ - virtual int tryacquire_write_upgrade (void) = 0; -}; - -/** - * @class ACE_Adaptive_Lock - * - * @brief An adaptive general locking class that defers the decision of - * lock type to run time. - * - * This class, as ACE_Lock, provide a set of general locking APIs. - * However, it defers our decision of what kind of lock to use - * to the run time and delegates all locking operations to the actual - * lock. Users must define a constructor in their subclass to - * initialize @c lock_. - */ -class ACE_Export ACE_Adaptive_Lock : public ACE_Lock -{ -public: - /// You must also override the destructor function to match with how - /// you construct the underneath @c lock_. - virtual ~ACE_Adaptive_Lock (void); - - // = Lock/unlock operations. - - virtual int remove (void); - virtual int acquire (void); - virtual int tryacquire (void); - virtual int release (void); - virtual int acquire_read (void); - virtual int acquire_write (void); - virtual int tryacquire_read (void); - virtual int tryacquire_write (void); - virtual int tryacquire_write_upgrade (void); - void dump (void) const; - -protected: - /** - * Create and initialize create the actual lock used in the class. - * The default constructor simply set the @c lock_ to 0 (null). You - * must overwrite this method for this class to work. - */ - ACE_Adaptive_Lock (void); - - ACE_Lock *lock_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Lock.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_LOCK_H */ diff --git a/dep/acelite/ace/Lock.inl b/dep/acelite/ace/Lock.inl deleted file mode 100644 index 7e3ae68396a..00000000000 --- a/dep/acelite/ace/Lock.inl +++ /dev/null @@ -1,12 +0,0 @@ -// -*- C++ -*- -// -// $Id: Lock.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_Lock::ACE_Lock (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Lock_Adapter_T.cpp b/dep/acelite/ace/Lock_Adapter_T.cpp deleted file mode 100644 index abe6190866d..00000000000 --- a/dep/acelite/ace/Lock_Adapter_T.cpp +++ /dev/null @@ -1,106 +0,0 @@ -// $Id: Lock_Adapter_T.cpp 93359 2011-02-11 11:33:12Z mcorino $ - -#ifndef ACE_LOCK_ADAPTER_T_CPP -#define ACE_LOCK_ADAPTER_T_CPP - -#include "ace/Lock_Adapter_T.h" -#include "ace/OS_Memory.h" // for ACE_NEW - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if !defined (__ACE_INLINE__) -#include "ace/Lock_Adapter_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_Lock_Adapter::~ACE_Lock_Adapter (void) -{ - if (this->delete_lock_) - delete this->lock_; -} - -// Explicitly destroy the lock. -template int -ACE_Lock_Adapter::remove (void) -{ - return this->lock_->remove (); -} - -// Block the thread until the lock is acquired. -template int -ACE_Lock_Adapter::acquire (void) -{ - return this->lock_->acquire (); -} - -// Conditionally acquire the lock (i.e., won't block). - -template int -ACE_Lock_Adapter::tryacquire (void) -{ - return this->lock_->tryacquire (); -} - -// Release the lock. - -template int -ACE_Lock_Adapter::release (void) -{ - return this->lock_->release (); -} - -// Block until the thread acquires a read lock. If the locking -// mechanism doesn't support read locks then this just calls -// . - -template int -ACE_Lock_Adapter::acquire_read (void) -{ - return this->lock_->acquire_read (); -} - -// Block until the thread acquires a write lock. If the locking -// mechanism doesn't support read locks then this just calls -// . - -template int -ACE_Lock_Adapter::acquire_write (void) -{ - return this->lock_->acquire_write (); -} - -// Conditionally acquire a read lock. If the locking mechanism -// doesn't support read locks then this just calls . - -template int -ACE_Lock_Adapter::tryacquire_read (void) -{ - return this->lock_->tryacquire_read (); -} - -// Conditionally acquire a write lock. If the locking mechanism -// doesn't support write locks then this just calls . - -template int -ACE_Lock_Adapter::tryacquire_write (void) -{ - return this->lock_->tryacquire_write (); -} - -// Conditionally try to upgrade a lock held for read to a write lock. -// If the locking mechanism doesn't support read locks then this just -// calls . Returns 0 on success, -1 on failure. - -template int -ACE_Lock_Adapter::tryacquire_write_upgrade (void) -{ - return this->lock_->tryacquire_write_upgrade (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_LOCK_ADAPTER_T_CPP */ diff --git a/dep/acelite/ace/Lock_Adapter_T.h b/dep/acelite/ace/Lock_Adapter_T.h deleted file mode 100644 index 3785d7a2d39..00000000000 --- a/dep/acelite/ace/Lock_Adapter_T.h +++ /dev/null @@ -1,123 +0,0 @@ -// -*- C++ -*- - -//========================================================================== -/** - * @file Lock_Adapter_T.h - * - * $Id: Lock_Adapter_T.h 93359 2011-02-11 11:33:12Z mcorino $ - * - * Moved from Synch.h. - * - * @author Douglas C. Schmidt - */ -//========================================================================== - -#ifndef ACE_LOCK_ADAPTER_T_H -#define ACE_LOCK_ADAPTER_T_H -#include /**/ "ace/pre.h" - -#include "ace/Lock.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Lock_Adapter - * - * @brief This is an adapter that allows applications to transparently - * combine the ACE_Lock abstract base class (which contains - * pure virtual methods) with any of the other concrete ACE - * synchronization classes (e.g., ACE_Mutex, ACE_Semaphore, - * ACE_RW_Mutex, etc.). - * - * This class uses a form of the Adapter pattern. - */ -template -class ACE_Lock_Adapter : public ACE_Lock -{ -public: - typedef ACE_LOCKING_MECHANISM ACE_LOCK; - - // = Initialization/Finalization methods. - - /// Constructor. All locking requests will be forwarded to @a lock. - ACE_Lock_Adapter (ACE_LOCKING_MECHANISM &lock); - - /// Constructor. Since no lock is provided by the user, one will be - /// created internally. - ACE_Lock_Adapter (void); - - /// Destructor. If @c lock_ was not passed in by the user, it will be - /// deleted. - virtual ~ACE_Lock_Adapter (void); - - // = Lock accessors. - /// Block the thread until the lock is acquired. - virtual int acquire (void); - - /// Conditionally acquire the lock (i.e., won't block). - virtual int tryacquire (void); - - /// Release the lock. - virtual int release (void); - - /** - * Block until the thread acquires a read lock. If the locking - * mechanism doesn't support read locks then this just calls - * acquire(). - */ - virtual int acquire_read (void); - - /** - * Block until the thread acquires a write lock. If the locking - * mechanism doesn't support read locks then this just calls - * acquire(). - */ - virtual int acquire_write (void); - - /// Conditionally acquire a read lock. If the locking mechanism - /// doesn't support read locks then this just calls acquire(). - virtual int tryacquire_read (void); - - /// Conditionally acquire a write lock. If the locking mechanism - /// doesn't support read locks then this just calls acquire(). - virtual int tryacquire_write (void); - - /** - * Conditionally try to upgrade a lock held for read to a write lock. - * If the locking mechanism doesn't support read locks then this just - * calls acquire(). Returns 0 on success, -1 on failure. - */ - virtual int tryacquire_write_upgrade (void); - - /// Explicitly destroy the lock. - virtual int remove (void); - -private: - /// The concrete locking mechanism that all the methods delegate to. - ACE_LOCKING_MECHANISM *lock_; - - /// This flag keep track of whether we are responsible for deleting - /// the lock - bool delete_lock_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "ace/Lock_Adapter_T.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Lock_Adapter_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Lock_Adapter_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" -#endif /* ACE_LOCK_ADAPTER_T_H */ diff --git a/dep/acelite/ace/Lock_Adapter_T.inl b/dep/acelite/ace/Lock_Adapter_T.inl deleted file mode 100644 index 4ffaf6cb69b..00000000000 --- a/dep/acelite/ace/Lock_Adapter_T.inl +++ /dev/null @@ -1,28 +0,0 @@ -// -*- C++ -*- -// -// $Id: Lock_Adapter_T.inl 93385 2011-02-14 20:21:20Z mitza $ - -#include "ace/OS_Memory.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -template -ACE_INLINE -ACE_Lock_Adapter::ACE_Lock_Adapter ( - ACE_LOCKING_MECHANISM &lock) - : lock_ (&lock), - delete_lock_ (false) -{ -} - -template -ACE_INLINE -ACE_Lock_Adapter::ACE_Lock_Adapter (void) - : lock_ (0), - delete_lock_ (true) -{ - ACE_NEW (this->lock_, - ACE_LOCKING_MECHANISM); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Log_Msg.cpp b/dep/acelite/ace/Log_Msg.cpp deleted file mode 100644 index 676236b72ca..00000000000 --- a/dep/acelite/ace/Log_Msg.cpp +++ /dev/null @@ -1,2602 +0,0 @@ -// $Id: Log_Msg.cpp 95761 2012-05-15 18:23:04Z johnnyw $ - -// We need this to get the status of ACE_NTRACE... -#include "ace/config-all.h" - -// Turn off tracing for the duration of this file. -#if defined (ACE_NTRACE) -# undef ACE_NTRACE -#endif /* ACE_NTRACE */ -#define ACE_NTRACE 1 - -#include "ace/ACE.h" -#include "ace/Thread_Manager.h" -#include "ace/Guard_T.h" -#include "ace/OS_NS_stdio.h" -#include "ace/OS_NS_errno.h" -#include "ace/OS_NS_sys_time.h" -#include "ace/OS_NS_wchar.h" -#include "ace/OS_NS_signal.h" -#include "ace/os_include/os_typeinfo.h" - -#if !defined (ACE_MT_SAFE) || (ACE_MT_SAFE != 0) -# include "ace/Object_Manager_Base.h" -#endif /* ! ACE_MT_SAFE */ - -#if !defined (ACE_LACKS_IOSTREAM_TOTALLY) -// FUZZ: disable check_for_streams_include -# include "ace/streams.h" -#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ - -#if defined (ACE_HAS_TRACE) -# include "ace/Trace.h" -#endif /* ACE_HAS_TRACE */ - -#include "ace/Log_Msg.h" -#include "ace/Log_Msg_Callback.h" -#include "ace/Log_Msg_IPC.h" -#include "ace/Log_Msg_NT_Event_Log.h" -#include "ace/Log_Msg_UNIX_Syslog.h" -#include "ace/Log_Record.h" -#include "ace/Recursive_Thread_Mutex.h" -#include "ace/Stack_Trace.h" -#include "ace/Atomic_Op.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Log_Msg.inl" -#endif /* __ACE_INLINE__ */ - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_ALLOC_HOOK_DEFINE(ACE_Log_Msg) - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - bool ACE_Log_Msg::key_created_ = 0; -# if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || \ - defined (ACE_HAS_TSS_EMULATION) - -static ACE_thread_key_t the_log_msg_tss_key = 0; - -ACE_thread_key_t *log_msg_tss_key (void) -{ - return &the_log_msg_tss_key; -} - -# endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION */ -#else -static ACE_Cleanup_Adapter* log_msg_cleanup = 0; -class ACE_Msg_Log_Cleanup: public ACE_Cleanup_Adapter -{ -public: - virtual ~ACE_Msg_Log_Cleanup (void) { - if (this == log_msg_cleanup) - log_msg_cleanup = 0; - } -}; -#endif /* ACE_MT_SAFE */ - -#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) && !defined (ACE_HAS_PHARLAP) -# define ACE_LOG_MSG_SYSLOG_BACKEND ACE_Log_Msg_NT_Event_Log -#elif !defined (ACE_LACKS_UNIX_SYSLOG) && !defined (ACE_HAS_WINCE) -# define ACE_LOG_MSG_SYSLOG_BACKEND ACE_Log_Msg_UNIX_Syslog -#else -# define ACE_LOG_MSG_SYSLOG_BACKEND ACE_Log_Msg_IPC -#endif /* ! ACE_WIN32 */ - -// When doing ACE_OS::s[n]printf() calls in log(), we need to update -// the space remaining in the output buffer based on what's returned from -// the output function. If we could rely on more modern compilers, this -// would be in an unnamed namespace, but it's a macro instead. -// count is a size_t, len is an int and assumed to be non-negative. -#define ACE_UPDATE_COUNT(COUNT, LEN) \ - do { if (static_cast (LEN) > COUNT) COUNT = 0; \ - else COUNT -= static_cast (LEN); \ - } while (0) - -/// Instance count for Log_Msg - used to know when dynamically -/// allocated storage (program name and host name) can be safely -/// deleted. -int ACE_Log_Msg::instance_count_ = 0; - -/** - * @class ACE_Log_Msg_Manager - * - * @brief Synchronize output operations. - * - * Provides global point of contact for all ACE_Log_Msg instances - * in a process. - * - * For internal use by ACE, only! - */ -class ACE_Log_Msg_Manager -{ -public: - static ACE_Log_Msg_Backend *log_backend_; - static ACE_Log_Msg_Backend *custom_backend_; - - static u_long log_backend_flags_; - - static int init_backend (const u_long *flags = 0); - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - //FUZZ: disable check_for_lack_ACE_OS - static void close (void) ACE_GCC_DESTRUCTOR_ATTRIBUTE; - //FUZZ: enable check_for_lack_ACE_OS - - static ACE_Recursive_Thread_Mutex *get_lock (void); - -private: - static ACE_Recursive_Thread_Mutex *lock_; -#endif /* ! ACE_MT_SAFE */ -}; - -ACE_Log_Msg_Backend *ACE_Log_Msg_Manager::log_backend_ = 0; -ACE_Log_Msg_Backend *ACE_Log_Msg_Manager::custom_backend_ = 0; - -u_long ACE_Log_Msg_Manager::log_backend_flags_ = 0; - -int ACE_Log_Msg_Manager::init_backend (const u_long *flags) -{ - // If flags have been supplied, and they are different from the flags - // we had last time, then we may have to re-create the backend as a - // different type. - if (flags) - { - // Sanity check for custom backend. - if (ACE_BIT_ENABLED (*flags, ACE_Log_Msg::CUSTOM) && - ACE_Log_Msg_Manager::custom_backend_ == 0) - { - return -1; - } - - if ((ACE_BIT_ENABLED (*flags, ACE_Log_Msg::SYSLOG) - && ACE_BIT_DISABLED (ACE_Log_Msg_Manager::log_backend_flags_, ACE_Log_Msg::SYSLOG)) - || (ACE_BIT_DISABLED (*flags, ACE_Log_Msg::SYSLOG) - && ACE_BIT_ENABLED (ACE_Log_Msg_Manager::log_backend_flags_, ACE_Log_Msg::SYSLOG))) - { - delete ACE_Log_Msg_Manager::log_backend_; - ACE_Log_Msg_Manager::log_backend_ = 0; - } - - ACE_Log_Msg_Manager::log_backend_flags_ = *flags; - } - - if (ACE_Log_Msg_Manager::log_backend_ == 0) - { - ACE_NO_HEAP_CHECK; - -#if (defined (WIN32) || !defined (ACE_LACKS_UNIX_SYSLOG)) && !defined (ACE_HAS_WINCE) && !defined (ACE_HAS_PHARLAP) - // Allocate the ACE_Log_Msg_Backend instance. - if (ACE_BIT_ENABLED (ACE_Log_Msg_Manager::log_backend_flags_, ACE_Log_Msg::SYSLOG)) - ACE_NEW_RETURN (ACE_Log_Msg_Manager::log_backend_, - ACE_LOG_MSG_SYSLOG_BACKEND, - -1); - else -#endif /* defined (WIN32) && !defined (ACE_HAS_WINCE) && !defined (ACE_HAS_PHARLAP) */ - ACE_NEW_RETURN (ACE_Log_Msg_Manager::log_backend_, - ACE_Log_Msg_IPC, - -1); - } - - return 0; -} - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) -ACE_Recursive_Thread_Mutex *ACE_Log_Msg_Manager::lock_ = 0; - -ACE_Recursive_Thread_Mutex * -ACE_Log_Msg_Manager::get_lock (void) -{ - // This function is called by the first thread to create an ACE_Log_Msg - // instance. It makes the call while holding a mutex, so we don't have - // to grab another one here. - - if (ACE_Log_Msg_Manager::lock_ == 0) - { - ACE_NO_HEAP_CHECK; - - ACE_NEW_RETURN (ACE_Log_Msg_Manager::lock_, - ACE_Recursive_Thread_Mutex, - 0); - } - - if (init_backend () == -1) - return 0; - - return ACE_Log_Msg_Manager::lock_; -} - -void -ACE_Log_Msg_Manager::close (void) -{ -#if defined (ACE_HAS_STHREADS) && ! defined (ACE_HAS_TSS_EMULATION) && ! defined (ACE_HAS_EXCEPTIONS) - // Delete the (main thread's) Log_Msg instance. I think that this - // is only "necessary" if exception handling is not enabled. - // Without exception handling, main thread TSS destructors don't - // seem to be called. It's not really necessary anyways, because - // this one leak is harmless on Solaris. - delete ACE_Log_Msg::instance (); -#endif /* ACE_HAS_STHREADS && ! TSS_EMULATION && ! ACE_HAS_EXCEPTIONS */ - - // Ugly, ugly, but don't know a better way. - delete ACE_Log_Msg_Manager::lock_; - ACE_Log_Msg_Manager::lock_ = 0; - - delete ACE_Log_Msg_Manager::log_backend_; - ACE_Log_Msg_Manager::log_backend_ = 0; - - // we are never responsible for custom backend - ACE_Log_Msg_Manager::custom_backend_ = 0; -} - -# if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || \ - defined (ACE_HAS_TSS_EMULATION) -/* static */ -# if defined (ACE_HAS_THR_C_DEST) -# define LOCAL_EXTERN_PREFIX extern "C" -# else -# define LOCAL_EXTERN_PREFIX -# endif /* ACE_HAS_THR_C_DEST */ -LOCAL_EXTERN_PREFIX -void -ACE_TSS_CLEANUP_NAME (void *ptr) -{ - // Delegate to thr_desc if this not has terminated - ACE_Log_Msg* log_msg = (ACE_Log_Msg*) ptr; - if (log_msg->thr_desc()!=0) - log_msg->thr_desc()->log_msg_cleanup(log_msg); - else - delete log_msg; -} -# endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION */ -#endif /* ! ACE_MT_SAFE */ - -/* static */ -int -ACE_Log_Msg::exists (void) -{ -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) -# if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || \ - defined (ACE_HAS_TSS_EMULATION) - void *tss_log_msg = 0; // The actual type is ACE_Log_Msg*, but we need this - // void to keep G++ from complaining. - - // Get the tss_log_msg from thread-specific storage. - return ACE_Log_Msg::key_created_ - && ACE_Thread::getspecific (*(log_msg_tss_key ()), &tss_log_msg) != -1 - && tss_log_msg != 0; -# else -# error "Platform must support thread-specific storage if threads are used." -# endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION */ -#else /* ! ACE_MT_SAFE */ - return 1; -#endif /* ! ACE_MT_SAFE */ -} - -ACE_Log_Msg * -ACE_Log_Msg::instance (void) -{ -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) -# if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || \ - defined (ACE_HAS_TSS_EMULATION) - // TSS Singleton implementation. - - if (!ACE_Log_Msg::key_created_) - { - ACE_thread_mutex_t *lock = - reinterpret_cast ( - ACE_OS_Object_Manager::preallocated_object - [ACE_OS_Object_Manager::ACE_LOG_MSG_INSTANCE_LOCK]); - - if (1 == ACE_OS_Object_Manager::starting_up()) - //This function is called before ACE_OS_Object_Manager is - //initialized. So the lock might not be valid. Assume it's - //single threaded and so don't need the lock. - ; - else - ACE_OS::thread_mutex_lock (lock); - - if (!ACE_Log_Msg::key_created_) - { - // Allocate the Singleton lock. - ACE_Log_Msg_Manager::get_lock (); - - { - ACE_NO_HEAP_CHECK; - if (ACE_Thread::keycreate (log_msg_tss_key (), - &ACE_TSS_CLEANUP_NAME) != 0) - { - if (1 == ACE_OS_Object_Manager::starting_up()) - //This function is called before ACE_OS_Object_Manager is - //initialized. So the lock might not be valid. Assume it's - //single threaded and so don't need the lock. - ; - else - ACE_OS::thread_mutex_unlock (lock); - return 0; // Major problems, this should *never* happen! - } - } - - ACE_Log_Msg::key_created_ = true; - } - - if (1 == ACE_OS_Object_Manager::starting_up()) - //This function is called before ACE_OS_Object_Manager is - //initialized. So the lock might not be valid. Assume it's - //single threaded and so don't need the lock. - ; - else - ACE_OS::thread_mutex_unlock (lock); - } - - ACE_Log_Msg *tss_log_msg = 0; - void *temp = 0; - - // Get the tss_log_msg from thread-specific storage. - if (ACE_Thread::getspecific (*(log_msg_tss_key ()), &temp) == -1) - return 0; // This should not happen! - - tss_log_msg = static_cast (temp); - - // Check to see if this is the first time in for this thread. - if (tss_log_msg == 0) - { - // Allocate memory off the heap and store it in a pointer in - // thread-specific storage (on the stack...). Stop heap - // checking, the memory will always be freed by the thread - // rundown because of the TSS callback set up when the key was - // created. This prevents from getting these blocks reported as - // memory leaks. - { - ACE_NO_HEAP_CHECK; - - ACE_NEW_RETURN (tss_log_msg, - ACE_Log_Msg, - 0); - // Store the dynamically allocated pointer in thread-specific - // storage. It gets deleted via the ACE_TSS_cleanup function - // when the thread terminates. - - if (ACE_Thread::setspecific (*(log_msg_tss_key()), - reinterpret_cast (tss_log_msg)) - != 0) - return 0; // Major problems, this should *never* happen! - } - } - - return tss_log_msg; -# else -# error "Platform must support thread-specific storage if threads are used." -# endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION */ -#else /* ! ACE_MT_SAFE */ - // We don't have threads, we cannot call - // ACE_Log_Msg_Manager::get_lock () to initialize the logger - // callback, so instead we do it here. - if (ACE_Log_Msg_Manager::init_backend () == -1) - return 0; - - // Singleton implementation. - - if (log_msg_cleanup == 0) - { - ACE_NEW_RETURN (log_msg_cleanup, ACE_Msg_Log_Cleanup, 0); - // Register the instance for destruction at program termination. - ACE_Object_Manager::at_exit (log_msg_cleanup, - 0, - typeid (*log_msg_cleanup).name ()); - } - - return &log_msg_cleanup->object (); -#endif /* ! ACE_MT_SAFE */ -} - -// Not inlined to help prevent having to include OS.h just to -// get ACE_DEBUG, et al, macros. -int -ACE_Log_Msg::last_error_adapter (void) -{ - return ACE_OS::last_error (); -} - -// Sets the flag in the default priority mask used to initialize -// ACE_Log_Msg instances, as well as the current per-thread instance. - -void -ACE_Log_Msg::enable_debug_messages (ACE_Log_Priority priority) -{ - ACE_SET_BITS (ACE_Log_Msg::default_priority_mask_, priority); - ACE_Log_Msg *i = ACE_Log_Msg::instance (); - i->priority_mask (i->priority_mask () | priority); -} - -// Clears the flag in the default priority mask used to initialize -// ACE_Log_Msg instances, as well as the current per-thread instance. - -void -ACE_Log_Msg::disable_debug_messages (ACE_Log_Priority priority) -{ - ACE_CLR_BITS (ACE_Log_Msg::default_priority_mask_, priority); - ACE_Log_Msg *i = ACE_Log_Msg::instance (); - i->priority_mask (i->priority_mask () & ~priority); -} - -const ACE_TCHAR * -ACE_Log_Msg::program_name (void) -{ - return ACE_Log_Msg::program_name_; -} - -/// Name of the local host. -const ACE_TCHAR *ACE_Log_Msg::local_host_ = 0; - -/// Records the program name. -const ACE_TCHAR *ACE_Log_Msg::program_name_ = 0; - -/// Default is to use stderr. -u_long ACE_Log_Msg::flags_ = ACE_Log_Msg::STDERR; - -/// Process id of the current process. -pid_t ACE_Log_Msg::pid_ = -2; - -/// Current offset of msg_[]. -ptrdiff_t ACE_Log_Msg::msg_off_ = 0; - -/// Default per-thread priority mask -/// By default, no priorities are enabled. -u_long ACE_Log_Msg::default_priority_mask_ = 0; - -/// Default per-process priority mask -/// By default, all priorities are enabled. -u_long ACE_Log_Msg::process_priority_mask_ = LM_SHUTDOWN - | LM_TRACE - | LM_DEBUG - | LM_INFO - | LM_NOTICE - | LM_WARNING - | LM_STARTUP - | LM_ERROR - | LM_CRITICAL - | LM_ALERT - | LM_EMERGENCY; - -void -ACE_Log_Msg::close (void) -{ - // This call needs to go here to avoid memory leaks. - ACE_MT (ACE_Log_Msg_Manager::close ()); - - // Please note that this will be called by a statement that is - // harded coded into the ACE_Object_Manager's shutdown sequence, in - // its destructor. - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) && \ - (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || \ - defined (ACE_HAS_TSS_EMULATION)) - - if (ACE_Log_Msg::key_created_) - { - ACE_thread_mutex_t *lock = - reinterpret_cast - (ACE_OS_Object_Manager::preallocated_object - [ACE_OS_Object_Manager::ACE_LOG_MSG_INSTANCE_LOCK]); - ACE_OS::thread_mutex_lock (lock); - - if (ACE_Log_Msg::key_created_) - { - // Clean up this ACE_Log_Msg instance and reset the TSS to - // prevent any future cleanup attempts via TSS mechanisms at - // thread exit. Otherwise in the event of a dynamic library - // unload of libACE, by a program not linked with libACE, - // ACE_TSS_cleanup will be invoked after libACE has been unloaded. - // See Bugzilla 2980 for lots of details. - ACE_Log_Msg *tss_log_msg = 0; - void *temp = 0; - - // Get the tss_log_msg from thread-specific storage. - if (ACE_Thread::getspecific (*(log_msg_tss_key ()), &temp) != -1 - && temp) - { - tss_log_msg = static_cast (temp); - // we haven't been cleaned up - ACE_TSS_CLEANUP_NAME(tss_log_msg); - if (ACE_Thread::setspecific(*(log_msg_tss_key()), - reinterpret_cast (0)) != 0) - ACE_OS::printf ("ACE_Log_Msg::close failed to ACE_Thread::setspecific to 0\n"); - } - - // The key is not needed any longer; ACE_Log_Msg is closing - // and will need to be reopened if this process wishes to use - // logging again. So delete the key. - ACE_Thread::keyfree (*(log_msg_tss_key())); - ACE_Log_Msg::key_created_ = false; - } - - ACE_OS::thread_mutex_unlock (lock); - } -#endif /* (ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION) && ACE_MT_SAFE */ -} - -void -ACE_Log_Msg::sync_hook (const ACE_TCHAR *prg_name) -{ - ACE_LOG_MSG->sync (prg_name); -} - -ACE_OS_Thread_Descriptor * -ACE_Log_Msg::thr_desc_hook (void) -{ - return ACE_LOG_MSG->thr_desc (); -} - -// Call after a fork to resynchronize the PID and PROGRAM_NAME -// variables. -void -ACE_Log_Msg::sync (const ACE_TCHAR *prog_name) -{ - ACE_TRACE ("ACE_Log_Msg::sync"); - - if (prog_name) - { - // Must free if already allocated!!! - ACE_OS::free ((void *) ACE_Log_Msg::program_name_); - - // Stop heap checking, block will be freed by the destructor when - // the last ACE_Log_Msg instance is deleted. - // Heap checking state will be restored when the block is left. - { - ACE_NO_HEAP_CHECK; - - ACE_Log_Msg::program_name_ = ACE_OS::strdup (prog_name); - } - } - - ACE_Log_Msg::pid_ = ACE_OS::getpid (); - ACE_Log_Msg::msg_off_ = 0; -} - -u_long -ACE_Log_Msg::flags (void) -{ - ACE_TRACE ("ACE_Log_Msg::flags"); - u_long result; - ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, - *ACE_Log_Msg_Manager::get_lock (), 0)); - - result = ACE_Log_Msg::flags_; - return result; -} - -void -ACE_Log_Msg::set_flags (u_long flgs) -{ - ACE_TRACE ("ACE_Log_Msg::set_flags"); - ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, - *ACE_Log_Msg_Manager::get_lock ())); - - ACE_SET_BITS (ACE_Log_Msg::flags_, flgs); -} - -void -ACE_Log_Msg::clr_flags (u_long flgs) -{ - ACE_TRACE ("ACE_Log_Msg::clr_flags"); - ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, - *ACE_Log_Msg_Manager::get_lock ())); - - ACE_CLR_BITS (ACE_Log_Msg::flags_, flgs); -} - -int -ACE_Log_Msg::acquire (void) -{ - ACE_TRACE ("ACE_Log_Msg::acquire"); -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - return ACE_Log_Msg_Manager::get_lock ()->acquire (); -#else /* ! ACE_MT_SAFE */ - return 0; -#endif /* ! ACE_MT_SAFE */ -} - -u_long -ACE_Log_Msg::priority_mask (u_long n_mask, MASK_TYPE mask_type) -{ - u_long o_mask; - - if (mask_type == THREAD) - { - o_mask = this->priority_mask_; - this->priority_mask_ = n_mask; - } - else - { - o_mask = ACE_Log_Msg::process_priority_mask_; - ACE_Log_Msg::process_priority_mask_ = n_mask; - } - - return o_mask; -} - -int -ACE_Log_Msg::release (void) -{ - ACE_TRACE ("ACE_Log_Msg::release"); - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - return ACE_Log_Msg_Manager::get_lock ()->release (); -#else /* ! ACE_MT_SAFE */ - return 0; -#endif /* ! ACE_MT_SAFE */ -} - -ACE_Log_Msg::ACE_Log_Msg (void) - : status_ (0), - errnum_ (0), - linenum_ (0), - msg_ (0), - restart_ (1), // Restart by default... - ostream_ (0), - ostream_refcount_ (0), - msg_callback_ (0), - trace_depth_ (0), - trace_active_ (false), - tracing_enabled_ (true), // On by default? - thr_desc_ (0), - priority_mask_ (default_priority_mask_), - timestamp_ (0) -{ - // ACE_TRACE ("ACE_Log_Msg::ACE_Log_Msg"); - - ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, - *ACE_Log_Msg_Manager::get_lock ())); - ++instance_count_; - - if (this->instance_count_ == 1) - ACE_Base_Thread_Adapter::set_log_msg_hooks (ACE_Log_Msg::init_hook, - ACE_Log_Msg::inherit_hook, - ACE_Log_Msg::close, - ACE_Log_Msg::sync_hook, - ACE_Log_Msg::thr_desc_hook); - - this->conditional_values_.is_set_ = false; - - char *timestamp = ACE_OS::getenv ("ACE_LOG_TIMESTAMP"); - if (timestamp != 0) - { - // If variable is set or is set to date tag so we print date and time. - if (ACE_OS::strcmp (timestamp, "TIME") == 0) - { - this->timestamp_ = 1; - } - else if (ACE_OS::strcmp (timestamp, "DATE") == 0) - { - this->timestamp_ = 2; - } - } - - ACE_NEW_NORETURN (this->msg_, ACE_TCHAR[ACE_MAXLOGMSGLEN+1]); -} - -ACE_Log_Msg::~ACE_Log_Msg (void) -{ -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - - int instance_count = 0; - - // Only hold the guard while updating the instance_count_. - // If ACE_Log_Msg_Manager::close () is called, the lock will - // be deleted. - { - ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, - *ACE_Log_Msg_Manager::get_lock ())); - instance_count = --instance_count_; - } - // Release the guard. - -#else /* ! ACE_MT_SAFE */ - int instance_count = --instance_count_; -#endif /* ! ACE_MT_SAFE */ - - // If this is the last instance then cleanup. Only the last - // thread to destroy its ACE_Log_Msg instance should execute - // this block. - if (instance_count == 0) - { - // Destroy the message queue instance. - if (ACE_Log_Msg_Manager::log_backend_ != 0) - ACE_Log_Msg_Manager::log_backend_->close (); - - // Close down custom backend - if (ACE_Log_Msg_Manager::custom_backend_ != 0) - ACE_Log_Msg_Manager::custom_backend_->close (); - -# if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) -# if defined (ACE_HAS_TSS_EMULATION) - ACE_Log_Msg_Manager::close (); -# endif /* ACE_HAS_TSS_EMULATION */ -# endif /* ACE_MT_SAFE */ - - if (ACE_Log_Msg::program_name_) - { - ACE_OS::free ((void *) ACE_Log_Msg::program_name_); - ACE_Log_Msg::program_name_ = 0; - } - - if (ACE_Log_Msg::local_host_) - { - ACE_OS::free ((void *) ACE_Log_Msg::local_host_); - ACE_Log_Msg::local_host_ = 0; - } - } - - this->cleanup_ostream (); - - delete[] this->msg_; -} - -void -ACE_Log_Msg::cleanup_ostream () -{ - if (this->ostream_refcount_) - { - if (--*this->ostream_refcount_ == 0) - { - delete this->ostream_refcount_; -#if defined (ACE_LACKS_IOSTREAM_TOTALLY) - ACE_OS::fclose (this->ostream_); -#else - delete this->ostream_; - this->ostream_ = 0; -#endif - } - this->ostream_refcount_ = 0; - } -} - -// Open the sender-side of the message queue. - -int -ACE_Log_Msg::open (const ACE_TCHAR *prog_name, - u_long flags, - const ACE_TCHAR *logger_key) -{ - ACE_TRACE ("ACE_Log_Msg::open"); - ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, - *ACE_Log_Msg_Manager::get_lock (), -1)); - - if (prog_name) - { - ACE_OS::free ((void *) ACE_Log_Msg::program_name_); - - // Stop heap checking, block will be freed by the destructor. - { - ACE_NO_HEAP_CHECK; - - ACE_ALLOCATOR_RETURN (ACE_Log_Msg::program_name_, - ACE_OS::strdup (prog_name), - -1); - } - } - else if (ACE_Log_Msg::program_name_ == 0) - { - // Stop heap checking, block will be freed by the destructor. - ACE_NO_HEAP_CHECK; - ACE_ALLOCATOR_RETURN (ACE_Log_Msg::program_name_, - ACE_OS::strdup (ACE_TEXT ("")), - -1); - } - - int status = 0; - - // Be sure that there is a message_queue_, with multiple threads. - ACE_MT (ACE_Log_Msg_Manager::init_backend (&flags)); - - // Always close the current handle before doing anything else. - if (ACE_Log_Msg_Manager::log_backend_ != 0) - ACE_Log_Msg_Manager::log_backend_->reset (); - - if (ACE_Log_Msg_Manager::custom_backend_ != 0) - ACE_Log_Msg_Manager::custom_backend_->reset (); - - // Note that if we fail to open the message queue the default action - // is to use stderr (set via static initialization in the - // Log_Msg.cpp file). - - if (ACE_BIT_ENABLED (flags, ACE_Log_Msg::LOGGER) - || ACE_BIT_ENABLED (flags, ACE_Log_Msg::SYSLOG)) - { - // The SYSLOG backends (both NT and UNIX) can get along fine - // without the logger_key - they will default to prog_name if - // logger key is 0. - if (logger_key == 0 && ACE_BIT_ENABLED (flags, ACE_Log_Msg::LOGGER)) - status = -1; - else - status = ACE_Log_Msg_Manager::log_backend_->open (logger_key); - - if (status == -1) - ACE_SET_BITS (ACE_Log_Msg::flags_, ACE_Log_Msg::STDERR); - else - { - if (ACE_BIT_ENABLED (flags, ACE_Log_Msg::LOGGER)) - ACE_SET_BITS (ACE_Log_Msg::flags_, ACE_Log_Msg::LOGGER); - if (ACE_BIT_ENABLED (flags, ACE_Log_Msg::SYSLOG)) - ACE_SET_BITS (ACE_Log_Msg::flags_, ACE_Log_Msg::SYSLOG); - } - } - else if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::LOGGER) - || ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::SYSLOG)) - { - // If we are closing down logger, redirect logging to stderr. - ACE_CLR_BITS (ACE_Log_Msg::flags_, ACE_Log_Msg::LOGGER); - ACE_CLR_BITS (ACE_Log_Msg::flags_, ACE_Log_Msg::SYSLOG); - ACE_SET_BITS (ACE_Log_Msg::flags_, ACE_Log_Msg::STDERR); - } - - if (ACE_BIT_ENABLED (flags, ACE_Log_Msg::CUSTOM)) - { - status = - ACE_Log_Msg_Manager::custom_backend_->open (logger_key); - - if (status != -1) - ACE_SET_BITS (ACE_Log_Msg::flags_, ACE_Log_Msg::CUSTOM); - } - - // Remember, ACE_Log_Msg::STDERR bit is on by default... - if (status != -1 - && ACE_BIT_ENABLED (flags, - ACE_Log_Msg::STDERR) == 0) - ACE_CLR_BITS (ACE_Log_Msg::flags_, - ACE_Log_Msg::STDERR); - - // VERBOSE takes precedence over VERBOSE_LITE... - if (ACE_BIT_ENABLED (flags, - ACE_Log_Msg::VERBOSE_LITE)) - ACE_SET_BITS (ACE_Log_Msg::flags_, - ACE_Log_Msg::VERBOSE_LITE); - else if (ACE_BIT_ENABLED (flags, - ACE_Log_Msg::VERBOSE)) - ACE_SET_BITS (ACE_Log_Msg::flags_, - ACE_Log_Msg::VERBOSE); - - if (ACE_BIT_ENABLED (flags, - ACE_Log_Msg::OSTREAM)) - { - ACE_SET_BITS (ACE_Log_Msg::flags_, - ACE_Log_Msg::OSTREAM); - // Only set this to cerr if it hasn't already been set. - if (this->msg_ostream () == 0) - this->msg_ostream (ACE_DEFAULT_LOG_STREAM); - } - - if (ACE_BIT_ENABLED (flags, - ACE_Log_Msg::MSG_CALLBACK)) - ACE_SET_BITS (ACE_Log_Msg::flags_, - ACE_Log_Msg::MSG_CALLBACK); - - if (ACE_BIT_ENABLED (flags, - ACE_Log_Msg::SILENT)) - ACE_SET_BITS (ACE_Log_Msg::flags_, - ACE_Log_Msg::SILENT); - - return status; -} - -/** - * Valid Options (prefixed by '%', as in printf format strings) include: - * 'A': print an ACE_timer_t value - * 'a': exit the program at this point (var-argument is the exit status!) - * 'b': print a ssize_t value - * 'B': print a size_t value - * 'c': print a character - * 'C': print a character string - * 'i', 'd': print a decimal number - * 'I', indent according to nesting depth - * 'e', 'E', 'f', 'F', 'g', 'G': print a double - * 'l', print line number where an error occurred. - * 'M': print the name of the priority of the message. - * 'm': Return the message corresponding to errno value, e.g., as done by - * 'N': print file name where the error occurred. - * 'n': print the name of the program (or "" if not set) - * 'o': print as an octal number - * 'P': format the current process id - * 'p': format the appropriate errno message from sys_errlist, e.g., as done by - * 'Q': print out the uint64 number - * 'q': print out the int64 number - * '@': print a void* pointer (in hexadecimal) - * 'r': call the function pointed to by the corresponding argument - * 'R': print return status - * 'S': print out the appropriate signal message corresponding - * to var-argument, e.g., as done by strsignal() - * 's': format a character string - * 'T': print timestamp in hour:minute:sec:usec format. - * 'D': print timestamp in month/day/year hour:minute:sec:usec format. - * 't': print thread id (1 if single-threaded) - * 'u': print as unsigned int - * 'x': print as a hex number - * 'X': print as a hex number - * 'w': print a wide character - * 'W': print out a wide character string. - * 'z': print an ACE_OS::WChar character - * 'Z': print an ACE_OS::WChar character string - * ':': print a time_t value as an integral number - * '%': format a single percent sign, '%' - */ -ssize_t -ACE_Log_Msg::log (ACE_Log_Priority log_priority, - const ACE_TCHAR *format_str, ...) -{ - ACE_TRACE ("ACE_Log_Msg::log"); - - // Start of variable args section. - va_list argp; - - va_start (argp, format_str); - - ssize_t const result = this->log (format_str, - log_priority, - argp); - va_end (argp); - - return result; -} - -#if defined (ACE_HAS_WCHAR) -/** - * Since this is the ANTI_TCHAR version, we need to convert - * the format string over. - */ -ssize_t -ACE_Log_Msg::log (ACE_Log_Priority log_priority, - const ACE_ANTI_TCHAR *format_str, ...) -{ - ACE_TRACE ("ACE_Log_Msg::log"); - - // Start of variable args section. - va_list argp; - - va_start (argp, format_str); - - ssize_t const result = this->log (ACE_TEXT_ANTI_TO_TCHAR (format_str), - log_priority, - argp); - va_end (argp); - - return result; -} -#endif /* ACE_HAS_WCHAR */ - -ssize_t -ACE_Log_Msg::log (const ACE_TCHAR *format_str, - ACE_Log_Priority log_priority, - va_list argp) -{ - ACE_TRACE ("ACE_Log_Msg::log"); - // External decls. - - typedef void (*PTF)(...); - - // Check if there were any conditional values set. - bool const conditional_values = this->conditional_values_.is_set_; - - // Reset conditional values. - this->conditional_values_.is_set_ = false; - - // Only print the message if hasn't been reset to - // exclude this logging priority. - if (this->log_priority_enabled (log_priority) == 0) - return 0; - - // If conditional values were set and the log priority is correct, - // then the values are actually set. - if (conditional_values) - this->set (this->conditional_values_.file_, - this->conditional_values_.line_, - this->conditional_values_.op_status_, - this->conditional_values_.errnum_, - this->restart (), - this->msg_ostream (), - this->msg_callback ()); - - // Logging is supposed to be a benign activity (i.e., not interfer - // with normal application operations), so don't inadvertently smash - // errno! - ACE_Errno_Guard guard (errno); - - ACE_Log_Record log_record (log_priority, - ACE_OS::gettimeofday (), - this->getpid ()); - - // bp is pointer to where to put next part of logged message. - // bspace is the number of characters remaining in msg_. - ACE_TCHAR *bp = const_cast (this->msg ()); - size_t bspace = ACE_MAXLOGMSGLEN; // Leave room for Nul term. - if (this->msg_off_ <= ACE_Log_Record::MAXLOGMSGLEN) - bspace -= static_cast (this->msg_off_); - - // If this platform has snprintf() capability to prevent overrunning the - // output buffer, use it. To avoid adding a maintenance-hassle compile- - // time couple between here and OS.cpp, don't try to figure this out at - // compile time. Instead, do a quick check now; if we get a -1 return, - // the platform doesn't support the length-limiting capability. - ACE_TCHAR test[2]; - bool can_check = ACE_OS::snprintf (test, 1, ACE_TEXT ("x")) != -1; - - bool abort_prog = false; - int exit_value = 0; - - if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::VERBOSE)) - { - // Prepend the program name onto this message - - if (ACE_Log_Msg::program_name_ != 0) - { - for (const ACE_TCHAR *s = ACE_Log_Msg::program_name_; - bspace > 1 && (*bp = *s) != '\0'; - ++s, --bspace) - bp++; - - *bp++ = '|'; - --bspace; - } - } - - if (timestamp_ > 0) - { - ACE_TCHAR day_and_time[27]; - const ACE_TCHAR *s = 0; - if (timestamp_ == 1) - { - // Print just the time - s = ACE::timestamp (day_and_time, - sizeof (day_and_time) / sizeof (ACE_TCHAR), - true); - } - else - { - // Print time and date - ACE::timestamp (day_and_time, - sizeof (day_and_time) / sizeof (ACE_TCHAR)); - s = day_and_time; - } - - for (; bspace > 1 && (*bp = *s) != '\0'; ++s, --bspace) - ++bp; - - *bp++ = '|'; - --bspace; - } - - while (*format_str != '\0' && bspace > 0) - { - // Copy input to output until we encounter a %, however a - // % followed by another % is not a format specification. - - if (*format_str != '%') - { - *bp++ = *format_str++; - --bspace; - } - else if (format_str[1] == '%') // An "escaped" '%' (just print one '%'). - { - *bp++ = *format_str++; // Store first % - ++format_str; // but skip second % - --bspace; - } - else - { - // This is most likely a format specification that ends with - // one of the valid options described previously. To enable full - // use of all sprintf capabilities, save the format specifier - // from the '%' up to the format letter in a new char array. - // This allows the full sprintf capability for padding, field - // widths, alignment, etc. Any width/precision requiring a - // caller-supplied argument is extracted and placed as text - // into the format array. Lastly, we convert the caller-supplied - // format specifier from the ACE_Log_Msg-supported list to the - // equivalent sprintf specifier, and run the new format spec - // through sprintf, adding it to the bp string. - - const ACE_TCHAR *abort_str = ACE_TEXT ("Aborting..."); - const ACE_TCHAR *start_format = format_str; - ACE_TCHAR format[128]; // Converted format string - ACE_OS::memset (format, '\0', 128); // Set this string to known values. - ACE_TCHAR *fp = 0; // Current format pointer - int wp = 0; // Width/precision extracted from args - bool done = false; - bool skip_nul_locate = false; - int this_len = 0; // How many chars s[n]printf wrote - - fp = format; - *fp++ = *format_str++; // Copy in the % - - // Initialization to satisfy VC6 - int tmp_indent = 0; - // Work through the format string to copy in the format - // from the caller. While it's going across, extract ints - // for '*' width/precision values from the argument list. - // When the real format specifier is located, change it to - // one recognized by sprintf, if needed, and do the sprintf - // call. - - while (!done) - { - done = true; // Unless a conversion spec changes it - - switch (*format_str) - { - // The initial set of cases are the conversion - // specifiers. Copy them in to the format array. - // Note we don't use 'l', a normal conversion spec, - // as a conversion because it is a ACE_Log_Msg format - // specifier. - case '-': - case '+': - case '0': - case ' ': - case '#': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case '.': - case 'L': - case 'h': - *fp++ = *format_str; - done = false; - break; - - case '*': - wp = va_arg (argp, int); - ACE_OS::sprintf (fp, ACE_TEXT ("%d"), wp); - fp += ACE_OS::strlen (fp); - done = false; - break; - - case 'A': // ACE_timer_t - { - ACE_OS::strcpy (fp, ACE_TEXT ("f")); - double const value = va_arg (argp, double); - if (can_check) - this_len = ACE_OS::snprintf (bp, bspace, format, value); - else - this_len = ACE_OS::sprintf (bp, format, value); - ACE_UPDATE_COUNT (bspace, this_len); - } - break; - - case 'a': // Abort program after handling all of format string. - abort_prog = true; - exit_value = va_arg (argp, int); - ACE_OS::strsncpy (bp, abort_str, bspace); - if (bspace > ACE_OS::strlen (abort_str)) - bspace -= ACE_OS::strlen (abort_str); - else - bspace = 0; - break; - - case 'l': // Source file line number - ACE_OS::strcpy (fp, ACE_TEXT ("d")); - if (can_check) - this_len = ACE_OS::snprintf (bp, - bspace, - format, - this->linenum ()); - else - this_len = ACE_OS::sprintf (bp, format, this->linenum ()); - ACE_UPDATE_COUNT (bspace, this_len); - break; - - case 'N': // Source file name -#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - ACE_OS::strcpy (fp, ACE_TEXT ("ls")); -#else - ACE_OS::strcpy (fp, ACE_TEXT ("s")); -#endif - if (can_check) - this_len = ACE_OS::snprintf (bp, bspace, format, - this->file () ? - ACE_TEXT_CHAR_TO_TCHAR (this->file ()) - : ACE_TEXT ("")); - else - this_len = ACE_OS::sprintf (bp, format, - this->file () ? - ACE_TEXT_CHAR_TO_TCHAR (this->file ()) - : ACE_TEXT ("")); - ACE_UPDATE_COUNT (bspace, this_len); - break; - - case 'n': // Program name -#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - ACE_OS::strcpy (fp, ACE_TEXT ("ls")); -#else /* ACE_WIN32 && ACE_USES_WCHAR */ - ACE_OS::strcpy (fp, ACE_TEXT ("s")); -#endif - if (can_check) - this_len = ACE_OS::snprintf (bp, bspace, format, - ACE_Log_Msg::program_name_ ? - ACE_Log_Msg::program_name_ : - ACE_TEXT ("")); - else - this_len = ACE_OS::sprintf (bp, format, - ACE_Log_Msg::program_name_ ? - ACE_Log_Msg::program_name_ : - ACE_TEXT ("")); - ACE_UPDATE_COUNT (bspace, this_len); - break; - - case 'P': // Process ID -#if defined (ACE_OPENVMS) - // Print the process id in hex on OpenVMS. - ACE_OS::strcpy (fp, ACE_TEXT ("x")); -#else - ACE_OS::strcpy (fp, ACE_TEXT ("d")); -#endif - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, - static_cast (this->getpid ())); - else - this_len = ACE_OS::sprintf - (bp, format, static_cast (this->getpid ())); - ACE_UPDATE_COUNT (bspace, this_len); - break; - - case 'p': // string, ala perror() - { - errno = 0; - char *msg = ACE_OS::strerror (ACE::map_errno (this->errnum ())); - // Windows can try to translate the errnum using - // system calls if strerror() doesn't get anything useful. -#if defined (ACE_WIN32) - if (errno == 0) - { -#endif - -#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - ACE_OS::strcpy (fp, ACE_TEXT ("ls: %ls")); - wchar_t *str = va_arg (argp, wchar_t *); -#else - ACE_OS::strcpy (fp, ACE_TEXT ("s: %s")); - ACE_TCHAR *str = va_arg (argp, ACE_TCHAR *); -#endif - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, - str ? str : ACE_TEXT ("(null)"), - ACE_TEXT_CHAR_TO_TCHAR (msg)); - else - this_len = ACE_OS::sprintf - (bp, format, - str ? str : ACE_TEXT ("(null)"), - ACE_TEXT_CHAR_TO_TCHAR (msg)); -#if defined (ACE_WIN32) - } - else - { - errno = ACE::map_errno (this->errnum ()); - ACE_TCHAR *lpMsgBuf = 0; - - // PharLap can't do FormatMessage, so try for socket - // error. -# if !defined (ACE_HAS_PHARLAP) - ACE_TEXT_FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER - | FORMAT_MESSAGE_MAX_WIDTH_MASK - | FORMAT_MESSAGE_FROM_SYSTEM, - 0, - errno, - MAKELANGID (LANG_NEUTRAL, - SUBLANG_DEFAULT), - // Default language - (ACE_TCHAR *) &lpMsgBuf, - 0, - 0); -# endif /* ACE_HAS_PHARLAP */ - - // If we don't get a valid response from - // , we'll assume this is a - // WinSock error and so we'll try to convert - // it into a string. If this doesn't work it - // returns "unknown error" which is fine for - // our purposes. - ACE_TCHAR *str = va_arg (argp, ACE_TCHAR *); - if (lpMsgBuf == 0) - { - const ACE_TCHAR *message = - ACE::sock_error (errno); - ACE_OS::strcpy (fp, ACE_TEXT ("s: %s")); - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, - str ? str : ACE_TEXT ("(null)"), - message); - else - this_len = ACE_OS::sprintf - (bp, format, - str ? str : ACE_TEXT ("(null)"), - message); - } - else - { - ACE_OS::strcpy (fp, ACE_TEXT ("s: %s")); - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, - str ? str : ACE_TEXT ("(null)"), - lpMsgBuf); - else - this_len = ACE_OS::sprintf - (bp, format, - str ? str : ACE_TEXT ("(null)"), - lpMsgBuf); - // Free the buffer. - ::LocalFree (lpMsgBuf); - } - } -#endif /* ACE_WIN32 */ - ACE_UPDATE_COUNT (bspace, this_len); - break; - } - - case 'M': // Print the name of the priority of the message. - - // Look at the format precision specifier. .1 is interpreted - // as a single character printout, otherwise we print the name of - // the priority. - - // So, did we find a .1 specifier? Do we need to override it? - if (format[1] == ACE_TEXT('.') && - format[2] == ACE_TEXT('1')) - { - // Yup. - // Print a single character signifying the severity of the message - fp = format; - fp++; - -# if defined (ACE_USES_WCHAR) - -# if defined (ACE_WIN32) // Windows uses 'c' for a wide character - ACE_OS::strcpy (fp, ACE_TEXT ("c")); -# else // Other platforms behave differently -# if defined (HPUX) // HP-Unix compatible - ACE_OS::strcpy (fp, ACE_TEXT ("C")); -# else // Other - ACE_OS::strcpy (fp, ACE_TEXT ("lc")); -# endif /* HPUX */ -# endif - -# else /* ACE_USES_WCHAR */ - - // Non-unicode builds simply use a standard character format specifier - ACE_OS::strcpy (fp, ACE_TEXT ("c")); - -# endif /* ACE_USES_WCHAR */ - - // Below is an optimized (binary search based) - // version of the following simple piece of code: - // - // log_priority == LM_SHUTDOWN ? 'S' : // Shutdown - // log_priority == LM_TRACE ? 'T' : // Trace - // log_priority == LM_DEBUG ? 'D' : // Debug - // log_priority == LM_INFO ? 'I' : // Info - // log_priority == LM_NOTICE ? 'N' : // Notice - // log_priority == LM_WARNING ? 'W' : // Warning - // log_priority == LM_STARTUP ? 'U' : // Startup - // log_priority == LM_ERROR ? 'E' : // Error - // log_priority == LM_CRITICAL ? 'C' : // Critical - // log_priority == LM_ALERT ? 'A' : // Alert - // log_priority == LM_EMERGENCY ? '!' : // Emergency - // '?' // Unknown - - if (can_check) - { - this_len = ACE_OS::snprintf - (bp, bspace, format, -#if !defined (ACE_USES_WCHAR) || defined (ACE_WIN32) - (int) -#else - (wint_t) -#endif - (log_priority <= LM_WARNING) ? - (log_priority <= LM_DEBUG) ? - (log_priority <= LM_TRACE) ? - (log_priority == LM_SHUTDOWN) ? - ACE_TEXT('S') : ACE_TEXT('T') : ACE_TEXT('D') : - (log_priority <= LM_NOTICE) ? - (log_priority == LM_INFO) ? - ACE_TEXT('I') : ACE_TEXT('N') : ACE_TEXT('W') : - (log_priority <= LM_CRITICAL) ? - (log_priority <= LM_ERROR) ? - (log_priority == LM_STARTUP) ? - ACE_TEXT('U') : ACE_TEXT('E') : ACE_TEXT('C') : - (log_priority <= LM_EMERGENCY) ? - (log_priority == LM_ALERT) ? - ACE_TEXT('A') : ACE_TEXT('!') : ACE_TEXT('?')); - } - else - { - this_len = ACE_OS::sprintf - (bp, format, -#if !defined (ACE_USES_WCHAR) || defined (ACE_WIN32) - (int) -#else - (wint_t) -#endif - (log_priority <= LM_WARNING) ? - (log_priority <= LM_DEBUG) ? - (log_priority <= LM_TRACE) ? - (log_priority == LM_SHUTDOWN) ? - ACE_TEXT('S') : ACE_TEXT('T') : ACE_TEXT('D') : - (log_priority <= LM_NOTICE) ? - (log_priority == LM_INFO) ? - ACE_TEXT('I') : ACE_TEXT('N') : ACE_TEXT('W') : - (log_priority <= LM_CRITICAL) ? - (log_priority <= LM_ERROR) ? - (log_priority == LM_STARTUP) ? - ACE_TEXT('U') : ACE_TEXT('E') : ACE_TEXT('C') : - (log_priority <= LM_EMERGENCY) ? - (log_priority == LM_ALERT) ? - ACE_TEXT('A') : ACE_TEXT('!') : ACE_TEXT('?')); - } - - ACE_UPDATE_COUNT (bspace, this_len); - } - else - { - // Nope, print out standard priority_name() string - -#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - ACE_OS::strcpy (fp, ACE_TEXT ("ls")); -#else - ACE_OS::strcpy (fp, ACE_TEXT ("s")); -#endif - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, - ACE_Log_Record::priority_name (log_priority)); - else - this_len = ACE_OS::sprintf - (bp, format, - ACE_Log_Record::priority_name (log_priority)); - ACE_UPDATE_COUNT (bspace, this_len); - } - break; - - case 'm': // Format the string assocated with the errno value. - { - errno = 0; - char *msg = ACE_OS::strerror (ACE::map_errno (this->errnum ())); - // Windows can try to translate the errnum using - // system calls if strerror() doesn't get anything useful. -#if defined (ACE_WIN32) - if (errno == 0) - { -#endif - -#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - ACE_OS::strcpy (fp, ACE_TEXT ("ls")); -#else /* ACE_WIN32 && ACE_USES_WCHAR */ - ACE_OS::strcpy (fp, ACE_TEXT ("s")); -#endif - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, ACE_TEXT_CHAR_TO_TCHAR (msg)); - else - this_len = ACE_OS::sprintf - (bp, format, ACE_TEXT_CHAR_TO_TCHAR (msg)); -#if defined (ACE_WIN32) - } - else - { - errno = ACE::map_errno (this->errnum ()); - ACE_TCHAR *lpMsgBuf = 0; - - // PharLap can't do FormatMessage, so try for socket - // error. -# if !defined (ACE_HAS_PHARLAP) - ACE_TEXT_FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER - | FORMAT_MESSAGE_MAX_WIDTH_MASK - | FORMAT_MESSAGE_FROM_SYSTEM, - 0, - errno, - MAKELANGID (LANG_NEUTRAL, - SUBLANG_DEFAULT), - // Default language - (ACE_TCHAR *) &lpMsgBuf, - 0, - 0); -# endif /* ACE_HAS_PHARLAP */ - - // If we don't get a valid response from - // , we'll assume this is a - // WinSock error and so we'll try to convert - // it into a string. If this doesn't work it - // returns "unknown error" which is fine for - // our purposes. - if (lpMsgBuf == 0) - { - const ACE_TCHAR *message = - ACE::sock_error (errno); - ACE_OS::strcpy (fp, ACE_TEXT ("s")); - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, message); - else - this_len = ACE_OS::sprintf (bp, format, message); - } - else - { - ACE_OS::strcpy (fp, ACE_TEXT ("s")); - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, lpMsgBuf); - else - this_len = ACE_OS::sprintf - (bp, format, lpMsgBuf); - // Free the buffer. - ::LocalFree (lpMsgBuf); - } - } -#endif /* ACE_WIN32 */ - ACE_UPDATE_COUNT (bspace, this_len); - break; - } - - case 'R': // Format the return status of the operation. - this->op_status (va_arg (argp, int)); - ACE_OS::strcpy (fp, ACE_TEXT ("d")); - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, this->op_status ()); - else - this_len = ACE_OS::sprintf - (bp, format, this->op_status ()); - ACE_UPDATE_COUNT (bspace, this_len); - break; - - case '{': // Increment the trace_depth, then indent - skip_nul_locate = true; - (void) this->inc (); - break; - - case '}': // indent, then decrement trace_depth - skip_nul_locate = true; - (void) this->dec (); - break; - - case '$': // insert a newline, then indent the next line - // according to %I - *bp++ = '\n'; - --bspace; - /* fallthrough */ - - case 'I': // Indent with nesting_depth*width spaces - // Caller can do %*I to override nesting indent, and - // if %*I was done, wp has the extracted width. -#if defined (ACE_HAS_TRACE) - if (0 == wp) - wp = ACE_Trace::get_nesting_indent (); -#else - if (0 == wp) - wp = 4; -#endif /* ACE_HAS_TRACE */ - wp *= this->trace_depth_; - if (static_cast (wp) > bspace) - wp = static_cast (bspace); - for (tmp_indent = wp; - tmp_indent; - --tmp_indent) - *bp++ = ' '; - - *bp = '\0'; - bspace -= static_cast (wp); - skip_nul_locate = true; - break; - - case 'r': // Run (invoke) this subroutine. - { - ptrdiff_t const osave = ACE_Log_Msg::msg_off_; - - if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, - ACE_Log_Msg::SILENT) && - bspace > 1) - { - *bp++ = '{'; - --bspace; - } - ACE_Log_Msg::msg_off_ = bp - this->msg_; - - (*va_arg (argp, PTF))(); - - if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, - ACE_Log_Msg::SILENT) && - bspace > (1 + ACE_OS::strlen (bp))) - { - bspace -= (ACE_OS::strlen (bp) + 1); - bp += ACE_OS::strlen (bp); - *bp++ = '}'; - } - *bp = '\0'; - skip_nul_locate = true; - ACE_Log_Msg::msg_off_ = osave; - break; - } - - case 'S': // format the string for with this signal number. - { - const int sig = va_arg (argp, int); - ACE_OS::strcpy (fp, ACE_TEXT ("s")); - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, ACE_OS::strsignal(sig)); - else - this_len = ACE_OS::sprintf - (bp, format, ACE_OS::strsignal(sig)); - ACE_UPDATE_COUNT (bspace, this_len); - break; - } - - case 'D': // Format the timestamp in format: - // yyyy-mm-dd hour:minute:sec.usec - // This is a maximum of 27 characters - // including terminator. - { - ACE_TCHAR day_and_time[27]; - // Did we find the flag indicating a time value argument - if (format[1] == ACE_TEXT('#')) - { - ACE_Time_Value* time_value = va_arg (argp, ACE_Time_Value*); - ACE::timestamp (*time_value, - day_and_time, - sizeof (day_and_time) / sizeof (ACE_TCHAR)); - } - else - { - ACE::timestamp (day_and_time, - sizeof (day_and_time) / sizeof (ACE_TCHAR)); - } -#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - ACE_OS::strcpy (fp, ACE_TEXT ("ls")); -#else - ACE_OS::strcpy (fp, ACE_TEXT ("s")); -#endif - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, day_and_time); - else - this_len = ACE_OS::sprintf (bp, format, day_and_time); - ACE_UPDATE_COUNT (bspace, this_len); - break; - } - - case 'T': // Format the timestamp in - // hour:minute:sec.usec format. - { - ACE_TCHAR day_and_time[27]; -#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - ACE_OS::strcpy (fp, ACE_TEXT ("ls")); -#else - ACE_OS::strcpy (fp, ACE_TEXT ("s")); -#endif - // Did we find the flag indicating a time value argument - if (format[1] == ACE_TEXT('#')) - { - ACE_Time_Value* time_value = va_arg (argp, ACE_Time_Value*); - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, - ACE::timestamp (*time_value, - day_and_time, - sizeof day_and_time / sizeof (ACE_TCHAR))); - else - this_len = ACE_OS::sprintf - (bp, format, ACE::timestamp (*time_value, - day_and_time, - sizeof day_and_time / sizeof (ACE_TCHAR))); - } - else - { - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, - ACE::timestamp (day_and_time, sizeof day_and_time / sizeof (ACE_TCHAR))); - else - this_len = ACE_OS::sprintf - (bp, format, ACE::timestamp (day_and_time, - sizeof day_and_time / sizeof (ACE_TCHAR))); - } - ACE_UPDATE_COUNT (bspace, this_len); - break; - } - - case 't': // Format thread id. -#if defined (ACE_WIN32) - ACE_OS::strcpy (fp, ACE_TEXT ("u")); - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, - static_cast (ACE_Thread::self ())); - else - this_len = - ACE_OS::sprintf (bp, - format, - static_cast (ACE_Thread::self ())); -#else - ACE_hthread_t t_id; - ACE_OS::thr_self (t_id); - - // Yes, this is an ugly C-style cast, but the correct - // C++ cast is different depending on whether the t_id - // is an integral type or a pointer type. FreeBSD uses - // a pointer type, but doesn't have a _np function to - // get an integral type, like the OSes above. - ACE_OS::strcpy (fp, ACE_TEXT ("lu")); - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, (unsigned long)t_id); - else - this_len = ACE_OS::sprintf - (bp, format, (unsigned long)t_id); - -#endif /* ACE_WIN32 */ - ACE_UPDATE_COUNT (bspace, this_len); - break; - - case 's': // String - { -#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - wchar_t *str = va_arg (argp, wchar_t *); - ACE_OS::strcpy (fp, ACE_TEXT ("ls")); -#else /* ACE_WIN32 && ACE_USES_WCHAR */ - ACE_TCHAR *str = va_arg (argp, ACE_TCHAR *); - ACE_OS::strcpy (fp, ACE_TEXT ("s")); -#endif /* ACE_WIN32 && ACE_USES_WCHAR */ - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, str ? str : ACE_TEXT ("(null)")); - else - this_len = ACE_OS::sprintf - (bp, format, str ? str : ACE_TEXT ("(null)")); - ACE_UPDATE_COUNT (bspace, this_len); - } - break; - - case 'C': // Narrow-char string - { - char *cstr = va_arg (argp, char *); -#if defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - ACE_OS::strcpy (fp, ACE_TEXT ("S")); -#else /* ACE_WIN32 && ACE_USES_WCHAR */ - ACE_OS::strcpy (fp, ACE_TEXT ("s")); -#endif /* ACE_WIN32 && ACE_USES_WCHAR */ - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, cstr ? cstr : "(null)"); - else - this_len = ACE_OS::sprintf - (bp, format, cstr ? cstr : "(null)"); - ACE_UPDATE_COUNT (bspace, this_len); - } - break; - - case 'W': - { -#if defined (ACE_HAS_WCHAR) - wchar_t *wchar_str = va_arg (argp, wchar_t *); -# if defined (HPUX) - ACE_OS::strcpy (fp, ACE_TEXT ("S")); -# elif defined (ACE_WIN32) -# if defined (ACE_USES_WCHAR) - ACE_OS::strcpy (fp, ACE_TEXT ("s")); -# else /* ACE_USES_WCHAR */ - ACE_OS::strcpy (fp, ACE_TEXT ("S")); -# endif /* ACE_USES_WCHAR */ -# else - ACE_OS::strcpy (fp, ACE_TEXT ("ls")); -# endif /* HPUX */ - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, wchar_str ? wchar_str : ACE_TEXT_WIDE("(null)")); - else - this_len = ACE_OS::sprintf - (bp, format, wchar_str ? wchar_str : ACE_TEXT_WIDE("(null)")); -#endif /* ACE_HAS_WCHAR */ - ACE_UPDATE_COUNT (bspace, this_len); - } - break; - - case 'w': // Wide character -#if defined (ACE_WIN32) -# if defined (ACE_USES_WCHAR) - ACE_OS::strcpy (fp, ACE_TEXT ("c")); -# else /* ACE_USES_WCHAR */ - ACE_OS::strcpy (fp, ACE_TEXT ("C")); -# endif /* ACE_USES_WCHAR */ - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, va_arg (argp, int)); - else - this_len = ACE_OS::sprintf - (bp, format, va_arg (argp, int)); -#elif defined (ACE_USES_WCHAR) -# if defined (HPUX) - ACE_OS::strcpy (fp, ACE_TEXT ("C")); -# else - ACE_OS::strcpy (fp, ACE_TEXT ("lc")); -# endif /* HPUX */ - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, va_arg (argp, wint_t)); - else - this_len = ACE_OS::sprintf - (bp, format, va_arg (argp, wint_t)); -#else /* ACE_WIN32 */ - ACE_OS::strcpy (fp, ACE_TEXT ("u")); - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, va_arg (argp, int)); - else - this_len = ACE_OS::sprintf - (bp, format, va_arg (argp, int)); -#endif /* ACE_WIN32 */ - ACE_UPDATE_COUNT (bspace, this_len); - break; - - case 'z': // ACE_OS::WChar character - { - // On some platforms sizeof (wchar_t) can be 2 - // on the others 4 ... - wchar_t wtchar = - static_cast (va_arg (argp, int)); -#if defined (ACE_WIN32) -# if defined (ACE_USES_WCHAR) - ACE_OS::strcpy (fp, ACE_TEXT ("c")); -# else /* ACE_USES_WCHAR */ - ACE_OS::strcpy (fp, ACE_TEXT ("C")); -# endif /* ACE_USES_WCHAR */ -#elif defined (ACE_USES_WCHAR) -# if defined (HPUX) - ACE_OS::strcpy (fp, ACE_TEXT ("C")); -# else - ACE_OS::strcpy (fp, ACE_TEXT ("lc")); -# endif /* HPUX */ -#else /* ACE_WIN32 */ - ACE_OS::strcpy (fp, ACE_TEXT ("u")); -#endif /* ACE_WIN32 */ - if (can_check) - this_len = ACE_OS::snprintf (bp, bspace, format, wtchar); - else - this_len = ACE_OS::sprintf (bp, format, wtchar); - ACE_UPDATE_COUNT (bspace, this_len); - break; - } - - case 'Z': // ACE_OS::WChar character string - { - ACE_OS::WChar *wchar_str = va_arg (argp, ACE_OS::WChar*); - if (wchar_str == 0) - break; - - wchar_t *wchar_t_str = 0; - if (sizeof (ACE_OS::WChar) != sizeof (wchar_t)) - { - size_t len = ACE_OS::wslen (wchar_str) + 1; - ACE_NEW_NORETURN(wchar_t_str, wchar_t[len]); - if (wchar_t_str == 0) - break; - - for (size_t i = 0; i < len; ++i) - { - wchar_t_str[i] = wchar_str[i]; - } - } - - if (wchar_t_str == 0) - { - wchar_t_str = reinterpret_cast (wchar_str); - } -#if defined (ACE_WIN32) -# if defined (ACE_USES_WCHAR) - ACE_OS::strcpy (fp, ACE_TEXT ("s")); -# else /* ACE_USES_WCHAR */ - ACE_OS::strcpy (fp, ACE_TEXT ("S")); -# endif /* ACE_USES_WCHAR */ -#elif defined (ACE_HAS_WCHAR) -# if defined (HPUX) - ACE_OS::strcpy (fp, ACE_TEXT ("S")); -# else - ACE_OS::strcpy (fp, ACE_TEXT ("ls")); -# endif /* HPUX */ -#endif /* ACE_WIN32 / ACE_HAS_WCHAR */ - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, wchar_t_str); - else - this_len = ACE_OS::sprintf (bp, format, wchar_t_str); - if(sizeof(ACE_OS::WChar) != sizeof(wchar_t)) - { - delete [] wchar_t_str; - } - ACE_UPDATE_COUNT (bspace, this_len); - break; - } - - case 'c': -#if defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - ACE_OS::strcpy (fp, ACE_TEXT ("C")); -#else - ACE_OS::strcpy (fp, ACE_TEXT ("c")); -#endif /* ACE_WIN32 && ACE_USES_WCHAR */ - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, va_arg (argp, int)); - else - this_len = ACE_OS::sprintf - (bp, format, va_arg (argp, int)); - ACE_UPDATE_COUNT (bspace, this_len); - break; - - case 'd': case 'i': case 'o': - case 'u': case 'x': case 'X': - fp[0] = *format_str; - fp[1] = '\0'; - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, va_arg (argp, int)); - else - this_len = ACE_OS::sprintf - (bp, format, va_arg (argp, int)); - ACE_UPDATE_COUNT (bspace, this_len); - break; - - case 'F': case 'f': case 'e': case 'E': - case 'g': case 'G': - fp[0] = *format_str; - fp[1] = '\0'; - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, va_arg (argp, double)); - else - this_len = ACE_OS::sprintf - (bp, format, va_arg (argp, double)); - ACE_UPDATE_COUNT (bspace, this_len); - break; - - case 'Q': - { - const ACE_TCHAR *fmt = ACE_UINT64_FORMAT_SPECIFIER; - ACE_OS::strcpy (fp, &fmt[1]); // Skip leading % - if (can_check) - this_len = ACE_OS::snprintf (bp, bspace, - format, - va_arg (argp, ACE_UINT64)); - else - this_len = ACE_OS::sprintf (bp, - format, - va_arg (argp, ACE_UINT64)); - } - ACE_UPDATE_COUNT (bspace, this_len); - break; - - case 'q': - { - const ACE_TCHAR *fmt = ACE_INT64_FORMAT_SPECIFIER; - ACE_OS::strcpy (fp, &fmt[1]); // Skip leading % - if (can_check) - this_len = ACE_OS::snprintf (bp, bspace, - format, - va_arg (argp, ACE_INT64)); - else - this_len = ACE_OS::sprintf (bp, - format, - va_arg (argp, ACE_INT64)); - } - ACE_UPDATE_COUNT (bspace, this_len); - break; - - case 'b': - { - const ACE_TCHAR *fmt = ACE_SSIZE_T_FORMAT_SPECIFIER; - ACE_OS::strcpy (fp, &fmt[1]); // Skip leading % - } - if (can_check) - this_len = ACE_OS::snprintf (bp, bspace, - format, - va_arg (argp, ssize_t)); - else - this_len = ACE_OS::sprintf (bp, - format, - va_arg (argp, ssize_t)); - ACE_UPDATE_COUNT (bspace, this_len); - break; - - case 'B': - { - const ACE_TCHAR *fmt = ACE_SIZE_T_FORMAT_SPECIFIER; - ACE_OS::strcpy (fp, &fmt[1]); // Skip leading % - } - if (can_check) - this_len = ACE_OS::snprintf (bp, bspace, - format, - va_arg (argp, size_t)); - else - this_len = ACE_OS::sprintf (bp, - format, - va_arg (argp, size_t)); - ACE_UPDATE_COUNT (bspace, this_len); - break; - - case ':': - { - // Assume a 32 bit time_t and change if needed. - const ACE_TCHAR *fmt = ACE_TEXT ("%d"); - if (sizeof (time_t) == 8) - fmt = ACE_INT64_FORMAT_SPECIFIER; - - ACE_OS::strcpy (fp, &fmt[1]); // Skip leading % - } - if (can_check) - this_len = ACE_OS::snprintf (bp, bspace, - format, - va_arg (argp, time_t)); - else - this_len = ACE_OS::sprintf (bp, - format, - va_arg (argp, time_t)); - ACE_UPDATE_COUNT (bspace, this_len); - break; - - case '@': - ACE_OS::strcpy (fp, ACE_TEXT ("p")); - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, va_arg (argp, void*)); - else - this_len = ACE_OS::sprintf - (bp, format, va_arg (argp, void*)); - ACE_UPDATE_COUNT (bspace, this_len); - break; - - case '?': - // Stack trace up to this point - { - // skip the frame that we're currently in - ACE_Stack_Trace t(2); - ACE_OS::strcpy (fp, ACE_TEXT ("s")); - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, t.c_str ()); - else - this_len = ACE_OS::sprintf - (bp, format, t.c_str ()); - ACE_UPDATE_COUNT (bspace, this_len); - break; - } - - - default: - // So, it's not a legit format specifier after all... - // Copy from the original % to where we are now, then - // continue with whatever comes next. - while (start_format != format_str && bspace > 0) - { - *bp++ = *start_format++; - --bspace; - } - if (bspace > 0) - { - *bp++ = *format_str; - --bspace; - } - break; - } - - // Bump to the next char in the caller's format_str - ++format_str; - } - - if (!skip_nul_locate) - while (*bp != '\0') // Locate end of bp. - ++bp; - } - } - - *bp = '\0'; // Terminate bp, but don't auto-increment this! - - ssize_t result = 0; - - // Check that memory was not corrupted, if it corrupted we can't log anything - // anymore because all our members could be corrupted. - if (bp >= (this->msg_ + ACE_MAXLOGMSGLEN+1)) - { - abort_prog = true; - ACE_OS::fprintf (stderr, - "The following logged message is too long!\n"); - } - else - { - // Copy the message from thread-specific storage into the transfer - // buffer (this can be optimized away by changing other code...). - log_record.msg_data (this->msg ()); - - // Write the to the appropriate location. - result = this->log (log_record, - abort_prog); - } - - if (abort_prog) - { - // Since we are now calling abort instead of exit, this value is - // not used. - ACE_UNUSED_ARG (exit_value); - - // *Always* print a message to stderr if we're aborting. We - // don't use verbose, however, to avoid recursive aborts if - // something is hosed. - log_record.print (ACE_Log_Msg::local_host_, 0, stderr); - ACE_OS::abort (); - } - - return result; -} - -#if !defined (ACE_WIN32) -/** - * @class ACE_Log_Msg_Sig_Guard - * - * @brief For use only by ACE_Log_Msg. - * - * Doesn't require the use of global variables or global - * functions in an application). - */ -class ACE_Log_Msg_Sig_Guard -{ -private: - ACE_Log_Msg_Sig_Guard (void); - ~ACE_Log_Msg_Sig_Guard (void); - - /// Original signal mask. - sigset_t omask_; - - friend ssize_t ACE_Log_Msg::log (ACE_Log_Record &log_record, - int suppress_stderr); -}; - -ACE_Log_Msg_Sig_Guard::ACE_Log_Msg_Sig_Guard (void) -{ -#if !defined (ACE_LACKS_UNIX_SIGNALS) - ACE_OS::sigemptyset (&this->omask_); - -# if defined (ACE_LACKS_PTHREAD_THR_SIGSETMASK) - ACE_OS::sigprocmask (SIG_BLOCK, - ACE_OS_Object_Manager::default_mask (), - &this->omask_); -# else - ACE_OS::thr_sigsetmask (SIG_BLOCK, - ACE_OS_Object_Manager::default_mask (), - &this->omask_); -# endif /* ACE_LACKS_PTHREAD_THR_SIGSETMASK */ -#endif /* ACE_LACKS_UNIX_SIGNALS */ -} - -ACE_Log_Msg_Sig_Guard::~ACE_Log_Msg_Sig_Guard (void) -{ -#if !defined (ACE_LACKS_UNIX_SIGNALS) -# if defined (ACE_LACKS_PTHREAD_THR_SIGSETMASK) - ACE_OS::sigprocmask (SIG_SETMASK, - &this->omask_, - 0); -# else - ACE_OS::thr_sigsetmask (SIG_SETMASK, - &this->omask_, - 0); -# endif /* ACE_LACKS_PTHREAD_THR_SIGSETMASK */ -#endif /* ! ACE_LACKS_UNIX_SIGNALS */ -} -#endif /* ! ACE_WIN32 */ - -ssize_t -ACE_Log_Msg::log (ACE_Log_Record &log_record, - int suppress_stderr) -{ - ssize_t result = 0; - - // Format the message and print it to stderr and/or ship it off to - // the log_client daemon, and/or print it to the ostream. Of - // course, only print the message if "SILENT" mode is disabled. - if (ACE_BIT_DISABLED (ACE_Log_Msg::flags_, - ACE_Log_Msg::SILENT)) - { - bool tracing = this->tracing_enabled (); - this->stop_tracing (); - -#if !defined (ACE_WIN32) - // Make this block signal-safe. - ACE_Log_Msg_Sig_Guard sb; -#endif /* !ACE_WIN32 */ - - // Do the callback, if needed, before acquiring the lock - // to avoid holding the lock during the callback so we don't - // have deadlock if the callback uses the logger. - if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, - ACE_Log_Msg::MSG_CALLBACK) - && this->msg_callback () != 0) - this->msg_callback ()->log (log_record); - - // Make sure that the lock is held during all this. - ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, - *ACE_Log_Msg_Manager::get_lock (), - -1)); - - if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, - ACE_Log_Msg::STDERR) - && !suppress_stderr) // This is taken care of by our caller. - log_record.print (ACE_Log_Msg::local_host_, - ACE_Log_Msg::flags_, - stderr); - - if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::CUSTOM) || - ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::SYSLOG) || - ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::LOGGER)) - { - // Be sure that there is a message_queue_, with multiple threads. - ACE_MT (ACE_Log_Msg_Manager::init_backend ()); - } - - - if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::LOGGER) || - ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::SYSLOG)) - { - result = - ACE_Log_Msg_Manager::log_backend_->log (log_record); - } - - if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::CUSTOM) && - ACE_Log_Msg_Manager::custom_backend_ != 0) - { - result = - ACE_Log_Msg_Manager::custom_backend_->log (log_record); - } - - // This must come last, after the other two print operations - // (see the method for details). - if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, - ACE_Log_Msg::OSTREAM) - && this->msg_ostream () != 0) - log_record.print (ACE_Log_Msg::local_host_, - ACE_Log_Msg::flags_, -#if defined (ACE_LACKS_IOSTREAM_TOTALLY) - static_cast (this->msg_ostream ()) -#else /* ! ACE_LACKS_IOSTREAM_TOTALLY */ - *this->msg_ostream () -#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ - ); - - if (tracing) - this->start_tracing (); - } - - return result; -} - -// Calls log to do the actual print, but formats first. - -int -ACE_Log_Msg::log_hexdump (ACE_Log_Priority log_priority, - const char *buffer, - size_t size, - const ACE_TCHAR *text) -{ - // Only print the message if hasn't been reset to - // exclude this logging priority. - if (this->log_priority_enabled (log_priority) == 0) - return 0; - - ACE_TCHAR* buf = 0; - size_t const buf_sz = - ACE_Log_Record::MAXLOGMSGLEN - ACE_Log_Record::VERBOSE_LEN - 58; - ACE_NEW_RETURN (buf, ACE_TCHAR[buf_sz], -1); - - ACE_TCHAR *msg_buf = 0; - const size_t text_sz = text ? ACE_OS::strlen(text) : 0; - ACE_NEW_RETURN (msg_buf, - ACE_TCHAR[text_sz + 58], - -1); - - buf[0] = 0; // in case size = 0 - - size_t const len = ACE::format_hexdump - (buffer, size, buf, buf_sz / sizeof (ACE_TCHAR) - text_sz); - - int sz = 0; - - if (text) - sz = ACE_OS::sprintf (msg_buf, -#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - ACE_TEXT ("%ls - "), -#else - ACE_TEXT ("%s - "), -#endif - text); - - sz += ACE_OS::sprintf (msg_buf + sz, - ACE_TEXT ("HEXDUMP ") - ACE_SIZE_T_FORMAT_SPECIFIER - ACE_TEXT (" bytes"), - size); - - if (len < size) - ACE_OS::sprintf (msg_buf + sz, - ACE_TEXT (" (showing first ") - ACE_SIZE_T_FORMAT_SPECIFIER - ACE_TEXT (" bytes)"), - len); - - // Now print out the formatted buffer. - this->log (log_priority, - ACE_TEXT ("%s\n%s"), - msg_buf, - buf); - - delete [] msg_buf; - delete [] buf; - return 0; -} - -void -ACE_Log_Msg::set (const char *file, - int line, - int op_status, - int errnum, - bool restart, - ACE_OSTREAM_TYPE *os, - ACE_Log_Msg_Callback *c) -{ - ACE_TRACE ("ACE_Log_Msg::set"); - this->file (file); - this->linenum (line); - this->op_status (op_status); - this->errnum (errnum); - this->restart (restart); - this->msg_ostream (os); - this->msg_callback (c); -} - -void -ACE_Log_Msg::conditional_set (const char *filename, - int line, - int status, - int err) -{ - this->conditional_values_.is_set_ = true; - this->conditional_values_.file_ = filename; - this->conditional_values_.line_ = line; - this->conditional_values_.op_status_ = status; - this->conditional_values_.errnum_ = err; -} - -void -ACE_Log_Msg::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Log_Msg::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("status_ = %d\n"), this->status_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nerrnum_ = %d\n"), this->errnum_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nlinenum_ = %d\n"), this->linenum_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nfile_ = %C\n"), this->file_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nmsg_ = %s\n"), this->msg_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nrestart_ = %d\n"), this->restart_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nostream_ = %@\n"), this->ostream_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nmsg_callback_ = %@\n"), - this->msg_callback_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nprogram_name_ = %s\n"), - this->program_name_ ? this->program_name_ - : ACE_TEXT (""))); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nlocal_host_ = %s\n"), - this->local_host_ ? this->local_host_ - : ACE_TEXT (""))); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\npid_ = %d\n"), this->getpid ())); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nflags_ = 0x%x\n"), this->flags_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ntrace_depth_ = %d\n"), - this->trace_depth_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ntrace_active_ = %d\n"), - this->trace_active_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ntracing_enabled_ = %d\n"), - this->tracing_enabled_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\npriority_mask_ = 0x%x\n"), - this->priority_mask_)); - if (this->thr_desc_ != 0 && this->thr_desc_->state () != 0) - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthr_state_ = %d\n"), - this->thr_desc_->state ())); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nmsg_off_ = %d\n"), this->msg_off_)); - - // Be sure that there is a message_queue_, with multiple threads. - ACE_MT (ACE_Log_Msg_Manager::init_backend ()); - - ACE_MT (ACE_Log_Msg_Manager::get_lock ()->dump ()); - // Synchronize output operations. - - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -void -ACE_Log_Msg::thr_desc (ACE_Thread_Descriptor *td) -{ - this->thr_desc_ = td; - - if (td != 0) - td->acquire_release (); -} - -ACE_Log_Msg_Backend * -ACE_Log_Msg::msg_backend (ACE_Log_Msg_Backend *b) -{ - ACE_TRACE ("ACE_Log_Msg::msg_backend"); - ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, - *ACE_Log_Msg_Manager::get_lock (), 0)); - - ACE_Log_Msg_Backend *tmp = ACE_Log_Msg_Manager::custom_backend_; - ACE_Log_Msg_Manager::custom_backend_ = b; - return tmp; -} - -ACE_Log_Msg_Backend * -ACE_Log_Msg::msg_backend (void) -{ - ACE_TRACE ("ACE_Log_Msg::msg_backend"); - ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, - *ACE_Log_Msg_Manager::get_lock (), 0)); - - return ACE_Log_Msg_Manager::custom_backend_; -} - -void -ACE_Log_Msg::msg_ostream (ACE_OSTREAM_TYPE *m, bool delete_ostream) -{ - if (this->ostream_ == m) - { - // Same stream, allow user to change the delete_ostream "flag" - if (delete_ostream && !this->ostream_refcount_) - { - ACE_NEW (this->ostream_refcount_, Atomic_ULong (1)); - } - else if (!delete_ostream && this->ostream_refcount_) - { - if (--*this->ostream_refcount_ == 0) - { - delete this->ostream_refcount_; - } - this->ostream_refcount_ = 0; - } - // The other two cases are no-ops, the user has requested the same - // state that's already present. - return; - } - - this->cleanup_ostream (); - - if (delete_ostream) - { - ACE_NEW (this->ostream_refcount_, Atomic_ULong (1)); - } - - this->ostream_ = m; -} - -void -ACE_Log_Msg::local_host (const ACE_TCHAR *s) -{ - if (s) - { - ACE_OS::free ((void *) ACE_Log_Msg::local_host_); - { - ACE_NO_HEAP_CHECK; - - ACE_ALLOCATOR (ACE_Log_Msg::local_host_, ACE_OS::strdup (s)); - } - } -} - -int -ACE_Log_Msg::log_priority_enabled (ACE_Log_Priority log_priority, - const char *, - ...) -{ - return this->log_priority_enabled (log_priority); -} - -#if defined (ACE_USES_WCHAR) -int -ACE_Log_Msg::log_priority_enabled (ACE_Log_Priority log_priority, - const wchar_t *, - ...) -{ - return this->log_priority_enabled (log_priority); -} -#endif /* ACE_USES_WCHAR */ - -// **************************************************************** - -void -ACE_Log_Msg::init_hook (ACE_OS_Log_Msg_Attributes &attributes -# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) - , ACE_SEH_EXCEPT_HANDLER selector - , ACE_SEH_EXCEPT_HANDLER handler -# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ - ) -{ -# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) - attributes.seh_except_selector_ = selector; - attributes.seh_except_handler_ = handler; -# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ - if (ACE_Log_Msg::exists ()) - { - ACE_Log_Msg *inherit_log = ACE_LOG_MSG; - attributes.ostream_ = inherit_log->msg_ostream (); - if (attributes.ostream_ && inherit_log->ostream_refcount_) - { - ++*inherit_log->ostream_refcount_; - attributes.ostream_refcount_ = inherit_log->ostream_refcount_; - } - else - { - attributes.ostream_refcount_ = 0; - } - attributes.priority_mask_ = inherit_log->priority_mask (); - attributes.tracing_enabled_ = inherit_log->tracing_enabled (); - attributes.restart_ = inherit_log->restart (); - attributes.trace_depth_ = inherit_log->trace_depth (); - } -} - -void -ACE_Log_Msg::inherit_hook (ACE_OS_Thread_Descriptor *thr_desc, - ACE_OS_Log_Msg_Attributes &attributes) -{ -#if !defined (ACE_THREADS_DONT_INHERIT_LOG_MSG) && \ - !defined (ACE_HAS_MINIMAL_ACE_OS) - // Inherit the logging features if the parent thread has an - // . Note that all of the following operations occur - // within thread-specific storage. - ACE_Log_Msg *new_log = ACE_LOG_MSG; - - // Note that we do not inherit the callback because this might have - // been allocated off of the stack of the original thread, in which - // case all hell would break loose... - - if (attributes.ostream_) - { - new_log->ostream_ = attributes.ostream_; - new_log->ostream_refcount_ = - static_cast (attributes.ostream_refcount_); - - new_log->priority_mask (attributes.priority_mask_); - - if (attributes.tracing_enabled_) - new_log->start_tracing (); - - new_log->restart (attributes.restart_); - new_log->trace_depth (attributes.trace_depth_); - } - - // @@ Now the TSS Log_Msg has been created, cache my thread - // descriptor in. - - if (thr_desc != 0) - // This downcast is safe. We do it to avoid having to #include - // ace/Thread_Manager.h. - new_log->thr_desc (static_cast (thr_desc)); - // Block the thread from proceeding until - // thread manager has thread descriptor ready. -#endif /* ! ACE_THREADS_DONT_INHERIT_LOG_MSG && ! ACE_HAS_MINIMAL_ACE_OS */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Log_Msg.h b/dep/acelite/ace/Log_Msg.h deleted file mode 100644 index 28d5944937f..00000000000 --- a/dep/acelite/ace/Log_Msg.h +++ /dev/null @@ -1,751 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Log_Msg.h - * - * $Id: Log_Msg.h 95128 2011-11-27 21:22:15Z johnnyw $ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_LOG_MSG_H -#define ACE_LOG_MSG_H -#include /**/ "ace/pre.h" - -// This stuff must come first to avoid problems with circular -// headers... -// ... but ACE_NDEBUG and ACE_NLOGGING can come from the config.h file, so -// pull that one early. -#include /**/ "ace/config-all.h" -#include /**/ "ace/ACE_export.h" -#include "ace/Global_Macros.h" -#include "ace/Default_Constants.h" -#include "ace/Log_Priority.h" -#include "ace/os_include/os_limits.h" -#include "ace/Synch_Traits.h" - -// The ACE_ASSERT macro used to be defined here, include ace/Assert.h -// for backwards compatibility. -#include "ace/Assert.h" - -#if defined (ACE_NLOGGING) -#if !defined (ACE_HEX_DUMP) -# define ACE_HEX_DUMP(X) do {} while (0) -#endif -#if !defined (ACE_RETURN) -# define ACE_RETURN(Y) do { return (Y); } while (0) -#endif -#if !defined (ACE_ERROR_RETURN) -# define ACE_ERROR_RETURN(X, Y) return (Y) -#endif -#if !defined (ACE_ERROR_BREAK) -# define ACE_ERROR_BREAK(X) { break; } -#endif -#if !defined (ACE_ERROR) -# define ACE_ERROR(X) do {} while (0) -#endif -#if !defined (ACE_DEBUG) -# define ACE_DEBUG(X) do {} while (0) -#endif -#if !defined (ACE_ERROR_INIT) -# define ACE_ERROR_INIT(VALUE, FLAGS) -#endif -#else -#if !defined (ACE_HEX_DUMP) -#define ACE_HEX_DUMP(X) \ - do { \ - int const __ace_error = ACE_Log_Msg::last_error_adapter (); \ - ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \ - ace___->conditional_set (__FILE__, __LINE__, 0, __ace_error); \ - ace___->log_hexdump X; \ - } while (0) -#endif -#if !defined (ACE_RETURN) -#define ACE_RETURN(Y) \ - do { \ - int const __ace_error = ACE_Log_Msg::last_error_adapter (); \ - ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \ - ace___->set (__FILE__, __LINE__, Y, __ace_error, ace___->restart (), \ - ace___->msg_ostream (), ace___->msg_callback ()); \ - return Y; \ - } while (0) -#endif -#if !defined (ACE_ERROR_RETURN) -#define ACE_ERROR_RETURN(X, Y) \ - do { \ - int const __ace_error = ACE_Log_Msg::last_error_adapter (); \ - ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \ - ace___->conditional_set (__FILE__, __LINE__, Y, __ace_error); \ - ace___->log X; \ - return Y; \ - } while (0) -#endif -#if !defined (ACE_ERROR) -#define ACE_ERROR(X) \ - do { \ - int const __ace_error = ACE_Log_Msg::last_error_adapter (); \ - ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \ - ace___->conditional_set (__FILE__, __LINE__, -1, __ace_error); \ - ace___->log X; \ - } while (0) -#endif -#if !defined (ACE_DEBUG) -#define ACE_DEBUG(X) \ - do { \ - int const __ace_error = ACE_Log_Msg::last_error_adapter (); \ - ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \ - ace___->conditional_set (__FILE__, __LINE__, 0, __ace_error); \ - ace___->log X; \ - } while (0) -#endif -#if !defined (ACE_ERROR_INIT) -#define ACE_ERROR_INIT(VALUE, FLAGS) \ - do { \ - ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \ - ace___->set_flags (FLAGS); \ - ace___->op_status (VALUE); \ - } while (0) -#endif -#if !defined (ACE_ERROR_BREAK) -#define ACE_ERROR_BREAK(X) { ACE_ERROR (X); break; } -#endif -#endif /* ACE_NLOGGING */ - -#include "ace/OS_Log_Msg_Attributes.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// These workarounds are necessary for nasty libraries or platforms -// that #define STDERR or THREAD (e.g. LynxOS). We simply #undef -// these macros as there is no way to save the macro definition using -// the pre-processor. See Bugzilla Bug #299 for more info. -#if defined (STDERR) -# undef STDERR -#endif /* STDERR */ - -#if defined (THREAD) -# undef THREAD -#endif /* THREAD */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Log_Msg_Callback; -class ACE_Log_Msg_Backend; - -// **************************************************************** - -#define ACE_LOG_MSG ACE_Log_Msg::instance () - -// Forward declaration -class ACE_Thread_Descriptor; -class ACE_Log_Record; -template class ACE_Atomic_Op; - -/** - * @class ACE_Log_Msg - * - * @brief Provides a variable length argument message logging - * abstraction. - * - * This class is very flexible since it allows formatted error - * messages to be printed in a thread-safe manner to various - * locations, such as stderr, cerr, a distributed logger, etc. The - * current message is also kept in a thread-specific storage location - * (threads spawned using ACE_Thread_Manager automatically get an - * ACE_Log_Msg object that inherits the spawning thread's settings), - * which can be used to communicate errors between framework methods - * and callers. A message is logged by the log() method, only if the - * message priority is currently enabled. Moreover, only the current - * log message is stored here -- it will be overwritten by the - * subsequent call to log(). - * - * The ACE_Log_Msg class uses two priority masks to control its - * logging behavior. The @c priority_mask_ object attribute is - * thread- specific and specifies the priority levels logged by the - * thread. The @c process_priority_mask_ class attribute is not - * thread-specific and specifies the priority levels that will be - * logged by all threads in the process. By default, all levels are - * disabled for @c priority_mask_ and all levels are enabled for @c - * process_priority_mask_ (i.e. the process-wide mask controls the - * settings, and each instance can expand on it if desired). Both - * priority masks can be modified using the priority_mask() method of - * this class. - */ -class ACE_Export ACE_Log_Msg -{ -public: - // Logger Flags. - enum - { - /// Write messages to stderr. - STDERR = 1, - /// Write messages to the local client logger daemon. - LOGGER = 2, - /// Write messages to the ostream * stored in thread-specific - /// storage. - OSTREAM = 4, - /// Write messages to the callback object. - MSG_CALLBACK = 8, - /// Display messages in a verbose manner. - VERBOSE = 16, - /// Display messages in a less verbose manner (i.e., only print - /// information that can change between calls). - VERBOSE_LITE = 32, - /// Do not print messages at all (just leave in thread-specific - /// storage for later inspection). - SILENT = 64, - /// Write messages to the system's event log. - SYSLOG = 128, - /// Write messages to the user provided backend - CUSTOM = 256 - }; - - // = Initialization and termination routines. - - /// Returns a pointer to the Singleton. - static ACE_Log_Msg *instance (void); - - /// Returns last error. - static int last_error_adapter (void); - - /// Returns non-null if an ACE_Log_Msg exists for the calling thread. - static int exists (void); - - /// Returns the current program name used for logging. - static const ACE_TCHAR * program_name (void); - - /// Clears the flag from the default priority mask used to - /// initialize ACE_Log_Msg instances. - static void disable_debug_messages (ACE_Log_Priority priority = LM_DEBUG); - - /// Sets the flag in the default priority mask used to initialize - /// ACE_Log_Msg instances. - static void enable_debug_messages (ACE_Log_Priority priority = LM_DEBUG); - - /// Initialize logger. - ACE_Log_Msg (void); - - /// cleanup logger. - ~ACE_Log_Msg (void); - - /// Initialize the ACE logging facility. - /** - * Initialize the ACE logging facility. Supplies the program name - * that is available to each logging message call. Default arguments - * set up logging to STDERR only. - * - * @param prog_name The name of the calling program. - * @param options_flags A bitwise-or of options flags used to set the - * initial behavior and logging sink(s). (see the - * enum above for the valid values). - * @param logger_key The name of ACE_FIFO rendezvous point where the - * local client logger daemon is listening for logging - * messages if the LOGGER bit is set in the @a flags - * argument. If the SYSLOG bit is set in @a flags, - * @a logger_key is the source/program name specified - * in the syslog facility (UNIX/Linux) or the Windows - * event log (Windows). In the SYSLOG case, if - * @a logger_key is 0, @a prog_name is used. - */ - int open (const ACE_TCHAR *prog_name, - u_long options_flags = ACE_Log_Msg::STDERR, - const ACE_TCHAR *logger_key = 0); - - // = Set/get the options flags. - - /** - * Enable the bits in the logger's options flags. - */ - void set_flags (u_long f); - - /** - * Disable the bits in the logger's options flags. - */ - void clr_flags (u_long f); - - /** - * Return the bits in the logger's options flags. - */ - u_long flags (void); - - /** @name Allow apps to acquire and release internal synchronization - * lock - * - * This lock is used internally by the ACE_Log_Msg - * implementation. By exporting the lock, applications can hold the - * lock atomically over a number of calls to ACE_Log_Msg. - */ - //@{ - - /// Acquire the internal lock. - int acquire (void); - - /// Release the internal lock. - int release (void); - //@} - - /// Call after doing a @c fork() to resynchronize the process id and - /// @c program_name_ variables. - void sync (const ACE_TCHAR *program_name); - - // = Set/get methods. Note that these are non-static and thus will - // be thread-specific. - - /// Set the result of the operation status (by convention, -1 means - /// error). - void op_status (int status); - - /// Get the result of the operation status (by convention, -1 means - /// error). - int op_status (void) const; - - /// Set the value of the errnum (by convention this corresponds to - /// errno). - void errnum (int); - - /// Get the value of the errnum (by convention this corresponds to - /// errno). - int errnum (void) const; - - /// Set the line number where an error occurred. - void linenum (int); - - /// Get the line number where an error occurred. - int linenum (void) const; - - /// Set the file name where an error occurred. - void file (const char *); - - /// Get the file name where an error occurred. - const char *file (void); - - /// Set the message that describes what type of error occurred. - void msg (const ACE_TCHAR *); - - /// Get the message that describes what type of error occurred. - const ACE_TCHAR *msg (void); - - /// Set the field that indicates whether interrupted calls should be - /// restarted. - void restart (bool r); - - /// Get the field that indicates whether interrupted calls should be - /// restarted. - bool restart (void) const; - - // = Notice that the following two function is equivalent to - // "void msg_ostream (HANDLE)" and "HANDLE msg_ostream (void)" - // on Windows CE. There is no support on CE. - - /// Update the ostream without overwriting the delete_ostream_ flag. - void msg_ostream (ACE_OSTREAM_TYPE *); - - /** - * delete_stream == true, forces Log_Msg.h to delete the stream in - * its own ~dtor (assumes control of the stream) - * use only with proper ostream (eg: fstream), not (cout, cerr) - */ - void msg_ostream (ACE_OSTREAM_TYPE *, bool delete_ostream); - - /// Get the ostream that is used to print error messages. - ACE_OSTREAM_TYPE *msg_ostream (void) const; - - /** - * Set a new callback object and return the existing callback to - * allow "chaining". Note that ACE_Log_Msg_Callback objects are not - * inherited when spawning a new thread, so you'll need to reset - * them in each thread. - */ - ACE_Log_Msg_Callback *msg_callback (ACE_Log_Msg_Callback *c); - ACE_Log_Msg_Callback *msg_callback (void) const; - - /** - * Set a new backend object and return the existing backend to - * allow "chaining". Note that as opposed to ACE_Log_Msg_Callback, - * ACE_Log_Msg_Backend is a per-process entity. - * - * @note Be aware that because of the current architecture there is - * no guarantee that open (), reset () and close () will be called - * on a backend object. - * - */ - static ACE_Log_Msg_Backend *msg_backend (ACE_Log_Msg_Backend *b); - static ACE_Log_Msg_Backend *msg_backend (void); - - /// Nesting depth increment. - int inc (void); - - /// Nesting depth decrement. - int dec (void); - - /// Get trace depth. - int trace_depth (void) const; - - /// Set trace depth. - void trace_depth (int); - - /// Get trace active status. - bool trace_active (void) const; - - /// Set trace active status. - void trace_active (bool value); - - /// Get the TSS thread descriptor. - ACE_Thread_Descriptor *thr_desc (void) const; - - /** - * Set the TSS thread descriptor. This method will call - * td->acquire_release to block execution until this call - * return. - */ - void thr_desc (ACE_Thread_Descriptor *td); - - /// Stop tracing status on a per-thread basis... - void stop_tracing (void); - - /// Start tracing status on a per-thread basis... - void start_tracing (void); - - /// Query tracing status on a per-thread basis... - bool tracing_enabled (void) const; - - typedef enum - { - PROCESS = 0, - THREAD = 1 - } MASK_TYPE; - - // = Get/set the priority mask. - /// Get the current ACE_Log_Priority mask. - u_long priority_mask (MASK_TYPE = THREAD); - - /// Set the ACE_Log_Priority mask, returns original mask. - u_long priority_mask (u_long, MASK_TYPE = THREAD); - - /// Return true if the requested priority is enabled. - int log_priority_enabled (ACE_Log_Priority log_priority); - - /// Return true if the requested priority is enabled. - int log_priority_enabled (ACE_Log_Priority log_priority, - const char *, - ...); - -#if defined (ACE_USES_WCHAR) - // We are not using ACE_TCHAR for this since ACE_HEX_DUMP - // doesn't take in a ACE_TCHAR. log_hexdump takes in a char - // string, so this must be able to take in a char string even - // when using ACE_USES_WCHAR. - /// Return true if the requested priority is enabled. - int log_priority_enabled (ACE_Log_Priority log_priority, - const wchar_t *, - ...); -#endif /* ACE_USES_WCHAR */ - - /// Optimize reading of the pid (avoids a system call if the value is - /// cached...). - pid_t getpid (void) const; - - /// Get the name of the local host. - const ACE_TCHAR *local_host (void) const; - - /// Set the name of the local host. - void local_host (const ACE_TCHAR *); - - /** - * Set the line number, file name, operational status, error number, - * restart flag, ostream, and the callback object. This combines - * all the other set methods into a single method. - */ - void set (const char *file, - int line, - int op_status = -1, - int errnum = 0, - bool restart = true, - ACE_OSTREAM_TYPE *os = 0, - ACE_Log_Msg_Callback *c = 0); - - /// These values are only actually set if the requested priority is - /// enabled. - void conditional_set (const char *file, - int line, - int op_status, - int errnum); - - /** - * Format a message to the thread-safe ACE logging mechanism. Valid - * options (prefixed by '%', as in printf format strings) include: - * - 'A': print an ACE_timer_t value (which could be either double - * or ACE_UINT32.) - * - 'a': abort the program at this point abruptly. - * - 'b': print a ssize_t value - * - 'B': print a size_t value - * - 'c': print a character - * - 'C': print a char* character string (also see s and W) - * - 'i', 'd': print a decimal number - * - 'I': indent according to nesting depth (obtained from - * ACE_Trace::get_nesting_indent()). - * - 'e', 'E', 'f', 'F', 'g', 'G': print a double - * - 'l': print line number where an error occurred. - * - 'M': print the name of the priority of the message. - * - 'm': return the message corresponding to errno value, e.g., as - * done by strerror() - * - 'N': print file name where the error occurred. - * - 'n': print the name of the program (or "" if not set) - * - 'o': print as an octal number - * - 'P': print out the current process id - * - 'p': print out the appropriate errno message from sys_errlist, - * e.g., as done by perror() - * - 'Q': print out the uint64 number - * - 'q': print out the int64 number - * - '@': print a void* pointer (in hexadecimal) - * - 'r': call the function pointed to by the corresponding argument - * - 'R': print return status - * - 'S': print out the appropriate signal message corresponding - * to var-argument, e.g., as done by strsignal() - * - 's': prints a ACE_TCHAR* character string (also see C and W) - * - 'T': print timestamp in hour:minute:sec:usec format (plain option, - * i.e. without any flags, prints system supplied timestamp; - * with '#' flag added expects ACE_Time_Value* in argument list) - * - 'D': print timestamp as Weekday Month day year hour:minute:sec.usec - * (plain option, i.e. without any flags, prints system supplied - * timestamp; with '#' flag added expects ACE_Time_Value* in - * argument list) - * - 't': print thread id (1 if single-threaded) - * - 'u': print as unsigned int - * - 'w': prints a wide character - * - 'W': prints a wchar_t* character string (also see C and s) - * - 'x': print as a hex number - * - 'X': print as a hex number - * - 'z': print an ACE_OS::WChar character - * - 'Z': print an ACE_OS::WChar character string - * - ':': print a time_t value as an integral number - * - '%': print out a single percent sign, '%' - * - '?': print out stack trace (see Stack_Trace.h header comments) - */ - ssize_t log (ACE_Log_Priority priority, const ACE_TCHAR *format, ...); - -#if defined (ACE_HAS_WCHAR) - ssize_t log (ACE_Log_Priority priority, const ACE_ANTI_TCHAR *format, ...); -#endif /* ACE_HAS_WCHAR */ - - /** - * An alternative logging mechanism that makes it possible to - * integrate variable argument lists from other logging mechanisms - * into the ACE mechanism. - */ - ssize_t log (const ACE_TCHAR *format, - ACE_Log_Priority priority, - va_list argp); - - /// Log a custom built log record to the currently enabled logging - /// sinks. - ssize_t log (ACE_Log_Record &log_record, - int suppress_stderr = 0); - - /** - * Method to log hex dump. This is useful for debugging. Calls - * log() to do the actual print, but formats first to make the chars - * printable. - */ - int log_hexdump (ACE_Log_Priority log_priority, - const char *buffer, - size_t size, - const ACE_TCHAR *text = 0); - - /** - * Init hook, create a Log_Msg_Attribute object, initialize its - * attributes from the TSS Log_Msg and save the object in the - * @a attributes argument - */ - static void init_hook (ACE_OS_Log_Msg_Attributes &attributes -# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) - , ACE_SEH_EXCEPT_HANDLER selector = 0 - , ACE_SEH_EXCEPT_HANDLER handler = 0 -# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ - ); - - /** - * Inherit hook, the @a attributes field is a ACE_OS_Log_Msg_Attributes - * object, invoke the inherit_log_msg() method on it, then destroy - * it and set the @a attribute argument to 0. - */ - static void inherit_hook (ACE_OS_Thread_Descriptor *thr_desc, - ACE_OS_Log_Msg_Attributes &attributes); - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -private: - void cleanup_ostream (); - - /// Status of operation (-1 means failure, >= 0 means success). - int status_; - - /// Type of error that occurred (see ). - int errnum_; - - /// Line number where the error occurred. - int linenum_; - - /// File where the error occurred. - char file_[MAXPATHLEN + 1]; - - /// The log message, which resides in thread-specific storage. Note - /// that only the current log message is stored here -- it will be - /// overwritten by the subsequent call to log(). - ACE_TCHAR* msg_; // Add one for NUL-terminator. - - /// Indicates whether we should restart system calls that are - /// interrupted. - bool restart_; - - /// The ostream where logging messages can be written. - ACE_OSTREAM_TYPE *ostream_; - - /// This pointer is 0 if we are not reference counting (the user has not - /// passed "true" for the delete_ostream argument to msg_ostream). - /// If we are reference counting, this points to a shared count that will - /// be deleted when it reaches zero. Since we want optional but shared - /// ownership neither std::auto_ptr nor ACE_Strong_Bound_Ptr have the right - /// semantics. *Bound_Ptr also doesn't take advantage of Atomic_Op. - typedef ACE_Atomic_Op Atomic_ULong; - Atomic_ULong *ostream_refcount_; - - /// The callback object. - ACE_Log_Msg_Callback *msg_callback_; - - /// Depth of the nesting for printing traces. - int trace_depth_; - - /// Are we already within an ACE_Trace constructor call? - bool trace_active_; - - /// Are we allowing tracing in this thread? - bool tracing_enabled_; - - /** - * If we're running in the context of an ACE_Thread_Manager this - * will point to the thread descriptor adapter which holds the - * thread descriptor of the thread. This can be used to rapidly - * access all thread data kept in ACE_Thread_Descriptor. - */ - ACE_Thread_Descriptor *thr_desc_; - - /** - * Keeps track of all the per-thread ACE_Log_Priority values that - * are currently enabled. Default is for all logging priorities to - * be disabled. - */ - u_long priority_mask_; - - /// Always timestamp? - int timestamp_; - - // = The following fields are *not* kept in thread-specific storage. - - // We only want one instance for the entire process! - - /** - * Keeps track of all the per-process ACE_Log_Priority values that - * are currently enabled. Default is for all logging priorities to - * be enabled. - */ - static u_long process_priority_mask_; - - /// Records the program name. - static const ACE_TCHAR *program_name_; - - /// Name of the local host (used when printing messages). - static const ACE_TCHAR *local_host_; - - /// Process id of the current process. - static pid_t pid_; - - /// Options flags used to hold the logger flag options, e.g., - /// STDERR, LOGGER, OSTREAM, MSG_CALLBACK, etc. - static u_long flags_; - - /// Offset of msg_[]. - static ptrdiff_t msg_off_; - - /** - * Number of existing ACE_Log_Msg instances; when 0, delete program/host - * names - */ - static int instance_count_; - - /** - * Priority mask to use for each new instance - */ - static u_long default_priority_mask_; - - /// Anonymous struct since there will only be one instance. This - /// struct keeps information stored away in case we actually end up - /// calling log() if the log priority is correct. - struct - { - bool is_set_; - const char *file_; - int line_; - int op_status_; - int errnum_; - } conditional_values_; - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - static bool key_created_; -#endif /* ACE_MT_SAFE */ - - /// For cleanup, at program termination. - static void close (void); - - /// Decouple the OS layer from the ACE_Log_Msg layer. - static void sync_hook (const ACE_TCHAR *prg_name); - - /// Return the TSS singleton thread descriptor - static ACE_OS_Thread_Descriptor *thr_desc_hook (void); - - //friend void ACE_OS::cleanup_tss (const u_int); - - // = Disallow these operations. - ACE_Log_Msg &operator= (const ACE_Log_Msg &); - ACE_Log_Msg (const ACE_Log_Msg &); -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) -# if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || \ - defined (ACE_HAS_TSS_EMULATION) -/* static */ -# if defined (ACE_HAS_THR_C_DEST) -# define LOCAL_EXTERN_PREFIX extern "C" -# else -# define LOCAL_EXTERN_PREFIX -# endif /* ACE_HAS_THR_C_DEST */ - -#if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1) -# define ACE_TSS_CLEANUP_NAME ACE_PREPROC_CONCATENATE(ACE_,ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _TSS_cleanup)) -#else -# define ACE_TSS_CLEANUP_NAME ACE_TSS_cleanup -#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */ - - -LOCAL_EXTERN_PREFIX -void -ACE_TSS_CLEANUP_NAME (void *ptr); -# endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION */ -#endif /* ACE_MT_SAFE */ - -#if defined (__ACE_INLINE__) -#include "ace/Log_Msg.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* ACE_LOG_MSG_H */ diff --git a/dep/acelite/ace/Log_Msg.inl b/dep/acelite/ace/Log_Msg.inl deleted file mode 100644 index bb5290331bb..00000000000 --- a/dep/acelite/ace/Log_Msg.inl +++ /dev/null @@ -1,235 +0,0 @@ -// -*- C++ -*- -// -// $Id: Log_Msg.inl 82723 2008-09-16 09:35:44Z johnnyw $ - -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_unistd.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -u_long -ACE_Log_Msg::priority_mask (MASK_TYPE mask_type) -{ - return mask_type == THREAD - ? this->priority_mask_ - : ACE_Log_Msg::process_priority_mask_; -} - -ACE_INLINE -int -ACE_Log_Msg::log_priority_enabled (ACE_Log_Priority log_priority) -{ - return ACE_BIT_ENABLED (this->priority_mask_ | - ACE_Log_Msg::process_priority_mask_, - log_priority); -} - -ACE_INLINE -void -ACE_Log_Msg::op_status (int status) -{ - this->status_ = status; -} - -ACE_INLINE -int -ACE_Log_Msg::op_status (void) const -{ - return this->status_; -} - -ACE_INLINE -void -ACE_Log_Msg::restart (bool r) -{ - this->restart_ = r; -} - -ACE_INLINE -bool -ACE_Log_Msg::restart (void) const -{ - return this->restart_; -} - -ACE_INLINE -int -ACE_Log_Msg::errnum (void) const -{ - return this->errnum_; -} - -ACE_INLINE -void -ACE_Log_Msg::errnum (int e) -{ - this->errnum_ = e; -} - -ACE_INLINE -int -ACE_Log_Msg::linenum (void) const -{ - return this->linenum_; -} - -ACE_INLINE -void -ACE_Log_Msg::linenum (int l) -{ - this->linenum_ = l; -} - -ACE_INLINE -int -ACE_Log_Msg::inc (void) -{ - return this->trace_depth_++; -} - -ACE_INLINE -int -ACE_Log_Msg::dec (void) -{ - return this->trace_depth_ == 0 ? 0 : --this->trace_depth_; -} - -ACE_INLINE -int -ACE_Log_Msg::trace_depth (void) const -{ - return this->trace_depth_; -} - -ACE_INLINE -void -ACE_Log_Msg::trace_depth (int depth) -{ - this->trace_depth_ = depth; -} - -ACE_INLINE -bool -ACE_Log_Msg::trace_active (void) const -{ - return this->trace_active_; -} - -ACE_INLINE -void -ACE_Log_Msg::trace_active (bool value) -{ - this->trace_active_ = value; -} - -ACE_INLINE -ACE_Thread_Descriptor * -ACE_Log_Msg::thr_desc (void) const -{ - return this->thr_desc_; -} - -/// Enable the tracing facility on a per-thread basis. -ACE_INLINE -void -ACE_Log_Msg::start_tracing (void) -{ - this->tracing_enabled_ = true; -} - -/// Disable the tracing facility on a per-thread basis. -ACE_INLINE -void -ACE_Log_Msg::stop_tracing (void) -{ - this->tracing_enabled_ = false; -} - -ACE_INLINE -bool -ACE_Log_Msg::tracing_enabled (void) const -{ - return this->tracing_enabled_; -} - -ACE_INLINE -const char * -ACE_Log_Msg::file (void) -{ - return this->file_; -} - -ACE_INLINE -void -ACE_Log_Msg::file (const char *s) -{ - ACE_OS::strsncpy (this->file_, s, sizeof this->file_); -} - -ACE_INLINE -const ACE_TCHAR * -ACE_Log_Msg::msg (void) -{ - return this->msg_ + ACE_Log_Msg::msg_off_; -} - -ACE_INLINE -void -ACE_Log_Msg::msg (const ACE_TCHAR *m) -{ - ACE_OS::strsncpy (this->msg_, m, - ((ACE_MAXLOGMSGLEN+1) / sizeof (ACE_TCHAR))); -} - -ACE_INLINE -ACE_Log_Msg_Callback * -ACE_Log_Msg::msg_callback (void) const -{ - return this->msg_callback_; -} - -ACE_INLINE -ACE_Log_Msg_Callback * -ACE_Log_Msg::msg_callback (ACE_Log_Msg_Callback *c) -{ - ACE_Log_Msg_Callback *old = this->msg_callback_; - this->msg_callback_ = c; - return old; -} - -ACE_INLINE -ACE_OSTREAM_TYPE * -ACE_Log_Msg::msg_ostream (void) const -{ - return this->ostream_; -} - -ACE_INLINE -void -ACE_Log_Msg::msg_ostream (ACE_OSTREAM_TYPE *m) -{ - this->ostream_ = m; -} - -ACE_INLINE -const ACE_TCHAR * -ACE_Log_Msg::local_host (void) const -{ - return ACE_Log_Msg::local_host_; -} - -ACE_INLINE -pid_t -ACE_Log_Msg::getpid (void) const -{ - if (ACE_Log_Msg::pid_ == -2) - ACE_Log_Msg::pid_ = ACE_OS::getpid (); - - return ACE_Log_Msg::pid_; -} - - - -ACE_END_VERSIONED_NAMESPACE_DECL - diff --git a/dep/acelite/ace/Log_Msg_Backend.cpp b/dep/acelite/ace/Log_Msg_Backend.cpp deleted file mode 100644 index 3ab6a3d7005..00000000000 --- a/dep/acelite/ace/Log_Msg_Backend.cpp +++ /dev/null @@ -1,14 +0,0 @@ -// $Id: Log_Msg_Backend.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/Log_Msg_Backend.h" - - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Log_Msg_Backend::~ACE_Log_Msg_Backend (void) -{ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Log_Msg_Backend.h b/dep/acelite/ace/Log_Msg_Backend.h deleted file mode 100644 index ba3dba1c948..00000000000 --- a/dep/acelite/ace/Log_Msg_Backend.h +++ /dev/null @@ -1,88 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Log_Msg_Backend.h - * - * $Id: Log_Msg_Backend.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - - -#ifndef ACE_LOG_MSG_BACKEND_H -#define ACE_LOG_MSG_BACKEND_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/os_include/sys/os_types.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Log_Record; - -/** - * @class ACE_Log_Msg_Backend - * - * @brief Defines the interface for ACE_Log_Msg back end processing. - * - * The ACE_Log_Msg class uses ACE_Log_Msg_Backend as the target interface - * for back end log record procesing. In addition to the classes ACE - * derives from this (ACE_Log_Msg_NT_Event_Log, ACE_Log_Msg_UNIX_Syslog, and - * ACE_Log_Msg_IPC) users can derive classes from ACE_Log_Msg_Backend for - * use as a custom logger back end. - */ -class ACE_Export ACE_Log_Msg_Backend -{ -public: - /// No-op virtual destructor. - virtual ~ACE_Log_Msg_Backend (void); - - /** - * Open the back end object. Perform any actions needed to prepare - * the object for later logging operations. - * - * @param logger_key The character string passed to ACE_Log_Msg::open(). - * If the @c LOGGER logging destination is not being - * used, any string can be passed through to the back end. - * - * @retval 0 for success. - * @retval -1 for failure. - */ - virtual int open (const ACE_TCHAR *logger_key) = 0; - - /** - * Reset the backend. If ACE_Log_Msg is reopened during execution, this - * hook will be called. This method should perform any needed cleanup - * activity (similar to close()) because this object won't be reopened - * if the new open call does not specify use of this back end being reset. - * - * @retval Currently ignored, but to be safe, return 0 for success; - * -1 for failure. - */ - virtual int reset (void) = 0; - - /// Close the backend completely. - virtual int close (void) = 0; - - /** - * Process a log record. - * - * @param log_record The ACE_Log_Record to process. - * - * @retval -1 for failure; else it is customarily the number of bytes - * processed, but can also be 0 to signify success. - */ - virtual ssize_t log (ACE_Log_Record &log_record) = 0; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_LOG_MSG_BACKEND_H */ diff --git a/dep/acelite/ace/Log_Msg_Callback.cpp b/dep/acelite/ace/Log_Msg_Callback.cpp deleted file mode 100644 index 62ae542cfbe..00000000000 --- a/dep/acelite/ace/Log_Msg_Callback.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// $Id: Log_Msg_Callback.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/Log_Msg_Callback.h" - - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Log_Msg_Callback::~ACE_Log_Msg_Callback (void) -{ -} -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Log_Msg_Callback.h b/dep/acelite/ace/Log_Msg_Callback.h deleted file mode 100644 index a67407459e6..00000000000 --- a/dep/acelite/ace/Log_Msg_Callback.h +++ /dev/null @@ -1,69 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Log_Msg_Callback.h - * - * $Id: Log_Msg_Callback.h 91064 2010-07-12 10:11:24Z johnnyw $ - * - * @author Douglas C. Schmidt - */ -//============================================================================= - -#ifndef ACE_LOG_MSG_CALLBACK_H -#define ACE_LOG_MSG_CALLBACK_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/ACE_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_Log_Record; - -/** - * @class ACE_Log_Msg_Callback - * - * @brief An interface class used to get logging callbacks. - * - * Users who are interested in getting the logging messages - * directly, can subclass this interface and override the log() - * method. They must then register their subclass with the - * Log_Msg class and make sure that they turn on the - * ACE_Log_Msg::MSG_CALLBACK flag. - * - * Your log() routine is called with an instance of - * ACE_Log_Record. From this class, you can get the log - * message, the verbose log message, message type, message - * priority, and so on. - * - * Remember that there is one Log_Msg object per thread. - * Therefore, you may need to register your callback object with - * many ACE_Log_Msg objects (and have the correct - * synchronization in the log() method) or have a separate - * callback object per Log_Msg object. Moreover, - * ACE_Log_Msg_Callbacks are not inherited when a new thread - * is spawned because it might have been allocated off of the - * stack of the original thread, in which case all hell would - * break loose... Therefore, you'll need to reset these in each - * new thread. - */ -class ACE_Export ACE_Log_Msg_Callback -{ -public: - /// No-op virtual destructor. - virtual ~ACE_Log_Msg_Callback (void); - - /// Callback routine. This is called when we want to log a message. - /// Since this routine is pure virtual, it must be overwritten by the - /// subclass. - virtual void log (ACE_Log_Record &log_record) = 0; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_LOG_MSG_CALLBACK_H */ diff --git a/dep/acelite/ace/Log_Msg_IPC.cpp b/dep/acelite/ace/Log_Msg_IPC.cpp deleted file mode 100644 index 4df1db72276..00000000000 --- a/dep/acelite/ace/Log_Msg_IPC.cpp +++ /dev/null @@ -1,114 +0,0 @@ -// $Id: Log_Msg_IPC.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/Log_Msg_IPC.h" -#include "ace/Log_Record.h" -#include "ace/CDR_Stream.h" -#include "ace/Truncate.h" - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Log_Msg_IPC::ACE_Log_Msg_IPC (void) -{ -} - -ACE_Log_Msg_IPC::~ACE_Log_Msg_IPC (void) -{ - (void) this->close (); -} - -int -ACE_Log_Msg_IPC::open (const ACE_TCHAR *logger_key) -{ - ACE_LOG_MSG_IPC_CONNECTOR con; - return con.connect (this->message_queue_, - ACE_LOG_MSG_IPC_ADDR (logger_key)); -} - -int -ACE_Log_Msg_IPC::reset (void) -{ - if (this->message_queue_.get_handle () != ACE_INVALID_HANDLE) - { - // If we don't do this, handles aren't reused on Win32 and the - // server eventually crashes! - return this->close (); - } - return 0; -} - -int -ACE_Log_Msg_IPC::close (void) -{ - return this->message_queue_.close (); -} - -ssize_t -ACE_Log_Msg_IPC::log (ACE_Log_Record &log_record) -{ - // Serialize the log record using a CDR stream, allocate enough - // space for the complete . - size_t const max_payload_size = - 4 // type - + 4 // pid - + 12 // timestamp - + 4 // process id - + 4 // data length -#if defined (ACE_USES_WCHAR) - + (log_record.msg_data_len () * ACE_OutputCDR::wchar_maxbytes()) // message -#else - + log_record.msg_data_len () // message -#endif - + ACE_CDR::MAX_ALIGNMENT; // padding; - - // Insert contents of into payload stream. - ACE_OutputCDR payload (max_payload_size); - if (!(payload << log_record)) - return -1; - - // Get the number of bytes used by the CDR stream. If it becomes desireable - // to support payloads more than 4GB, this field will need to be changed - // to a 64-bit value. - ACE_CDR::ULong const length = - ACE_Utils::truncate_cast (payload.total_length ()); - - // Send a header so the receiver can determine the byte order and - // size of the incoming CDR stream. - ACE_OutputCDR header (ACE_CDR::MAX_ALIGNMENT + 8); - if (!(header << ACE_OutputCDR::from_boolean (ACE_CDR_BYTE_ORDER))) - return -1; - - // Store the size of the payload that follows - if (!(header << ACE_CDR::ULong (length))) - return -1; - - // Use an iovec to send both buffer and payload simultaneously. - iovec iov[2]; - iov[0].iov_base = header.begin ()->rd_ptr (); - iov[0].iov_len = 8; - iov[1].iov_base = payload.begin ()->rd_ptr (); - iov[1].iov_len = length; - -#if (ACE_HAS_STREAM_LOG_MSG_IPC == 1) - // Use the API if supported to ensure correct message - // queueing according to priority. - - ACE_Str_Buf header_msg (static_cast (header.begin ()->rd_ptr ()), - static_cast (8)); - - ACE_Str_Buf payload_msg (static_cast (payload.begin ()->rd_ptr ()), - static_cast (length)); - - return this->message_queue_.send (&header_msg, - &payload_msg, - static_cast (log_record.priority ()), - MSG_BAND); -#else - // We're running over sockets, so send header and payload - // efficiently using "gather-write". - return this->message_queue_.sendv_n (iov, 2); -#endif /* ACE_HAS_STREAM_LOG_MSG_IPC */ -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Log_Msg_IPC.h b/dep/acelite/ace/Log_Msg_IPC.h deleted file mode 100644 index 958eae27648..00000000000 --- a/dep/acelite/ace/Log_Msg_IPC.h +++ /dev/null @@ -1,81 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Log_Msg_IPC.h - * - * $Id: Log_Msg_IPC.h 84536 2009-02-20 09:28:48Z johnnyw $ - * - * @author Carlos O'Ryan - */ -//============================================================================= - -#ifndef ACE_LOG_MSG_LOGGER_H -#define ACE_LOG_MSG_LOGGER_H -#include /**/ "ace/pre.h" - -#include "ace/Log_Msg_Backend.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Default_Constants.h" - -// IPC conduit between sender and client daemon. This should be -// included in the ACE_Log_Msg class, but due to "order of include" -// problems it can't be... -#if (ACE_HAS_STREAM_LOG_MSG_IPC == 1) -# include "ace/SPIPE_Connector.h" -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef ACE_SPIPE_Stream ACE_LOG_MSG_IPC_STREAM; -typedef ACE_SPIPE_Connector ACE_LOG_MSG_IPC_CONNECTOR; -typedef ACE_SPIPE_Addr ACE_LOG_MSG_IPC_ADDR; -ACE_END_VERSIONED_NAMESPACE_DECL -#else -# include "ace/SOCK_Connector.h" -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -typedef ACE_SOCK_Stream ACE_LOG_MSG_IPC_STREAM; -typedef ACE_SOCK_Connector ACE_LOG_MSG_IPC_CONNECTOR; -typedef ACE_INET_Addr ACE_LOG_MSG_IPC_ADDR; -ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_HAS_STREAM_PIPES */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/// Defines the interfaces for ACE_Log_Msg backend. -/** - * Implement an ACE_Log_Msg_Backend that logs to a remote logging - * process. - */ -class ACE_Export ACE_Log_Msg_IPC : public ACE_Log_Msg_Backend -{ -public: - /// Constructor - ACE_Log_Msg_IPC (void); - - /// Destructor - virtual ~ACE_Log_Msg_IPC (void); - - /// Open a new connection - virtual int open (const ACE_TCHAR *logger_key); - - /** - * Reset the backend. When changing the logging destination the - * backend may need to properly disconnect from the remote logging - * daemon and reclaim some local resources. But we try to reduce - * the number of local allocations/deallocations. - */ - virtual int reset (void); - - virtual int close (void); - virtual ssize_t log (ACE_Log_Record &log_record); - -private: - ACE_LOG_MSG_IPC_STREAM message_queue_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* ACE_LOG_MSG_H */ diff --git a/dep/acelite/ace/Log_Msg_NT_Event_Log.cpp b/dep/acelite/ace/Log_Msg_NT_Event_Log.cpp deleted file mode 100644 index 2e7ff49fa70..00000000000 --- a/dep/acelite/ace/Log_Msg_NT_Event_Log.cpp +++ /dev/null @@ -1,170 +0,0 @@ -// $Id: Log_Msg_NT_Event_Log.cpp 91286 2010-08-05 09:04:31Z johnnyw $ - -#include "ace/config-all.h" - -#if defined (ACE_HAS_LOG_MSG_NT_EVENT_LOG) - -#include "ace/Log_Msg_NT_Event_Log.h" -#include "ace/Log_Msg.h" -#include "ace/Log_Record.h" -#include "ace/OS_NS_stdio.h" -#include "ace/OS_NS_string.h" - - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Log_Msg_NT_Event_Log::ACE_Log_Msg_NT_Event_Log (void) - : evlog_handle_(0) -{ -} - -ACE_Log_Msg_NT_Event_Log::~ACE_Log_Msg_NT_Event_Log (void) -{ - this->close (); -} - -int -ACE_Log_Msg_NT_Event_Log::open (const ACE_TCHAR *logger_key) -{ - // ACE's "resource module" contains the message resource required - // for event logging. - ACE_TCHAR msg_file [MAXPATHLEN]; - - if (!ACE_TEXT_GetModuleFileName (ACE_OS::get_win32_resource_module (), - msg_file, - MAXPATHLEN)) - return -1; - DWORD msg_file_length = - static_cast ((ACE_OS::strlen (msg_file) + 1) * sizeof (ACE_TCHAR)); - - // If a logger_key has been supplied then we use that as the event - // source name, otherwise we default to the program name. - const ACE_TCHAR *event_source_name = logger_key ? logger_key : ACE_Log_Msg::program_name (); - - // Information is stored in the registry at a location based on the - // program name. - ACE_TCHAR reg_key [MAXPATHLEN]; - ACE_OS::strcpy (reg_key, - ACE_TEXT ("SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\")); - size_t reg_key_length = ACE_OS::strlen(reg_key); - ACE_OS::strncat (reg_key, - event_source_name, - MAXPATHLEN - reg_key_length); - - // Add the event source to the registry. Note that if this fails it - // is not fatal. The application will still be able to write entries - // to the event log, they just won't be formatted correctly. - HKEY hkey; - ACE_TEXT_RegCreateKey (HKEY_LOCAL_MACHINE, - reg_key, - &hkey); - DWORD flags = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE; - ACE_TEXT_RegSetValueEx (hkey, - ACE_TEXT ("TypesSupported"), - 0, - REG_DWORD, - (LPBYTE) &flags, - sizeof (DWORD)); - ACE_TEXT_RegSetValueEx (hkey, - ACE_TEXT ("EventMessageFile"), - 0, - REG_SZ, - (LPBYTE) msg_file, - msg_file_length); - RegCloseKey (hkey); - - // Obtain a handle to the event source. - this->evlog_handle_ = ACE_TEXT_RegisterEventSource (0, - event_source_name); - return this->evlog_handle_ ? 0 : -1; -} - -int -ACE_Log_Msg_NT_Event_Log::reset (void) -{ - return this->close (); -} - -int -ACE_Log_Msg_NT_Event_Log::close (void) -{ - if (this->evlog_handle_ == 0 - || DeregisterEventSource (this->evlog_handle_)) - { - this->evlog_handle_ = 0; - return 0; - } - else - return -1; -} - -ssize_t -ACE_Log_Msg_NT_Event_Log::log (ACE_Log_Record &log_record) -{ - // Make a copy of the log text and replace any newlines with - // CR-LF. Newline characters on their own do not appear correctly in - // the event viewer. We allow for a doubling in the size of the msg - // data for the worst case of all newlines. - const ACE_TCHAR *src_msg_data = log_record.msg_data (); - ACE_TCHAR msg_data [(ACE_Log_Record::MAXLOGMSGLEN * 2) + 1]; - - size_t maxlen = ACE_Log_Record::MAXLOGMSGLEN; - if (ACE_Log_Record::MAXLOGMSGLEN > log_record.msg_data_len ()) - maxlen = log_record.msg_data_len (); - - size_t end = 0; - for (size_t i = 0, j = 0; - i < maxlen; - ++i) - { - if (src_msg_data[i] == '\n') - { - msg_data[j++] = '\r'; - msg_data[j++] = '\n'; - } - else - msg_data[j++] = src_msg_data[i]; - - end = j; - } - msg_data[end] = '\0'; - - // Map the ACE log record type to an event log type. - WORD event_type; - switch (log_record.type ()) - { - case LM_STARTUP: - case LM_SHUTDOWN: - case LM_TRACE: - case LM_DEBUG: - case LM_INFO: - event_type = EVENTLOG_INFORMATION_TYPE; - break; - case LM_NOTICE: - case LM_WARNING: - event_type = EVENTLOG_WARNING_TYPE; - break; - case LM_ERROR: - case LM_CRITICAL: - case LM_ALERT: - case LM_EMERGENCY: - default: - event_type = EVENTLOG_ERROR_TYPE; - break; - } - - // Send the log message to the system event log. - const ACE_TCHAR* msgs [1]; - msgs[0] = msg_data; - - if (ACE_TEXT_ReportEvent (this->evlog_handle_, - event_type, 0, 0, 0, 1, 0, msgs, 0) == 0) - return -1; - else - return 0; -} - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_LOG_MSG_NT_EVENT_LOG */ diff --git a/dep/acelite/ace/Log_Msg_NT_Event_Log.h b/dep/acelite/ace/Log_Msg_NT_Event_Log.h deleted file mode 100644 index 777f8e97f9a..00000000000 --- a/dep/acelite/ace/Log_Msg_NT_Event_Log.h +++ /dev/null @@ -1,72 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Log_Msg_NT_Event_Log.h - * - * $Id: Log_Msg_NT_Event_Log.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Christopher Kohlhoff - */ -//============================================================================= - -#ifndef ACE_LOG_MSG_NT_EVENT_LOG_H -#define ACE_LOG_MSG_NT_EVENT_LOG_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined ACE_HAS_LOG_MSG_NT_EVENT_LOG - -#include "ace/Log_Msg_Backend.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_Log_Msg_NT_Event_Log - * - * @brief Implements an ACE_Log_Msg_Backend that logs to the WinNT system - * event log. - */ -class ACE_Export ACE_Log_Msg_NT_Event_Log : public ACE_Log_Msg_Backend -{ -public: - /// Constructor - ACE_Log_Msg_NT_Event_Log (void); - - /// Destructor - virtual ~ACE_Log_Msg_NT_Event_Log (void); - - /// Open a new event log. - /** - * Initialize the event logging facility. - * @param logger_key The name of the calling program. This name is - * used in the Source field of the event log. If - * it is 0 (no name), the application name as - * returned from ACE_Log_Msg::program_name() is used. - */ - virtual int open (const ACE_TCHAR *logger_key); - - /// Reset the backend. - virtual int reset (void); - - /// Close the backend completely. - virtual int close (void); - - /// This is called when we want to log a message. - virtual ssize_t log (ACE_Log_Record &log_record); - -private: - HANDLE evlog_handle_; -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_HAS_LOG_MSG_NT_EVENT_LOG */ - -#include /**/ "ace/post.h" -#endif /* ACE_LOG_MSG_NT_EVENT_LOG_H */ diff --git a/dep/acelite/ace/Log_Msg_UNIX_Syslog.cpp b/dep/acelite/ace/Log_Msg_UNIX_Syslog.cpp deleted file mode 100644 index ae4e307ec0e..00000000000 --- a/dep/acelite/ace/Log_Msg_UNIX_Syslog.cpp +++ /dev/null @@ -1,207 +0,0 @@ -// $Id: Log_Msg_UNIX_Syslog.cpp 92791 2010-12-04 16:25:22Z shuston $ - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_UNIX_SYSLOG) - -#include "ace/ACE.h" -#include "ace/Log_Msg.h" -#include "ace/Log_Msg_UNIX_Syslog.h" -#include "ace/Log_Record.h" -#include "ace/OS_NS_string.h" -#include "ace/os_include/os_syslog.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// NOTE: -// The ACE_Log_Msg_UNIX_Syslog class can use the openlog(), -// setlogmask(), syslog() and closelog() routines in a thread safe -// manner (versus using openlog_r(), et. al.), as the ACE_Log_Msg -// class uses the lock provided by its local ACE_Log_Msg_Manager -// class when calling the methods of the backend classes. As a -// result, logging semantics with respect to the UNIX syslog -// facility, will be the same for all threads in a process. This -// should not be too limiting, as the ACE_Log_Msg class itself can -// be used to control thread specific logging behavior. - -ACE_Log_Msg_UNIX_Syslog::ACE_Log_Msg_UNIX_Syslog (void) -{ -} - -ACE_Log_Msg_UNIX_Syslog::~ACE_Log_Msg_UNIX_Syslog (void) -{ - (void) this->close (); -} - -int -ACE_Log_Msg_UNIX_Syslog::open (const ACE_TCHAR * logger_key) -{ - if (logger_key == 0) - logger_key = ACE_Log_Msg::program_name (); - - // Initialize the UNIX syslog facility. Default the syslog log - // options LOG_CONS and LOG_PID to be set. There really should be a - // logging strategy option to control the syslog log options, - // however, we'll take the easy way out for now. -#if defined (ACE_USES_WCHAR) - openlog (ACE_TEXT_ALWAYS_CHAR (logger_key), - LOG_CONS|LOG_PID, - ACE_DEFAULT_SYSLOG_FACILITY); -#else - openlog (const_cast (logger_key), - LOG_CONS|LOG_PID, - ACE_DEFAULT_SYSLOG_FACILITY); -#endif /* ACE_USES_WCHAR */ - - // Enable logging of all syslog priorities. If logging of all - // priorities is not desired, use the ACE_Log_Msg::priority_mask() - // method to control the log output sent to the syslog daemon via - // the log() method, or use the system's syslog.conf file to select - // desired level of information. - -#if !defined (ACE_LACKS_SETLOGMASK) - (void) setlogmask (LOG_UPTO (LOG_DEBUG)); -#endif /* ACE_LACKS_SETLOGMASK */ - - return 0; -} - -int -ACE_Log_Msg_UNIX_Syslog::reset (void) -{ - return this->close (); -} - -int -ACE_Log_Msg_UNIX_Syslog::close (void) -{ - closelog(); - return 0; -} - -ssize_t -ACE_Log_Msg_UNIX_Syslog::log (ACE_Log_Record &log_record) -{ - int syslog_priority = this->convert_log_priority (log_record.type ()); - u_long flags = ACE_LOG_MSG->flags (); - - // The UNIX syslog() facility does not support multi-line messages. - // Break up the message data into separate lines and send each line - // to the syslog daemon. - - ACE_TCHAR message[ACE_Log_Record::MAXVERBOSELOGMSGLEN]; - ACE_OS::strcpy (message, log_record.msg_data ()); - ACE_TCHAR *strtokp = 0; - - for (ACE_TCHAR *line = ACE_OS::strtok_r (message, - ACE_TEXT ("\n"), - &strtokp); - line != 0; - line = ACE_OS::strtok_r (0, - ACE_TEXT ("\n"), - &strtokp)) - { - // Format the message line. Note that the processing for - // VERBOSE is the same as for VERBOSE_LITE, since syslog() - // already provides us with the hostname and PID. However, the - // timestamp is duplicated (albeit a shortened version) to - // provide a timestamp with greater precision than that provided - // by syslog(). - if (ACE_BIT_ENABLED (flags, ACE_Log_Msg::VERBOSE) - || ACE_BIT_ENABLED (flags, ACE_Log_Msg::VERBOSE_LITE)) - { - ACE_TCHAR date_and_time[27]; - if (0 == ACE::timestamp (date_and_time, sizeof (date_and_time), 1)) - ACE_OS::strcpy (date_and_time, ACE_TEXT ("