X-Git-Url: https://git.teslayout.com/public/public/public/?p=anna.git;a=blobdiff_plain;f=source%2Fdiameter.comm%2FEngine.cpp;fp=source%2Fdiameter.comm%2FEngine.cpp;h=94c7d2d9ae6cfd9aee10f5df237de7b6873a7589;hp=867b6cceb093af97502194853a6ae6d7bdd15366;hb=5a6cba5fde2b2f538a7515f8293cc0a8d9589dfa;hpb=af9c86ffb0e28d35ad94d99c5f77e41578c972b4 diff --git a/source/diameter.comm/Engine.cpp b/source/diameter.comm/Engine.cpp index 867b6cc..94c7d2d 100644 --- a/source/diameter.comm/Engine.cpp +++ b/source/diameter.comm/Engine.cpp @@ -71,7 +71,7 @@ comm::Engine::Engine(const char *className, const stack::Dictionary *baseProtoco } -void comm::Engine::assertBaseProtocolHealth() throw(anna::RuntimeException) { +void comm::Engine::assertBaseProtocolHealth() noexcept(false) { if (!getBaseProtocolCodecEngine()->getDictionary()) throw anna::RuntimeException("Invalid diameter::comm::Engine object: base protocol dictionary provided on constructor was NULL", ANNA_FILE_LOCATION); // it would be interesting to check and identify certain base protocol elements in the dictionary ... @@ -79,13 +79,13 @@ void comm::Engine::assertBaseProtocolHealth() throw(anna::RuntimeException) { } -comm::Server* comm::Engine::allocateServer() throw() { return a_serversRecycler.create(); } -void comm::Engine::releaseServer(Server *server) throw() { a_serversRecycler.release(server); } -comm::ClientSession* comm::Engine::allocateClientSession() throw() { return a_clientSessionsRecycler.create(); } -void comm::Engine::releaseClientSession(ClientSession *clientSession) throw() { a_clientSessionsRecycler.release(clientSession); } +comm::Server* comm::Engine::allocateServer() { return a_serversRecycler.create(); } +void comm::Engine::releaseServer(Server *server) { a_serversRecycler.release(server); } +comm::ClientSession* comm::Engine::allocateClientSession() { return a_clientSessionsRecycler.create(); } +void comm::Engine::releaseClientSession(ClientSession *clientSession) { a_clientSessionsRecycler.release(clientSession); } -void comm::Engine::setClientCERandDWR(const anna::DataBlock & cer, const anna::DataBlock & dwr) throw(anna::RuntimeException) { +void comm::Engine::setClientCERandDWR(const anna::DataBlock & cer, const anna::DataBlock & dwr) noexcept(false) { if(codec::functions::getCommandId(cer) != helpers::base::COMMANDID__Capabilities_Exchange_Request) { throw anna::RuntimeException("The message provided as 'CER' is not a Capabilities-Exchange-Request", ANNA_FILE_LOCATION); } @@ -98,7 +98,7 @@ void comm::Engine::setClientCERandDWR(const anna::DataBlock & cer, const anna::D a_dwr = dwr; } -void comm::Engine::setClientCERandDWR(const std::string & cer, const std::string & dwr) throw(anna::RuntimeException) { +void comm::Engine::setClientCERandDWR(const std::string & cer, const std::string & dwr) noexcept(false) { // Check for base protocol codec engine health: assertBaseProtocolHealth(); @@ -178,7 +178,7 @@ void comm::Engine::setClientCERandDWR(const std::string & cer, const std::string setClientCERandDWR(diameterCER.code(), diameterDWR.code()); } -void comm::Engine::setWatchdogPeriod(const anna::Millisecond & wp) throw(anna::RuntimeException) { +void comm::Engine::setWatchdogPeriod(const anna::Millisecond & wp) noexcept(false) { if(wp < ClientSession::DefaultWatchdogPeriod) { throw anna::RuntimeException(anna::functions::asString("Please set watchdog period over %s", ClientSession::DefaultWatchdogPeriod.asString().c_str()), ANNA_FILE_LOCATION); } @@ -186,7 +186,7 @@ void comm::Engine::setWatchdogPeriod(const anna::Millisecond & wp) throw(anna::R a_watchdogPeriod = wp; } -void comm::Engine::checkEntityCollision(const socket_v &v) throw(anna::RuntimeException) { +void comm::Engine::checkEntityCollision(const socket_v &v) noexcept(false) { socket_v::const_iterator it; socket_v::const_iterator it_min(v.begin()); socket_v::const_iterator it_max(v.end()); @@ -208,7 +208,7 @@ void comm::Engine::checkEntityCollision(const socket_v &v) throw(anna::RuntimeEx } comm::Entity* comm::Engine::createEntity(const socket_v & socketList, const std::string &description) -throw(anna::RuntimeException) { +noexcept(false) { Entity* result(NULL); anna::Guard guard(this, "anna::diameter::comm::Engine::createEntity"); @@ -257,7 +257,7 @@ throw(anna::RuntimeException) { comm::LocalServer *comm::Engine::createLocalServer(const std::string & addr, int port, int maxConnections, const anna::Millisecond & allowedInactivityTime, int category, const std::string & description) -throw(anna::RuntimeException) { +noexcept(false) { LocalServer* result(NULL); anna::Guard guard(this, "anna::diameter::comm::Engine::createLocalServer"); // Proteccion antes de reservar memoria para un LocalServer @@ -292,7 +292,7 @@ throw(anna::RuntimeException) { comm::Entity* comm::Engine::createEntity(const std::string & addr1, int port1, const std::string & addr2, int port2, const std::string &description) -throw(anna::RuntimeException) { +noexcept(false) { socket_v dualList; dualList.push_back(socket_t(addr1, port1)); dualList.push_back(socket_t(addr2, port2)); @@ -301,7 +301,7 @@ throw(anna::RuntimeException) { comm::Server* comm::Engine::createServer(Entity *entity, const socket_t & socket) -throw(anna::RuntimeException) { +noexcept(false) { Server* result(NULL); anna::Guard guard(this, "anna::diameter::comm::Engine::createServer"); @@ -333,7 +333,7 @@ throw(anna::RuntimeException) { // Lohacemos privado comm::ClientSession* comm::Engine::createClientSession(Server *server, int socketId) -throw(anna::RuntimeException) { +noexcept(false) { ClientSession* result(NULL); anna::Guard guard(this, "anna::diameter::comm::Engine::createClientSession"); @@ -377,7 +377,7 @@ throw(anna::RuntimeException) { } -bool comm::Engine::broadcastEntities(const Message* message) throw(anna::RuntimeException) { +bool comm::Engine::broadcastEntities(const Message* message) noexcept(false) { LOGMETHOD(anna::TraceMethod tttm("diameter::comm::Engine", "broadcastEntities", ANNA_FILE_LOCATION)); bool allok = true; bool ok; @@ -396,7 +396,7 @@ bool comm::Engine::broadcastEntities(const Message* message) throw(anna::Runtime return allok; } -bool comm::Engine::broadcastLocalServers(const Message* message) throw(anna::RuntimeException) { +bool comm::Engine::broadcastLocalServers(const Message* message) noexcept(false) { LOGMETHOD(anna::TraceMethod tttm("diameter::comm::Engine", "broadcastLocalServers", ANNA_FILE_LOCATION)); bool allok = true; bool ok; @@ -415,7 +415,7 @@ bool comm::Engine::broadcastLocalServers(const Message* message) throw(anna::Run return allok; } -bool comm::Engine::bind() throw(anna::RuntimeException) { +bool comm::Engine::bind() noexcept(false) { LOGMETHOD(anna::TraceMethod tttm("diameter::comm::Engine", "bind", ANNA_FILE_LOCATION)); bool result = true; // all OK return @@ -432,12 +432,12 @@ bool comm::Engine::bind() throw(anna::RuntimeException) { } comm::ClientSession* comm::Engine::findClientSession(const std::string & addr, int port, int socketId, anna::Exception::Mode::_v emode) -throw(anna::RuntimeException) { +noexcept(false) { return findClientSession(ClientSession::getKey(addr, port, socketId), emode); } comm::ClientSession* comm::Engine::findClientSession(const std::string & key, anna::Exception::Mode::_v emode) -throw(anna::RuntimeException) { +noexcept(false) { anna::Guard guard(this, "anna::diameter::comm::Engine::findClientSession"); clientSession_iterator ii = clientSession_find(key); @@ -461,7 +461,7 @@ throw(anna::RuntimeException) { comm::Server* comm::Engine::findServer(const std::string & addr, int port, anna::Exception::Mode::_v emode) -throw(anna::RuntimeException) { +noexcept(false) { anna::Guard guard(this, "anna::diameter::comm::Engine::findServer"); server_iterator ii = server_find(server_key(addr, port)); @@ -485,7 +485,7 @@ throw(anna::RuntimeException) { } comm::Entity* comm::Engine::findEntity(const socket_v & socketList, anna::Exception::Mode::_v emode) -throw(anna::RuntimeException) { +noexcept(false) { anna::Guard guard(this, "anna::diameter::comm::Engine::findEntity"); entity_key key(getEntityKey(socketList)); entity_iterator ii = entity_find(key); @@ -509,7 +509,7 @@ throw(anna::RuntimeException) { } comm::Entity* comm::Engine::findEntity(const std::string & addr1, int port1, const std::string & addr2, int port2, anna::Exception::Mode::_v emode) -throw(anna::RuntimeException) { +noexcept(false) { socket_v dualList; dualList.push_back(socket_t(addr1, port1)); dualList.push_back(socket_t(addr2, port2)); @@ -518,7 +518,7 @@ throw(anna::RuntimeException) { //Entity* Engine::findEntity(int category, anna::Exception::Mode::_v emode) -//throw(anna::RuntimeException) { +//noexcept(false) { // // Entity *entity; // @@ -532,7 +532,7 @@ throw(anna::RuntimeException) { comm::LocalServer* comm::Engine::findLocalServer(const std::string & addr, int port, anna::Exception::Mode::_v emode) -throw(anna::RuntimeException) { +noexcept(false) { anna::Guard guard(this, "anna::diameter::comm::Engine::findLocalServer"); socket_t key(addr, port); localServer_iterator ii = localServer_find(key); @@ -557,7 +557,7 @@ throw(anna::RuntimeException) { } -comm::ServerSession* comm::Engine::findServerSession(int socketId, anna::Exception::Mode::_v emode) throw(anna::RuntimeException) { +comm::ServerSession* comm::Engine::findServerSession(int socketId, anna::Exception::Mode::_v emode) noexcept(false) { anna::Guard guard(this, "anna::diameter::comm::Engine::findServerSession"); ServerSession *result; @@ -585,7 +585,7 @@ comm::ServerSession* comm::Engine::findServerSession(int socketId, anna::Excepti void comm::Engine::closeClientSession(comm::ClientSession* clientSession, bool destroy) -throw(anna::RuntimeException) { +noexcept(false) { if(clientSession == NULL) return; @@ -623,7 +623,7 @@ throw(anna::RuntimeException) { void comm::Engine::closeServer(comm::Server* server, bool destroy) -throw(anna::RuntimeException) { +noexcept(false) { if(server == NULL) return; @@ -655,7 +655,7 @@ throw(anna::RuntimeException) { void comm::Engine::closeEntity(comm::Entity* entity, bool destroy) -throw(anna::RuntimeException) { +noexcept(false) { if(entity == NULL) return; @@ -690,7 +690,7 @@ throw(anna::RuntimeException) { void comm::Engine::closeLocalServer(comm::LocalServer* localServer, bool destroy) -throw(anna::RuntimeException) { +noexcept(false) { if(localServer == NULL) return; @@ -722,7 +722,7 @@ throw(anna::RuntimeException) { -void comm::Engine::closeEntities(bool destroy) throw(anna::RuntimeException) { +void comm::Engine::closeEntities(bool destroy) noexcept(false) { LOGMETHOD(anna::TraceMethod tttm("diameter::comm::Engine", "closeEntities", ANNA_FILE_LOCATION)); anna::Guard guard(this, "anna::diameter::comm::Engine::closeEntities"); @@ -730,7 +730,7 @@ void comm::Engine::closeEntities(bool destroy) throw(anna::RuntimeException) { closeEntity(entity(it), destroy); } -void comm::Engine::closeLocalServers(bool destroy) throw(anna::RuntimeException) { +void comm::Engine::closeLocalServers(bool destroy) noexcept(false) { LOGMETHOD(anna::TraceMethod tttm("diameter::comm::Engine", "closeLocalServers", ANNA_FILE_LOCATION)); anna::Guard guard(this, "anna::diameter::comm::Engine::closeLocalServers"); @@ -738,7 +738,7 @@ void comm::Engine::closeLocalServers(bool destroy) throw(anna::RuntimeException) closeLocalServer(localServer(it), destroy); } -void comm::Engine::eraseDeprecatedIdleEntities() throw() { +void comm::Engine::eraseDeprecatedIdleEntities() { LOGMETHOD(anna::TraceMethod tttm("diameter::comm::Engine", "eraseDeprecatedIdleEntities", ANNA_FILE_LOCATION)); Entity *et; @@ -749,7 +749,7 @@ void comm::Engine::eraseDeprecatedIdleEntities() throw() { } } -int comm::Engine::getOTARequestsForEntities() const throw() { +int comm::Engine::getOTARequestsForEntities() const { int result = 0; for(const_entity_iterator it = entity_begin(), maxii = entity_end(); it != maxii; it ++) @@ -758,7 +758,7 @@ int comm::Engine::getOTARequestsForEntities() const throw() { return result; } -int comm::Engine::getOTARequestsForLocalServers() const throw() { +int comm::Engine::getOTARequestsForLocalServers() const { int result = 0; for(const_localServer_iterator it = localServer_begin(), maxii = localServer_end(); it != maxii; it ++) @@ -768,18 +768,18 @@ int comm::Engine::getOTARequestsForLocalServers() const throw() { } -void comm::Engine::setOriginRealmName(const std::string & originRealmName) throw() { +void comm::Engine::setOriginRealmName(const std::string & originRealmName) { a_originRealm = ((originRealmName != "") ? originRealmName : anna::functions::getDomainname()); } -void comm::Engine::setOriginHostName(const std::string & originHostName) throw() { +void comm::Engine::setOriginHostName(const std::string & originHostName) { a_originHost = ((originHostName != "") ? originHostName : anna::functions::getHostname()); } -void comm::Engine::raiseAutoRecovery(bool autoRecovery) throw(anna::RuntimeException) { +void comm::Engine::raiseAutoRecovery(bool autoRecovery) noexcept(false) { LOGMETHOD(anna::TraceMethod tttm("diameter::comm::Engine", "raiseAutoRecovery", ANNA_FILE_LOCATION)); for(entity_iterator it = entity_begin(), maxii = entity_end(); it != maxii; it ++) @@ -787,12 +787,12 @@ void comm::Engine::raiseAutoRecovery(bool autoRecovery) throw(anna::RuntimeExcep } void comm::Engine::do_stop() -throw() { +{ LOGMETHOD(anna::TraceMethod tttm("diameter::comm::Engine", "do_stop", ANNA_FILE_LOCATION)); close(true /* destroy */); } -std::string comm::Engine::asString(void) const throw() { +std::string comm::Engine::asString(void) const { std::string trace; trace = "\n================================"; trace += "\nDiameter comm Engine information"; @@ -834,7 +834,7 @@ std::string comm::Engine::asString(void) const throw() { anna::xml::Node* comm::Engine::asXML(anna::xml::Node* parent) const -throw() { +{ parent = anna::app::Component::asXML(parent); anna::xml::Node* result = parent->createChild("diameter.comm.Engine"); result->createAttribute("AutoBind", a_autoBind ? "yes" : "no"); @@ -883,30 +883,30 @@ throw() { return result; } -comm::Engine::clientSession_iterator comm::Engine::clientSession_find(const clientSession_key &key) throw() { +comm::Engine::clientSession_iterator comm::Engine::clientSession_find(const clientSession_key &key) { return a_clientSessions.find(key); } -comm::Engine::server_iterator comm::Engine::server_find(const server_key &key) throw() { +comm::Engine::server_iterator comm::Engine::server_find(const server_key &key) { return a_servers.find(key); } -comm::Engine::entity_iterator comm::Engine::entity_find(const entity_key &key) throw() { +comm::Engine::entity_iterator comm::Engine::entity_find(const entity_key &key) { return a_entities.find(key); } -comm::Engine::localServer_iterator comm::Engine::localServer_find(const socket_t &key) throw() { +comm::Engine::localServer_iterator comm::Engine::localServer_find(const socket_t &key) { return a_localServers.find(key); } -comm::Engine::entity_key comm::Engine::getEntityKey(const std::string & addr1, int port1, const std::string & addr2, int port2) const throw() { +comm::Engine::entity_key comm::Engine::getEntityKey(const std::string & addr1, int port1, const std::string & addr2, int port2) const { socket_v dualList; dualList.push_back(socket_t(addr1, port1)); dualList.push_back(socket_t(addr2, port2)); return (getEntityKey(dualList)); } -comm::Engine::entity_key comm::Engine::getEntityKey(const socket_v &v) const throw() { +comm::Engine::entity_key comm::Engine::getEntityKey(const socket_v &v) const { std::string result; socket_v::const_iterator it; socket_v::const_iterator it_min(v.begin()); @@ -922,7 +922,7 @@ comm::Engine::entity_key comm::Engine::getEntityKey(const socket_v &v) const thr } -void comm::Engine::availabilityLostForEntities() throw() { +void comm::Engine::availabilityLostForEntities() { a_availableForEntities = false; LOGDEBUG( std::string msg = "diameter::comm::Engine { Origin-Realm: "; @@ -941,7 +941,7 @@ void comm::Engine::availabilityLostForEntities() throw() { } -void comm::Engine::availabilityRecoveredForEntities() throw() { +void comm::Engine::availabilityRecoveredForEntities() { a_availableForEntities = true; LOGDEBUG( std::string msg = "diameter::comm::Engine { Origin-Realm: "; @@ -960,7 +960,7 @@ void comm::Engine::availabilityRecoveredForEntities() throw() { } -void comm::Engine::availabilityLostForLocalServers() throw() { +void comm::Engine::availabilityLostForLocalServers() { a_availableForLocalServers = false; LOGDEBUG( std::string msg = "diameter::comm::Engine { Origin-Realm: "; @@ -979,7 +979,7 @@ void comm::Engine::availabilityLostForLocalServers() throw() { } -void comm::Engine::availabilityRecoveredForLocalServers() throw() { +void comm::Engine::availabilityRecoveredForLocalServers() { a_availableForLocalServers = true; LOGDEBUG( std::string msg = "diameter::comm::Engine { Origin-Realm: "; @@ -998,7 +998,7 @@ void comm::Engine::availabilityRecoveredForLocalServers() throw() { } -bool comm::Engine::refreshAvailabilityForEntities() throw() { +bool comm::Engine::refreshAvailabilityForEntities() { // Here available if(a_availableForEntities) { // check not-bound state for all client-sessions: bool isolate = true; @@ -1024,7 +1024,7 @@ bool comm::Engine::refreshAvailabilityForEntities() throw() { return false; } -bool comm::Engine::refreshAvailabilityForLocalServers() throw() { +bool comm::Engine::refreshAvailabilityForLocalServers() { // Here available if(a_availableForLocalServers) { // check not-bound state for all client-sessions: bool isolate = true; @@ -1051,7 +1051,7 @@ bool comm::Engine::refreshAvailabilityForLocalServers() throw() { } -void comm::Engine::readDPA(anna::DataBlock &dpa, const anna::DataBlock & dpr) throw() { +void comm::Engine::readDPA(anna::DataBlock &dpa, const anna::DataBlock & dpr) { // Check for base protocol codec engine health: try { @@ -1107,7 +1107,7 @@ void comm::Engine::readDPA(anna::DataBlock &dpa, const anna::DataBlock & dpr) th } -void comm::Engine::readCEA(anna::DataBlock &cea, const anna::DataBlock &cer) throw() { +void comm::Engine::readCEA(anna::DataBlock &cea, const anna::DataBlock &cer) { // Check for base protocol codec engine health: assertBaseProtocolHealth(); @@ -1195,7 +1195,7 @@ void comm::Engine::readCEA(anna::DataBlock &cea, const anna::DataBlock &cer) thr } } -void comm::Engine::manageDrDhServerSession(ServerSession *ss, bool register_or_desregister) throw() { +void comm::Engine::manageDrDhServerSession(ServerSession *ss, bool register_or_desregister) { // Decode CER (TODO: use raw buffer helpers) std::string destinationRealm, destinationHost; @@ -1255,7 +1255,7 @@ void comm::Engine::manageDrDhServerSession(ServerSession *ss, bool register_or_d } } -void comm::Engine::readDWA(anna::DataBlock &dwa, const anna::DataBlock & dwr) throw() { +void comm::Engine::readDWA(anna::DataBlock &dwa, const anna::DataBlock & dwr) { // Check for base protocol codec engine health: assertBaseProtocolHealth(); @@ -1305,7 +1305,7 @@ void comm::Engine::readDWA(anna::DataBlock &dwa, const anna::DataBlock & dwr) th } } -void comm::Engine::resetStatistics() throw() { +void comm::Engine::resetStatistics() { for(server_iterator it = server_begin(), maxii = server_end(); it != maxii; it ++) server(it)->resetStatistics(); @@ -1313,18 +1313,18 @@ void comm::Engine::resetStatistics() throw() { localServer(it)->resetStatistics(); } -void comm::Engine::do_initialize() throw(RuntimeException) { +void comm::Engine::do_initialize() noexcept(false) { LOGMETHOD(anna::TraceMethod tttm("diameter::comm::Engine", "do_initialize", ANNA_FILE_LOCATION)); LOGDEBUG(anna::Logger::debug("Nothing special done on component initialization", ANNA_FILE_LOCATION)); } -void comm::Engine::lazyInitialize() throw(RuntimeException) { +void comm::Engine::lazyInitialize() noexcept(false) { LOGMETHOD(anna::TraceMethod tttm("diameter::comm::Engine", "lazyInitialize", ANNA_FILE_LOCATION)); anna::app::Component::initialize(); // this will invoke do_initialize } // Not tested yet -const comm::Response* comm::Engine::sendRealmHost(const Message* message, const std::string &destinationRealm, const std::string &destinationHost) throw(anna::RuntimeException) { +const comm::Response* comm::Engine::sendRealmHost(const Message* message, const std::string &destinationRealm, const std::string &destinationHost) noexcept(false) { if (destinationRealm == "") throw anna::RuntimeException("Unable to resolve the destination: empty provided Destination-Realm name", ANNA_FILE_LOCATION);