| // base64codec.cpp | // base64codec.cpp | ||||
| // Copyright (C) 2006 - 2009 MicroNeil Research Corporation | |||||
| // See base64codec.hpp | |||||
| //typedef vector<char> base64codec_buffer; | |||||
| //typedef vector<char>::iterator base64codec_iterator; | |||||
| // | |||||
| // Copyright (C) 2004-2020 MicroNeil Research Corporation. | |||||
| // | |||||
| // This software is released under the MIT license. See LICENSE.TXT. | |||||
| #include "base64codec.hpp" | #include "base64codec.hpp" | ||||
| // base64codec.hpp | // base64codec.hpp | ||||
| // Copyright (C) 2006 - 2009 MicroNeil Research Corporation | |||||
| // BASE64 encoder decoder objects extending vectors | |||||
| // | |||||
| // Copyright (C) 2004-2020 MicroNeil Research Corporation. | |||||
| // | |||||
| // This software is released under the MIT license. See LICENSE.TXT. | |||||
| // | |||||
| // Tools for encoding and decoding base64 data. | |||||
| #pragma once | #pragma once | ||||
| // configuration.cpp | // configuration.cpp | ||||
| // | // | ||||
| // (C) 2006 - 2009 MicroNeil Research Corporation. | |||||
| // Copyright (C) 2004-2020 MicroNeil Research Corporation. | |||||
| // | // | ||||
| // This program is part of the MicroNeil Research Open Library Project. For | |||||
| // more information go to http://www.microneil.com/OpenLibrary/index.html | |||||
| // This software is released under the MIT license. See LICENSE.TXT. | |||||
| // | // | ||||
| // This program is free software; you can redistribute it and/or modify it | |||||
| // under the terms of the GNU General Public License as published by the | |||||
| // Free Software Foundation; either version 2 of the License, or (at your | |||||
| // option) any later version. | |||||
| // | |||||
| // This program is distributed in the hope that it will be useful, but WITHOUT | |||||
| // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||||
| // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |||||
| // more details. | |||||
| // | |||||
| // You should have received a copy of the GNU General Public License along with | |||||
| // this program; if not, write to the Free Software Foundation, Inc., 59 Temple | |||||
| // Place, Suite 330, Boston, MA 02111-1307 USA | |||||
| // See configuration.hpp for details | |||||
| // Tools for efficiently parsing XML, usually in configuration files. | |||||
| #include "configuration.hpp" | #include "configuration.hpp" | ||||
| // configuration.hpp | // configuration.hpp | ||||
| // | // | ||||
| // (C) 2006 - 2009 MicroNeil Research Corporation. | |||||
| // See http://www.codedweller.com for details. | |||||
| // | |||||
| // This program is free software; you can redistribute it and/or modify it | |||||
| // under the terms of the GNU General Public License as published by the | |||||
| // Free Software Foundation; either version 2 of the License, or (at your | |||||
| // option) any later version. | |||||
| // | |||||
| // This program is distributed in the hope that it will be useful, but WITHOUT | |||||
| // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||||
| // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |||||
| // more details. | |||||
| // | |||||
| // You should have received a copy of the GNU General Public License along with | |||||
| // this program; if not, write to the Free Software Foundation, Inc., 59 Temple | |||||
| // Place, Suite 330, Boston, MA 02111-1307 USA | |||||
| // Copyright (C) 2004-2020 MicroNeil Research Corporation. | |||||
| // | // | ||||
| // This software is released under the MIT license. See LICENSE.TXT. | |||||
| // What about this ============================================================= | // What about this ============================================================= | ||||
| // The configuration module provides a platform for reading configuration files | // The configuration module provides a platform for reading configuration files | ||||
| // (or string data) containing well-formed xml and mapping that data to program | // (or string data) containing well-formed xml and mapping that data to program | ||||
| // variables. | // variables. | ||||
| // | |||||
| // The idea is to provide the ability for an object or application to provide | // The idea is to provide the ability for an object or application to provide | ||||
| // a modular "configuration" object that models a hierarchical collection of | // a modular "configuration" object that models a hierarchical collection of | ||||
| // "settings" that can be represented easily in code and in xml. | // "settings" that can be represented easily in code and in xml. |
| // faults.hpp | // faults.hpp | ||||
| // | // | ||||
| // Copyright (C) MicroNeil Research Corporation 2009 | |||||
| // This file is part of the CodeDweller library. | |||||
| // See www.codedweller.com for details. | |||||
| // Copyright (C) 2004-2020 MicroNeil Research Corporation. | |||||
| // | |||||
| // This software is released under the MIT license. See LICENSE.TXT. | |||||
| // | // | ||||
| // Faults and Checks are classes we can use in place of assert() to handle | // Faults and Checks are classes we can use in place of assert() to handle | ||||
| // unreasonable or necessary conditions in our code. They are constructed with | // unreasonable or necessary conditions in our code. They are constructed with |
| // histogram.hpp | // histogram.hpp | ||||
| // Copyright (C) 2006 - 2009 MicroNeil Research Corporation | |||||
| // Class to capture a histogram of events using a <set> | |||||
| // | |||||
| // Copyright (C) 2004-2020 MicroNeil Research Corporation. | |||||
| // | |||||
| // This software is released under the MIT license. See LICENSE.TXT. | |||||
| #pragma once | #pragma once | ||||
| // MANGLER.CPP | // MANGLER.CPP | ||||
| // | // | ||||
| // (C) 1984-2020 MicroNeil Research Corporation | |||||
| // Copyright (C) 2004-2020 MicroNeil Research Corporation. | |||||
| // | |||||
| // This software is released under the MIT license. See LICENSE.TXT. | |||||
| // | |||||
| // Derived from Version 1 of Mangler Encryption Algorythm, 1984. | // Derived from Version 1 of Mangler Encryption Algorythm, 1984. | ||||
| // Derived from Version 2 of Mangler Encryption Algorythm, 1998. | // Derived from Version 2 of Mangler Encryption Algorythm, 1998. | ||||
| // | // | ||||
| // 20021008 _M | |||||
| // Found and corrected range bug in ChaosDriver(void) where | |||||
| // ~Position might access a location outside the fill. Replaced | |||||
| // ~Position with Position^0xff which has the intended effect. | |||||
| // 20020119 _M Version 3.0 | |||||
| // | |||||
| // Mangler encryption engine object. | // Mangler encryption engine object. | ||||
| // Using new optimized chaos driver for uniformity experiments. | // Using new optimized chaos driver for uniformity experiments. | ||||
| // Important in this experiment is proof of highest possible entropy. | // Important in this experiment is proof of highest possible entropy. |
| // MANGLER.HPP | // MANGLER.HPP | ||||
| // | // | ||||
| // (C) 1984-2020 MicroNeil Research Corporation | |||||
| // Copyright (C) 2004-2020 MicroNeil Research Corporation. | |||||
| // | |||||
| // This software is released under the MIT license. See LICENSE.TXT. | |||||
| // | |||||
| // Derived from Version 1 of Mangler Encryption Algorythm, 1984. | // Derived from Version 1 of Mangler Encryption Algorythm, 1984. | ||||
| // Derived from Version 2 of Mangler Encryption Algorythm, 1998. | // Derived from Version 2 of Mangler Encryption Algorythm, 1998. | ||||
| // | // |
| // mishmash.cpp (c) 20190407 _M | |||||
| // non-cryptographic has for short strings | |||||
| // mishmash.cpp | |||||
| // | |||||
| // Copyright (C) 2019-2020 MicroNeil Research Corporation. | |||||
| // | |||||
| // This software is released under the MIT license. See LICENSE.TXT. | |||||
| // | |||||
| // Mishmash is a non-cryptographic hash optimized for short strings. | |||||
| #include "mishmash.hpp" | #include "mishmash.hpp" | ||||
| // mishmash.hpp (c) 20190407 _M | |||||
| // mishmash.hpp// | |||||
| // Copyright (C) 2019-2020 MicroNeil Research Corporation. | |||||
| // | // | ||||
| // This software is released under the MIT license. See LICENSE.TXT. | |||||
| // | |||||
| // Mishamash is a non-cryptographic hash optimized for short strings. | |||||
| #pragma once | #pragma once | ||||
| #include <string> | #include <string> |
| // networking.cpp | // networking.cpp | ||||
| // Copyright (C) 2006-2009 MicroNeil Research Corporation. | |||||
| // | // | ||||
| // This program is part of the MicroNeil Research Open Library Project. For | |||||
| // more information go to http://www.microneil.com/OpenLibrary/index.html | |||||
| // Copyright (C) 2004-2020 MicroNeil Research Corporation. | |||||
| // | // | ||||
| // This program is free software; you can redistribute it and/or modify it | |||||
| // under the terms of the GNU General Public License as published by the | |||||
| // Free Software Foundation; either version 2 of the License, or (at your | |||||
| // option) any later version. | |||||
| // | |||||
| // This program is distributed in the hope that it will be useful, but WITHOUT | |||||
| // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||||
| // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |||||
| // more details. | |||||
| // | |||||
| // You should have received a copy of the GNU General Public License along with | |||||
| // this program; if not, write to the Free Software Foundation, Inc., 59 Temple | |||||
| // Place, Suite 330, Boston, MA 02111-1307 USA | |||||
| //============================================================================== | |||||
| // See networking.hpp for notes. | |||||
| // This software is released under the MIT license. See LICENSE.TXT. | |||||
| #include "networking.hpp" | #include "networking.hpp" | ||||
| // networking.hpp | // networking.hpp | ||||
| // Copyright (C) 2006-2009 MicroNeil Research Corporation. | |||||
| // | // | ||||
| // This program is part of the MicroNeil Research Open Library Project. For | |||||
| // more information go to http://www.microneil.com/OpenLibrary/index.html | |||||
| // Copyright (C) 2004-2020 MicroNeil Research Corporation. | |||||
| // | // | ||||
| // This program is free software; you can redistribute it and/or modify it | |||||
| // under the terms of the GNU General Public License as published by the | |||||
| // Free Software Foundation; either version 2 of the License, or (at your | |||||
| // option) any later version. | |||||
| // | |||||
| // This program is distributed in the hope that it will be useful, but WITHOUT | |||||
| // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||||
| // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |||||
| // more details. | |||||
| // | |||||
| // You should have received a copy of the GNU General Public License along with | |||||
| // this program; if not, write to the Free Software Foundation, Inc., 59 Temple | |||||
| // Place, Suite 330, Boston, MA 02111-1307 USA | |||||
| //============================================================================== | |||||
| // This software is released under the MIT license. See LICENSE.TXT. | |||||
| // The networking module abstracts network communications and provides a set | // The networking module abstracts network communications and provides a set | ||||
| // of objects for handling most tasks. | |||||
| // of objects for handling most tasks on both win* and *nix. | |||||
| #pragma once | #pragma once | ||||
| // onetimepad.cpp | // onetimepad.cpp | ||||
| // Copyright (C) 2006-2007 MicroNeil Research Corporation | |||||
| // | |||||
| // Copyright (C) 2006-2020 MicroNeil Research Corporation. | |||||
| // | |||||
| // This software is released under the MIT license. See LICENSE.TXT. | |||||
| #include "onetimepad.hpp" | #include "onetimepad.hpp" | ||||
| #include "timing.hpp" | #include "timing.hpp" |
| // onetimepad.hpp | // onetimepad.hpp | ||||
| // Copyright (C) 2006 - 2007 MicroNeil Research Corporation | |||||
| // | |||||
| // Copyright (C) 2006-2020 MicroNeil Research Corporation. | |||||
| // | |||||
| // This software is released under the MIT license. See LICENSE.TXT. | |||||
| // | // | ||||
| // This module leverages the Mangler encryption engine to create | // This module leverages the Mangler encryption engine to create | ||||
| // cryptographically strong one-time pads and random numbers upon request. | // cryptographically strong one-time pads and random numbers upon request. |
| // threading.cpp | // threading.cpp | ||||
| // | // | ||||
| // (C) 2006 - 2009 MicroNeil Research Corporation. | |||||
| // Copyright (C) 2006-2020 MicroNeil Research Corporation. | |||||
| // | // | ||||
| // This program is part of the MicroNeil Research Open Library Project. For | |||||
| // more information go to http://www.microneil.com/OpenLibrary/index.html | |||||
| // | |||||
| // This program is free software; you can redistribute it and/or modify it | |||||
| // under the terms of the GNU General Public License as published by the | |||||
| // Free Software Foundation; either version 2 of the License, or (at your | |||||
| // option) any later version. | |||||
| // | |||||
| // This program is distributed in the hope that it will be useful, but WITHOUT | |||||
| // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||||
| // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |||||
| // more details. | |||||
| // | |||||
| // You should have received a copy of the GNU General Public License along with | |||||
| // this program; if not, write to the Free Software Foundation, Inc., 59 Temple | |||||
| // Place, Suite 330, Boston, MA 02111-1307 USA | |||||
| // For details on the Threading module and development history see threading.hpp | |||||
| // This software is released under the MIT license. See LICENSE.TXT. | |||||
| #include "threading.hpp" | #include "threading.hpp" | ||||
| // threading.hpp | // threading.hpp | ||||
| // | // | ||||
| // (C) 2006 - 2009 MicroNeil Research Corporation. | |||||
| // Copyright (C) 2004-2020 MicroNeil Research Corporation. | |||||
| // | // | ||||
| // This program is part of the MicroNeil Research Open Library Project. For | |||||
| // more information go to http://www.microneil.com/OpenLibrary/index.html | |||||
| // | |||||
| // This program is free software; you can redistribute it and/or modify it | |||||
| // under the terms of the GNU General Public License as published by the | |||||
| // Free Software Foundation; either version 2 of the License, or (at your | |||||
| // option) any later version. | |||||
| // | |||||
| // This program is distributed in the hope that it will be useful, but WITHOUT | |||||
| // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||||
| // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |||||
| // more details. | |||||
| // | |||||
| // You should have received a copy of the GNU General Public License along with | |||||
| // this program; if not, write to the Free Software Foundation, Inc., 59 Temple | |||||
| // Place, Suite 330, Boston, MA 02111-1307 USA | |||||
| // This software is released under the MIT license. See LICENSE.TXT. | |||||
| // The "Threading" module is a basic, cross-platform, multi-threading tool kit. | // The "Threading" module is a basic, cross-platform, multi-threading tool kit. | ||||
| // The differences between posix compatible systems and win32 based systems are | // The differences between posix compatible systems and win32 based systems are | ||||
| // here are designed to cover all of the basics efficiently while hiding the | // here are designed to cover all of the basics efficiently while hiding the | ||||
| // required under-cover work. | // required under-cover work. | ||||
| // A lot of this module is coded here in the header with the inline keyword | |||||
| // because it is likely that the more basic objects can be efficiently compiled | |||||
| // as inline abstractions to native calls. Really basic systems won't need | |||||
| // anything beyond what is in this file. | |||||
| // 20070202.1601 _M Further research has suggested that using a Semaphore in | |||||
| // WIN32 environments in place of a CRITICAL_SECTION may provide the best | |||||
| // performance and stability on all platforms. Specifically, SMP platforms may | |||||
| // race and waste resources with CRITICAL_SECTIONs and in those cases it is | |||||
| // recommended that the CRITICAL_SECTIONs may be "throttled" using Semaphores | |||||
| // to limit the number of threads that may contend for a critical section. It | |||||
| // is also suggested that if the Semaphore has an initialization value of 1 | |||||
| // the CRITICAL_SECTION is redundant. So this code has been modified to do | |||||
| // precisely that! | |||||
| // | |||||
| // This new version also includes a ProductionGateway object that simplifies | |||||
| // the producer/consumer model. The object keeps track of the number of calls | |||||
| // to produce() and consume() and ensures that threads will block on consume() | |||||
| // until a sufficient number of calls to produce() are made. That is, for every | |||||
| // one call to produce(), a call to consume() will be allowed to proceed. The | |||||
| // object also allows for the potentially asynchronous nature of these calls. | |||||
| // 20070530.1751 _M Added top level exception handling in threads along with | |||||
| // isRunning() and isBad() methods. | |||||
| // 20060528.1647 _M All of the basics are complete and tested on both WIN32 and | |||||
| // RHEL4 single and multiple processors. | |||||
| // Include MNR_threading Once Only ============================================= | |||||
| #pragma once | #pragma once | ||||
| #include <set> | #include <set> |
| // timing.cpp | // timing.cpp | ||||
| // | // | ||||
| // Copyright (C) 2006 - 2009 MicroNeil Research Corporation. | |||||
| // Copyright (C) 2004-2020 MicroNeil Research Corporation. | |||||
| // | // | ||||
| // See the corresponding .hpp file for descriptions and history. | |||||
| // | |||||
| // This program is part of the MicroNeil Research Open Library Project. For | |||||
| // more information go to http://www.microneil.com/OpenLibrary/index.html | |||||
| // | |||||
| // This program is free software; you can redistribute it and/or modify it | |||||
| // under the terms of the GNU General Public License as published by the | |||||
| // Free Software Foundation; either version 2 of the License, or (at your | |||||
| // option) any later version. | |||||
| // | |||||
| // This program is distributed in the hope that it will be useful, but WITHOUT | |||||
| // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||||
| // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |||||
| // more details. | |||||
| // | |||||
| // You should have received a copy of the GNU General Public License along with | |||||
| // this program; if not, write to the Free Software Foundation, Inc., 59 Temple | |||||
| // Place, Suite 330, Boston, MA 02111-1307 USA | |||||
| // This software is released under the MIT license. See LICENSE.TXT. | |||||
| #include <ctime> | #include <ctime> | ||||
| #include <sys/time.h> | #include <sys/time.h> |
| // timing.hpp | // timing.hpp | ||||
| // | // | ||||
| // Copyright (C) 2004-2009 MicroNeil Research Corporation. | |||||
| // This program is part of the MicroNeil Research Open Library Project. For | |||||
| // more information go to http://www.microneil.com/OpenLibrary/index.html | |||||
| // | |||||
| // This program is free software; you can redistribute it and/or modify it | |||||
| // under the terms of the GNU General Public License as published by the | |||||
| // Free Software Foundation; either version 2 of the License, or (at your | |||||
| // option) any later version. | |||||
| // Copyright (C) 2004-2020 MicroNeil Research Corporation. | |||||
| // | // | ||||
| // This program is distributed in the hope that it will be useful, but WITHOUT | |||||
| // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||||
| // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |||||
| // more details. | |||||
| // This software is released under the MIT license. See LICENSE.TXT. | |||||
| // | // | ||||
| // You should have received a copy of the GNU General Public License along with | |||||
| // this program; if not, write to the Free Software Foundation, Inc., 59 Temple | |||||
| // Place, Suite 330, Boston, MA 02111-1307 USA | |||||
| // The purpose of this module is to abstract timing functions for | // The purpose of this module is to abstract timing functions for | ||||
| // cross platform C++ development usning GNU compilers in *nix and | // cross platform C++ development usning GNU compilers in *nix and | ||||
| // win32 environments (minGW). Timing resolution is in milliseconds | // win32 environments (minGW). Timing resolution is in milliseconds | ||||
| // throughout to provide consistency and reasonable expectations. | // throughout to provide consistency and reasonable expectations. | ||||
| // 20060404 _M Added Timer::start(msclock startt) for chaining. | |||||
| // 20060403 _M This "timing" module has been completed and tested on | |||||
| // win32 (compiled using CodeBlocks and minGW) and on RHES3 (g++). | |||||
| // | |||||
| // The bottom line is that this code is perfect for most applications that | |||||
| // don't need real-time interaction on the win32 platform. That is, for | |||||
| // any application that can accept 15ms or so of "wiggle" in their timing | |||||
| // functions. On linux I was able to observe very consistent results with | |||||
| // variations measured in 1-2ms. | |||||
| // | |||||
| // Aynone seeking real-time accuracy on the win32 platform will need to contend | |||||
| // with all of the landmines in place against that and will need to write more | |||||
| // ellaborate versions of Timer::getLocalRawClock() and Sleeper::doRawSleep() | |||||
| // aa appropriate for their application. The existing code should work fine for | |||||
| // almost all other applications. | |||||
| // | |||||
| // This code was written with that in mind to some extent. That is why all of | |||||
| // the timing functions are measured in milliseconds rather than microseconds | |||||
| // or something smaller. Milliseconds are convenient for polling delays, | |||||
| // communications timeouts, measuring database application performance, and | |||||
| // other similar tasks. For that purpose - this timing module is just fine :-) | |||||
| // 20060323 _M Rewrote this module from a combination of previous | |||||
| // bits and pieces. This module will provide classes that abstract | |||||
| // timing functions for use in GNU projects on *nix and win32 systems. | |||||
| #pragma once | #pragma once | ||||
| namespace codedweller { | namespace codedweller { |