From 48466ada3cf818cc1ac5c1465184c4b89cfa5ba2 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 25 Sep 2010 16:14:34 +0200 Subject: [PATCH] Changed: Removed "using namespace" in *.h --- code/nel/tools/nel_unit_test/ut_ligo.h | 2 - .../tools/nel_unit_test/ut_ligo_primitive.h | 52 +- code/nel/tools/nel_unit_test/ut_misc.h | 2 - .../nel/tools/nel_unit_test/ut_misc_co_task.h | 16 +- .../nel/tools/nel_unit_test/ut_misc_command.h | 28 +- .../tools/nel_unit_test/ut_misc_config_file.h | 36 +- code/nel/tools/nel_unit_test/ut_misc_file.h | 2 +- .../tools/nel_unit_test/ut_misc_pack_file.h | 54 +- .../tools/nel_unit_test/ut_misc_singleton.h | 6 +- .../nel/tools/nel_unit_test/ut_misc_sstring.h | 6 +- code/nel/tools/nel_unit_test/ut_misc_stream.h | 20 +- code/nel/tools/nel_unit_test/ut_net.h | 2 - code/nel/tools/nel_unit_test/ut_net_layer3.h | 40 +- code/nel/tools/nel_unit_test/ut_net_message.h | 28 +- code/nel/tools/nel_unit_test/ut_net_module.h | 728 +++++++++--------- 15 files changed, 508 insertions(+), 514 deletions(-) diff --git a/code/nel/tools/nel_unit_test/ut_ligo.h b/code/nel/tools/nel_unit_test/ut_ligo.h index 69dc209cb..7cace2c82 100644 --- a/code/nel/tools/nel_unit_test/ut_ligo.h +++ b/code/nel/tools/nel_unit_test/ut_ligo.h @@ -19,8 +19,6 @@ #include -using namespace NLLIGO; - #include "ut_ligo_primitive.h" // Add a line here when adding a new test CLASS diff --git a/code/nel/tools/nel_unit_test/ut_ligo_primitive.h b/code/nel/tools/nel_unit_test/ut_ligo_primitive.h index 4b626e4fe..7f0ab0c46 100644 --- a/code/nel/tools/nel_unit_test/ut_ligo_primitive.h +++ b/code/nel/tools/nel_unit_test/ut_ligo_primitive.h @@ -35,8 +35,8 @@ private: string _RefPrimFileName; void setup() { - _RestorePath = CPath::getCurrentPath(); - CPath::setCurrentPath(_WorkingPath.c_str()); + _RestorePath = NLMISC::CPath::getCurrentPath(); + NLMISC::CPath::setCurrentPath(_WorkingPath.c_str()); _RefPrimFileName = "__test_prim.primitive"; @@ -79,30 +79,30 @@ private: fclose(fp); // init ligo - CPrimitiveContext::instance().CurrentLigoConfig = &_LigoConfig; + NLLIGO::CPrimitiveContext::instance().CurrentLigoConfig = &_LigoConfig; _LigoConfig.readPrimitiveClass(CLASS_FILE_NAME, false); // create a reference primitive - if (CFile::isExists(_RefPrimFileName)) + if (NLMISC::CFile::isExists(_RefPrimFileName)) { - CFile::deleteFile(_RefPrimFileName); + NLMISC::CFile::deleteFile(_RefPrimFileName); } - CPrimitives primDoc; + NLLIGO::CPrimitives primDoc; nlassert(primDoc.RootNode != NULL); - CPrimitiveContext::instance().CurrentPrimitive = &primDoc; + NLLIGO::CPrimitiveContext::instance().CurrentPrimitive = &primDoc; - IPrimitive *p = dynamic_cast (CClassRegistry::create ("CPrimNode")); - p->addPropertyByName("class", new CPropertyString("test")); - p->addPropertyByName("name", new CPropertyString("test_root")); + NLLIGO::IPrimitive *p = dynamic_cast (NLMISC::CClassRegistry::create ("CPrimNode")); + p->addPropertyByName("class", new NLLIGO::CPropertyString("test")); + p->addPropertyByName("name", new NLLIGO::CPropertyString("test_root")); primDoc.RootNode->insertChild(p); - CPrimAlias *pa = dynamic_cast (CClassRegistry::create ("CPrimAlias")); - pa->addPropertyByName("class", new CPropertyString("alias")); - pa->addPropertyByName("name", new CPropertyString("alias")); + NLLIGO::CPrimAlias *pa = dynamic_cast (NLMISC::CClassRegistry::create ("CPrimAlias")); + pa->addPropertyByName("class", new NLLIGO::CPropertyString("alias")); + pa->addPropertyByName("name", new NLLIGO::CPropertyString("alias")); p->insertChild(pa); - CPrimitiveContext::instance().CurrentPrimitive = NULL; + NLLIGO::CPrimitiveContext::instance().CurrentPrimitive = NULL; // save the file saveXmlPrimitiveFile(primDoc, _RefPrimFileName); @@ -110,7 +110,7 @@ private: void tear_down() { - CPath::setCurrentPath(_RestorePath.c_str()); + NLMISC::CPath::setCurrentPath(_RestorePath.c_str()); } void testAliasGenerator() @@ -121,17 +121,17 @@ private: // First, load then save the doc { - CPrimitives primDoc; + NLLIGO::CPrimitives primDoc; - CPrimitiveContext::instance().CurrentPrimitive = &primDoc; + NLLIGO::CPrimitiveContext::instance().CurrentPrimitive = &primDoc; loadXmlPrimitiveFile(primDoc, _RefPrimFileName, _LigoConfig); - CPrimitiveContext::instance().CurrentPrimitive = NULL; + NLLIGO::CPrimitiveContext::instance().CurrentPrimitive = NULL; lastGeneratedAlias = primDoc.getLastGeneratedAlias(); // get a copy of the primitive - IPrimitive *prim = NULL; - IPrimitive *primCopy = NULL; + NLLIGO::IPrimitive *prim = NULL; + NLLIGO::IPrimitive *primCopy = NULL; TEST_ASSERT(primDoc.RootNode->getChild(prim, 0)); if (prim) { @@ -143,9 +143,9 @@ private: primDoc.RootNode->removeChild(prim); // insert the copy - CPrimitiveContext::instance().CurrentPrimitive = &primDoc; + NLLIGO::CPrimitiveContext::instance().CurrentPrimitive = &primDoc; primDoc.RootNode->insertChild(primCopy); - CPrimitiveContext::instance().CurrentPrimitive = NULL; + NLLIGO::CPrimitiveContext::instance().CurrentPrimitive = NULL; } } @@ -155,17 +155,17 @@ private: // second, reload the file and check the last generated alias { - CPrimitives primDoc; + NLLIGO::CPrimitives primDoc; - CPrimitiveContext::instance().CurrentPrimitive = &primDoc; + NLLIGO::CPrimitiveContext::instance().CurrentPrimitive = &primDoc; loadXmlPrimitiveFile(primDoc, _RefPrimFileName, _LigoConfig); - CPrimitiveContext::instance().CurrentPrimitive = NULL; + NLLIGO::CPrimitiveContext::instance().CurrentPrimitive = NULL; TEST_ASSERT(lastGeneratedAlias == primDoc.getLastGeneratedAlias()); } } - CLigoConfig _LigoConfig; + NLLIGO::CLigoConfig _LigoConfig; }; #endif diff --git a/code/nel/tools/nel_unit_test/ut_misc.h b/code/nel/tools/nel_unit_test/ut_misc.h index db8c60c19..94087c51c 100644 --- a/code/nel/tools/nel_unit_test/ut_misc.h +++ b/code/nel/tools/nel_unit_test/ut_misc.h @@ -17,8 +17,6 @@ #ifndef UT_MISC #define UT_MISC -using namespace NLMISC; - #include "ut_misc_co_task.h" #include "ut_misc_command.h" #include "ut_misc_config_file.h" diff --git a/code/nel/tools/nel_unit_test/ut_misc_co_task.h b/code/nel/tools/nel_unit_test/ut_misc_co_task.h index acfe0b809..309dac10a 100644 --- a/code/nel/tools/nel_unit_test/ut_misc_co_task.h +++ b/code/nel/tools/nel_unit_test/ut_misc_co_task.h @@ -81,7 +81,7 @@ vector result; vector result2; // a simple task -class CTask1 : public CCoTask +class CTask1 : public NLMISC::CCoTask { vector &Output; public: @@ -93,7 +93,7 @@ public: { for (uint i=0; i<5; ++i) { - string s = toString("Task1 : %u", i); + string s = NLMISC::toString("Task1 : %u", i); Output.push_back(s); yield(); } @@ -101,7 +101,7 @@ public: }; // another simple task -class CTask2 : public CCoTask +class CTask2 : public NLMISC::CCoTask { vector &Output; @@ -122,7 +122,7 @@ public: }; // a thread runnable class -class CTaskThread : public IRunnable +class CTaskThread : public NLMISC::IRunnable { void run() { @@ -133,7 +133,7 @@ class CTaskThread : public IRunnable t1.resume(); string s = NLMISC::toString("Thread : %u", i); result2.push_back(s); - nlSleep(0); + NLMISC::nlSleep(0); } } }; @@ -159,7 +159,7 @@ public: result2.clear(); CTaskThread tt; - IThread *th = IThread::create(&tt); + NLMISC::IThread *th = NLMISC::IThread::create(&tt); CTask2 t2; @@ -171,7 +171,7 @@ public: t2.resume(); string s = NLMISC::toString("Main : %u", i); result.push_back(s); - nlSleep(0); + NLMISC::nlSleep(0); } // wait task completion @@ -213,7 +213,7 @@ public: // loop and run the main task and the two sub task for (uint i=0; i<2; ++i) { - string s = toString("Main : %u", i); + string s = NLMISC::toString("Main : %u", i); result.push_back(s); t1.resume(); t2.resume(); diff --git a/code/nel/tools/nel_unit_test/ut_misc_command.h b/code/nel/tools/nel_unit_test/ut_misc_command.h index 341c7cba0..246871a16 100644 --- a/code/nel/tools/nel_unit_test/ut_misc_command.h +++ b/code/nel/tools/nel_unit_test/ut_misc_command.h @@ -21,7 +21,7 @@ vector callList; -class TTest : public ICommandsHandler +class TTest : public NLMISC::ICommandsHandler { protected: std::string _Name; @@ -151,11 +151,11 @@ public: callList.clear(); - ICommand::execute("T4.derivedCommand4", *InfoLog); + NLMISC::ICommand::execute("T4.derivedCommand4", *NLMISC::InfoLog); TEST_ASSERT(callList.size() == 1); TEST_ASSERT(callList[0] == "T4.derivedCommand4"); - ICommand::execute("T4.theCommand1", *InfoLog); + NLMISC::ICommand::execute("T4.theCommand1", *NLMISC::InfoLog); TEST_ASSERT(callList.size() == 3); TEST_ASSERT(callList[1] == "T4.recallBase"); TEST_ASSERT(callList[2] == "T4.theCommand1"); @@ -170,28 +170,28 @@ public: callList.clear(); - ICommand::execute("T1.theCommand1", *InfoLog); + NLMISC::ICommand::execute("T1.theCommand1", *NLMISC::InfoLog); TEST_ASSERT(callList.size() == 1); TEST_ASSERT(callList[0] == "T1.theCommand1"); - ICommand::execute("T1.derivedCommand", *InfoLog); + NLMISC::ICommand::execute("T1.derivedCommand", *NLMISC::InfoLog); TEST_ASSERT(callList.size() == 2); TEST_ASSERT(callList[1] == "T1.derivedCommand"); - ICommand::execute("T1.commandToOverride", *InfoLog); + NLMISC::ICommand::execute("T1.commandToOverride", *NLMISC::InfoLog); TEST_ASSERT(callList.size() == 3); TEST_ASSERT(callList[2] == "T1.commandToOverride"); - ICommand::execute("T2.theCommand1", *InfoLog); + NLMISC::ICommand::execute("T2.theCommand1", *NLMISC::InfoLog); TEST_ASSERT(callList.size() == 4); TEST_ASSERT(callList[3] == "T2.theCommand1"); - ICommand::execute("T2.derivedCommand", *InfoLog); + NLMISC::ICommand::execute("T2.derivedCommand", *NLMISC::InfoLog); TEST_ASSERT(callList.size() == 5); TEST_ASSERT(callList[4] == "T2.derivedCommand"); - ICommand::execute("T2.commandToOverride", *InfoLog); + NLMISC::ICommand::execute("T2.commandToOverride", *NLMISC::InfoLog); TEST_ASSERT(callList.size() == 6); TEST_ASSERT(callList[5] == "T2.command Overidden"); } @@ -204,11 +204,11 @@ public: TEST_ASSERT(callList.empty()); - ICommand::execute("inst1.theCommand1", *InfoLog); + NLMISC::ICommand::execute("inst1.theCommand1", *NLMISC::InfoLog); TEST_ASSERT(callList.size() == 1); TEST_ASSERT(callList[0] == "inst1.theCommand1"); - ICommand::execute("inst1.theCommand2", *InfoLog); + NLMISC::ICommand::execute("inst1.theCommand2", *NLMISC::InfoLog); TEST_ASSERT(callList.size() == 2); TEST_ASSERT(callList[0] == "inst1.theCommand1"); TEST_ASSERT(callList[1] == "inst1.theCommand2"); @@ -221,13 +221,13 @@ public: TEST_ASSERT(callList.size() == 2); - ICommand::execute("inst2.theCommand1", *InfoLog); + NLMISC::ICommand::execute("inst2.theCommand1", *NLMISC::InfoLog); TEST_ASSERT(callList.size() == 3); TEST_ASSERT(callList[0] == "inst1.theCommand1"); TEST_ASSERT(callList[1] == "inst1.theCommand2"); TEST_ASSERT(callList[2] == "inst2.theCommand1"); - ICommand::execute("inst2.theCommand2", *InfoLog); + NLMISC::ICommand::execute("inst2.theCommand2", *NLMISC::InfoLog); TEST_ASSERT(callList.size() == 4); TEST_ASSERT(callList[0] == "inst1.theCommand1"); TEST_ASSERT(callList[1] == "inst1.theCommand2"); @@ -239,7 +239,7 @@ public: { delete t1; - ICommand::execute("inst1.theCommand2", *InfoLog); + NLMISC::ICommand::execute("inst1.theCommand2", *NLMISC::InfoLog); TEST_ASSERT(callList.size() == 4); TEST_ASSERT(callList[0] == "inst1.theCommand1"); TEST_ASSERT(callList[1] == "inst1.theCommand2"); diff --git a/code/nel/tools/nel_unit_test/ut_misc_config_file.h b/code/nel/tools/nel_unit_test/ut_misc_config_file.h index e3d092216..c8ab923f2 100644 --- a/code/nel/tools/nel_unit_test/ut_misc_config_file.h +++ b/code/nel/tools/nel_unit_test/ut_misc_config_file.h @@ -41,18 +41,18 @@ public: void setup() { - _OldPath = CPath::getCurrentPath(); - CPath::setCurrentPath(_WorkingPath.c_str()); + _OldPath = NLMISC::CPath::getCurrentPath(); + NLMISC::CPath::setCurrentPath(_WorkingPath.c_str()); } void tear_down() { - CPath::setCurrentPath(_OldPath.c_str()); + NLMISC::CPath::setCurrentPath(_OldPath.c_str()); } void configWithInclude() { - CConfigFile configFile; + NLMISC::CConfigFile configFile; TEST_THROWS_NOTHING(configFile.load(NEL_UNIT_BASE "ut_misc_files/cfg_with_include.cfg")); @@ -65,7 +65,7 @@ public: void configWithOptional() { - CConfigFile configFile; + NLMISC::CConfigFile configFile; TEST_THROWS_NOTHING(configFile.load(NEL_UNIT_BASE "ut_misc_files/cfg_with_optional.cfg")); @@ -79,7 +79,7 @@ public: void configWithDefine() { - CConfigFile configFile; + NLMISC::CConfigFile configFile; TEST_THROWS_NOTHING(configFile.load(NEL_UNIT_BASE "ut_misc_files/cfg_with_define.cfg")); @@ -90,12 +90,12 @@ public: TEST_ASSERT(configFile.getVarPtr("CfgMustExist") != NULL); } - class CMyDisplayer : public IDisplayer + class CMyDisplayer : public NLMISC::IDisplayer { public: vector Lines; - virtual void doDisplay( const CLog::TDisplayInfo& args, const char *message) + virtual void doDisplay( const NLMISC::CLog::TDisplayInfo& args, const char *message) { Lines.push_back(message); } @@ -105,11 +105,11 @@ public: { // override the warning channel to get the error on unclosed if CMyDisplayer warnings; - CLog logger; + NLMISC::CLog logger; logger.addDisplayer(&warnings); - CNLWarningOverride override(&logger); + NLMISC::CNLWarningOverride override(&logger); - CConfigFile configFile; + NLMISC::CConfigFile configFile; string fullName = NLMISC::CPath::getFullPath(NEL_UNIT_BASE "ut_misc_files/cfg_with_bad_test.cfg", false); @@ -139,11 +139,11 @@ public: void configIncludeAndOptional() { CMyDisplayer warnings; - CLog logger; + NLMISC::CLog logger; logger.addDisplayer(&warnings); - CNLWarningOverride override(&logger); + NLMISC::CNLWarningOverride override(&logger); - CConfigFile configFile; + NLMISC::CConfigFile configFile; string fullName = NLMISC::CPath::getFullPath(NEL_UNIT_BASE "ut_misc_files/cfg_with_include_and_optional.cfg", false); @@ -158,17 +158,17 @@ public: void reportErrorInSubFiles() { CMyDisplayer warnings; - CLog logger; + NLMISC::CLog logger; logger.addDisplayer(&warnings); - CNLWarningOverride override(&logger); + NLMISC::CNLWarningOverride override(&logger); - CConfigFile configFile; + NLMISC::CConfigFile configFile; string fullName = NLMISC::CPath::getFullPath(NEL_UNIT_BASE "ut_misc_files/cfg_with_error_main.cfg", false); string subfullName = NLMISC::CPath::getFullPath(NEL_UNIT_BASE "ut_misc_files/cfg_with_error.cfg", false); - TEST_THROWS(configFile.load(NEL_UNIT_BASE "ut_misc_files/cfg_with_error_main.cfg"), EParseError); + TEST_THROWS(configFile.load(NEL_UNIT_BASE "ut_misc_files/cfg_with_error_main.cfg"), NLMISC::EParseError); // check that we have error report with correct filename and line number TEST_ASSERT(warnings.Lines.size() == 1); diff --git a/code/nel/tools/nel_unit_test/ut_misc_file.h b/code/nel/tools/nel_unit_test/ut_misc_file.h index 5403b8202..79b93b914 100644 --- a/code/nel/tools/nel_unit_test/ut_misc_file.h +++ b/code/nel/tools/nel_unit_test/ut_misc_file.h @@ -20,7 +20,7 @@ #include #include -// Test suite for CFile behavior +// Test suite for NLMISC::CFile behavior struct CUTMiscFile : public Test::Suite { CUTMiscFile() diff --git a/code/nel/tools/nel_unit_test/ut_misc_pack_file.h b/code/nel/tools/nel_unit_test/ut_misc_pack_file.h index 3b9b3041b..616cd7d3b 100644 --- a/code/nel/tools/nel_unit_test/ut_misc_pack_file.h +++ b/code/nel/tools/nel_unit_test/ut_misc_pack_file.h @@ -55,31 +55,31 @@ public: void setup() { - _OldPath = CPath::getCurrentPath(); - CPath::setCurrentPath(_WorkingPath.c_str()); - string pathAfter = CPath::getCurrentPath(); + _OldPath = NLMISC::CPath::getCurrentPath(); + NLMISC::CPath::setCurrentPath(_WorkingPath.c_str()); + string pathAfter = NLMISC::CPath::getCurrentPath(); } void tear_down() { - CPath::setCurrentPath(_OldPath.c_str()); + NLMISC::CPath::setCurrentPath(_OldPath.c_str()); } void addBnp() { // add bnp file in the path and access to file inside - CPath::addSearchBigFile(NEL_UNIT_BASE "ut_misc_files/files.bnp", false, false); + NLMISC::CPath::addSearchBigFile(NEL_UNIT_BASE "ut_misc_files/files.bnp", false, false); } void loadFromBnp() { // lookup for the file - string filename = CPath::lookup("file1_in_bnp.txt", true, true, false); + string filename = NLMISC::CPath::lookup("file1_in_bnp.txt", true, true, false); TEST_ASSERT(filename == "files.bnp@file1_in_bnp.txt"); // read the first file content { - CIFile file1(filename); + NLMISC::CIFile file1(filename); string content1; content1.resize(file1.getFileSize()); file1.serialBuffer((uint8*)content1.data(), file1.getFileSize()); @@ -89,12 +89,12 @@ public: } // lookup for the 2nd file - filename = CPath::lookup("file2_in_bnp.txt", true, true, false); + filename = NLMISC::CPath::lookup("file2_in_bnp.txt", true, true, false); TEST_ASSERT(filename == "files.bnp@file2_in_bnp.txt"); { // read the second file content - CIFile file2(filename); + NLMISC::CIFile file2(filename); string content2; content2.resize(file2.getFileSize()); file2.serialBuffer((uint8*)content2.data(), file2.getFileSize()); @@ -107,18 +107,18 @@ public: void addXmlpack() { // add xml_pack file in the path and access to file inside - CPath::addSearchXmlpackFile(NEL_UNIT_BASE "ut_misc_files/xml_files/xml_files.xml_pack", false, false); + NLMISC::CPath::addSearchXmlpackFile(NEL_UNIT_BASE "ut_misc_files/xml_files/xml_files.xml_pack", false, false); } void loadFromXmlpack() { // lookup for the file - string filename = CPath::lookup("file1_in_xml_pack.xml", true, true, false); + string filename = NLMISC::CPath::lookup("file1_in_xml_pack.xml", true, true, false); TEST_ASSERT(filename == NEL_UNIT_BASE "ut_misc_files/xml_files/xml_files.xml_pack@@file1_in_xml_pack.xml"); // read the first file content { - CIFile file1(filename); + NLMISC::CIFile file1(filename); string content1; content1.resize(file1.getFileSize()); file1.serialBuffer((uint8*)content1.data(), file1.getFileSize()); @@ -129,12 +129,12 @@ public: } // lookup for the 2nd file - filename = CPath::lookup("file2_in_xml_pack.xml", true, true, false); + filename = NLMISC::CPath::lookup("file2_in_xml_pack.xml", true, true, false); TEST_ASSERT(filename == NEL_UNIT_BASE "ut_misc_files/xml_files/xml_files.xml_pack@@file2_in_xml_pack.xml"); { // read the second file content - CIFile file2(filename); + NLMISC::CIFile file2(filename); string content2; content2.resize(file2.getFileSize()); file2.serialBuffer((uint8*)content2.data(), file2.getFileSize()); @@ -150,7 +150,7 @@ public: //#ifdef WIN32 //_CrtCheckMemory(); //#endif - CPath::memoryCompress(); + NLMISC::CPath::memoryCompress(); //#ifdef WIN32 //_CrtCheckMemory(); //#endif @@ -170,7 +170,7 @@ public: void decompressMemory() { - CPath::memoryUncompress(); + NLMISC::CPath::memoryUncompress(); } void loadFromBnpUncompressed() @@ -191,30 +191,30 @@ public: // but the 'addSearchPath' or add xml pack must be done // at a higher discriminant directory -// CPath::addSearchXmlpackFile(NEL_UNIT_BASE "ut_misc_files/xml_files/same_subfolder_1/samename/samename.xml_pack", true, false, NULL); -// CPath::addSearchXmlpackFile(NEL_UNIT_BASE "ut_misc_files/xml_files/same_subfolder_2/samename/samename.xml_pack", true, false, NULL); - CPath::addSearchPath(NEL_UNIT_BASE "ut_misc_files/xml_files", true, false); +// NLMISC::CPath::addSearchXmlpackFile(NEL_UNIT_BASE "ut_misc_files/xml_files/same_subfolder_1/samename/samename.xml_pack", true, false, NULL); +// NLMISC::CPath::addSearchXmlpackFile(NEL_UNIT_BASE "ut_misc_files/xml_files/same_subfolder_2/samename/samename.xml_pack", true, false, NULL); + NLMISC::CPath::addSearchPath(NEL_UNIT_BASE "ut_misc_files/xml_files", true, false); // lookup for the files in first subdirectory - string filename = CPath::lookup("file1_in_sub_1.xml", true, true, false); + string filename = NLMISC::CPath::lookup("file1_in_sub_1.xml", true, true, false); TEST_ASSERT(filename == NEL_UNIT_BASE "ut_misc_files/xml_files/same_subfolder_1/samename/samename.xml_pack@@file1_in_sub_1.xml"); - filename = CPath::lookup("file2_in_sub_1.xml", true, true, false); + filename = NLMISC::CPath::lookup("file2_in_sub_1.xml", true, true, false); TEST_ASSERT(filename == NEL_UNIT_BASE "ut_misc_files/xml_files/same_subfolder_1/samename/samename.xml_pack@@file2_in_sub_1.xml"); // lookup for the files in the second subdirectory - filename = CPath::lookup("file1_in_sub_2.xml", true, true, false); + filename = NLMISC::CPath::lookup("file1_in_sub_2.xml", true, true, false); TEST_ASSERT(filename == NEL_UNIT_BASE "ut_misc_files/xml_files/same_subfolder_2/samename/samename.xml_pack@@file1_in_sub_2.xml"); - filename = CPath::lookup("file2_in_sub_2.xml", true, true, false); + filename = NLMISC::CPath::lookup("file2_in_sub_2.xml", true, true, false); TEST_ASSERT(filename == NEL_UNIT_BASE "ut_misc_files/xml_files/same_subfolder_2/samename/samename.xml_pack@@file2_in_sub_2.xml"); // read the file content of the first file in first pack - filename = CPath::lookup("file1_in_sub_1.xml", true, true, false); + filename = NLMISC::CPath::lookup("file1_in_sub_1.xml", true, true, false); // check that we can read the file modif date uint32 d = NLMISC::CFile::getFileModificationDate(filename); TEST_ASSERT(d != 0); { - CIFile file1(filename); + NLMISC::CIFile file1(filename); string content1; content1.resize(file1.getFileSize()); file1.serialBuffer((uint8*)content1.data(), file1.getFileSize()); @@ -225,10 +225,10 @@ public: } // read the file content of the second file in the second pack - filename = CPath::lookup("file2_in_sub_2.xml", true, true, false); + filename = NLMISC::CPath::lookup("file2_in_sub_2.xml", true, true, false); { // read the second file content - CIFile file2(filename); + NLMISC::CIFile file2(filename); string content2; content2.resize(file2.getFileSize()); file2.serialBuffer((uint8*)content2.data(), file2.getFileSize()); diff --git a/code/nel/tools/nel_unit_test/ut_misc_singleton.h b/code/nel/tools/nel_unit_test/ut_misc_singleton.h index 65caf6a4b..5b106eeaa 100644 --- a/code/nel/tools/nel_unit_test/ut_misc_singleton.h +++ b/code/nel/tools/nel_unit_test/ut_misc_singleton.h @@ -80,7 +80,7 @@ public: void createSingleton() { - TEST_ASSERT(CInstanceCounterManager::getInstance().getInstanceCounter("CSafeSingleton") == 0); + TEST_ASSERT(NLMISC::CInstanceCounterManager::getInstance().getInstanceCounter("CSafeSingleton") == 0); CSafeSingleton &ss = CSafeSingleton::getInstance(); TEST_ASSERT(NL_GET_INSTANCE_COUNTER(CSafeSingleton) == 1); @@ -106,7 +106,7 @@ public: /*void multiDllSingleton() { - TEST_ASSERT(CCommandRegistry::getInstance().exists("aDynLibCommand") == false); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().exists("aDynLibCommand") == false); CLibrary lib; if (lib.loadLibrary("dyn_lib_test", true, true, true) != true) @@ -115,7 +115,7 @@ public: return; } - TEST_ASSERT(CCommandRegistry::getInstance().isCommand("aDynLibCommand") == true); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().isCommand("aDynLibCommand") == true); IDynLibTest *libTest = dynamic_cast(lib.getNelLibraryInterface()); TEST_ASSERT(libTest != NULL); diff --git a/code/nel/tools/nel_unit_test/ut_misc_sstring.h b/code/nel/tools/nel_unit_test/ut_misc_sstring.h index b93585998..208560808 100644 --- a/code/nel/tools/nel_unit_test/ut_misc_sstring.h +++ b/code/nel/tools/nel_unit_test/ut_misc_sstring.h @@ -29,9 +29,9 @@ struct CUTMiscSString : public Test::Suite void testStrtok() { - CSString testLine(" a=b c (a=e b=c) \t\t c(a=e b=c) toto(bimbo(foo(bar(a=b))))"); + NLMISC::CSString testLine(" a=b c (a=e b=c) \t\t c(a=e b=c) toto(bimbo(foo(bar(a=b))))"); - CSString part; + NLMISC::CSString part; part = testLine.strtok(" \t", true, false); TEST_ASSERT(part == "a=b"); part = testLine.strtok(" \t", true, false); @@ -47,7 +47,7 @@ struct CUTMiscSString : public Test::Suite part = testLine.strtok(" \t=", true, false); TEST_ASSERT(part == "(bimbo(foo(bar(a=b))))"); part = part.stripBlockDelimiters(); - CSString part2 = part.strtok(" \t=", true, false); + NLMISC::CSString part2 = part.strtok(" \t=", true, false); TEST_ASSERT(part2 == "bimbo"); part2 = part.strtok(" \t=", true, false); TEST_ASSERT(part2 == "(foo(bar(a=b)))"); diff --git a/code/nel/tools/nel_unit_test/ut_misc_stream.h b/code/nel/tools/nel_unit_test/ut_misc_stream.h index 7196472c2..f3e1e3df3 100644 --- a/code/nel/tools/nel_unit_test/ut_misc_stream.h +++ b/code/nel/tools/nel_unit_test/ut_misc_stream.h @@ -21,7 +21,7 @@ #include // The following line is known to crash in a Ryzom service -CBitMemStream globalBms( false, 2048 ); // global to avoid reallocation +NLMISC::CBitMemStream globalBms( false, 2048 ); // global to avoid reallocation // Test suite for stream based classes // ! not complete at all at time of writing ! @@ -38,21 +38,21 @@ public: void preallocatedBitStream() { - CBitMemStream localBms( false, 2048 ); // global to avoid reallocation + NLMISC::CBitMemStream localBms( false, 2048 ); // global to avoid reallocation } void copyOnWrite() { // test the copy on write strategy in the mem stream (and derived) class. - // The point is to be able to copy a mem stream (e.g a CMessage) + // The point is to be able to copy a mem stream (e.g a NLNET::CMessage) // but to do not copy the stream buffer. // If more than one stream use the same buffer, any attempt to // modifye the buffer content while lead to a buffer duplication - CMemStream s1; - CMemStream s2; - CMemStream s3; + NLMISC::CMemStream s1; + NLMISC::CMemStream s2; + NLMISC::CMemStream s3; uint32 i = 1; @@ -94,7 +94,7 @@ public: // check that we can serialize with const stream or const object - CMemStream s1; + NLMISC::CMemStream s1; NLMISC::IStream &is1 = s1; const string str("toto"); @@ -120,7 +120,7 @@ public: is1.serial(i2); is1.serialEnum(e2); - const CMemStream &s2 = s1; + const NLMISC::CMemStream &s2 = s1; const NLMISC::IStream &is2 = s2; string str3; @@ -157,11 +157,11 @@ public: void memStreamSwap() { - CMemStream ms2; + NLMISC::CMemStream ms2; string s; { - CMemStream ms1; + NLMISC::CMemStream ms1; s = "foo1"; ms1.serial(s); diff --git a/code/nel/tools/nel_unit_test/ut_net.h b/code/nel/tools/nel_unit_test/ut_net.h index d50c8552d..4709ae7fd 100644 --- a/code/nel/tools/nel_unit_test/ut_net.h +++ b/code/nel/tools/nel_unit_test/ut_net.h @@ -19,8 +19,6 @@ #include -using namespace NLNET; - #include "ut_net_layer3.h" #include "ut_net_message.h" #include "ut_net_module.h" diff --git a/code/nel/tools/nel_unit_test/ut_net_layer3.h b/code/nel/tools/nel_unit_test/ut_net_layer3.h index 32ac8e669..42b365e9f 100644 --- a/code/nel/tools/nel_unit_test/ut_net_layer3.h +++ b/code/nel/tools/nel_unit_test/ut_net_layer3.h @@ -24,7 +24,7 @@ uint16 TestPort1 = 56000; uint NbTestReceived = 0; -CMessage msgoutExpectingAnswer0, msgoutSimple0, msgoutSimple50; +NLNET::CMessage msgoutExpectingAnswer0, msgoutSimple0, msgoutSimple50; // Data structure for messages struct TData @@ -44,9 +44,9 @@ struct TData }; // This callback must not take more than 10 ms -void cbTest( CMessage &msgin, TSockId from, CCallbackNetBase &netbase ) +void cbTest( NLNET::CMessage &msgin, NLNET::TSockId from, NLNET::CCallbackNetBase &netbase ) { - TTime before = CTime::getLocalTime(); + NLMISC::TTime before = NLMISC::CTime::getLocalTime(); // Read data from the message TData data; @@ -59,21 +59,21 @@ void cbTest( CMessage &msgin, TSockId from, CCallbackNetBase &netbase ) netbase.send( msgoutSimple0, from ); // Check that the duration is compatible with our timeout tests - TTime maxDuration; + NLMISC::TTime maxDuration; if ( msgin.getName() == "TEST_50" ) { - while ( CTime::getLocalTime() - before < 49 ); // wait + while ( NLMISC::CTime::getLocalTime() - before < 49 ); // wait maxDuration = 70; } else maxDuration = 10; - TTime actualDuration = CTime::getLocalTime() - before; + NLMISC::TTime actualDuration = NLMISC::CTime::getLocalTime() - before; if ( actualDuration > maxDuration ) nlerror( "The callback cbTest takes too long (%u) for %s, please fix the test", (uint)actualDuration, msgin.getName().c_str() ); } -static TCallbackItem CallbackArray[] = +static NLNET::TCallbackItem CallbackArray[] = { { "TEST_0", cbTest }, { "TEST_50", cbTest } @@ -124,12 +124,12 @@ public: msgoutSimple50.serial( data ); // Init connections - _Server = new CCallbackServer(); + _Server = new NLNET::CCallbackServer(); _Server->init( TestPort1 ); - _Server->addCallbackArray( CallbackArray, sizeof(CallbackArray)/sizeof(TCallbackItem) ); - _Client = new CCallbackClient(); - _Client->connect( CInetAddress( "localhost", TestPort1 ) ); - _Client->addCallbackArray( CallbackArray, sizeof(CallbackArray)/sizeof(TCallbackItem) ); + _Server->addCallbackArray( CallbackArray, sizeof(CallbackArray)/sizeof(NLNET::TCallbackItem) ); + _Client = new NLNET::CCallbackClient(); + _Client->connect( NLNET::CInetAddress( "localhost", TestPort1 ) ); + _Client->addCallbackArray( CallbackArray, sizeof(CallbackArray)/sizeof(NLNET::TCallbackItem) ); // TEST: Simple message transmission NbTestReceived = 0; @@ -138,7 +138,7 @@ public: { _Client->update(); _Server->update(); // legacy version - nlSleep( 50 ); + NLMISC::nlSleep( 50 ); } TEST_ASSERT( NbTestReceived == 2 ); // answer and reply @@ -153,7 +153,7 @@ public: _Server->update2( 0 ); // shortest time-out = ONE-SHOT mode TEST_ASSERT( (NbTestReceived == prevNbTestReceived) || (NbTestReceived == prevNbTestReceived + 1) ); - nlSleep( 10 ); + NLMISC::nlSleep( 10 ); } // TEST: GREEDY update mode on the receiver @@ -163,7 +163,7 @@ public: for ( uint i=0; i!=10; ++i ) // make sure all messages are flushed { _Client->update2(); - nlSleep( 10 ); + NLMISC::nlSleep( 10 ); } _Server->update2( -1 ); // receive all TEST_ASSERT( NbTestReceived == 20 ); @@ -175,7 +175,7 @@ public: for ( uint i=0; i!=10; ++i ) // make sure all messages are flushed { _Client->update2(); - nlSleep( 10 ); + NLMISC::nlSleep( 10 ); } while ( NbTestReceived < 20 ) { @@ -191,16 +191,16 @@ public: _Client->send( msgoutSimple0 ); _Client->send( msgoutSimple0 ); // send 2 messages at a time _Client->update2(); - TTime before = CTime::getLocalTime(); + NLMISC::TTime before = NLMISC::CTime::getLocalTime(); _Server->update2( -1, 30 ); - TTime duration = CTime::getLocalTime() - before; + NLMISC::TTime duration = NLMISC::CTime::getLocalTime() - before; TEST_ASSERT( duration >= 30 ); } } private: - CCallbackServer *_Server; - CCallbackClient *_Client; + NLNET::CCallbackServer *_Server; + NLNET::CCallbackClient *_Client; }; diff --git a/code/nel/tools/nel_unit_test/ut_net_message.h b/code/nel/tools/nel_unit_test/ut_net_message.h index 97900cd3f..8bb27786b 100644 --- a/code/nel/tools/nel_unit_test/ut_net_message.h +++ b/code/nel/tools/nel_unit_test/ut_net_message.h @@ -30,7 +30,7 @@ public: void lockSubMEssageWithLongName() { - CMessage master("BIG"); + NLNET::CMessage master("BIG"); // serial some stuff for (uint8 i=0; i<10; ++i) @@ -43,7 +43,7 @@ public: // serial 4 sub messages for (uint i=0; i<4; ++i) { - CMessage sub(toString("A_VERY_LONG_SUB_MESSAGE_NAME_%u", i)); + NLNET::CMessage sub(NLMISC::toString("A_VERY_LONG_SUB_MESSAGE_NAME_%u", i)); for (uint8 j=0; j #include -class CModuleType0 : public CModuleBase +class CModuleType0 : public NLNET::CModuleBase { public: uint PingCount; uint ResponseReceived; - set ModuleType0; + set ModuleType0; uint32 ModuleUpCalled; uint32 ModuleDownCalled; @@ -58,7 +58,7 @@ public: return "CModuleType0"; } - bool initModule(const TParsedCommandLine ¶m) + bool initModule(const NLNET::TParsedCommandLine ¶m) { bool ret = CModuleBase::initModule(param); if (param.getParam("FAIL") != NULL) @@ -84,7 +84,7 @@ public: { } - void onModuleUp(IModuleProxy *moduleProxy) + void onModuleUp(NLNET::IModuleProxy *moduleProxy) { ModuleUpCalled++; @@ -95,7 +95,7 @@ public: * module has been deleted OR has been no more accessible (due to * some gateway disconnection). */ - void onModuleDown(IModuleProxy *moduleProxy) + void onModuleDown(NLNET::IModuleProxy *moduleProxy) { ModuleDownCalled++; @@ -103,7 +103,7 @@ public: ModuleType0.erase(moduleProxy); } - bool onProcessModuleMessage(IModuleProxy *senderModuleProxy, const CMessage &message) + bool onProcessModuleMessage(NLNET::IModuleProxy *senderModuleProxy, const NLNET::CMessage &message) { ProcessMessageCalled++; @@ -114,17 +114,17 @@ public: } else if (message.getName() == "HELLO") { - CMessage ping("DEBUG_MOD_PING"); - senderModuleProxy->sendModuleMessage(this, CMessage(ping)); - senderModuleProxy->sendModuleMessage(this, CMessage(ping)); + NLNET::CMessage ping("DEBUG_MOD_PING"); + senderModuleProxy->sendModuleMessage(this, NLNET::CMessage(ping)); + senderModuleProxy->sendModuleMessage(this, NLNET::CMessage(ping)); { - CMessage resp; - resp.setType("HELLO_RESP", CMessage::Response); + NLNET::CMessage resp; + resp.setType("HELLO_RESP", NLNET::CMessage::Response); senderModuleProxy->sendModuleMessage(this, resp); } - senderModuleProxy->sendModuleMessage(this, CMessage(ping)); - senderModuleProxy->sendModuleMessage(this, CMessage(ping)); + senderModuleProxy->sendModuleMessage(this, NLNET::CMessage(ping)); + senderModuleProxy->sendModuleMessage(this, NLNET::CMessage(ping)); return true; } else if (message.getName() == "HELLO2") @@ -138,12 +138,12 @@ public: return false; } - void onModuleSecurityChange(IModuleProxy *moduleProxy) + void onModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) { SecurityUpdateCalled++; } - void onModuleSocketEvent(IModuleSocket *moduleSocket, IModule::TModuleSocketEvent eventType) + void onModuleSocketEvent(NLNET::IModuleSocket *moduleSocket, IModule::TModuleSocketEvent eventType) { } @@ -159,11 +159,11 @@ public: // use the first like me in the list nlassert(!ModuleType0.empty()); - TModuleProxyPtr proxy = *ModuleType0.begin(); + NLNET::TModuleProxyPtr proxy = *ModuleType0.begin(); - CMessage msg; - msg.setType("HELLO", CMessage::Request); - CMessage resp; + NLNET::CMessage msg; + msg.setType("HELLO", NLNET::CMessage::Request); + NLNET::CMessage resp; invokeModuleOperation(proxy, msg, resp); nlassert(resp.getName() == "HELLO_RESP"); @@ -183,11 +183,11 @@ public: // use the first like me in the list nlassert(!ModuleType0.empty()); - TModuleProxyPtr proxy = *ModuleType0.begin(); + NLNET::TModuleProxyPtr proxy = *ModuleType0.begin(); - CMessage msg; - msg.setType("HELLO2", CMessage::Request); - CMessage resp; + NLNET::CMessage msg; + msg.setType("HELLO2", NLNET::CMessage::Request); + NLNET::CMessage resp; try { @@ -225,12 +225,12 @@ enum TTestSecurityTypes }; // security type 1 data : contains host gateway name -struct TSecurityType1 : public TSecurityData +struct TSecurityType1 : public NLNET::TSecurityData { string SecurityGatewayName; TSecurityType1(const TCtorParam ¶m) - : TSecurityData(param) + : NLNET::TSecurityData(param) { } @@ -241,17 +241,17 @@ struct TSecurityType1 : public TSecurityData }; -NLMISC_REGISTER_OBJECT(TSecurityData, TSecurityType1, uint8, tst_type1); +NLMISC_REGISTER_OBJECT(NLNET::TSecurityData, TSecurityType1, uint8, tst_type1); // security type 2 data : contains host gateway name and a predefined integer value -struct TSecurityType2 : public TSecurityData +struct TSecurityType2 : public NLNET::TSecurityData { string SecurityGatewayName; uint32 IntegerValue; TSecurityType2(const TCtorParam ¶m) - : TSecurityData(param) + : NLNET::TSecurityData(param) { IntegerValue = 0x12345678; } @@ -263,16 +263,16 @@ struct TSecurityType2 : public TSecurityData } }; -NLMISC_REGISTER_OBJECT(TSecurityData, TSecurityType2, uint8, tst_type2); +NLMISC_REGISTER_OBJECT(NLNET::TSecurityData, TSecurityType2, uint8, tst_type2); // security type 3 data, same as type 1 -struct TSecurityType3 : public TSecurityData +struct TSecurityType3 : public NLNET::TSecurityData { string SecurityGatewayName; TSecurityType3(const TCtorParam ¶m) - : TSecurityData(param) + : NLNET::TSecurityData(param) { } @@ -282,15 +282,15 @@ struct TSecurityType3 : public TSecurityData } }; -NLMISC_REGISTER_OBJECT(TSecurityData, TSecurityType3, uint8, tst_type3); +NLMISC_REGISTER_OBJECT(NLNET::TSecurityData, TSecurityType3, uint8, tst_type3); // security type 4 data, same as type 1 but not registered -struct TSecurityType4 : public TSecurityData +struct TSecurityType4 : public NLNET::TSecurityData { string SecurityGatewayName; TSecurityType4(const TCtorParam ¶m) - : TSecurityData(param) + : NLNET::TSecurityData(param) { } @@ -304,19 +304,19 @@ struct TSecurityType4 : public TSecurityData * type 2 security to foreign module, * and that remove received type 1 security from foreign module */ -class CTestSecurity1 : public CGatewaySecurity +class CTestSecurity1 : public NLNET::CGatewaySecurity { public: CTestSecurity1(const TCtorParam ¶ms) - : CGatewaySecurity(params) + : NLNET::CGatewaySecurity(params) {} - virtual void onNewProxy(IModuleProxy *proxy) + virtual void onNewProxy(NLNET::IModuleProxy *proxy) { if (proxy->getGatewayRoute() == NULL) { // add a type 1 security - TSecurityType1 *st1 = new TSecurityType1(TSecurityData::TCtorParam(tst_type1)); + TSecurityType1 *st1 = new TSecurityType1(NLNET::TSecurityData::TCtorParam(tst_type1)); st1->SecurityGatewayName = _Gateway->getFullyQualifiedGatewayName(); setSecurityData(proxy, st1); @@ -325,7 +325,7 @@ public: { // remove any type 1 data and set a type 2 data removeSecurityData(proxy, tst_type1); - TSecurityType2 *st2 = new TSecurityType2(TSecurityData::TCtorParam(tst_type2)); + TSecurityType2 *st2 = new TSecurityType2(NLNET::TSecurityData::TCtorParam(tst_type2)); st2->SecurityGatewayName = _Gateway->getFullyQualifiedGatewayName(); setSecurityData(proxy, st2); @@ -334,13 +334,13 @@ public: forceSecurityUpdate(proxy); } - void onNewSecurityData(CGatewayRoute *from, IModuleProxy *proxy, TSecurityData *firstSecurityData) + void onNewSecurityData(NLNET::CGatewayRoute *from, NLNET::IModuleProxy *proxy, NLNET::TSecurityData *firstSecurityData) { // replace the complete security set replaceAllSecurityDatas(proxy, firstSecurityData); // remove any type 1 data and set a type 2 data removeSecurityData(proxy, tst_type1); - TSecurityType2 *st2 = new TSecurityType2(TSecurityData::TCtorParam(tst_type2)); + TSecurityType2 *st2 = new TSecurityType2(NLNET::TSecurityData::TCtorParam(tst_type2)); st2->SecurityGatewayName = _Gateway->getFullyQualifiedGatewayName(); setSecurityData(proxy, st2); @@ -350,13 +350,13 @@ public: virtual void onDelete() { - vector proxies; + vector proxies; _Gateway->getModuleProxyList(proxies); // remove any security data managed by this plug-in for (uint i=0; igetFirstSecurityData() != NULL) { bool update = false; @@ -369,34 +369,34 @@ public: } }; -NLMISC_REGISTER_OBJECT(CGatewaySecurity, CTestSecurity1, std::string, "TestSecurity1"); +NLMISC_REGISTER_OBJECT(NLNET::CGatewaySecurity, CTestSecurity1, std::string, "TestSecurity1"); /** a sample security plug-in that add type 3 and type 4 security data to local modules, */ -class CTestSecurity2 : public CGatewaySecurity +class CTestSecurity2 : public NLNET::CGatewaySecurity { public: CTestSecurity2(const TCtorParam ¶ms) - : CGatewaySecurity(params) + : NLNET::CGatewaySecurity(params) {} - virtual void onNewProxy(IModuleProxy *proxy) + virtual void onNewProxy(NLNET::IModuleProxy *proxy) { if (proxy->getGatewayRoute() == NULL) { // add a type 3 security - TSecurityType3 *st3 = new TSecurityType3(TSecurityData::TCtorParam(tst_type3)); + TSecurityType3 *st3 = new TSecurityType3(NLNET::TSecurityData::TCtorParam(tst_type3)); st3->SecurityGatewayName = _Gateway->getFullyQualifiedGatewayName(); setSecurityData(proxy, st3); // add a type 4 security - TSecurityType4 *st4 = new TSecurityType4(TSecurityData::TCtorParam(tst_type4)); + TSecurityType4 *st4 = new TSecurityType4(NLNET::TSecurityData::TCtorParam(tst_type4)); st4->SecurityGatewayName = _Gateway->getFullyQualifiedGatewayName(); setSecurityData(proxy, st4); forceSecurityUpdate(proxy); } } - void onNewSecurityData(CGatewayRoute *from, IModuleProxy *proxy, TSecurityData *firstSecurityData) + void onNewSecurityData(NLNET::CGatewayRoute *from, NLNET::IModuleProxy *proxy, NLNET::TSecurityData *firstSecurityData) { // replace the complete security set replaceAllSecurityDatas(proxy, firstSecurityData); @@ -404,13 +404,13 @@ public: virtual void onDelete() { - vector proxies; + vector proxies; _Gateway->getModuleProxyList(proxies); // remove any security data managed by this plug-in for (uint i=0; igetGatewayRoute() == NULL) { removeSecurityData(proxy, tst_type3); @@ -420,11 +420,11 @@ public: } } }; -NLMISC_REGISTER_OBJECT(CGatewaySecurity, CTestSecurity2, std::string, "TestSecurity2"); +NLMISC_REGISTER_OBJECT(NLNET::CGatewaySecurity, CTestSecurity2, std::string, "TestSecurity2"); // A module interceptor -class CInterceptor : public IModuleInterceptable +class CInterceptor : public NLNET::IModuleInterceptable { public: string Name; @@ -433,10 +433,10 @@ public: uint32 ProcessMessageCalled; uint32 SecurityUpdateCalled; - CInterceptor(IInterceptorRegistrar *registrar, const string &name) + CInterceptor(NLNET::IInterceptorRegistrar *registrar, const string &name) : Name(name) { - IModuleInterceptable::registerInterceptor(registrar), + NLNET::IModuleInterceptable::registerInterceptor(registrar), ModuleUpCalled = 0; ModuleDownCalled = 0; ProcessMessageCalled = 0; @@ -448,23 +448,23 @@ public: return Name; } - virtual void onModuleUp(IModuleProxy *moduleProxy) + virtual void onModuleUp(NLNET::IModuleProxy *moduleProxy) { ModuleUpCalled++; } - virtual void onModuleDown(IModuleProxy *moduleProxy) + virtual void onModuleDown(NLNET::IModuleProxy *moduleProxy) { ModuleDownCalled++; } - virtual bool onProcessModuleMessage(IModuleProxy *senderModuleProxy, const CMessage &message) + virtual bool onProcessModuleMessage(NLNET::IModuleProxy *senderModuleProxy, const NLNET::CMessage &message) { ProcessMessageCalled++; return false; } - virtual void onModuleSecurityChange(IModuleProxy *moduleProxy) + virtual void onModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) { SecurityUpdateCalled++; } @@ -479,7 +479,7 @@ class CUTNetModule : public Test::Suite public: // utility to look for a specified proxy in a vector of proxy // return true if the proxy if found - bool lookForModuleProxy(const vector proxList, const std::string &modName) + bool lookForModuleProxy(const vector proxList, const std::string &modName) { for (uint i=0; i proxList; + vector proxList; gw->getModuleProxyList(proxList); for (uint i=0; i(gw); + NLNET::IModule *gw = mm.createModule("StandardGateway", "gw", ""); + NLNET::IModule *mod = mm.createModule("ModuleType0", "mod", ""); + NLNET::IModuleGateway *gGw = dynamic_cast(gw); CModuleType0 *mod0 = dynamic_cast(mod); TEST_ASSERT(gGw != NULL); @@ -569,19 +569,19 @@ public: CInterceptor *inter1 = new CInterceptor(mod, "Inter1"); // plug the modules - cr.execute("gw.plug gw", InfoLog()); - cr.execute("mod.plug gw", InfoLog()); + cr.execute("gw.plug gw", NLMISC::InfoLog()); + cr.execute("mod.plug gw", NLMISC::InfoLog()); // update the network for (uint i=0; i<5; ++i) { mm.updateModules(); - nlSleep(40); + NLMISC::nlSleep(40); } // send a message to the module fro; the gateway - CMessage msg("foo"); - IModuleProxy *modProx = retrieveModuleProxy(gGw, "mod"); + NLNET::CMessage msg("foo"); + NLNET::IModuleProxy *modProx = retrieveModuleProxy(gGw, "mod"); TEST_ASSERT(modProx != NULL); modProx->sendModuleMessage(gw, msg); @@ -589,21 +589,21 @@ public: for (uint i=0; i<5; ++i) { mm.updateModules(); - nlSleep(40); + NLMISC::nlSleep(40); } // check the module manifest TEST_ASSERT(modProx->getModuleManifest() == "CModuleType0 Inter0 Inter1"); // unplug the modules - cr.execute("gw.unplug gw", InfoLog()); - cr.execute("mod.unplug gw", InfoLog()); + cr.execute("gw.unplug gw", NLMISC::InfoLog()); + cr.execute("mod.unplug gw", NLMISC::InfoLog()); // update the network for (uint i=0; i<5; ++i) { mm.updateModules(); - nlSleep(40); + NLMISC::nlSleep(40); } // now check that all methods have been called in that @@ -649,43 +649,43 @@ public: // - IModuleManager &mm = IModuleManager::getInstance(); - CCommandRegistry &cr = CCommandRegistry::getInstance(); + NLNET::IModuleManager &mm = NLNET::IModuleManager::getInstance(); + NLMISC::CCommandRegistry &cr = NLMISC::CCommandRegistry::getInstance(); // create the modules - IModule *gw1 = mm.createModule("StandardGateway", "gw1", ""); - IModule *gw2 = mm.createModule("StandardGateway", "gw2", ""); - IModuleGateway *gGw1 = dynamic_cast(gw1); - IModuleGateway *gGw2 = dynamic_cast(gw2); + NLNET::IModule *gw1 = mm.createModule("StandardGateway", "gw1", ""); + NLNET::IModule *gw2 = mm.createModule("StandardGateway", "gw2", ""); + NLNET::IModuleGateway *gGw1 = dynamic_cast(gw1); + NLNET::IModuleGateway *gGw2 = dynamic_cast(gw2); // plug gateway in themselves - cr.execute("gw1.plug gw1", InfoLog()); - cr.execute("gw2.plug gw2", InfoLog()); + cr.execute("gw1.plug gw1", NLMISC::InfoLog()); + cr.execute("gw2.plug gw2", NLMISC::InfoLog()); // create the client transport - cr.execute("gw1.transportAdd L3Client l3c", InfoLog()); - cr.execute("gw1.transportCmd l3c(retryInterval=1)", InfoLog()); - cr.execute("gw1.transportCmd l3c(connect addr=localhost:8062)", InfoLog()); + cr.execute("gw1.transportAdd L3Client l3c", NLMISC::InfoLog()); + cr.execute("gw1.transportCmd l3c(retryInterval=1)", NLMISC::InfoLog()); + cr.execute("gw1.transportCmd l3c(connect addr=localhost:8062)", NLMISC::InfoLog()); // update the network for (uint i=0; i<5; ++i) { mm.updateModules(); - nlSleep(40); + NLMISC::nlSleep(40); } TEST_ASSERT(retrieveModuleProxy(gGw1, "gw2") == NULL); TEST_ASSERT(retrieveModuleProxy(gGw1, "gw2") == NULL); // open the server - cr.execute("gw2.transportAdd L3Server l3s", InfoLog()); - cr.execute("gw2.transportCmd l3s(open port=8062)", InfoLog()); + cr.execute("gw2.transportAdd L3Server l3s", NLMISC::InfoLog()); + cr.execute("gw2.transportCmd l3s(open port=8062)", NLMISC::InfoLog()); // update the network (give more time because we must cover the Layer3 client reconnection timer) for (uint i=0; i<40; ++i) { mm.updateModules(); - nlSleep(50); + NLMISC::nlSleep(50); } // check module connectivity @@ -693,14 +693,14 @@ public: TEST_ASSERT(retrieveModuleProxy(gGw1, "gw2") != NULL); // exchange some message - cr.execute("gw1.sendPing "+gw2->getModuleFullyQualifiedName(), InfoLog()); - cr.execute("gw2.sendPing "+gw1->getModuleFullyQualifiedName(), InfoLog()); + cr.execute("gw1.sendPing "+gw2->getModuleFullyQualifiedName(), NLMISC::InfoLog()); + cr.execute("gw2.sendPing "+gw1->getModuleFullyQualifiedName(), NLMISC::InfoLog()); // update the network for (uint i=0; i<5; ++i) { mm.updateModules(); - nlSleep(40); + NLMISC::nlSleep(40); } // check the ping counter @@ -709,16 +709,16 @@ public: // flood a little with ping for (uint i=0; i<100; ++i) - cr.execute("gw1.sendPing "+gw2->getModuleFullyQualifiedName(), InfoLog()); + cr.execute("gw1.sendPing "+gw2->getModuleFullyQualifiedName(), NLMISC::InfoLog()); // close the server - cr.execute("gw2.transportCmd l3s(close)", InfoLog()); + cr.execute("gw2.transportCmd l3s(close)", NLMISC::InfoLog()); // update the network for (uint i=0; i<5; ++i) { mm.updateModules(); - nlSleep(40); + NLMISC::nlSleep(40); } // test no connectivity @@ -726,13 +726,13 @@ public: TEST_ASSERT(retrieveModuleProxy(gGw2, "gw1") == NULL); // re-open the server - cr.execute("gw2.transportCmd l3s(open port=8062)", InfoLog()); + cr.execute("gw2.transportCmd l3s(open port=8062)", NLMISC::InfoLog()); // update the network (give more time because we must cover the Layer3 client reconnection timer) for (uint i=0; i<40; ++i) { mm.updateModules(); - nlSleep(50); + NLMISC::nlSleep(50); } // check module connectivity @@ -740,14 +740,14 @@ public: TEST_ASSERT(retrieveModuleProxy(gGw2, "gw1") != NULL); // exchange some message - cr.execute("gw1.sendPing "+gw2->getModuleFullyQualifiedName(), InfoLog()); - cr.execute("gw2.sendPing "+gw1->getModuleFullyQualifiedName(), InfoLog()); + cr.execute("gw1.sendPing "+gw2->getModuleFullyQualifiedName(), NLMISC::InfoLog()); + cr.execute("gw2.sendPing "+gw1->getModuleFullyQualifiedName(), NLMISC::InfoLog()); // update the network for (uint i=0; i<5; ++i) { mm.updateModules(); - nlSleep(40); + NLMISC::nlSleep(40); } // check the ping counter @@ -764,24 +764,24 @@ public: // check that the synchronous messaging is working // by using module task - IModuleManager &mm = IModuleManager::getInstance(); - CCommandRegistry &cr = CCommandRegistry::getInstance(); + NLNET::IModuleManager &mm = NLNET::IModuleManager::getInstance(); + NLMISC::CCommandRegistry &cr = NLMISC::CCommandRegistry::getInstance(); // create the modules - IModule *gw = mm.createModule("StandardGateway", "gw", ""); - IModule *m1 = mm.createModule("ModuleType0", "m1", ""); - IModule *m2 = mm.createModule("ModuleType0", "m2", ""); + NLNET::IModule *gw = mm.createModule("StandardGateway", "gw", ""); + NLNET::IModule *m1 = mm.createModule("ModuleType0", "m1", ""); + NLNET::IModule *m2 = mm.createModule("ModuleType0", "m2", ""); // plug the two modules in the gateway - cr.execute("m1.plug gw", InfoLog()); - cr.execute("m2.plug gw", InfoLog()); + cr.execute("m1.plug gw", NLMISC::InfoLog()); + cr.execute("m2.plug gw", NLMISC::InfoLog()); // update the network for (uint i=0; i<15; ++i) { mm.updateModules(); - nlSleep(40); + NLMISC::nlSleep(40); } CModuleType0 *mod1 = dynamic_cast(m1); @@ -793,7 +793,7 @@ public: for (uint i=0; i<5; ++i) { mm.updateModules(); - nlSleep(40); + NLMISC::nlSleep(40); } @@ -807,7 +807,7 @@ public: for (uint i=0; i<5; ++i) { mm.updateModules(); - nlSleep(40); + NLMISC::nlSleep(40); } @@ -847,10 +847,10 @@ public: // We also plug the security plug-in 1 and then we check that // we have the correct security data - IModuleManager &mm = IModuleManager::getInstance(); - CCommandRegistry &cr = CCommandRegistry::getInstance(); + NLNET::IModuleManager &mm = NLNET::IModuleManager::getInstance(); + NLMISC::CCommandRegistry &cr = NLMISC::CCommandRegistry::getInstance(); - IModule *gw1, *gw2, *gw3; + NLNET::IModule *gw1, *gw2, *gw3; // create the modules gw1 = mm.createModule("StandardGateway", "gw1", ""); @@ -862,7 +862,7 @@ public: TEST_ASSERT(gw3 != NULL); // plug gateway in themselves - IModuleSocket *sGw1, *sGw2, *sGw3; + NLNET::IModuleSocket *sGw1, *sGw2, *sGw3; sGw1 = mm.getModuleSocket("gw1"); sGw2 = mm.getModuleSocket("gw2"); sGw3 = mm.getModuleSocket("gw3"); @@ -878,27 +878,27 @@ public: string cmd; // create security plug-in cmd = "gw2.securityCreate TestSecurity1"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); // create the transports cmd = "gw1.transportAdd L3Client l3c"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "gw2.transportAdd L3Client l3c"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "gw2.transportAdd L3Server l3s"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "gw3.transportAdd L3Server l3s"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); // connect transport cmd = "gw2.transportCmd l3s(open port=8062)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "gw3.transportCmd l3s(open port=8063)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "gw1.transportCmd l3c(connect addr=localhost:8062)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "gw2.transportCmd l3c(connect addr=localhost:8063)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); for (uint retry = 0; retry < 2; ++retry) @@ -907,27 +907,27 @@ public: { // recreate the security plug-in cmd = "gw2.securityCreate TestSecurity1"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); } // update the network for (uint i=0; i<15; ++i) { mm.updateModules(); - nlSleep(40); + NLMISC::nlSleep(40); } - IModuleGateway *gGw1, *gGw2, *gGw3; - gGw1 = dynamic_cast(gw1); + NLNET::IModuleGateway *gGw1, *gGw2, *gGw3; + gGw1 = dynamic_cast(gw1); TEST_ASSERT(gGw1 != NULL); - gGw2 = dynamic_cast(gw2); + gGw2 = dynamic_cast(gw2); TEST_ASSERT(gGw2 != NULL); - gGw3 = dynamic_cast(gw3); + gGw3 = dynamic_cast(gw3); TEST_ASSERT(gGw3 != NULL); // check security data - IModuleProxy *proxGw1_1, *proxGw2_1, *proxGw3_1; - IModuleProxy *proxGw1_2, *proxGw2_2, *proxGw3_2; - IModuleProxy *proxGw1_3, *proxGw2_3, *proxGw3_3; + NLNET::IModuleProxy *proxGw1_1, *proxGw2_1, *proxGw3_1; + NLNET::IModuleProxy *proxGw1_2, *proxGw2_2, *proxGw3_2; + NLNET::IModuleProxy *proxGw1_3, *proxGw2_3, *proxGw3_3; proxGw1_1 = retrieveModuleProxy(gGw1, "gw1"); proxGw2_1 = retrieveModuleProxy(gGw1, "gw2"); @@ -949,7 +949,7 @@ public: TEST_ASSERT(proxGw2_3 != NULL); TEST_ASSERT(proxGw3_3 != NULL); - const TSecurityData *ms; + const NLNET::TSecurityData *ms; const TSecurityType1 *st1; const TSecurityType2 *st2; @@ -1022,13 +1022,13 @@ public: // remove the security plug-in // create security plug-in cmd = "gw2.securityRemove"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); // update the network for (uint i=0; i<15; ++i) { mm.updateModules(); - nlSleep(40); + NLMISC::nlSleep(40); } ms = proxGw1_1->getFirstSecurityData(); @@ -1054,30 +1054,30 @@ public: // part 2 // create the security plug-in cmd = "gw2.securityCreate TestSecurity1"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "gw1.securityCreate TestSecurity2"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); // update the network for (uint i=0; i<15; ++i) { mm.updateModules(); - nlSleep(40); + NLMISC::nlSleep(40); } - IModuleGateway *gGw1, *gGw2, *gGw3; - gGw1 = dynamic_cast(gw1); + NLNET::IModuleGateway *gGw1, *gGw2, *gGw3; + gGw1 = dynamic_cast(gw1); TEST_ASSERT(gGw1 != NULL); - gGw2 = dynamic_cast(gw2); + gGw2 = dynamic_cast(gw2); TEST_ASSERT(gGw2 != NULL); - gGw3 = dynamic_cast(gw3); + gGw3 = dynamic_cast(gw3); TEST_ASSERT(gGw3 != NULL); // check security data - IModuleProxy *proxGw1_1, *proxGw2_1, *proxGw3_1; - IModuleProxy *proxGw1_2, *proxGw2_2, *proxGw3_2; - IModuleProxy *proxGw1_3, *proxGw2_3, *proxGw3_3; + NLNET::IModuleProxy *proxGw1_1, *proxGw2_1, *proxGw3_1; + NLNET::IModuleProxy *proxGw1_2, *proxGw2_2, *proxGw3_2; + NLNET::IModuleProxy *proxGw1_3, *proxGw2_3, *proxGw3_3; proxGw1_1 = retrieveModuleProxy(gGw1, "gw1"); proxGw2_1 = retrieveModuleProxy(gGw1, "gw2"); @@ -1099,7 +1099,7 @@ public: TEST_ASSERT(proxGw2_3 != NULL); TEST_ASSERT(proxGw3_3 != NULL); - const TSecurityData *ms; + const NLNET::TSecurityData *ms; // const TSecurityType1 *st1; // const TSecurityType2 *st2; @@ -1121,7 +1121,7 @@ public: TEST_ASSERT(ms != NULL); ms = proxGw1_2->findSecurityData(0xff); TEST_ASSERT(ms != NULL); - TEST_ASSERT(dynamic_cast(ms) != NULL); + TEST_ASSERT(dynamic_cast(ms) != NULL); ms = proxGw1_3->findSecurityData(tst_type1); TEST_ASSERT(ms == NULL); @@ -1131,7 +1131,7 @@ public: TEST_ASSERT(ms != NULL); ms = proxGw1_3->findSecurityData(0xff); TEST_ASSERT(ms != NULL); - TEST_ASSERT(dynamic_cast(ms) != NULL); + TEST_ASSERT(dynamic_cast(ms) != NULL); ms = proxGw2_1->findSecurityData(tst_type1); @@ -1192,13 +1192,13 @@ public: // remove the security plug-in // create security plug-in cmd = "gw1.securityRemove"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); // update the network for (uint i=0; i<15; ++i) { mm.updateModules(); - nlSleep(40); + NLMISC::nlSleep(40); } ms = proxGw1_1->findSecurityData(tst_type1); @@ -1318,10 +1318,10 @@ public: // \-----------------------------------------------------/ // - IModuleManager &mm = IModuleManager::getInstance(); - CCommandRegistry &cr = CCommandRegistry::getInstance(); + NLNET::IModuleManager &mm = NLNET::IModuleManager::getInstance(); + NLMISC::CCommandRegistry &cr = NLMISC::CCommandRegistry::getInstance(); - IModule *gw1, *gw2, *gw3, *gw4; + NLNET::IModule *gw1, *gw2, *gw3, *gw4; // create the modules gw1 = mm.createModule("StandardGateway", "gw1", ""); @@ -1335,7 +1335,7 @@ public: TEST_ASSERT(gw4 != NULL); // plug gateway into themselves - IModuleSocket *sGw1, *sGw2, *sGw3, *sGw4; + NLNET::IModuleSocket *sGw1, *sGw2, *sGw3, *sGw4; sGw1 = mm.getModuleSocket("gw1"); sGw2 = mm.getModuleSocket("gw2"); sGw3 = mm.getModuleSocket("gw3"); @@ -1354,56 +1354,56 @@ public: string cmd; // create the transports cmd = "gw1.transportAdd L3Client l3c"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "gw1.transportAdd L3Server l3s"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "gw2.transportAdd L3Client l3c"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "gw2.transportAdd L3Server l3s"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "gw3.transportAdd L3Client l3c"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "gw3.transportAdd L3Server l3s"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "gw4.transportAdd L3Server l3s"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); // connect transport cmd = "gw1.transportCmd l3s(open port=8061)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "gw2.transportCmd l3s(open port=8062)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "gw3.transportCmd l3s(open port=8063)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "gw4.transportCmd l3s(open port=8064)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "gw1.transportCmd l3c(connect addr=localhost:8062)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "gw2.transportCmd l3c(connect addr=localhost:8063)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "gw3.transportCmd l3c(connect addr=localhost:8064)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); // update the network for (uint i=0; i<15; ++i) { mm.updateModules(); - nlSleep(40); + NLMISC::nlSleep(40); } // check the modules list // ok, now, check that each gateways know the gateway it must know - IModuleGateway *gGw1, *gGw2, *gGw3, *gGw4; - gGw1 = dynamic_cast(gw1); + NLNET::IModuleGateway *gGw1, *gGw2, *gGw3, *gGw4; + gGw1 = dynamic_cast(gw1); TEST_ASSERT(gGw1 != NULL); - gGw2 = dynamic_cast(gw2); + gGw2 = dynamic_cast(gw2); TEST_ASSERT(gGw2 != NULL); - gGw3 = dynamic_cast(gw3); + gGw3 = dynamic_cast(gw3); TEST_ASSERT(gGw3 != NULL); - gGw4 = dynamic_cast(gw4); + gGw4 = dynamic_cast(gw4); TEST_ASSERT(gGw4 != NULL); - vector proxList; + vector proxList; gGw1->getModuleProxyList(proxList); TEST_ASSERT(proxList.size() == 4); proxList.clear(); @@ -1417,10 +1417,10 @@ public: TEST_ASSERT(proxList.size() == 4); // check the distance - IModuleProxy *gw1_1Prox, *gw1_2Prox, *gw1_3Prox, *gw1_4Prox; - IModuleProxy *gw2_1Prox, *gw2_2Prox, *gw2_3Prox, *gw2_4Prox; - IModuleProxy *gw3_1Prox, *gw3_2Prox, *gw3_3Prox, *gw3_4Prox; - IModuleProxy *gw4_1Prox, *gw4_2Prox, *gw4_3Prox, *gw4_4Prox; + NLNET::IModuleProxy *gw1_1Prox, *gw1_2Prox, *gw1_3Prox, *gw1_4Prox; + NLNET::IModuleProxy *gw2_1Prox, *gw2_2Prox, *gw2_3Prox, *gw2_4Prox; + NLNET::IModuleProxy *gw3_1Prox, *gw3_2Prox, *gw3_3Prox, *gw3_4Prox; + NLNET::IModuleProxy *gw4_1Prox, *gw4_2Prox, *gw4_3Prox, *gw4_4Prox; gw1_1Prox = retrieveModuleProxy(gGw1, "gw1"); TEST_ASSERT(gw1_1Prox != NULL); @@ -1476,13 +1476,13 @@ public: // now, connect gw3 to gw1 cmd = "gw3.transportCmd l3c(connect addr=localhost:8061)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); // update the network for (uint i=0; i<7; ++i) { mm.updateModules(); - nlSleep(100); + NLMISC::nlSleep(100); } // check module list @@ -1554,13 +1554,13 @@ public: // close gw3 to gw1 cmd = "gw3.transportCmd l3c(close connId=1)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); // update the network for (uint i=0; i<7; ++i) { mm.updateModules(); - nlSleep(100); + NLMISC::nlSleep(100); } // check module list @@ -1632,13 +1632,13 @@ public: // make a double connection from gw1 to gw2 cmd = "gw1.transportCmd l3c(connect addr=localhost:8062)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); // update the network for (uint i=0; i<7; ++i) { mm.updateModules(); - nlSleep(100); + NLMISC::nlSleep(100); } // check module list @@ -1737,10 +1737,10 @@ public: // Switching OFF the firewall should disclose all modules, // switching ON then must throw an exception - IModuleManager &mm = IModuleManager::getInstance(); - CCommandRegistry &cr = CCommandRegistry::getInstance(); + NLNET::IModuleManager &mm = NLNET::IModuleManager::getInstance(); + NLMISC::CCommandRegistry &cr = NLMISC::CCommandRegistry::getInstance(); - IModule *peer1, *peer2, *master, *other; + NLNET::IModule *peer1, *peer2, *master, *other; // create the modules peer1 = mm.createModule("StandardGateway", "peer1", ""); @@ -1754,7 +1754,7 @@ public: TEST_ASSERT(other != NULL); // plug gateway in themselves - IModuleSocket *sPeer1, *sPeer2, *sMaster, *sOther; + NLNET::IModuleSocket *sPeer1, *sPeer2, *sMaster, *sOther; sPeer1 = mm.getModuleSocket("peer1"); sPeer2 = mm.getModuleSocket("peer2"); sMaster = mm.getModuleSocket("master"); @@ -1773,49 +1773,49 @@ public: string cmd; // create the transports cmd = "peer1.transportAdd L3Client l3c"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "peer2.transportAdd L3Client l3c"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "master.transportAdd L3Server l3s1"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "master.transportAdd L3Server l3s2"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "other.transportAdd L3Client l3c"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); // Set option and connect transport cmd = "master.transportOptions l3s1(Firewalled)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "master.transportCmd l3s1(open port=8060)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "master.transportCmd l3s2(open port=8061)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "peer1.transportCmd l3c(connect addr=localhost:8060)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "peer2.transportCmd l3c(connect addr=localhost:8060)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "other.transportCmd l3c(connect addr=localhost:8061)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); // d'ho ! all done, now let's run some loop of update for (uint i=0; i<7; ++i) { mm.updateModules(); - nlSleep(100); + NLMISC::nlSleep(100); } // ok, now, check that each gateway only knows the gateway it must know - IModuleGateway *gPeer1, *gPeer2, *gMaster, *gOther; - gPeer1 = dynamic_cast(peer1); + NLNET::IModuleGateway *gPeer1, *gPeer2, *gMaster, *gOther; + gPeer1 = dynamic_cast(peer1); TEST_ASSERT(gPeer1 != NULL); - gPeer2 = dynamic_cast(peer2); + gPeer2 = dynamic_cast(peer2); TEST_ASSERT(gPeer2 != NULL); - gMaster = dynamic_cast(master); + gMaster = dynamic_cast(master); TEST_ASSERT(gMaster != NULL); - gOther = dynamic_cast(other); + gOther = dynamic_cast(other); TEST_ASSERT(gOther != NULL); - vector proxList; + vector proxList; gPeer1->getModuleProxyList(proxList); TEST_ASSERT(proxList.size() == 1); TEST_ASSERT(lookForModuleProxy(proxList, "peer1")); @@ -1844,18 +1844,18 @@ public: // now send the debug 'PING' message from 'other' to 'peer1', and a message from 'master' to 'peer2' { - CMessage ping("DEBUG_MOD_PING"); + NLNET::CMessage ping("DEBUG_MOD_PING"); // retrieve peer1 proxy from other - IModuleProxy *peer1Prox = retrieveModuleProxy(gMaster, "peer1"); + NLNET::IModuleProxy *peer1Prox = retrieveModuleProxy(gMaster, "peer1"); TEST_ASSERT(peer1Prox != NULL); peer1Prox->sendModuleMessage(master, ping); } { - CMessage ping("DEBUG_MOD_PING"); + NLNET::CMessage ping("DEBUG_MOD_PING"); // retrieve peer1 proxy from other - IModuleProxy *peer2Prox = retrieveModuleProxy(gOther, "peer2"); + NLNET::IModuleProxy *peer2Prox = retrieveModuleProxy(gOther, "peer2"); TEST_ASSERT(peer2Prox != NULL); peer2Prox->sendModuleMessage(other, ping); } @@ -1864,7 +1864,7 @@ public: for (uint i=0; i<7; ++i) { mm.updateModules(); - nlSleep(100); + NLMISC::nlSleep(100); } // check new proxy table and ping counter @@ -1900,13 +1900,13 @@ public: // now, remove firewall mode cmd = "master.transportOptions l3s1()"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); // update the network for (uint i=0; i<7; ++i) { mm.updateModules(); - nlSleep(100); + NLMISC::nlSleep(100); } // check new proxy table and ping counter @@ -1945,7 +1945,7 @@ public: // no try reactivate firewall mode with active route cmd = "master.transportOptions l3s1(Firewalled)"; - TEST_THROWS(cr.execute(cmd, InfoLog()), IModuleGateway::EGatewayFirewallBreak); + TEST_THROWS(cr.execute(cmd, NLMISC::InfoLog()), NLNET::IModuleGateway::EGatewayFirewallBreak); // cleanup @@ -1977,10 +1977,10 @@ public: // // When switching the PeerInvisible option to OFF, peer1 and peer2 must see each other - IModuleManager &mm = IModuleManager::getInstance(); - CCommandRegistry &cr = CCommandRegistry::getInstance(); + NLNET::IModuleManager &mm = NLNET::IModuleManager::getInstance(); + NLMISC::CCommandRegistry &cr = NLMISC::CCommandRegistry::getInstance(); - IModule *peer1, *peer2, *master, *other; + NLNET::IModule *peer1, *peer2, *master, *other; // create the modules peer1 = mm.createModule("StandardGateway", "peer1", ""); @@ -1994,7 +1994,7 @@ public: TEST_ASSERT(other != NULL); // plug gateway in themselves - IModuleSocket *sPeer1, *sPeer2, *sMaster, *sOther; + NLNET::IModuleSocket *sPeer1, *sPeer2, *sMaster, *sOther; sPeer1 = mm.getModuleSocket("peer1"); sPeer2 = mm.getModuleSocket("peer2"); sMaster = mm.getModuleSocket("master"); @@ -2013,49 +2013,49 @@ public: string cmd; // create the transports cmd = "peer1.transportAdd L3Client l3c"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "peer2.transportAdd L3Client l3c"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "master.transportAdd L3Server l3s1"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "master.transportAdd L3Server l3s2"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "other.transportAdd L3Client l3c"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); // Set option and connect transport cmd = "master.transportOptions l3s1(PeerInvisible)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "master.transportCmd l3s1(open port=8060)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "master.transportCmd l3s2(open port=8061)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "peer1.transportCmd l3c(connect addr=localhost:8060)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "peer2.transportCmd l3c(connect addr=localhost:8060)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "other.transportCmd l3c(connect addr=localhost:8061)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); // d'ho ! all done, now let's run some loop of update for (uint i=0; i<7; ++i) { mm.updateModules(); - nlSleep(100); + NLMISC::nlSleep(100); } // ok, now, check that each gateway only knows the gateway it must know - IModuleGateway *gPeer1, *gPeer2, *gMaster, *gOther; - gPeer1 = dynamic_cast(peer1); + NLNET::IModuleGateway *gPeer1, *gPeer2, *gMaster, *gOther; + gPeer1 = dynamic_cast(peer1); TEST_ASSERT(gPeer1 != NULL); - gPeer2 = dynamic_cast(peer2); + gPeer2 = dynamic_cast(peer2); TEST_ASSERT(gPeer2 != NULL); - gMaster = dynamic_cast(master); + gMaster = dynamic_cast(master); TEST_ASSERT(gMaster != NULL); - gOther = dynamic_cast(other); + gOther = dynamic_cast(other); TEST_ASSERT(gOther != NULL); - vector proxList; + vector proxList; gPeer1->getModuleProxyList(proxList); TEST_ASSERT(proxList.size() == 3); TEST_ASSERT(lookForModuleProxy(proxList, "peer1")); @@ -2087,13 +2087,13 @@ public: // now, remove the 'PeerInvisible' options cmd = "master.transportOptions l3s1()"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); // update the network for (uint i=0; i<7; ++i) { mm.updateModules(); - nlSleep(100); + NLMISC::nlSleep(100); } // check new proxy table @@ -2131,13 +2131,13 @@ public: // now, re set the 'PeerInvisible' options cmd = "master.transportOptions l3s1(PeerInvisible)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); // update the network for (uint i=0; i<7; ++i) { mm.updateModules(); - nlSleep(100); + NLMISC::nlSleep(100); } // check new proxy table @@ -2181,13 +2181,13 @@ public: void gwPlugUnplug() { // check that multiple plug/unplug operations work well - IModuleManager &mm = IModuleManager::getInstance(); - CCommandRegistry &cr = CCommandRegistry::getInstance(); + NLNET::IModuleManager &mm = NLNET::IModuleManager::getInstance(); + NLMISC::CCommandRegistry &cr = NLMISC::CCommandRegistry::getInstance(); - IModule *mod = mm.createModule("StandardGateway", "gw", ""); + NLNET::IModule *mod = mm.createModule("StandardGateway", "gw", ""); TEST_ASSERT(mod != NULL); - IModuleSocket *socket = mm.getModuleSocket("gw"); + NLNET::IModuleSocket *socket = mm.getModuleSocket("gw"); TEST_ASSERT(socket != NULL); mod->plugModule(socket); mod->unplugModule(socket); @@ -2195,7 +2195,7 @@ public: mod->unplugModule(socket); mod->plugModule(socket); - std::vector result; + std::vector result; socket->getModuleList(result); TEST_ASSERT(result.size() == 1); @@ -2206,13 +2206,13 @@ public: void uniqueNameGenerator() { - IModuleManager &mm = IModuleManager::getInstance(); - CCommandRegistry &cr = CCommandRegistry::getInstance(); + NLNET::IModuleManager &mm = NLNET::IModuleManager::getInstance(); + NLMISC::CCommandRegistry &cr = NLMISC::CCommandRegistry::getInstance(); mm.setUniqueNameRoot("foo"); // create a simple module - IModule *mod = mm.createModule("ModuleType0", "mod", ""); + NLNET::IModule *mod = mm.createModule("ModuleType0", "mod", ""); TEST_ASSERT(mod != NULL); TEST_ASSERT(mod->getModuleFullyQualifiedName() == "foo:mod"); mm.deleteModule(mod); @@ -2229,22 +2229,22 @@ public: void localMessageQueing() { - IModuleManager &mm = IModuleManager::getInstance(); - CCommandRegistry &cr = CCommandRegistry::getInstance(); + NLNET::IModuleManager &mm = NLNET::IModuleManager::getInstance(); + NLMISC::CCommandRegistry &cr = NLMISC::CCommandRegistry::getInstance(); - IModule *mods = mm.createModule("StandardGateway", "gws", ""); + NLNET::IModule *mods = mm.createModule("StandardGateway", "gws", ""); TEST_ASSERT(mods != NULL); - IModuleGateway *gws = dynamic_cast(mods); + NLNET::IModuleGateway *gws = dynamic_cast(mods); TEST_ASSERT(gws != NULL); // get the socket interface of the gateway - IModuleSocket *socketGws = mm.getModuleSocket("gws"); + NLNET::IModuleSocket *socketGws = mm.getModuleSocket("gws"); TEST_ASSERT(socketGws != NULL); // create two modules that will communicate localy - IModule *m1= mm.createModule("ModuleType0", "m1", ""); + NLNET::IModule *m1= mm.createModule("ModuleType0", "m1", ""); TEST_ASSERT(m1!= NULL); - IModule *m2= mm.createModule("ModuleAsync", "m2", ""); + NLNET::IModule *m2= mm.createModule("ModuleAsync", "m2", ""); TEST_ASSERT(m2!= NULL); m1->plugModule(socketGws); @@ -2254,26 +2254,26 @@ public: for (uint i=0; i<4; ++i) { mm.updateModules(); - nlSleep(50); + NLMISC::nlSleep(50); } // retrieve module proxy and send one ping to each other - vector proxiesC; + vector proxiesC; gws->getModuleProxyList(proxiesC); TEST_ASSERT(proxiesC.size() == 2); TEST_ASSERT(lookForModuleProxy(proxiesC, "m2")); - IModuleProxy *pm2 = retrieveModuleProxy(gws, "m2"); + NLNET::IModuleProxy *pm2 = retrieveModuleProxy(gws, "m2"); TEST_ASSERT(pm2 != NULL); - CMessage aMessage("DEBUG_MOD_PING"); + NLNET::CMessage aMessage("DEBUG_MOD_PING"); pm2->sendModuleMessage(m1, aMessage); proxiesC.clear(); gws->getModuleProxyList(proxiesC); TEST_ASSERT(proxiesC.size() == 2); TEST_ASSERT(lookForModuleProxy(proxiesC, "m1")); - IModuleProxy *pm1 = retrieveModuleProxy(gws, "m1"); + NLNET::IModuleProxy *pm1 = retrieveModuleProxy(gws, "m1"); TEST_ASSERT(pm1 != NULL); - aMessage = CMessage("DEBUG_MOD_PING"); + aMessage = NLNET::CMessage("DEBUG_MOD_PING"); pm1->sendModuleMessage(m2, aMessage); // check received ping count @@ -2288,7 +2288,7 @@ public: for (uint i=0; i<4; ++i) { mm.updateModules(); - nlSleep(50); + NLMISC::nlSleep(50); } // check received ping count @@ -2299,7 +2299,7 @@ public: for (uint i=0; i<4; ++i) { mm.updateModules(); - nlSleep(50); + NLMISC::nlSleep(50); } // check received ping count @@ -2315,38 +2315,38 @@ public: void moduleMessaging() { - IModuleManager &mm = IModuleManager::getInstance(); - CCommandRegistry &cr = CCommandRegistry::getInstance(); + NLNET::IModuleManager &mm = NLNET::IModuleManager::getInstance(); + NLMISC::CCommandRegistry &cr = NLMISC::CCommandRegistry::getInstance(); // create two gateway an connect them, plug the gateway on themselves and send a message - IModule *mods = mm.createModule("StandardGateway", "gws", ""); + NLNET::IModule *mods = mm.createModule("StandardGateway", "gws", ""); TEST_ASSERT(mods != NULL); - IModuleGateway *gws = dynamic_cast(mods); + NLNET::IModuleGateway *gws = dynamic_cast(mods); TEST_ASSERT(gws != NULL); // plug the module in itself before opening connection - IModuleSocket *socketGws = mm.getModuleSocket("gws"); + NLNET::IModuleSocket *socketGws = mm.getModuleSocket("gws"); TEST_ASSERT(socketGws != NULL); mods->plugModule(socketGws); // add transport for server mode string cmd = "gws.transportAdd L3Server l3s"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "gws.transportCmd l3s(open port=6185)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); - IModule *modc = mm.createModule("StandardGateway", "gwc", ""); + NLNET::IModule *modc = mm.createModule("StandardGateway", "gwc", ""); TEST_ASSERT(modc != NULL); - IModuleGateway *gwc = dynamic_cast(modc); + NLNET::IModuleGateway *gwc = dynamic_cast(modc); TEST_ASSERT(gwc != NULL); // add transport for client mode cmd = "gwc.transportAdd L3Client l3c"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "gwc.transportCmd l3c(connect addr=localhost:6185)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); // plug the module in itself before opening connection - IModuleSocket *socketGwc = mm.getModuleSocket("gwc"); + NLNET::IModuleSocket *socketGwc = mm.getModuleSocket("gwc"); TEST_ASSERT(socketGwc != NULL); modc->plugModule(socketGwc); @@ -2354,30 +2354,30 @@ public: for (uint i=0; i<4; ++i) { mm.updateModules(); - nlSleep(100); + NLMISC::nlSleep(100); } // send a message from gws to gwc using the proxy // First, get the proxy for the client (must be the second one) - vector proxiesS; + vector proxiesS; gws->getModuleProxyList(proxiesS); TEST_ASSERT(proxiesS.size() == 2); TEST_ASSERT(lookForModuleProxy(proxiesS, "gwc")); - CMessage aMessage("DEBUG_MOD_PING"); + NLNET::CMessage aMessage("DEBUG_MOD_PING"); proxiesS[1]->sendModuleMessage(mods, aMessage); // update the gateways... for (uint i=0; i<4; ++i) { mm.updateModules(); - nlSleep(100); + NLMISC::nlSleep(100); } // check that the ping has been received TEST_ASSERT(gwc->getReceivedPingCount() == 1); // send two crossing messages simultaneously - vector proxiesC; + vector proxiesC; gwc->getModuleProxyList(proxiesC); TEST_ASSERT(proxiesC.size() == 2); TEST_ASSERT(lookForModuleProxy(proxiesC, "gws")); @@ -2388,7 +2388,7 @@ public: for (uint i=0; i<4; ++i) { mm.updateModules(); - nlSleep(100); + NLMISC::nlSleep(100); } // check that the ping has been received TEST_ASSERT(gwc->getReceivedPingCount() == 2); @@ -2401,7 +2401,7 @@ public: for (uint i=0; i<4; ++i) { mm.updateModules(); - nlSleep(100); + NLMISC::nlSleep(100); } // check that the ping has been received TEST_ASSERT(gwc->getReceivedPingCount() == 3); @@ -2416,24 +2416,24 @@ public: void moduleDisclosure() { - IModuleManager &mm = IModuleManager::getInstance(); - CCommandRegistry &cr = CCommandRegistry::getInstance(); + NLNET::IModuleManager &mm = NLNET::IModuleManager::getInstance(); + NLMISC::CCommandRegistry &cr = NLMISC::CCommandRegistry::getInstance(); - IModule *mods = mm.createModule("StandardGateway", "gws", ""); + NLNET::IModule *mods = mm.createModule("StandardGateway", "gws", ""); TEST_ASSERT(mods != NULL); - IModuleGateway *gws = dynamic_cast(mods); + NLNET::IModuleGateway *gws = dynamic_cast(mods); TEST_ASSERT(gws != NULL); TEST_ASSERT(gws->getProxyCount() == 0); // plug the module in itself before opening connection - IModuleSocket *socketGws = mm.getModuleSocket("gws"); + NLNET::IModuleSocket *socketGws = mm.getModuleSocket("gws"); TEST_ASSERT(socketGws != NULL); mods->plugModule(socketGws); // now, there must be one proxy in the gateway TEST_ASSERT(gws->getProxyCount() == 1); - vector proxies; + vector proxies; gws->getModuleProxyList(proxies); TEST_ASSERT(proxies.size() == 1); TEST_ASSERT(proxies[0]->getGatewayRoute() == NULL); @@ -2441,24 +2441,24 @@ public: // add transport for server mode string cmd = "gws.transportAdd L3Server l3s"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "gws.transportCmd l3s(open port=6185)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); - IModule *modc = mm.createModule("StandardGateway", "gwc", ""); + NLNET::IModule *modc = mm.createModule("StandardGateway", "gwc", ""); TEST_ASSERT(modc != NULL); - IModuleGateway *gwc = dynamic_cast(modc); + NLNET::IModuleGateway *gwc = dynamic_cast(modc); TEST_ASSERT(gwc != NULL); // add transport for client mode cmd = "gwc.transportAdd L3Client l3c"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "gwc.transportCmd l3c(connect addr=localhost:6185)"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); for (uint i=0; i<5; ++i) { mm.updateModules(); - nlSleep(100); + NLMISC::nlSleep(100); } // The server must have not changed @@ -2473,7 +2473,7 @@ public: TEST_ASSERT(proxies[0]->getModuleName().find("gws") == proxies[0]->getModuleName().size() - 3); // plug the client module in itself after opening connection - IModuleSocket *socketGwc = mm.getModuleSocket("gwc"); + NLNET::IModuleSocket *socketGwc = mm.getModuleSocket("gwc"); TEST_ASSERT(socketGwc != NULL); modc->plugModule(socketGwc); @@ -2481,7 +2481,7 @@ public: for (uint i=0; i<4; ++i) { mm.updateModules(); - nlSleep(100); + NLMISC::nlSleep(100); } // The server must have now the two modules @@ -2510,7 +2510,7 @@ public: for (uint i=0; i<4; ++i) { - nlSleep(100); + NLMISC::nlSleep(100); mm.updateModules(); } @@ -2532,9 +2532,9 @@ public: // Dump the module state cmd = "gws.dump"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); cmd = "gwc.dump"; - TEST_ASSERT(cr.execute(cmd, InfoLog())); + TEST_ASSERT(cr.execute(cmd, NLMISC::InfoLog())); // cleanup modules mm.deleteModule(mods); @@ -2545,32 +2545,32 @@ public: void connectGateways() { - IModuleManager &mm = IModuleManager::getInstance(); + NLNET::IModuleManager &mm = NLNET::IModuleManager::getInstance(); - IModule *mods = mm.createModule("StandardGateway", "gws", ""); + NLNET::IModule *mods = mm.createModule("StandardGateway", "gws", ""); TEST_ASSERT(mods != NULL); - IModuleGateway *gws = dynamic_cast(mods); + NLNET::IModuleGateway *gws = dynamic_cast(mods); TEST_ASSERT(gws != NULL); // add transport for server mode string cmd = "gws.transportAdd L3Server l3s"; - TEST_ASSERT(CCommandRegistry::getInstance().execute(cmd, InfoLog())); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().execute(cmd, NLMISC::InfoLog())); cmd = "gws.transportCmd l3s(open port=6185)"; - TEST_ASSERT(CCommandRegistry::getInstance().execute(cmd, InfoLog())); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().execute(cmd, NLMISC::InfoLog())); - IModule *modc1 = mm.createModule("StandardGateway", "gwc1", ""); + NLNET::IModule *modc1 = mm.createModule("StandardGateway", "gwc1", ""); TEST_ASSERT(modc1 != NULL); - IModuleGateway *gwc1 = dynamic_cast(modc1); + NLNET::IModuleGateway *gwc1 = dynamic_cast(modc1); TEST_ASSERT(gwc1 != NULL); // add transport for client mode cmd = "gwc1.transportAdd L3Client l3c"; - TEST_ASSERT(CCommandRegistry::getInstance().execute(cmd, InfoLog())); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().execute(cmd, NLMISC::InfoLog())); cmd = "gwc1.transportCmd l3c(connect addr=localhost:6185)"; - TEST_ASSERT(CCommandRegistry::getInstance().execute(cmd, InfoLog())); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().execute(cmd, NLMISC::InfoLog())); for (uint i=0; i<4; ++i) { mm.updateModules(); - nlSleep(100); + NLMISC::nlSleep(100); } TEST_ASSERT(gws->getRouteCount() == 1); @@ -2579,24 +2579,24 @@ public: // do a second connect to the server for stress // add transport for client mode cmd = "gwc1.transportCmd l3c(connect addr=localhost:6185)"; - TEST_ASSERT(CCommandRegistry::getInstance().execute(cmd, InfoLog())); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().execute(cmd, NLMISC::InfoLog())); // create third gateway - IModule *modc2 = mm.createModule("StandardGateway", "gwc2", ""); + NLNET::IModule *modc2 = mm.createModule("StandardGateway", "gwc2", ""); TEST_ASSERT(modc2 != NULL); - IModuleGateway *gwc2 = dynamic_cast(modc2); + NLNET::IModuleGateway *gwc2 = dynamic_cast(modc2); TEST_ASSERT(gwc2 != NULL); // add transport for client mode cmd = "gwc2.transportAdd L3Client l3c"; - TEST_ASSERT(CCommandRegistry::getInstance().execute(cmd, InfoLog())); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().execute(cmd, NLMISC::InfoLog())); cmd = "gwc2.transportCmd l3c(connect addr=localhost:6185)"; - TEST_ASSERT(CCommandRegistry::getInstance().execute(cmd, InfoLog())); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().execute(cmd, NLMISC::InfoLog())); // update the module to update the network callback client and server for (uint i=0; i<4; ++i) { // give some time to the listen and receiver thread to do there jobs - nlSleep(100); + NLMISC::nlSleep(100); mm.updateModules(); } @@ -2606,11 +2606,11 @@ public: // dump the gateways state cmd = "gws.dump"; - TEST_ASSERT(CCommandRegistry::getInstance().execute(cmd, InfoLog())); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().execute(cmd, NLMISC::InfoLog())); cmd = "gwc1.dump"; - TEST_ASSERT(CCommandRegistry::getInstance().execute(cmd, InfoLog())); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().execute(cmd, NLMISC::InfoLog())); cmd = "gwc2.dump"; - TEST_ASSERT(CCommandRegistry::getInstance().execute(cmd, InfoLog())); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().execute(cmd, NLMISC::InfoLog())); // cleanup the modules mm.deleteModule(mods); @@ -2623,42 +2623,42 @@ public: void gatewayTransportManagement() { - IModuleManager &mm = IModuleManager::getInstance(); + NLNET::IModuleManager &mm = NLNET::IModuleManager::getInstance(); // create a gateway module - IModule *mod = mm.createModule("StandardGateway", "gw", ""); + NLNET::IModule *mod = mm.createModule("StandardGateway", "gw", ""); TEST_ASSERT(mod != NULL); - IModuleGateway *gw = dynamic_cast(mod); + NLNET::IModuleGateway *gw = dynamic_cast(mod); TEST_ASSERT(gw != NULL); // Create a layer 3 server transport // send a transport creation command string cmd = "gw.transportAdd L3Server l3s"; - TEST_ASSERT(CCommandRegistry::getInstance().execute(cmd, InfoLog())); - IGatewayTransport *transportL3s = gw->getGatewayTransport("l3s"); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().execute(cmd, NLMISC::InfoLog())); + NLNET::IGatewayTransport *transportL3s = gw->getGatewayTransport("l3s"); TEST_ASSERT(transportL3s != NULL); // send a transport command cmd = "gw.transportCmd l3s(open port=6185)"; - TEST_ASSERT(CCommandRegistry::getInstance().execute(cmd, InfoLog())); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().execute(cmd, NLMISC::InfoLog())); // Create a layer 3 client transport // send a transport creation command cmd = "gw.transportAdd L3Client l3c"; - TEST_ASSERT(CCommandRegistry::getInstance().execute(cmd, InfoLog())); - IGatewayTransport *transportL3c = gw->getGatewayTransport("l3c"); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().execute(cmd, NLMISC::InfoLog())); + NLNET::IGatewayTransport *transportL3c = gw->getGatewayTransport("l3c"); TEST_ASSERT(transportL3c != NULL); // send a transport command cmd = "gw.transportCmd l3c(connect addr=localhost:6185)"; - TEST_ASSERT(CCommandRegistry::getInstance().execute(cmd, InfoLog())); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().execute(cmd, NLMISC::InfoLog())); // update the module to update the network callback client and server for (uint i=0; i<4; ++i) { // give some time to the listen and receiver thread to do there jobs mm.updateModules(); - nlSleep(100); + NLMISC::nlSleep(100); } TEST_ASSERT(transportL3s->getRouteCount() == 1); @@ -2667,22 +2667,22 @@ public: // dump the gateways state cmd = "gw.dump"; - TEST_ASSERT(CCommandRegistry::getInstance().execute(cmd, InfoLog())); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().execute(cmd, NLMISC::InfoLog())); // close all connections cmd = "gw.transportCmd l3s(close)"; - TEST_ASSERT(CCommandRegistry::getInstance().execute(cmd, InfoLog())); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().execute(cmd, NLMISC::InfoLog())); cmd = "gw.transportCmd l3c(close connId=0)"; - TEST_ASSERT(CCommandRegistry::getInstance().execute(cmd, InfoLog())); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().execute(cmd, NLMISC::InfoLog())); // update the module to update the network callback client and server for (uint i=0; i<4; ++i) { // give some time to the listen and receiver thread to do there jobs mm.updateModules(); - nlSleep(100); + NLMISC::nlSleep(100); } TEST_ASSERT(transportL3s->getRouteCount() == 0); @@ -2691,9 +2691,9 @@ public: // Remove transports cmd = "gw.transportRemove l3s"; - TEST_ASSERT(CCommandRegistry::getInstance().execute(cmd, InfoLog())); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().execute(cmd, NLMISC::InfoLog())); cmd = "gw.transportRemove l3c"; - TEST_ASSERT(CCommandRegistry::getInstance().execute(cmd, InfoLog())); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().execute(cmd, NLMISC::InfoLog())); TEST_ASSERT(gw->getGatewayTransport("l3c") == NULL); TEST_ASSERT(gw->getGatewayTransport("l3s") == NULL); @@ -2704,7 +2704,7 @@ public: { // give some time to the listen and receiver thread to do there jobs mm.updateModules(); - nlSleep(100); + NLMISC::nlSleep(100); } // cleanup the modules @@ -2717,37 +2717,37 @@ public: string cmd; // load a library cmd = "moduleManager.loadLibrary net_module_lib_test/net_module_lib_test"; - TEST_ASSERT(CCommandRegistry::getInstance().execute(cmd, InfoLog())); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().execute(cmd, NLMISC::InfoLog())); // dump the module state cmd = "moduleManager.dump"; - TEST_ASSERT(CCommandRegistry::getInstance().execute(cmd, InfoLog())); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().execute(cmd, NLMISC::InfoLog())); // create a module cmd = "moduleManager.createModule ModuleType1 AModuleName"; - TEST_ASSERT(CCommandRegistry::getInstance().execute(cmd, InfoLog())); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().execute(cmd, NLMISC::InfoLog())); // dump the module state cmd = "moduleManager.dump"; - TEST_ASSERT(CCommandRegistry::getInstance().execute(cmd, InfoLog())); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().execute(cmd, NLMISC::InfoLog())); // delete the module cmd = "moduleManager.deleteModule AModuleName"; - TEST_ASSERT(CCommandRegistry::getInstance().execute(cmd, InfoLog())); + TEST_ASSERT(NLMISC::CCommandRegistry::getInstance().execute(cmd, NLMISC::InfoLog())); }*/ void plugLocalGateway() { - IModuleManager &mm = IModuleManager::getInstance(); + NLNET::IModuleManager &mm = NLNET::IModuleManager::getInstance(); - IModule *gateway1 = mm.createModule("LocalGateway", "g1", ""); + NLNET::IModule *gateway1 = mm.createModule("LocalGateway", "g1", ""); TEST_ASSERT(gateway1 != NULL); - IModule *gateway2 = mm.createModule("LocalGateway", "g2", ""); + NLNET::IModule *gateway2 = mm.createModule("LocalGateway", "g2", ""); TEST_ASSERT(gateway2 != NULL); - IModuleSocket *socket1 = mm.getModuleSocket("g1"); + NLNET::IModuleSocket *socket1 = mm.getModuleSocket("g1"); TEST_ASSERT(socket1 != NULL); - IModuleSocket *socket2 = mm.getModuleSocket("g2"); + NLNET::IModuleSocket *socket2 = mm.getModuleSocket("g2"); TEST_ASSERT(socket2 != NULL); gateway1->plugModule(socket1); gateway1->plugModule(socket2); @@ -2762,17 +2762,17 @@ public: void createLocalGateway() { - IModuleManager &mm = IModuleManager::getInstance(); + NLNET::IModuleManager &mm = NLNET::IModuleManager::getInstance(); - IModule *gateway = mm.createModule("LocalGateway", "localGateway", ""); + NLNET::IModule *gateway = mm.createModule("LocalGateway", "localGateway", ""); TEST_ASSERT(gateway != NULL); - IModule *mod1 = mm.createModule("ModuleType0", "plugged1", ""); + NLNET::IModule *mod1 = mm.createModule("ModuleType0", "plugged1", ""); TEST_ASSERT(mod1 != NULL); - IModule *mod2 = mm.createModule("ModuleType0", "plugged2", ""); + NLNET::IModule *mod2 = mm.createModule("ModuleType0", "plugged2", ""); TEST_ASSERT(mod2 != NULL); - IModuleSocket *socket = mm.getModuleSocket("localGateway"); + NLNET::IModuleSocket *socket = mm.getModuleSocket("localGateway"); TEST_ASSERT(socket != NULL); mod1->plugModule(socket); mod2->plugModule(socket); @@ -2804,9 +2804,9 @@ public: void failedInit() { - IModuleManager &mm = IModuleManager::getInstance(); + NLNET::IModuleManager &mm = NLNET::IModuleManager::getInstance(); - IModule *module = mm.createModule("ModuleType0", "FailingInit", "FAIL"); + NLNET::IModule *module = mm.createModule("ModuleType0", "FailingInit", "FAIL"); TEST_ASSERT(module == NULL); } @@ -2864,7 +2864,7 @@ public: void localModuleFactory() { - IModuleManager &mm = IModuleManager::getInstance(); + NLNET::IModuleManager &mm = NLNET::IModuleManager::getInstance(); vector moduleList; mm.getAvailableModuleClassList(moduleList); @@ -2878,7 +2878,7 @@ public: void testModuleInitInfoBadParsing() { - TParsedCommandLine mif; + NLNET::TParsedCommandLine mif; string paramString = " a=1 b=2 ( b=1) "; TEST_ASSERT(!mif.parseParamList(paramString)); @@ -2904,7 +2904,7 @@ public: void testModuleInitInfoQuering() { - TParsedCommandLine mif; + NLNET::TParsedCommandLine mif; string paramString = " a=1 b=2 sub ( y=22 zzzz=12 subsub (g=\"bean in box\" z=2) ) "; @@ -2924,7 +2924,7 @@ public: void testModuleInitInfoParsing() { - TParsedCommandLine mif; + NLNET::TParsedCommandLine mif; string paramString = "a"; TEST_ASSERT(mif.parseParamList(paramString));