mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-24 13:05:53 +00:00
Cleanup:
* Move QUALITY_ONE to Quality.h * Move functional files up one level * Remove core.h * Merge routines into Config.cpp * Rename Section to IniFileSections * Rename IniFileSections routines
This commit is contained in:
@@ -1839,11 +1839,6 @@
|
|||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\basics\utility\CountedObject.h">
|
<ClInclude Include="..\..\src\ripple\basics\utility\CountedObject.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\basics\utility\IniFile.cpp">
|
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClInclude Include="..\..\src\ripple\basics\utility\IniFile.h">
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\ripple\basics\utility\PlatformMacros.h">
|
<ClInclude Include="..\..\src\ripple\basics\utility\PlatformMacros.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\basics\utility\StringUtilities.cpp">
|
<ClCompile Include="..\..\src\ripple\basics\utility\StringUtilities.cpp">
|
||||||
@@ -2484,45 +2479,45 @@
|
|||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\module\app\websocket\WSServerHandler.h">
|
<ClInclude Include="..\..\src\ripple\module\app\websocket\WSServerHandler.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\module\core\functional\Config.cpp">
|
<ClCompile Include="..\..\src\ripple\module\core\Config.cpp">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\module\core\functional\Config.h">
|
<ClInclude Include="..\..\src\ripple\module\core\Config.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\module\core\functional\ConfigSections.h">
|
<ClInclude Include="..\..\src\ripple\module\core\ConfigSections.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\module\core\functional\Job.cpp">
|
<ClCompile Include="..\..\src\ripple\module\core\Job.cpp">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\module\core\functional\Job.h">
|
<ClInclude Include="..\..\src\ripple\module\core\Job.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\module\core\functional\JobQueue.cpp">
|
<ClCompile Include="..\..\src\ripple\module\core\JobQueue.cpp">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\module\core\functional\JobQueue.h">
|
<ClInclude Include="..\..\src\ripple\module\core\JobQueue.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\module\core\functional\JobTypeData.h">
|
<ClInclude Include="..\..\src\ripple\module\core\JobTypeData.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\module\core\functional\JobTypeInfo.h">
|
<ClInclude Include="..\..\src\ripple\module\core\JobTypeInfo.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\module\core\functional\JobTypes.h">
|
<ClInclude Include="..\..\src\ripple\module\core\JobTypes.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\module\core\functional\LoadEvent.cpp">
|
<ClCompile Include="..\..\src\ripple\module\core\LoadEvent.cpp">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\module\core\functional\LoadEvent.h">
|
<ClInclude Include="..\..\src\ripple\module\core\LoadEvent.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\module\core\functional\LoadFeeTrack.h">
|
<ClInclude Include="..\..\src\ripple\module\core\LoadFeeTrack.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\module\core\functional\LoadFeeTrackImp.cpp">
|
<ClCompile Include="..\..\src\ripple\module\core\LoadFeeTrackImp.cpp">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\module\core\functional\LoadFeeTrackImp.h">
|
<ClInclude Include="..\..\src\ripple\module\core\LoadFeeTrackImp.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\module\core\functional\LoadMonitor.cpp">
|
<ClCompile Include="..\..\src\ripple\module\core\LoadMonitor.cpp">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\module\core\functional\LoadMonitor.h">
|
<ClInclude Include="..\..\src\ripple\module\core\LoadMonitor.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\module\data\crypto\Base58Data.cpp">
|
<ClCompile Include="..\..\src\ripple\module\data\crypto\Base58Data.cpp">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
@@ -3427,8 +3422,6 @@
|
|||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\ripple\unity\core.cpp">
|
<ClCompile Include="..\..\src\ripple\unity\core.cpp">
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\unity\core.h">
|
|
||||||
</ClInclude>
|
|
||||||
<ClCompile Include="..\..\src\ripple\unity\data.cpp">
|
<ClCompile Include="..\..\src\ripple\unity\data.cpp">
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\unity\data.h">
|
<ClInclude Include="..\..\src\ripple\unity\data.h">
|
||||||
|
|||||||
@@ -403,9 +403,6 @@
|
|||||||
<Filter Include="ripple\module\core">
|
<Filter Include="ripple\module\core">
|
||||||
<UniqueIdentifier>{4DAFFAEC-2D9A-42C0-210F-483796C162E9}</UniqueIdentifier>
|
<UniqueIdentifier>{4DAFFAEC-2D9A-42C0-210F-483796C162E9}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="ripple\module\core\functional">
|
|
||||||
<UniqueIdentifier>{61C8064B-23D8-A490-1614-9D2BA78ADB68}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="ripple\module\data">
|
<Filter Include="ripple\module\data">
|
||||||
<UniqueIdentifier>{FB5092D7-3AA5-4E7F-F783-C8A929D8B588}</UniqueIdentifier>
|
<UniqueIdentifier>{FB5092D7-3AA5-4E7F-F783-C8A929D8B588}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
@@ -2826,12 +2823,6 @@
|
|||||||
<ClInclude Include="..\..\src\ripple\basics\utility\CountedObject.h">
|
<ClInclude Include="..\..\src\ripple\basics\utility\CountedObject.h">
|
||||||
<Filter>ripple\basics\utility</Filter>
|
<Filter>ripple\basics\utility</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\basics\utility\IniFile.cpp">
|
|
||||||
<Filter>ripple\basics\utility</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClInclude Include="..\..\src\ripple\basics\utility\IniFile.h">
|
|
||||||
<Filter>ripple\basics\utility</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\ripple\basics\utility\PlatformMacros.h">
|
<ClInclude Include="..\..\src\ripple\basics\utility\PlatformMacros.h">
|
||||||
<Filter>ripple\basics\utility</Filter>
|
<Filter>ripple\basics\utility</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -3600,56 +3591,56 @@
|
|||||||
<ClInclude Include="..\..\src\ripple\module\app\websocket\WSServerHandler.h">
|
<ClInclude Include="..\..\src\ripple\module\app\websocket\WSServerHandler.h">
|
||||||
<Filter>ripple\module\app\websocket</Filter>
|
<Filter>ripple\module\app\websocket</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\module\core\functional\Config.cpp">
|
<ClCompile Include="..\..\src\ripple\module\core\Config.cpp">
|
||||||
<Filter>ripple\module\core\functional</Filter>
|
<Filter>ripple\module\core</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\module\core\functional\Config.h">
|
<ClInclude Include="..\..\src\ripple\module\core\Config.h">
|
||||||
<Filter>ripple\module\core\functional</Filter>
|
<Filter>ripple\module\core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\module\core\functional\ConfigSections.h">
|
<ClInclude Include="..\..\src\ripple\module\core\ConfigSections.h">
|
||||||
<Filter>ripple\module\core\functional</Filter>
|
<Filter>ripple\module\core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\module\core\functional\Job.cpp">
|
<ClCompile Include="..\..\src\ripple\module\core\Job.cpp">
|
||||||
<Filter>ripple\module\core\functional</Filter>
|
<Filter>ripple\module\core</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\module\core\functional\Job.h">
|
<ClInclude Include="..\..\src\ripple\module\core\Job.h">
|
||||||
<Filter>ripple\module\core\functional</Filter>
|
<Filter>ripple\module\core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\module\core\functional\JobQueue.cpp">
|
<ClCompile Include="..\..\src\ripple\module\core\JobQueue.cpp">
|
||||||
<Filter>ripple\module\core\functional</Filter>
|
<Filter>ripple\module\core</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\module\core\functional\JobQueue.h">
|
<ClInclude Include="..\..\src\ripple\module\core\JobQueue.h">
|
||||||
<Filter>ripple\module\core\functional</Filter>
|
<Filter>ripple\module\core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\module\core\functional\JobTypeData.h">
|
<ClInclude Include="..\..\src\ripple\module\core\JobTypeData.h">
|
||||||
<Filter>ripple\module\core\functional</Filter>
|
<Filter>ripple\module\core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\module\core\functional\JobTypeInfo.h">
|
<ClInclude Include="..\..\src\ripple\module\core\JobTypeInfo.h">
|
||||||
<Filter>ripple\module\core\functional</Filter>
|
<Filter>ripple\module\core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\module\core\functional\JobTypes.h">
|
<ClInclude Include="..\..\src\ripple\module\core\JobTypes.h">
|
||||||
<Filter>ripple\module\core\functional</Filter>
|
<Filter>ripple\module\core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\module\core\functional\LoadEvent.cpp">
|
<ClCompile Include="..\..\src\ripple\module\core\LoadEvent.cpp">
|
||||||
<Filter>ripple\module\core\functional</Filter>
|
<Filter>ripple\module\core</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\module\core\functional\LoadEvent.h">
|
<ClInclude Include="..\..\src\ripple\module\core\LoadEvent.h">
|
||||||
<Filter>ripple\module\core\functional</Filter>
|
<Filter>ripple\module\core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\module\core\functional\LoadFeeTrack.h">
|
<ClInclude Include="..\..\src\ripple\module\core\LoadFeeTrack.h">
|
||||||
<Filter>ripple\module\core\functional</Filter>
|
<Filter>ripple\module\core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\module\core\functional\LoadFeeTrackImp.cpp">
|
<ClCompile Include="..\..\src\ripple\module\core\LoadFeeTrackImp.cpp">
|
||||||
<Filter>ripple\module\core\functional</Filter>
|
<Filter>ripple\module\core</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\module\core\functional\LoadFeeTrackImp.h">
|
<ClInclude Include="..\..\src\ripple\module\core\LoadFeeTrackImp.h">
|
||||||
<Filter>ripple\module\core\functional</Filter>
|
<Filter>ripple\module\core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\module\core\functional\LoadMonitor.cpp">
|
<ClCompile Include="..\..\src\ripple\module\core\LoadMonitor.cpp">
|
||||||
<Filter>ripple\module\core\functional</Filter>
|
<Filter>ripple\module\core</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\module\core\functional\LoadMonitor.h">
|
<ClInclude Include="..\..\src\ripple\module\core\LoadMonitor.h">
|
||||||
<Filter>ripple\module\core\functional</Filter>
|
<Filter>ripple\module\core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\module\data\crypto\Base58Data.cpp">
|
<ClCompile Include="..\..\src\ripple\module\data\crypto\Base58Data.cpp">
|
||||||
<Filter>ripple\module\data\crypto</Filter>
|
<Filter>ripple\module\data\crypto</Filter>
|
||||||
@@ -4746,9 +4737,6 @@
|
|||||||
<ClCompile Include="..\..\src\ripple\unity\core.cpp">
|
<ClCompile Include="..\..\src\ripple\unity\core.cpp">
|
||||||
<Filter>ripple\unity</Filter>
|
<Filter>ripple\unity</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\unity\core.h">
|
|
||||||
<Filter>ripple\unity</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClCompile Include="..\..\src\ripple\unity\data.cpp">
|
<ClCompile Include="..\..\src\ripple\unity\data.cpp">
|
||||||
<Filter>ripple\unity</Filter>
|
<Filter>ripple\unity</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|||||||
@@ -1,156 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of rippled: https://github.com/ripple/rippled
|
|
||||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#include <ripple/basics/utility/IniFile.h>
|
|
||||||
#include <boost/algorithm/string.hpp>
|
|
||||||
#include <boost/format.hpp>
|
|
||||||
|
|
||||||
namespace ripple {
|
|
||||||
|
|
||||||
#define SECTION_DEFAULT_NAME ""
|
|
||||||
|
|
||||||
Section ParseSection (std::string const& strInput, const bool bTrim)
|
|
||||||
{
|
|
||||||
std::string strData (strInput);
|
|
||||||
std::vector<std::string> vLines;
|
|
||||||
Section secResult;
|
|
||||||
|
|
||||||
// Convert DOS format to unix.
|
|
||||||
boost::algorithm::replace_all (strData, "\r\n", "\n");
|
|
||||||
|
|
||||||
// Convert MacOS format to unix.
|
|
||||||
boost::algorithm::replace_all (strData, "\r", "\n");
|
|
||||||
|
|
||||||
boost::algorithm::split (vLines, strData, boost::algorithm::is_any_of ("\n"));
|
|
||||||
|
|
||||||
// Set the default Section name.
|
|
||||||
std::string strSection = SECTION_DEFAULT_NAME;
|
|
||||||
|
|
||||||
// Initialize the default Section.
|
|
||||||
secResult[strSection] = Section::mapped_type ();
|
|
||||||
|
|
||||||
// Parse each line.
|
|
||||||
BOOST_FOREACH (std::string & strValue, vLines)
|
|
||||||
{
|
|
||||||
if (strValue.empty () || strValue[0] == '#')
|
|
||||||
{
|
|
||||||
// Blank line or comment, do nothing.
|
|
||||||
}
|
|
||||||
else if (strValue[0] == '[' && strValue[strValue.length () - 1] == ']')
|
|
||||||
{
|
|
||||||
// New Section.
|
|
||||||
|
|
||||||
strSection = strValue.substr (1, strValue.length () - 2);
|
|
||||||
secResult[strSection] = Section::mapped_type ();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Another line for Section.
|
|
||||||
if (bTrim)
|
|
||||||
boost::algorithm::trim (strValue);
|
|
||||||
|
|
||||||
if (!strValue.empty ())
|
|
||||||
secResult[strSection].push_back (strValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return secResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
Section::mapped_type* SectionEntries (Section& secSource, std::string const& strSection)
|
|
||||||
{
|
|
||||||
Section::iterator it;
|
|
||||||
Section::mapped_type* smtResult;
|
|
||||||
|
|
||||||
it = secSource.find (strSection);
|
|
||||||
|
|
||||||
if (it == secSource.end ())
|
|
||||||
{
|
|
||||||
smtResult = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//Section::mapped_type& vecEntries = it->second;
|
|
||||||
|
|
||||||
smtResult = & (it->second);
|
|
||||||
}
|
|
||||||
|
|
||||||
return smtResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
int SectionCount (Section& secSource, std::string const& strSection)
|
|
||||||
{
|
|
||||||
Section::mapped_type* pmtEntries = SectionEntries (secSource, strSection);
|
|
||||||
|
|
||||||
return pmtEntries ? pmtEntries->size () : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SectionSingleB (Section& secSource, std::string const& strSection, std::string& strValue)
|
|
||||||
{
|
|
||||||
Section::mapped_type* pmtEntries = SectionEntries (secSource, strSection);
|
|
||||||
bool bSingle = pmtEntries && 1 == pmtEntries->size ();
|
|
||||||
|
|
||||||
if (bSingle)
|
|
||||||
{
|
|
||||||
strValue = (*pmtEntries)[0];
|
|
||||||
}
|
|
||||||
else if (pmtEntries)
|
|
||||||
{
|
|
||||||
WriteLog (lsWARNING, ParseSection) << boost::str (boost::format ("Section [%s]: requires 1 line not %d lines.")
|
|
||||||
% strSection
|
|
||||||
% pmtEntries->size ());
|
|
||||||
}
|
|
||||||
|
|
||||||
return bSingle;
|
|
||||||
}
|
|
||||||
|
|
||||||
beast::StringPairArray
|
|
||||||
parseKeyValueSection (Section& secSource, beast::String const& strSection)
|
|
||||||
{
|
|
||||||
beast::StringPairArray result;
|
|
||||||
|
|
||||||
// yuck.
|
|
||||||
std::string const stdStrSection (strSection.toStdString ());
|
|
||||||
|
|
||||||
typedef Section::mapped_type Entries;
|
|
||||||
|
|
||||||
Entries* const entries = SectionEntries (secSource, stdStrSection);
|
|
||||||
|
|
||||||
if (entries != nullptr)
|
|
||||||
{
|
|
||||||
for (Entries::const_iterator iter = entries->begin (); iter != entries->end (); ++iter)
|
|
||||||
{
|
|
||||||
beast::String const line (iter->c_str ());
|
|
||||||
|
|
||||||
int const equalPos = line.indexOfChar ('=');
|
|
||||||
|
|
||||||
if (equalPos != -1)
|
|
||||||
{
|
|
||||||
beast::String const key = line.substring (0, equalPos);
|
|
||||||
beast::String const value = line.substring (equalPos + 1, line.length ());
|
|
||||||
|
|
||||||
result.set (key, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // ripple
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of rippled: https://github.com/ripple/rippled
|
|
||||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#ifndef RIPPLE_INIFILE_H_INCLUDED
|
|
||||||
#define RIPPLE_INIFILE_H_INCLUDED
|
|
||||||
|
|
||||||
#include <beast/module/core/text/StringPairArray.h>
|
|
||||||
|
|
||||||
namespace ripple {
|
|
||||||
|
|
||||||
// VFALCO TODO Rename to IniFile and clean up
|
|
||||||
typedef std::map <const std::string, std::vector<std::string> > Section;
|
|
||||||
|
|
||||||
// VFALCO TODO Wrap this up in a class interface
|
|
||||||
//
|
|
||||||
|
|
||||||
Section ParseSection (std::string const& strInput, const bool bTrim);
|
|
||||||
bool SectionSingleB (Section& secSource, std::string const& strSection, std::string& strValue);
|
|
||||||
int SectionCount (Section& secSource, std::string const& strSection);
|
|
||||||
Section::mapped_type* SectionEntries (Section& secSource, std::string const& strSection);
|
|
||||||
|
|
||||||
/** Parse a section of lines as a key/value array.
|
|
||||||
|
|
||||||
Each line is in the form <key>=<value>.
|
|
||||||
Spaces are considered part of the key and value.
|
|
||||||
*/
|
|
||||||
beast::StringPairArray
|
|
||||||
parseKeyValueSection (Section& secSource, beast::String const& strSection);
|
|
||||||
|
|
||||||
} // ripple
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -23,22 +23,12 @@
|
|||||||
#include <ripple/types/api/Blob.h>
|
#include <ripple/types/api/Blob.h>
|
||||||
#include <ripple/types/api/ByteOrder.h>
|
#include <ripple/types/api/ByteOrder.h>
|
||||||
#include <ripple/types/api/strHex.h>
|
#include <ripple/types/api/strHex.h>
|
||||||
|
#include <boost/format.hpp>
|
||||||
#include <beast/module/core/text/StringPairArray.h>
|
#include <beast/module/core/text/StringPairArray.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
// String utility functions.
|
|
||||||
|
|
||||||
// Ripple specific constant used for parsing qualities and other things
|
|
||||||
//
|
|
||||||
// VFALCO NOTE This does not belong here!
|
|
||||||
// NIKB TODO Why is this here instead of somewhere more sensible? What
|
|
||||||
// "other things" is this being used for?
|
|
||||||
#define QUALITY_ONE 1000000000 // 10e9
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
extern std::string strprintf (const char* format, ...);
|
extern std::string strprintf (const char* format, ...);
|
||||||
|
|
||||||
extern std::string urlEncode (std::string const& strSrc);
|
extern std::string urlEncode (std::string const& strSrc);
|
||||||
|
|||||||
@@ -29,6 +29,9 @@
|
|||||||
namespace ripple {
|
namespace ripple {
|
||||||
namespace core {
|
namespace core {
|
||||||
|
|
||||||
|
// Ripple specific constant used for parsing qualities and other things
|
||||||
|
#define QUALITY_ONE 1000000000 // 10e9
|
||||||
|
|
||||||
/** Represents the logical ratio of output currency to input currency.
|
/** Represents the logical ratio of output currency to input currency.
|
||||||
Internally this is stored using a custom floating point representation,
|
Internally this is stored using a custom floating point representation,
|
||||||
as the inverse of the ratio, so that quality will be descending in
|
as the inverse of the ratio, so that quality will be descending in
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
|
#include <ripple/module/core/LoadFeeTrack.h>
|
||||||
#include <ripple/overlay/predicates.h>
|
#include <ripple/overlay/predicates.h>
|
||||||
#include <ripple/types/api/UintTypes.h>
|
#include <ripple/types/api/UintTypes.h>
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
#include <ripple/basics/utility/Time.h>
|
#include <ripple/basics/utility/Time.h>
|
||||||
#include <ripple/common/jsonrpc_fields.h>
|
#include <ripple/common/jsonrpc_fields.h>
|
||||||
|
#include <ripple/module/core/Config.h>
|
||||||
|
#include <ripple/module/core/LoadFeeTrack.h>
|
||||||
#include <ripple/nodestore/Database.h>
|
#include <ripple/nodestore/Database.h>
|
||||||
#include <beast/unit_test/suite.h>
|
#include <beast/unit_test/suite.h>
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
|
#include <ripple/module/core/LoadFeeTrack.h>
|
||||||
#include <beast/cxx14/memory.h> // <memory>
|
#include <beast/cxx14/memory.h> // <memory>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
|
#include <ripple/module/app/book/Quality.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
// #define META_DEBUG
|
// #define META_DEBUG
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
|
#include <ripple/module/core/Config.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
LedgerProposal::LedgerProposal (uint256 const& pLgr, std::uint32_t seq,
|
LedgerProposal::LedgerProposal (uint256 const& pLgr, std::uint32_t seq,
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
|
#include <ripple/module/core/Config.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
SerializedValidation::SerializedValidation (SerializerIterator& sit, bool checkSignature)
|
SerializedValidation::SerializedValidation (SerializerIterator& sit, bool checkSignature)
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include <ripple/common/seconds_clock.h>
|
#include <ripple/common/seconds_clock.h>
|
||||||
#include <ripple/module/app/main/Tuning.h>
|
#include <ripple/module/app/main/Tuning.h>
|
||||||
#include <ripple/module/app/misc/ProofOfWorkFactory.h>
|
#include <ripple/module/app/misc/ProofOfWorkFactory.h>
|
||||||
|
#include <ripple/module/core/LoadFeeTrack.h>
|
||||||
#include <ripple/module/rpc/Manager.h>
|
#include <ripple/module/rpc/Manager.h>
|
||||||
#include <ripple/nodestore/Database.h>
|
#include <ripple/nodestore/Database.h>
|
||||||
#include <ripple/nodestore/DummyScheduler.h>
|
#include <ripple/nodestore/DummyScheduler.h>
|
||||||
@@ -734,8 +735,7 @@ public:
|
|||||||
m_peers = make_Overlay (m_mainIoPool, *m_resourceManager,
|
m_peers = make_Overlay (m_mainIoPool, *m_resourceManager,
|
||||||
*m_siteFiles, getConfig ().getModuleDatabasePath (),
|
*m_siteFiles, getConfig ().getModuleDatabasePath (),
|
||||||
*m_resolver, m_mainIoPool, m_peerSSLContext->get ());
|
*m_resolver, m_mainIoPool, m_peerSSLContext->get ());
|
||||||
// add to Stoppable
|
add (*m_peers); // add to Stoppable
|
||||||
add (*m_peers);
|
|
||||||
|
|
||||||
// SSL context used for WebSocket connections.
|
// SSL context used for WebSocket connections.
|
||||||
if (getConfig ().WEBSOCKET_SECURE)
|
if (getConfig ().WEBSOCKET_SECURE)
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
|
#include <ripple/module/core/LoadFeeTrack.h>
|
||||||
|
// REMOVE ASAP
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
|
#include <ripple/module/core/Config.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
LocalCredentials::LocalCredentials ()
|
LocalCredentials::LocalCredentials ()
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <ripple/basics/system/CheckLibraryVersions.h>
|
#include <ripple/basics/system/CheckLibraryVersions.h>
|
||||||
#include <ripple/basics/utility/Sustain.h>
|
#include <ripple/basics/utility/Sustain.h>
|
||||||
#include <ripple/basics/utility/ThreadName.h>
|
#include <ripple/basics/utility/ThreadName.h>
|
||||||
|
#include <ripple/module/core/ConfigSections.h>
|
||||||
#include <beast/unit_test.h>
|
#include <beast/unit_test.h>
|
||||||
#include <beast/streams/debug_ostream.h>
|
#include <beast/streams/debug_ostream.h>
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#define RIPPLE_APP_NODESTORESCHEDULER_H_INCLUDED
|
#define RIPPLE_APP_NODESTORESCHEDULER_H_INCLUDED
|
||||||
|
|
||||||
#include <ripple/nodestore/Scheduler.h>
|
#include <ripple/nodestore/Scheduler.h>
|
||||||
#include <ripple/module/core/functional/JobQueue.h>
|
#include <ripple/module/core/JobQueue.h>
|
||||||
#include <beast/threads/Stoppable.h>
|
#include <beast/threads/Stoppable.h>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,9 @@
|
|||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#include <ripple/basics/utility/Time.h>
|
#include <ripple/basics/utility/Time.h>
|
||||||
|
#include <ripple/module/app/book/Quality.h>
|
||||||
|
#include <ripple/module/core/Config.h>
|
||||||
|
#include <ripple/module/core/LoadFeeTrack.h>
|
||||||
#include <ripple/overlay/predicates.h>
|
#include <ripple/overlay/predicates.h>
|
||||||
#include <ripple/common/jsonrpc_fields.h>
|
#include <ripple/common/jsonrpc_fields.h>
|
||||||
#include <beast/module/core/thread/DeadlineTimer.h>
|
#include <beast/module/core/thread/DeadlineTimer.h>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
|
#include <ripple/module/core/Config.h>
|
||||||
#include <beast/unit_test/suite.h>
|
#include <beast/unit_test/suite.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|||||||
@@ -17,10 +17,11 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#include <tuple>
|
|
||||||
#include <boost/log/trivial.hpp>
|
|
||||||
|
|
||||||
#include <ripple/types/api/UintTypes.h>
|
#include <ripple/types/api/UintTypes.h>
|
||||||
|
#include <ripple/module/core/Config.h>
|
||||||
|
#include <ripple/module/core/LoadFeeTrack.h>
|
||||||
|
#include <boost/log/trivial.hpp>
|
||||||
|
#include <tuple>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
|
#include <ripple/module/app/book/Quality.h>
|
||||||
#include <ripple/module/app/paths/cursor/RippleLiquidity.h>
|
#include <ripple/module/app/paths/cursor/RippleLiquidity.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
|
#include <ripple/module/app/book/Quality.h>
|
||||||
#include <ripple/module/app/paths/cursor/RippleLiquidity.h>
|
#include <ripple/module/app/paths/cursor/RippleLiquidity.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|||||||
@@ -17,8 +17,9 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#include <ripple/basics/utility/IniFile.h>
|
|
||||||
#include <ripple/basics/utility/Time.h>
|
#include <ripple/basics/utility/Time.h>
|
||||||
|
#include <ripple/module/core/Config.h>
|
||||||
|
#include <ripple/module/core/LoadFeeTrack.h>
|
||||||
#include <beast/module/core/thread/DeadlineTimer.h>
|
#include <beast/module/core/thread/DeadlineTimer.h>
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
#include <boost/regex.hpp>
|
#include <boost/regex.hpp>
|
||||||
@@ -1155,7 +1156,7 @@ private:
|
|||||||
|
|
||||||
if (!bReject)
|
if (!bReject)
|
||||||
{
|
{
|
||||||
Section secSite = ParseSection (strSiteFile, true);
|
IniFileSections secSite = parseIniFile (strSiteFile, true);
|
||||||
bool bGood = !err;
|
bool bGood = !err;
|
||||||
|
|
||||||
if (bGood)
|
if (bGood)
|
||||||
@@ -1175,7 +1176,7 @@ private:
|
|||||||
//
|
//
|
||||||
std::string strSite;
|
std::string strSite;
|
||||||
|
|
||||||
if (bGood && !SectionSingleB (secSite, SECTION_DOMAIN, strSite))
|
if (bGood && !getSingleSection (secSite, SECTION_DOMAIN, strSite))
|
||||||
{
|
{
|
||||||
bGood = false;
|
bGood = false;
|
||||||
|
|
||||||
@@ -1199,9 +1200,9 @@ private:
|
|||||||
//
|
//
|
||||||
std::string strNodePublicKey;
|
std::string strNodePublicKey;
|
||||||
|
|
||||||
if (bGood && !SectionSingleB (secSite, SECTION_PUBLIC_KEY, strNodePublicKey))
|
if (bGood && !getSingleSection (secSite, SECTION_PUBLIC_KEY, strNodePublicKey))
|
||||||
{
|
{
|
||||||
// Bad [validation_public_key] Section.
|
// Bad [validation_public_key] IniFileSections.
|
||||||
bGood = false;
|
bGood = false;
|
||||||
|
|
||||||
WriteLog (lsTRACE, UniqueNodeList)
|
WriteLog (lsTRACE, UniqueNodeList)
|
||||||
@@ -1431,8 +1432,9 @@ private:
|
|||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
// Process Section [validators_url].
|
// Process IniFileSections [validators_url].
|
||||||
void getValidatorsUrl (RippleAddress const& naNodePublic, Section secSite)
|
void getValidatorsUrl (RippleAddress const& naNodePublic,
|
||||||
|
IniFileSections secSite)
|
||||||
{
|
{
|
||||||
std::string strValidatorsUrl;
|
std::string strValidatorsUrl;
|
||||||
std::string strScheme;
|
std::string strScheme;
|
||||||
@@ -1440,7 +1442,7 @@ private:
|
|||||||
int iPort;
|
int iPort;
|
||||||
std::string strPath;
|
std::string strPath;
|
||||||
|
|
||||||
if (SectionSingleB (secSite, SECTION_VALIDATORS_URL, strValidatorsUrl)
|
if (getSingleSection (secSite, SECTION_VALIDATORS_URL, strValidatorsUrl)
|
||||||
&& !strValidatorsUrl.empty ()
|
&& !strValidatorsUrl.empty ()
|
||||||
&& parseUrl (strValidatorsUrl, strScheme, strDomain, iPort, strPath)
|
&& parseUrl (strValidatorsUrl, strScheme, strDomain, iPort, strPath)
|
||||||
&& -1 == iPort
|
&& -1 == iPort
|
||||||
@@ -1467,9 +1469,9 @@ private:
|
|||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
// Process Section [ips_url].
|
// Process IniFileSections [ips_url].
|
||||||
// If we have a Section with a single entry, fetch the url and process it.
|
// If we have a IniFileSections with a single entry, fetch the url and process it.
|
||||||
void getIpsUrl (RippleAddress const& naNodePublic, Section secSite)
|
void getIpsUrl (RippleAddress const& naNodePublic, IniFileSections secSite)
|
||||||
{
|
{
|
||||||
std::string strIpsUrl;
|
std::string strIpsUrl;
|
||||||
std::string strScheme;
|
std::string strScheme;
|
||||||
@@ -1477,7 +1479,7 @@ private:
|
|||||||
int iPort;
|
int iPort;
|
||||||
std::string strPath;
|
std::string strPath;
|
||||||
|
|
||||||
if (SectionSingleB (secSite, SECTION_IPS_URL, strIpsUrl)
|
if (getSingleSection (secSite, SECTION_IPS_URL, strIpsUrl)
|
||||||
&& !strIpsUrl.empty ()
|
&& !strIpsUrl.empty ()
|
||||||
&& parseUrl (strIpsUrl, strScheme, strDomain, iPort, strPath)
|
&& parseUrl (strIpsUrl, strScheme, strDomain, iPort, strPath)
|
||||||
&& -1 == iPort
|
&& -1 == iPort
|
||||||
@@ -1504,7 +1506,7 @@ private:
|
|||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
// Given a Section with IPs, parse and persist it for a validator.
|
// Given a IniFileSections with IPs, parse and persist it for a validator.
|
||||||
bool responseIps (std::string const& strSite, RippleAddress const& naNodePublic, const boost::system::error_code& err, int iStatus, std::string const& strIpsFile)
|
bool responseIps (std::string const& strSite, RippleAddress const& naNodePublic, const boost::system::error_code& err, int iStatus, std::string const& strIpsFile)
|
||||||
{
|
{
|
||||||
bool bReject = !err && iStatus != 200;
|
bool bReject = !err && iStatus != 200;
|
||||||
@@ -1513,9 +1515,9 @@ private:
|
|||||||
{
|
{
|
||||||
if (!err)
|
if (!err)
|
||||||
{
|
{
|
||||||
Section secFile = ParseSection (strIpsFile, true);
|
IniFileSections secFile = parseIniFile (strIpsFile, true);
|
||||||
|
|
||||||
processIps (strSite, naNodePublic, SectionEntries (secFile, SECTION_IPS));
|
processIps (strSite, naNodePublic, getIniFileSection (secFile, SECTION_IPS));
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchFinish ();
|
fetchFinish ();
|
||||||
@@ -1524,8 +1526,8 @@ private:
|
|||||||
return bReject;
|
return bReject;
|
||||||
}
|
}
|
||||||
|
|
||||||
// After fetching a ripple.txt from a web site, given a Section with validators, parse and persist it.
|
// After fetching a ripple.txt from a web site, given a IniFileSections with validators, parse and persist it.
|
||||||
bool responseValidators (std::string const& strValidatorsUrl, RippleAddress const& naNodePublic, Section secSite, std::string const& strSite, const boost::system::error_code& err, int iStatus, std::string const& strValidatorsFile)
|
bool responseValidators (std::string const& strValidatorsUrl, RippleAddress const& naNodePublic, IniFileSections secSite, std::string const& strSite, const boost::system::error_code& err, int iStatus, std::string const& strValidatorsFile)
|
||||||
{
|
{
|
||||||
bool bReject = !err && iStatus != 200;
|
bool bReject = !err && iStatus != 200;
|
||||||
|
|
||||||
@@ -1533,9 +1535,9 @@ private:
|
|||||||
{
|
{
|
||||||
if (!err)
|
if (!err)
|
||||||
{
|
{
|
||||||
Section secFile = ParseSection (strValidatorsFile, true);
|
IniFileSections secFile = parseIniFile (strValidatorsFile, true);
|
||||||
|
|
||||||
processValidators (strSite, strValidatorsUrl, naNodePublic, vsValidator, SectionEntries (secFile, SECTION_VALIDATORS));
|
processValidators (strSite, strValidatorsUrl, naNodePublic, vsValidator, getIniFileSection (secFile, SECTION_VALIDATORS));
|
||||||
}
|
}
|
||||||
|
|
||||||
getIpsUrl (naNodePublic, secSite);
|
getIpsUrl (naNodePublic, secSite);
|
||||||
@@ -1550,7 +1552,7 @@ private:
|
|||||||
// Persist the IPs refered to by a Validator.
|
// Persist the IPs refered to by a Validator.
|
||||||
// --> strSite: source of the IPs (for debugging)
|
// --> strSite: source of the IPs (for debugging)
|
||||||
// --> naNodePublic: public key of the validating node.
|
// --> naNodePublic: public key of the validating node.
|
||||||
void processIps (std::string const& strSite, RippleAddress const& naNodePublic, Section::mapped_type* pmtVecStrIps)
|
void processIps (std::string const& strSite, RippleAddress const& naNodePublic, IniFileSections::mapped_type* pmtVecStrIps)
|
||||||
{
|
{
|
||||||
auto db = getApp().getWalletDB ().getDB ();
|
auto db = getApp().getWalletDB ().getDB ();
|
||||||
|
|
||||||
@@ -1622,7 +1624,7 @@ private:
|
|||||||
// --> strValidatorsSrc: source details for display
|
// --> strValidatorsSrc: source details for display
|
||||||
// --> naNodePublic: remote source public key - not valid for local
|
// --> naNodePublic: remote source public key - not valid for local
|
||||||
// --> vsWhy: reason for adding validator to SeedDomains or SeedNodes.
|
// --> vsWhy: reason for adding validator to SeedDomains or SeedNodes.
|
||||||
int processValidators (std::string const& strSite, std::string const& strValidatorsSrc, RippleAddress const& naNodePublic, ValidatorSource vsWhy, Section::mapped_type* pmtVecStrValidators)
|
int processValidators (std::string const& strSite, std::string const& strValidatorsSrc, RippleAddress const& naNodePublic, ValidatorSource vsWhy, IniFileSections::mapped_type* pmtVecStrValidators)
|
||||||
{
|
{
|
||||||
auto db = getApp().getWalletDB ().getDB ();
|
auto db = getApp().getWalletDB ().getDB ();
|
||||||
std::string strNodePublic = naNodePublic.isValid () ? naNodePublic.humanNodePublic () : strValidatorsSrc;
|
std::string strNodePublic = naNodePublic.isValid () ? naNodePublic.humanNodePublic () : strValidatorsSrc;
|
||||||
@@ -1722,24 +1724,24 @@ private:
|
|||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
// Process a ripple.txt.
|
// Process a ripple.txt.
|
||||||
void processFile (std::string const& strDomain, RippleAddress const& naNodePublic, Section secSite)
|
void processFile (std::string const& strDomain, RippleAddress const& naNodePublic, IniFileSections secSite)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Process Validators
|
// Process Validators
|
||||||
//
|
//
|
||||||
processValidators (strDomain, NODE_FILE_NAME, naNodePublic, vsReferral, SectionEntries (secSite, SECTION_VALIDATORS));
|
processValidators (strDomain, NODE_FILE_NAME, naNodePublic, vsReferral, getIniFileSection (secSite, SECTION_VALIDATORS));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Process ips
|
// Process ips
|
||||||
//
|
//
|
||||||
processIps (strDomain, naNodePublic, SectionEntries (secSite, SECTION_IPS));
|
processIps (strDomain, naNodePublic, getIniFileSection (secSite, SECTION_IPS));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Process currencies
|
// Process currencies
|
||||||
//
|
//
|
||||||
Section::mapped_type* pvCurrencies;
|
IniFileSections::mapped_type* pvCurrencies;
|
||||||
|
|
||||||
if ((pvCurrencies = SectionEntries (secSite, SECTION_CURRENCIES)) && pvCurrencies->size ())
|
if ((pvCurrencies = getIniFileSection (secSite, SECTION_CURRENCIES)) && pvCurrencies->size ())
|
||||||
{
|
{
|
||||||
// XXX Process currencies.
|
// XXX Process currencies.
|
||||||
WriteLog (lsWARNING, UniqueNodeList) << "Ignoring currencies: not implemented.";
|
WriteLog (lsWARNING, UniqueNodeList) << "Ignoring currencies: not implemented.";
|
||||||
@@ -1995,9 +1997,9 @@ private:
|
|||||||
//
|
//
|
||||||
void nodeProcess (std::string const& strSite, std::string const& strValidators, std::string const& strSource)
|
void nodeProcess (std::string const& strSite, std::string const& strValidators, std::string const& strSource)
|
||||||
{
|
{
|
||||||
Section secValidators = ParseSection (strValidators, true);
|
IniFileSections secValidators = parseIniFile (strValidators, true);
|
||||||
|
|
||||||
Section::mapped_type* pmtEntries = SectionEntries (secValidators, SECTION_VALIDATORS);
|
IniFileSections::mapped_type* pmtEntries = getIniFileSection (secValidators, SECTION_VALIDATORS);
|
||||||
|
|
||||||
if (pmtEntries)
|
if (pmtEntries)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
|
#include <ripple/module/core/Config.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
class SetAccount
|
class SetAccount
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
|
#include <ripple/module/core/Config.h>
|
||||||
#include <ripple/module/app/transactors/Transactor.h>
|
#include <ripple/module/app/transactors/Transactor.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|||||||
@@ -17,7 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#include <ripple/basics/utility/IniFile.h>
|
#include <ripple/module/core/Config.h>
|
||||||
|
#include <ripple/module/core/ConfigSections.h>
|
||||||
#include <beast/module/core/text/LexicalCast.h>
|
#include <beast/module/core/text/LexicalCast.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
@@ -33,6 +34,137 @@ namespace ripple {
|
|||||||
#define DEFAULT_FEE_OFFER DEFAULT_FEE_DEFAULT
|
#define DEFAULT_FEE_OFFER DEFAULT_FEE_DEFAULT
|
||||||
#define DEFAULT_FEE_OPERATION 1
|
#define DEFAULT_FEE_OPERATION 1
|
||||||
|
|
||||||
|
#define SECTION_DEFAULT_NAME ""
|
||||||
|
|
||||||
|
IniFileSections
|
||||||
|
parseIniFile (std::string const& strInput, const bool bTrim)
|
||||||
|
{
|
||||||
|
std::string strData (strInput);
|
||||||
|
std::vector<std::string> vLines;
|
||||||
|
IniFileSections secResult;
|
||||||
|
|
||||||
|
// Convert DOS format to unix.
|
||||||
|
boost::algorithm::replace_all (strData, "\r\n", "\n");
|
||||||
|
|
||||||
|
// Convert MacOS format to unix.
|
||||||
|
boost::algorithm::replace_all (strData, "\r", "\n");
|
||||||
|
|
||||||
|
boost::algorithm::split (vLines, strData,
|
||||||
|
boost::algorithm::is_any_of ("\n"));
|
||||||
|
|
||||||
|
// Set the default Section name.
|
||||||
|
std::string strSection = SECTION_DEFAULT_NAME;
|
||||||
|
|
||||||
|
// Initialize the default Section.
|
||||||
|
secResult[strSection] = IniFileSections::mapped_type ();
|
||||||
|
|
||||||
|
// Parse each line.
|
||||||
|
BOOST_FOREACH (std::string & strValue, vLines)
|
||||||
|
{
|
||||||
|
if (strValue.empty () || strValue[0] == '#')
|
||||||
|
{
|
||||||
|
// Blank line or comment, do nothing.
|
||||||
|
}
|
||||||
|
else if (strValue[0] == '[' && strValue[strValue.length () - 1] == ']')
|
||||||
|
{
|
||||||
|
// New Section.
|
||||||
|
|
||||||
|
strSection = strValue.substr (1, strValue.length () - 2);
|
||||||
|
secResult[strSection] = IniFileSections::mapped_type ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Another line for Section.
|
||||||
|
if (bTrim)
|
||||||
|
boost::algorithm::trim (strValue);
|
||||||
|
|
||||||
|
if (!strValue.empty ())
|
||||||
|
secResult[strSection].push_back (strValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return secResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
IniFileSections::mapped_type*
|
||||||
|
getIniFileSection (IniFileSections& secSource, std::string const& strSection)
|
||||||
|
{
|
||||||
|
IniFileSections::iterator it;
|
||||||
|
IniFileSections::mapped_type* smtResult;
|
||||||
|
it = secSource.find (strSection);
|
||||||
|
if (it == secSource.end ())
|
||||||
|
smtResult = 0;
|
||||||
|
else
|
||||||
|
smtResult = & (it->second);
|
||||||
|
return smtResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
countSectionEntries (IniFileSections& secSource, std::string const& strSection)
|
||||||
|
{
|
||||||
|
IniFileSections::mapped_type* pmtEntries =
|
||||||
|
getIniFileSection (secSource, strSection);
|
||||||
|
|
||||||
|
return pmtEntries ? pmtEntries->size () : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool getSingleSection (IniFileSections& secSource,
|
||||||
|
std::string const& strSection, std::string& strValue)
|
||||||
|
{
|
||||||
|
IniFileSections::mapped_type* pmtEntries =
|
||||||
|
getIniFileSection (secSource, strSection);
|
||||||
|
bool bSingle = pmtEntries && 1 == pmtEntries->size ();
|
||||||
|
|
||||||
|
if (bSingle)
|
||||||
|
{
|
||||||
|
strValue = (*pmtEntries)[0];
|
||||||
|
}
|
||||||
|
else if (pmtEntries)
|
||||||
|
{
|
||||||
|
WriteLog (lsWARNING, parseIniFile) << boost::str (boost::format ("Section [%s]: requires 1 line not %d lines.")
|
||||||
|
% strSection
|
||||||
|
% pmtEntries->size ());
|
||||||
|
}
|
||||||
|
|
||||||
|
return bSingle;
|
||||||
|
}
|
||||||
|
|
||||||
|
beast::StringPairArray
|
||||||
|
parseKeyValueSection (IniFileSections& secSource,
|
||||||
|
beast::String const& strSection)
|
||||||
|
{
|
||||||
|
beast::StringPairArray result;
|
||||||
|
|
||||||
|
// yuck.
|
||||||
|
std::string const stdStrSection (strSection.toStdString ());
|
||||||
|
|
||||||
|
typedef IniFileSections::mapped_type Entries;
|
||||||
|
|
||||||
|
Entries* const entries = getIniFileSection (secSource, stdStrSection);
|
||||||
|
|
||||||
|
if (entries != nullptr)
|
||||||
|
{
|
||||||
|
for (Entries::const_iterator iter = entries->begin ();
|
||||||
|
iter != entries->end (); ++iter)
|
||||||
|
{
|
||||||
|
beast::String const line (iter->c_str ());
|
||||||
|
|
||||||
|
int const equalPos = line.indexOfChar ('=');
|
||||||
|
|
||||||
|
if (equalPos != -1)
|
||||||
|
{
|
||||||
|
beast::String const key = line.substring (0, equalPos);
|
||||||
|
beast::String const value = line.substring (equalPos + 1,
|
||||||
|
line.length ());
|
||||||
|
|
||||||
|
result.set (key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/** Parses a set of strings into IP::Endpoint
|
/** Parses a set of strings into IP::Endpoint
|
||||||
Strings which fail to parse are not included in the output. If a stream is
|
Strings which fail to parse are not included in the output. If a stream is
|
||||||
provided, human readable diagnostic error messages are written for each
|
provided, human readable diagnostic error messages are written for each
|
||||||
@@ -42,7 +174,8 @@ namespace ripple {
|
|||||||
@param last The one-past-the-end of the string input sequence
|
@param last The one-past-the-end of the string input sequence
|
||||||
*/
|
*/
|
||||||
template <class OutputSequence, class InputIterator>
|
template <class OutputSequence, class InputIterator>
|
||||||
void parseAddresses (OutputSequence& out, InputIterator first, InputIterator last,
|
void
|
||||||
|
parseAddresses (OutputSequence& out, InputIterator first, InputIterator last,
|
||||||
beast::Journal::Stream stream = beast::Journal::Stream ())
|
beast::Journal::Stream stream = beast::Journal::Stream ())
|
||||||
{
|
{
|
||||||
while (first != last)
|
while (first != last)
|
||||||
@@ -50,7 +183,8 @@ void parseAddresses (OutputSequence& out, InputIterator first, InputIterator las
|
|||||||
auto const str (*first);
|
auto const str (*first);
|
||||||
++first;
|
++first;
|
||||||
{
|
{
|
||||||
beast::IP::Endpoint const addr (beast::IP::Endpoint::from_string (str));
|
beast::IP::Endpoint const addr (
|
||||||
|
beast::IP::Endpoint::from_string (str));
|
||||||
if (! is_unspecified (addr))
|
if (! is_unspecified (addr))
|
||||||
{
|
{
|
||||||
out.push_back (addr);
|
out.push_back (addr);
|
||||||
@@ -58,7 +192,8 @@ void parseAddresses (OutputSequence& out, InputIterator first, InputIterator las
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
beast::IP::Endpoint const addr (beast::IP::Endpoint::from_string_altform (str));
|
beast::IP::Endpoint const addr (
|
||||||
|
beast::IP::Endpoint::from_string_altform (str));
|
||||||
if (! is_unspecified (addr))
|
if (! is_unspecified (addr))
|
||||||
{
|
{
|
||||||
out.push_back (addr);
|
out.push_back (addr);
|
||||||
@@ -257,9 +392,7 @@ void Config::load ()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string strConfigFile;
|
file_contents.assign ((std::istreambuf_iterator<char> (ifsConfig)),
|
||||||
|
|
||||||
strConfigFile.assign ((std::istreambuf_iterator<char> (ifsConfig)),
|
|
||||||
std::istreambuf_iterator<char> ());
|
std::istreambuf_iterator<char> ());
|
||||||
|
|
||||||
if (ifsConfig.bad ())
|
if (ifsConfig.bad ())
|
||||||
@@ -268,48 +401,48 @@ void Config::load ()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Section secConfig = ParseSection (strConfigFile, true);
|
IniFileSections secConfig = parseIniFile (file_contents, true);
|
||||||
std::string strTemp;
|
std::string strTemp;
|
||||||
|
|
||||||
// XXX Leak
|
// XXX Leak
|
||||||
Section::mapped_type* smtTmp;
|
IniFileSections::mapped_type* smtTmp;
|
||||||
|
|
||||||
smtTmp = SectionEntries (secConfig, SECTION_VALIDATORS);
|
smtTmp = getIniFileSection (secConfig, SECTION_VALIDATORS);
|
||||||
|
|
||||||
if (smtTmp)
|
if (smtTmp)
|
||||||
{
|
{
|
||||||
validators = *smtTmp;
|
validators = *smtTmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
smtTmp = SectionEntries (secConfig, SECTION_CLUSTER_NODES);
|
smtTmp = getIniFileSection (secConfig, SECTION_CLUSTER_NODES);
|
||||||
|
|
||||||
if (smtTmp)
|
if (smtTmp)
|
||||||
{
|
{
|
||||||
CLUSTER_NODES = *smtTmp;
|
CLUSTER_NODES = *smtTmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
smtTmp = SectionEntries (secConfig, SECTION_IPS);
|
smtTmp = getIniFileSection (secConfig, SECTION_IPS);
|
||||||
|
|
||||||
if (smtTmp)
|
if (smtTmp)
|
||||||
{
|
{
|
||||||
IPS = *smtTmp;
|
IPS = *smtTmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
smtTmp = SectionEntries (secConfig, SECTION_IPS_FIXED);
|
smtTmp = getIniFileSection (secConfig, SECTION_IPS_FIXED);
|
||||||
|
|
||||||
if (smtTmp)
|
if (smtTmp)
|
||||||
{
|
{
|
||||||
IPS_FIXED = *smtTmp;
|
IPS_FIXED = *smtTmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
smtTmp = SectionEntries (secConfig, SECTION_SNTP);
|
smtTmp = getIniFileSection (secConfig, SECTION_SNTP);
|
||||||
|
|
||||||
if (smtTmp)
|
if (smtTmp)
|
||||||
{
|
{
|
||||||
SNTP_SERVERS = *smtTmp;
|
SNTP_SERVERS = *smtTmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
smtTmp = SectionEntries (secConfig, SECTION_RPC_STARTUP);
|
smtTmp = getIniFileSection (secConfig, SECTION_RPC_STARTUP);
|
||||||
|
|
||||||
if (smtTmp)
|
if (smtTmp)
|
||||||
{
|
{
|
||||||
@@ -321,27 +454,28 @@ void Config::load ()
|
|||||||
Json::Value jvCommand;
|
Json::Value jvCommand;
|
||||||
|
|
||||||
if (!jrReader.parse (strJson, jvCommand))
|
if (!jrReader.parse (strJson, jvCommand))
|
||||||
throw std::runtime_error (boost::str (boost::format ("Couldn't parse [" SECTION_RPC_STARTUP "] command: %s") % strJson));
|
throw std::runtime_error (
|
||||||
|
boost::str (boost::format (
|
||||||
|
"Couldn't parse [" SECTION_RPC_STARTUP "] command: %s") % strJson));
|
||||||
|
|
||||||
RPC_STARTUP.append (jvCommand);
|
RPC_STARTUP.append (jvCommand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_DATABASE_PATH, DATABASE_PATH))
|
if (getSingleSection (secConfig, SECTION_DATABASE_PATH, DATABASE_PATH))
|
||||||
DATA_DIR = DATABASE_PATH;
|
DATA_DIR = DATABASE_PATH;
|
||||||
|
|
||||||
|
(void) getSingleSection (secConfig, SECTION_VALIDATORS_SITE, VALIDATORS_SITE);
|
||||||
|
|
||||||
(void) SectionSingleB (secConfig, SECTION_VALIDATORS_SITE, VALIDATORS_SITE);
|
(void) getSingleSection (secConfig, SECTION_PEER_IP, PEER_IP);
|
||||||
|
|
||||||
(void) SectionSingleB (secConfig, SECTION_PEER_IP, PEER_IP);
|
if (getSingleSection (secConfig, SECTION_PEER_PRIVATE, strTemp))
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_PEER_PRIVATE, strTemp))
|
|
||||||
PEER_PRIVATE = beast::lexicalCastThrow <bool> (strTemp);
|
PEER_PRIVATE = beast::lexicalCastThrow <bool> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_PEERS_MAX, strTemp))
|
if (getSingleSection (secConfig, SECTION_PEERS_MAX, strTemp))
|
||||||
PEERS_MAX = beast::lexicalCastThrow <int> (strTemp);
|
PEERS_MAX = beast::lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
smtTmp = SectionEntries (secConfig, SECTION_RPC_ADMIN_ALLOW);
|
smtTmp = getIniFileSection (secConfig, SECTION_RPC_ADMIN_ALLOW);
|
||||||
|
|
||||||
if (smtTmp)
|
if (smtTmp)
|
||||||
{
|
{
|
||||||
@@ -353,11 +487,11 @@ void Config::load ()
|
|||||||
parsedAddresses.cbegin (), parsedAddresses.cend ());
|
parsedAddresses.cbegin (), parsedAddresses.cend ());
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) SectionSingleB (secConfig, SECTION_RPC_ADMIN_PASSWORD, RPC_ADMIN_PASSWORD);
|
(void) getSingleSection (secConfig, SECTION_RPC_ADMIN_PASSWORD, RPC_ADMIN_PASSWORD);
|
||||||
(void) SectionSingleB (secConfig, SECTION_RPC_ADMIN_USER, RPC_ADMIN_USER);
|
(void) getSingleSection (secConfig, SECTION_RPC_ADMIN_USER, RPC_ADMIN_USER);
|
||||||
(void) SectionSingleB (secConfig, SECTION_RPC_IP, m_rpcIP);
|
(void) getSingleSection (secConfig, SECTION_RPC_IP, m_rpcIP);
|
||||||
(void) SectionSingleB (secConfig, SECTION_RPC_PASSWORD, RPC_PASSWORD);
|
(void) getSingleSection (secConfig, SECTION_RPC_PASSWORD, RPC_PASSWORD);
|
||||||
(void) SectionSingleB (secConfig, SECTION_RPC_USER, RPC_USER);
|
(void) getSingleSection (secConfig, SECTION_RPC_USER, RPC_USER);
|
||||||
|
|
||||||
insightSettings = parseKeyValueSection (secConfig, SECTION_INSIGHT);
|
insightSettings = parseKeyValueSection (secConfig, SECTION_INSIGHT);
|
||||||
|
|
||||||
@@ -374,10 +508,10 @@ void Config::load ()
|
|||||||
importNodeDatabase = parseKeyValueSection (
|
importNodeDatabase = parseKeyValueSection (
|
||||||
secConfig, ConfigSection::importNodeDatabase ());
|
secConfig, ConfigSection::importNodeDatabase ());
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_PEER_PORT, strTemp))
|
if (getSingleSection (secConfig, SECTION_PEER_PORT, strTemp))
|
||||||
peerListeningPort = beast::lexicalCastThrow <int> (strTemp);
|
peerListeningPort = beast::lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_PEER_PROXY_PORT, strTemp))
|
if (getSingleSection (secConfig, SECTION_PEER_PROXY_PORT, strTemp))
|
||||||
{
|
{
|
||||||
peerPROXYListeningPort = beast::lexicalCastThrow <int> (strTemp);
|
peerPROXYListeningPort = beast::lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
@@ -394,16 +528,16 @@ void Config::load ()
|
|||||||
//
|
//
|
||||||
//---------------------------------------
|
//---------------------------------------
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_RPC_PORT, strTemp))
|
if (getSingleSection (secConfig, SECTION_RPC_PORT, strTemp))
|
||||||
m_rpcPort = beast::lexicalCastThrow <int> (strTemp);
|
m_rpcPort = beast::lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, "ledger_creator" , strTemp))
|
if (getSingleSection (secConfig, "ledger_creator" , strTemp))
|
||||||
LEDGER_CREATOR = beast::lexicalCastThrow <bool> (strTemp);
|
LEDGER_CREATOR = beast::lexicalCastThrow <bool> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_RPC_ALLOW_REMOTE, strTemp))
|
if (getSingleSection (secConfig, SECTION_RPC_ALLOW_REMOTE, strTemp))
|
||||||
RPC_ALLOW_REMOTE = beast::lexicalCastThrow <bool> (strTemp);
|
RPC_ALLOW_REMOTE = beast::lexicalCastThrow <bool> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_NODE_SIZE, strTemp))
|
if (getSingleSection (secConfig, SECTION_NODE_SIZE, strTemp))
|
||||||
{
|
{
|
||||||
if (strTemp == "tiny")
|
if (strTemp == "tiny")
|
||||||
NODE_SIZE = 0;
|
NODE_SIZE = 0;
|
||||||
@@ -426,55 +560,55 @@ void Config::load ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_ELB_SUPPORT, strTemp))
|
if (getSingleSection (secConfig, SECTION_ELB_SUPPORT, strTemp))
|
||||||
ELB_SUPPORT = beast::lexicalCastThrow <bool> (strTemp);
|
ELB_SUPPORT = beast::lexicalCastThrow <bool> (strTemp);
|
||||||
|
|
||||||
(void) SectionSingleB (secConfig, SECTION_WEBSOCKET_IP, WEBSOCKET_IP);
|
(void) getSingleSection (secConfig, SECTION_WEBSOCKET_IP, WEBSOCKET_IP);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_WEBSOCKET_PORT, strTemp))
|
if (getSingleSection (secConfig, SECTION_WEBSOCKET_PORT, strTemp))
|
||||||
WEBSOCKET_PORT = beast::lexicalCastThrow <int> (strTemp);
|
WEBSOCKET_PORT = beast::lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
(void) SectionSingleB (secConfig, SECTION_WEBSOCKET_PUBLIC_IP, WEBSOCKET_PUBLIC_IP);
|
(void) getSingleSection (secConfig, SECTION_WEBSOCKET_PUBLIC_IP, WEBSOCKET_PUBLIC_IP);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_WEBSOCKET_PUBLIC_PORT, strTemp))
|
if (getSingleSection (secConfig, SECTION_WEBSOCKET_PUBLIC_PORT, strTemp))
|
||||||
WEBSOCKET_PUBLIC_PORT = beast::lexicalCastThrow <int> (strTemp);
|
WEBSOCKET_PUBLIC_PORT = beast::lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
(void) SectionSingleB (secConfig, SECTION_WEBSOCKET_PROXY_IP, WEBSOCKET_PROXY_IP);
|
(void) getSingleSection (secConfig, SECTION_WEBSOCKET_PROXY_IP, WEBSOCKET_PROXY_IP);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_WEBSOCKET_PROXY_PORT, strTemp))
|
if (getSingleSection (secConfig, SECTION_WEBSOCKET_PROXY_PORT, strTemp))
|
||||||
WEBSOCKET_PROXY_PORT = beast::lexicalCastThrow <int> (strTemp);
|
WEBSOCKET_PROXY_PORT = beast::lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_WEBSOCKET_SECURE, strTemp))
|
if (getSingleSection (secConfig, SECTION_WEBSOCKET_SECURE, strTemp))
|
||||||
WEBSOCKET_SECURE = beast::lexicalCastThrow <int> (strTemp);
|
WEBSOCKET_SECURE = beast::lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_WEBSOCKET_PUBLIC_SECURE, strTemp))
|
if (getSingleSection (secConfig, SECTION_WEBSOCKET_PUBLIC_SECURE, strTemp))
|
||||||
WEBSOCKET_PUBLIC_SECURE = beast::lexicalCastThrow <int> (strTemp);
|
WEBSOCKET_PUBLIC_SECURE = beast::lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_WEBSOCKET_PROXY_SECURE, strTemp))
|
if (getSingleSection (secConfig, SECTION_WEBSOCKET_PROXY_SECURE, strTemp))
|
||||||
WEBSOCKET_PROXY_SECURE = beast::lexicalCastThrow <int> (strTemp);
|
WEBSOCKET_PROXY_SECURE = beast::lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_WEBSOCKET_PING_FREQ, strTemp))
|
if (getSingleSection (secConfig, SECTION_WEBSOCKET_PING_FREQ, strTemp))
|
||||||
WEBSOCKET_PING_FREQ = beast::lexicalCastThrow <int> (strTemp);
|
WEBSOCKET_PING_FREQ = beast::lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
SectionSingleB (secConfig, SECTION_WEBSOCKET_SSL_CERT, WEBSOCKET_SSL_CERT);
|
getSingleSection (secConfig, SECTION_WEBSOCKET_SSL_CERT, WEBSOCKET_SSL_CERT);
|
||||||
SectionSingleB (secConfig, SECTION_WEBSOCKET_SSL_CHAIN, WEBSOCKET_SSL_CHAIN);
|
getSingleSection (secConfig, SECTION_WEBSOCKET_SSL_CHAIN, WEBSOCKET_SSL_CHAIN);
|
||||||
SectionSingleB (secConfig, SECTION_WEBSOCKET_SSL_KEY, WEBSOCKET_SSL_KEY);
|
getSingleSection (secConfig, SECTION_WEBSOCKET_SSL_KEY, WEBSOCKET_SSL_KEY);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_RPC_SECURE, strTemp))
|
if (getSingleSection (secConfig, SECTION_RPC_SECURE, strTemp))
|
||||||
RPC_SECURE = beast::lexicalCastThrow <int> (strTemp);
|
RPC_SECURE = beast::lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
SectionSingleB (secConfig, SECTION_RPC_SSL_CERT, RPC_SSL_CERT);
|
getSingleSection (secConfig, SECTION_RPC_SSL_CERT, RPC_SSL_CERT);
|
||||||
SectionSingleB (secConfig, SECTION_RPC_SSL_CHAIN, RPC_SSL_CHAIN);
|
getSingleSection (secConfig, SECTION_RPC_SSL_CHAIN, RPC_SSL_CHAIN);
|
||||||
SectionSingleB (secConfig, SECTION_RPC_SSL_KEY, RPC_SSL_KEY);
|
getSingleSection (secConfig, SECTION_RPC_SSL_KEY, RPC_SSL_KEY);
|
||||||
|
|
||||||
|
|
||||||
SectionSingleB (secConfig, SECTION_SSL_VERIFY_FILE, SSL_VERIFY_FILE);
|
getSingleSection (secConfig, SECTION_SSL_VERIFY_FILE, SSL_VERIFY_FILE);
|
||||||
SectionSingleB (secConfig, SECTION_SSL_VERIFY_DIR, SSL_VERIFY_DIR);
|
getSingleSection (secConfig, SECTION_SSL_VERIFY_DIR, SSL_VERIFY_DIR);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_SSL_VERIFY, strTemp))
|
if (getSingleSection (secConfig, SECTION_SSL_VERIFY, strTemp))
|
||||||
SSL_VERIFY = beast::lexicalCastThrow <bool> (strTemp);
|
SSL_VERIFY = beast::lexicalCastThrow <bool> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_VALIDATION_SEED, strTemp))
|
if (getSingleSection (secConfig, SECTION_VALIDATION_SEED, strTemp))
|
||||||
{
|
{
|
||||||
VALIDATION_SEED.setSeedGeneric (strTemp);
|
VALIDATION_SEED.setSeedGeneric (strTemp);
|
||||||
|
|
||||||
@@ -485,7 +619,7 @@ void Config::load ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_NODE_SEED, strTemp))
|
if (getSingleSection (secConfig, SECTION_NODE_SEED, strTemp))
|
||||||
{
|
{
|
||||||
NODE_SEED.setSeedGeneric (strTemp);
|
NODE_SEED.setSeedGeneric (strTemp);
|
||||||
|
|
||||||
@@ -496,40 +630,40 @@ void Config::load ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) SectionSingleB (secConfig, SECTION_PEER_SSL_CIPHER_LIST, PEER_SSL_CIPHER_LIST);
|
(void) getSingleSection (secConfig, SECTION_PEER_SSL_CIPHER_LIST, PEER_SSL_CIPHER_LIST);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_PEER_SCAN_INTERVAL_MIN, strTemp))
|
if (getSingleSection (secConfig, SECTION_PEER_SCAN_INTERVAL_MIN, strTemp))
|
||||||
// Minimum for min is 60 seconds.
|
// Minimum for min is 60 seconds.
|
||||||
PEER_SCAN_INTERVAL_MIN = std::max (60, beast::lexicalCastThrow <int> (strTemp));
|
PEER_SCAN_INTERVAL_MIN = std::max (60, beast::lexicalCastThrow <int> (strTemp));
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_PEER_START_MAX, strTemp))
|
if (getSingleSection (secConfig, SECTION_PEER_START_MAX, strTemp))
|
||||||
PEER_START_MAX = std::max (1, beast::lexicalCastThrow <int> (strTemp));
|
PEER_START_MAX = std::max (1, beast::lexicalCastThrow <int> (strTemp));
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_PEER_CONNECT_LOW_WATER, strTemp))
|
if (getSingleSection (secConfig, SECTION_PEER_CONNECT_LOW_WATER, strTemp))
|
||||||
PEER_CONNECT_LOW_WATER = std::max (1, beast::lexicalCastThrow <int> (strTemp));
|
PEER_CONNECT_LOW_WATER = std::max (1, beast::lexicalCastThrow <int> (strTemp));
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_NETWORK_QUORUM, strTemp))
|
if (getSingleSection (secConfig, SECTION_NETWORK_QUORUM, strTemp))
|
||||||
NETWORK_QUORUM = beast::lexicalCastThrow <std::size_t> (strTemp);
|
NETWORK_QUORUM = beast::lexicalCastThrow <std::size_t> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_VALIDATION_QUORUM, strTemp))
|
if (getSingleSection (secConfig, SECTION_VALIDATION_QUORUM, strTemp))
|
||||||
VALIDATION_QUORUM = std::max (0, beast::lexicalCastThrow <int> (strTemp));
|
VALIDATION_QUORUM = std::max (0, beast::lexicalCastThrow <int> (strTemp));
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_FEE_ACCOUNT_RESERVE, strTemp))
|
if (getSingleSection (secConfig, SECTION_FEE_ACCOUNT_RESERVE, strTemp))
|
||||||
FEE_ACCOUNT_RESERVE = beast::lexicalCastThrow <std::uint64_t> (strTemp);
|
FEE_ACCOUNT_RESERVE = beast::lexicalCastThrow <std::uint64_t> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_FEE_OWNER_RESERVE, strTemp))
|
if (getSingleSection (secConfig, SECTION_FEE_OWNER_RESERVE, strTemp))
|
||||||
FEE_OWNER_RESERVE = beast::lexicalCastThrow <std::uint64_t> (strTemp);
|
FEE_OWNER_RESERVE = beast::lexicalCastThrow <std::uint64_t> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_FEE_OFFER, strTemp))
|
if (getSingleSection (secConfig, SECTION_FEE_OFFER, strTemp))
|
||||||
FEE_OFFER = beast::lexicalCastThrow <int> (strTemp);
|
FEE_OFFER = beast::lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_FEE_DEFAULT, strTemp))
|
if (getSingleSection (secConfig, SECTION_FEE_DEFAULT, strTemp))
|
||||||
FEE_DEFAULT = beast::lexicalCastThrow <int> (strTemp);
|
FEE_DEFAULT = beast::lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_FEE_OPERATION, strTemp))
|
if (getSingleSection (secConfig, SECTION_FEE_OPERATION, strTemp))
|
||||||
FEE_CONTRACT_OPERATION = beast::lexicalCastThrow <int> (strTemp);
|
FEE_CONTRACT_OPERATION = beast::lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_LEDGER_HISTORY, strTemp))
|
if (getSingleSection (secConfig, SECTION_LEDGER_HISTORY, strTemp))
|
||||||
{
|
{
|
||||||
boost::to_lower (strTemp);
|
boost::to_lower (strTemp);
|
||||||
|
|
||||||
@@ -540,7 +674,7 @@ void Config::load ()
|
|||||||
else
|
else
|
||||||
LEDGER_HISTORY = beast::lexicalCastThrow <std::uint32_t> (strTemp);
|
LEDGER_HISTORY = beast::lexicalCastThrow <std::uint32_t> (strTemp);
|
||||||
}
|
}
|
||||||
if (SectionSingleB (secConfig, SECTION_FETCH_DEPTH, strTemp))
|
if (getSingleSection (secConfig, SECTION_FETCH_DEPTH, strTemp))
|
||||||
{
|
{
|
||||||
boost::to_lower (strTemp);
|
boost::to_lower (strTemp);
|
||||||
|
|
||||||
@@ -555,30 +689,30 @@ void Config::load ()
|
|||||||
FETCH_DEPTH = 10;
|
FETCH_DEPTH = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_PATH_SEARCH_OLD, strTemp))
|
if (getSingleSection (secConfig, SECTION_PATH_SEARCH_OLD, strTemp))
|
||||||
PATH_SEARCH_OLD = beast::lexicalCastThrow <int> (strTemp);
|
PATH_SEARCH_OLD = beast::lexicalCastThrow <int> (strTemp);
|
||||||
if (SectionSingleB (secConfig, SECTION_PATH_SEARCH, strTemp))
|
if (getSingleSection (secConfig, SECTION_PATH_SEARCH, strTemp))
|
||||||
PATH_SEARCH = beast::lexicalCastThrow <int> (strTemp);
|
PATH_SEARCH = beast::lexicalCastThrow <int> (strTemp);
|
||||||
if (SectionSingleB (secConfig, SECTION_PATH_SEARCH_FAST, strTemp))
|
if (getSingleSection (secConfig, SECTION_PATH_SEARCH_FAST, strTemp))
|
||||||
PATH_SEARCH_FAST = beast::lexicalCastThrow <int> (strTemp);
|
PATH_SEARCH_FAST = beast::lexicalCastThrow <int> (strTemp);
|
||||||
if (SectionSingleB (secConfig, SECTION_PATH_SEARCH_MAX, strTemp))
|
if (getSingleSection (secConfig, SECTION_PATH_SEARCH_MAX, strTemp))
|
||||||
PATH_SEARCH_MAX = beast::lexicalCastThrow <int> (strTemp);
|
PATH_SEARCH_MAX = beast::lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_ACCOUNT_PROBE_MAX, strTemp))
|
if (getSingleSection (secConfig, SECTION_ACCOUNT_PROBE_MAX, strTemp))
|
||||||
ACCOUNT_PROBE_MAX = beast::lexicalCastThrow <int> (strTemp);
|
ACCOUNT_PROBE_MAX = beast::lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
(void) SectionSingleB (secConfig, SECTION_SMS_FROM, SMS_FROM);
|
(void) getSingleSection (secConfig, SECTION_SMS_FROM, SMS_FROM);
|
||||||
(void) SectionSingleB (secConfig, SECTION_SMS_KEY, SMS_KEY);
|
(void) getSingleSection (secConfig, SECTION_SMS_KEY, SMS_KEY);
|
||||||
(void) SectionSingleB (secConfig, SECTION_SMS_SECRET, SMS_SECRET);
|
(void) getSingleSection (secConfig, SECTION_SMS_SECRET, SMS_SECRET);
|
||||||
(void) SectionSingleB (secConfig, SECTION_SMS_TO, SMS_TO);
|
(void) getSingleSection (secConfig, SECTION_SMS_TO, SMS_TO);
|
||||||
(void) SectionSingleB (secConfig, SECTION_SMS_URL, SMS_URL);
|
(void) getSingleSection (secConfig, SECTION_SMS_URL, SMS_URL);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_VALIDATORS_FILE, strTemp))
|
if (getSingleSection (secConfig, SECTION_VALIDATORS_FILE, strTemp))
|
||||||
{
|
{
|
||||||
VALIDATORS_FILE = strTemp;
|
VALIDATORS_FILE = strTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_DEBUG_LOGFILE, strTemp))
|
if (getSingleSection (secConfig, SECTION_DEBUG_LOGFILE, strTemp))
|
||||||
DEBUG_LOGFILE = strTemp;
|
DEBUG_LOGFILE = strTemp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22,14 +22,61 @@
|
|||||||
|
|
||||||
#include <ripple/unity/json.h>
|
#include <ripple/unity/json.h>
|
||||||
#include <ripple/module/data/protocol/RippleAddress.h>
|
#include <ripple/module/data/protocol/RippleAddress.h>
|
||||||
#include <beast/module/core/files/File.h>
|
|
||||||
#include <beast/http/URL.h>
|
#include <beast/http/URL.h>
|
||||||
|
#include <beast/module/core/files/File.h>
|
||||||
|
#include <beast/module/core/text/StringPairArray.h>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
|
typedef std::map<std::string, std::vector<std::string>> IniFileSections;
|
||||||
|
|
||||||
|
IniFileSections
|
||||||
|
parseIniFile (std::string const& strInput, const bool bTrim);
|
||||||
|
|
||||||
|
bool
|
||||||
|
getSingleSection (IniFileSections& secSource,
|
||||||
|
std::string const& strSection, std::string& strValue);
|
||||||
|
|
||||||
|
int
|
||||||
|
countSectionEntries (IniFileSections& secSource, std::string const& strSection);
|
||||||
|
|
||||||
|
IniFileSections::mapped_type*
|
||||||
|
getIniFileSection (IniFileSections& secSource, std::string const& strSection);
|
||||||
|
|
||||||
|
/** Parse a section of lines as a key/value array.
|
||||||
|
Each line is in the form <key>=<value>.
|
||||||
|
Spaces are considered part of the key and value.
|
||||||
|
*/
|
||||||
|
// DEPRECATED
|
||||||
|
beast::StringPairArray
|
||||||
|
parseKeyValueSection (IniFileSections& secSource,
|
||||||
|
beast::String const& strSection);
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** Holds unparsed configuration information.
|
||||||
|
The raw data sections are processed with intermediate parsers specific
|
||||||
|
to each module instead of being all parsed in a central location.
|
||||||
|
*/
|
||||||
|
class BasicConfig
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/** The entire, unprocessed content of the config file.
|
||||||
|
Normally clients should not need to look at this.
|
||||||
|
*/
|
||||||
|
std::string file_contents;
|
||||||
|
|
||||||
|
/** Preprocessed contents of each section. */
|
||||||
|
//std::map <std::string,
|
||||||
|
};
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
// VFALCO TODO Replace these with beast "unsigned long long" generators
|
// VFALCO TODO Replace these with beast "unsigned long long" generators
|
||||||
// VFALCO NOTE Apparently these are used elsewhere. Make them constants in the config
|
// VFALCO NOTE Apparently these are used elsewhere. Make them constants in the config
|
||||||
// or in the Application
|
// or in the Application
|
||||||
@@ -89,22 +136,15 @@ struct SizedItem
|
|||||||
int sizes[5];
|
int sizes[5];
|
||||||
};
|
};
|
||||||
|
|
||||||
// VFALCO TODO rename all fields to not look like macros, and be more verbose
|
// VFALCO NOTE This entire derived class is deprecated
|
||||||
// VFALCO TODO document every member
|
// For new config information use the style implied
|
||||||
class Config
|
// in the base class. For existing config information
|
||||||
|
// try to refactor code to use the new style.
|
||||||
|
//
|
||||||
|
class Config : public BasicConfig
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//--------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// VFALCO NOTE To tame this "Config" beast I am breaking it up into
|
|
||||||
// individual sections related to a specific area of the
|
|
||||||
// program. For example, listening port configuration. Or
|
|
||||||
// node database configuration. Each class has its own
|
|
||||||
// default constructor, and load function for reading in
|
|
||||||
// settings from the parsed config file data.
|
|
||||||
//
|
|
||||||
// Clean member area. Please follow this style for modifying
|
|
||||||
// or adding code in the file.
|
|
||||||
|
|
||||||
struct Helpers
|
struct Helpers
|
||||||
{
|
{
|
||||||
@@ -266,6 +306,7 @@ public:
|
|||||||
|
|
||||||
/** Determine the level of administrative permission to grant.
|
/** Determine the level of administrative permission to grant.
|
||||||
*/
|
*/
|
||||||
|
// VFALCO TODO Get this out of here
|
||||||
enum Role
|
enum Role
|
||||||
{
|
{
|
||||||
GUEST,
|
GUEST,
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
#define RIPPLE_JOB_H
|
#define RIPPLE_JOB_H
|
||||||
|
|
||||||
#include <ripple/basics/types/BasicTypes.h>
|
#include <ripple/basics/types/BasicTypes.h>
|
||||||
#include <ripple/module/core/functional/LoadMonitor.h>
|
#include <ripple/module/core/LoadMonitor.h>
|
||||||
#include <ripple/unity/json.h>
|
#include <ripple/unity/json.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
@@ -17,10 +17,10 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#include <ripple/module/core/functional/JobQueue.h>
|
#include <ripple/module/core/JobQueue.h>
|
||||||
#include <ripple/module/core/functional/JobTypes.h>
|
#include <ripple/module/core/JobTypes.h>
|
||||||
#include <ripple/module/core/functional/JobTypeInfo.h>
|
#include <ripple/module/core/JobTypeInfo.h>
|
||||||
#include <ripple/module/core/functional/JobTypeData.h>
|
#include <ripple/module/core/JobTypeData.h>
|
||||||
|
|
||||||
#include <beast/cxx14/memory.h>
|
#include <beast/cxx14/memory.h>
|
||||||
#include <beast/chrono/chrono_util.h>
|
#include <beast/chrono/chrono_util.h>
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
#ifndef RIPPLE_CORE_JOBQUEUE_H_INCLUDED
|
#ifndef RIPPLE_CORE_JOBQUEUE_H_INCLUDED
|
||||||
#define RIPPLE_CORE_JOBQUEUE_H_INCLUDED
|
#define RIPPLE_CORE_JOBQUEUE_H_INCLUDED
|
||||||
|
|
||||||
#include <ripple/module/core/functional/JobTypes.h>
|
#include <ripple/module/core/JobTypes.h>
|
||||||
#include <beast/threads/Stoppable.h>
|
#include <beast/threads/Stoppable.h>
|
||||||
#include <boost/function.hpp>
|
#include <boost/function.hpp>
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
#ifndef RIPPLE_CORE_JOBTYPEDATA_H_INCLUDED
|
#ifndef RIPPLE_CORE_JOBTYPEDATA_H_INCLUDED
|
||||||
#define RIPPLE_CORE_JOBTYPEDATA_H_INCLUDED
|
#define RIPPLE_CORE_JOBTYPEDATA_H_INCLUDED
|
||||||
|
|
||||||
#include <ripple/module/core/functional/JobTypeInfo.h>
|
#include <ripple/module/core/JobTypeInfo.h>
|
||||||
|
|
||||||
namespace ripple
|
namespace ripple
|
||||||
{
|
{
|
||||||
@@ -20,8 +20,8 @@
|
|||||||
#ifndef RIPPLE_JOBTYPES_H_INCLUDED
|
#ifndef RIPPLE_JOBTYPES_H_INCLUDED
|
||||||
#define RIPPLE_JOBTYPES_H_INCLUDED
|
#define RIPPLE_JOBTYPES_H_INCLUDED
|
||||||
|
|
||||||
#include <ripple/module/core/functional/Job.h>
|
#include <ripple/module/core/Job.h>
|
||||||
#include <ripple/module/core/functional/JobTypeInfo.h>
|
#include <ripple/module/core/JobTypeInfo.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
namespace ripple
|
namespace ripple
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
#define RIPPLE_LOADFEETRACKIMP_H_INCLUDED
|
#define RIPPLE_LOADFEETRACKIMP_H_INCLUDED
|
||||||
|
|
||||||
#include <ripple/common/jsonrpc_fields.h>
|
#include <ripple/common/jsonrpc_fields.h>
|
||||||
|
#include <ripple/module/core/LoadFeeTrack.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
#ifndef RIPPLE_LOADMONITOR_H_INCLUDED
|
#ifndef RIPPLE_LOADMONITOR_H_INCLUDED
|
||||||
#define RIPPLE_LOADMONITOR_H_INCLUDED
|
#define RIPPLE_LOADMONITOR_H_INCLUDED
|
||||||
|
|
||||||
#include <ripple/module/core/functional/LoadEvent.h>
|
#include <ripple/module/core/LoadEvent.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
@@ -17,9 +17,10 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#include <boost/regex.hpp>
|
#include <ripple/module/core/Config.h>
|
||||||
#include <beast/asio/placeholders.h>
|
#include <beast/asio/placeholders.h>
|
||||||
#include <beast/module/core/memory/SharedSingleton.h>
|
#include <beast/module/core/memory/SharedSingleton.h>
|
||||||
|
#include <boost/regex.hpp>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
#ifndef RIPPLE_NET_BASICS_SNTPCLIENT_H_INCLUDED
|
#ifndef RIPPLE_NET_BASICS_SNTPCLIENT_H_INCLUDED
|
||||||
#define RIPPLE_NET_BASICS_SNTPCLIENT_H_INCLUDED
|
#define RIPPLE_NET_BASICS_SNTPCLIENT_H_INCLUDED
|
||||||
|
|
||||||
|
#include <beast/threads/Stoppable.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
class SNTPClient : public beast::Stoppable
|
class SNTPClient : public beast::Stoppable
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
#ifndef RIPPLE_NET_RPC_INFOSUB_H_INCLUDED
|
#ifndef RIPPLE_NET_RPC_INFOSUB_H_INCLUDED
|
||||||
#define RIPPLE_NET_RPC_INFOSUB_H_INCLUDED
|
#define RIPPLE_NET_RPC_INFOSUB_H_INCLUDED
|
||||||
|
|
||||||
|
#include <beast/threads/Stoppable.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
// Operations that clients may wish to perform against the network
|
// Operations that clients may wish to perform against the network
|
||||||
|
|||||||
@@ -20,6 +20,9 @@
|
|||||||
#ifndef RIPPLE_NET_RPC_RPCSUB_H_INCLUDED
|
#ifndef RIPPLE_NET_RPC_RPCSUB_H_INCLUDED
|
||||||
#define RIPPLE_NET_RPC_RPCSUB_H_INCLUDED
|
#define RIPPLE_NET_RPC_RPCSUB_H_INCLUDED
|
||||||
|
|
||||||
|
#include <ripple/module/core/JobQueue.h>
|
||||||
|
#include <beast/threads/Stoppable.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
/** Subscription object for JSON RPC. */
|
/** Subscription object for JSON RPC. */
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
#ifndef RIPPLE_APP_RPC_HANDLER
|
#ifndef RIPPLE_APP_RPC_HANDLER
|
||||||
#define RIPPLE_APP_RPC_HANDLER
|
#define RIPPLE_APP_RPC_HANDLER
|
||||||
|
|
||||||
|
#include <ripple/module/core/Config.h>
|
||||||
|
|
||||||
#include <ripple/module/rpc/impl/AccountFromString.h>
|
#include <ripple/module/rpc/impl/AccountFromString.h>
|
||||||
#include <ripple/module/rpc/impl/Accounts.h>
|
#include <ripple/module/rpc/impl/Accounts.h>
|
||||||
#include <ripple/module/rpc/impl/Authorize.h>
|
#include <ripple/module/rpc/impl/Authorize.h>
|
||||||
|
|||||||
@@ -20,11 +20,15 @@
|
|||||||
#ifndef RIPPLE_RPC_CONTEXT
|
#ifndef RIPPLE_RPC_CONTEXT
|
||||||
#define RIPPLE_RPC_CONTEXT
|
#define RIPPLE_RPC_CONTEXT
|
||||||
|
|
||||||
|
#include <ripple/module/core/Config.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
namespace RPC {
|
namespace RPC {
|
||||||
|
|
||||||
/** The context of information needed to call an RPC. */
|
/** The context of information needed to call an RPC. */
|
||||||
struct Context {
|
struct Context
|
||||||
|
{
|
||||||
|
// VFALCO NOTE Public members should not have underscores appended
|
||||||
Json::Value params_;
|
Json::Value params_;
|
||||||
Resource::Charge& loadType_;
|
Resource::Charge& loadType_;
|
||||||
NetworkOPs& netOps_;
|
NetworkOPs& netOps_;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#ifndef RIPPLE_RPC_HANDLER
|
#ifndef RIPPLE_RPC_HANDLER
|
||||||
#define RIPPLE_RPC_HANDLER
|
#define RIPPLE_RPC_HANDLER
|
||||||
|
|
||||||
|
#include <ripple/module/core/Config.h>
|
||||||
#include <ripple/module/rpc/RPCHandler.h>
|
#include <ripple/module/rpc/RPCHandler.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#include <ripple/module/app/main/RPCHTTPServer.h>
|
#include <ripple/module/app/main/RPCHTTPServer.h>
|
||||||
|
#include <ripple/module/core/Config.h>
|
||||||
|
#include <ripple/module/core/LoadFeeTrack.h>
|
||||||
#include <ripple/module/rpc/RPCHandler.h>
|
#include <ripple/module/rpc/RPCHandler.h>
|
||||||
#include <ripple/module/rpc/RPCServerHandler.h>
|
#include <ripple/module/rpc/RPCServerHandler.h>
|
||||||
#include <ripple/module/rpc/Tuning.h>
|
#include <ripple/module/rpc/Tuning.h>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#if RIPPLE_HYPERLEVELDB_AVAILABLE
|
#if RIPPLE_HYPERLEVELDB_AVAILABLE
|
||||||
|
|
||||||
#include <ripple/module/core/functional/Config.h>
|
#include <ripple/module/core/Config.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
namespace NodeStore {
|
namespace NodeStore {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#if RIPPLE_LEVELDB_AVAILABLE
|
#if RIPPLE_LEVELDB_AVAILABLE
|
||||||
|
|
||||||
#include <ripple/module/core/functional/Config.h>
|
#include <ripple/module/core/Config.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
namespace NodeStore {
|
namespace NodeStore {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#if RIPPLE_ROCKSDB_AVAILABLE
|
#if RIPPLE_ROCKSDB_AVAILABLE
|
||||||
|
|
||||||
#include <ripple/module/core/functional/Config.h>
|
#include <ripple/module/core/Config.h>
|
||||||
#include <beast/threads/Thread.h>
|
#include <beast/threads/Thread.h>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,8 @@
|
|||||||
#include <ripple/overlay/impl/peer_protocol_detector.h>
|
#include <ripple/overlay/impl/peer_protocol_detector.h>
|
||||||
#include <ripple/module/app/misc/ProofOfWork.h>
|
#include <ripple/module/app/misc/ProofOfWork.h>
|
||||||
#include <ripple/module/app/misc/ProofOfWorkFactory.h>
|
#include <ripple/module/app/misc/ProofOfWorkFactory.h>
|
||||||
|
#include <ripple/module/core/Config.h>
|
||||||
|
#include <ripple/module/core/LoadFeeTrack.h>
|
||||||
#include <ripple/module/data/protocol/Protocol.h>
|
#include <ripple/module/data/protocol/Protocol.h>
|
||||||
#include <ripple/unity/peerfinder.h>
|
#include <ripple/unity/peerfinder.h>
|
||||||
#include <ripple/validators/Manager.h>
|
#include <ripple/validators/Manager.h>
|
||||||
|
|||||||
@@ -44,7 +44,6 @@
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <ripple/unity/basics.h>
|
#include <ripple/unity/basics.h>
|
||||||
#include <ripple/unity/core.h>
|
|
||||||
#include <ripple/unity/data.h>
|
#include <ripple/unity/data.h>
|
||||||
#include <ripple/unity/net.h>
|
#include <ripple/unity/net.h>
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
#include <ripple/basics/log/Log.cpp>
|
#include <ripple/basics/log/Log.cpp>
|
||||||
#include <ripple/basics/system/CheckLibraryVersions.cpp>
|
#include <ripple/basics/system/CheckLibraryVersions.cpp>
|
||||||
#include <ripple/basics/utility/CountedObject.cpp>
|
#include <ripple/basics/utility/CountedObject.cpp>
|
||||||
#include <ripple/basics/utility/IniFile.cpp>
|
|
||||||
#include <ripple/basics/utility/StringUtilities.cpp>
|
#include <ripple/basics/utility/StringUtilities.cpp>
|
||||||
#include <ripple/basics/utility/Sustain.cpp>
|
#include <ripple/basics/utility/Sustain.cpp>
|
||||||
#include <ripple/basics/utility/ThreadName.cpp>
|
#include <ripple/basics/utility/ThreadName.cpp>
|
||||||
|
|||||||
@@ -19,8 +19,6 @@
|
|||||||
|
|
||||||
#include <BeastConfig.h>
|
#include <BeastConfig.h>
|
||||||
|
|
||||||
#include <ripple/unity/core.h>
|
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
@@ -31,11 +29,11 @@
|
|||||||
#include <beast/http/ParsedURL.h>
|
#include <beast/http/ParsedURL.h>
|
||||||
#include <ripple/unity/net.h> // for HTTPClient
|
#include <ripple/unity/net.h> // for HTTPClient
|
||||||
|
|
||||||
#include <ripple/module/core/functional/Config.cpp>
|
#include <ripple/module/core/Config.cpp>
|
||||||
#include <ripple/module/core/functional/LoadFeeTrackImp.h> // private
|
#include <ripple/module/core/LoadFeeTrackImp.h> // private
|
||||||
#include <ripple/module/core/functional/LoadFeeTrackImp.cpp>
|
#include <ripple/module/core/LoadFeeTrackImp.cpp>
|
||||||
#include <ripple/module/core/functional/LoadEvent.cpp>
|
#include <ripple/module/core/LoadEvent.cpp>
|
||||||
#include <ripple/module/core/functional/LoadMonitor.cpp>
|
#include <ripple/module/core/LoadMonitor.cpp>
|
||||||
|
|
||||||
#include <ripple/module/core/functional/Job.cpp>
|
#include <ripple/module/core/Job.cpp>
|
||||||
#include <ripple/module/core/functional/JobQueue.cpp>
|
#include <ripple/module/core/JobQueue.cpp>
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of rippled: https://github.com/ripple/rippled
|
|
||||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#ifndef RIPPLE_CORE_H_INCLUDED
|
|
||||||
#define RIPPLE_CORE_H_INCLUDED
|
|
||||||
|
|
||||||
#include <ripple/unity/basics.h>
|
|
||||||
#include <ripple/unity/data.h>
|
|
||||||
|
|
||||||
#include <beast/http/URL.h> // for Config
|
|
||||||
#include <beast/Insight.h>
|
|
||||||
|
|
||||||
#include <ripple/resource/api/LegacyFees.h>
|
|
||||||
|
|
||||||
#include <ripple/module/core/functional/ConfigSections.h>
|
|
||||||
#include <ripple/module/core/functional/Config.h>
|
|
||||||
#include <ripple/module/core/functional/LoadFeeTrack.h>
|
|
||||||
#include <ripple/module/core/functional/LoadEvent.h>
|
|
||||||
#include <ripple/module/core/functional/LoadMonitor.h>
|
|
||||||
|
|
||||||
#include <ripple/module/core/functional/Job.h>
|
|
||||||
#include <ripple/module/core/functional/JobQueue.h>
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -28,7 +28,6 @@
|
|||||||
#include <ripple/unity/resource.h>
|
#include <ripple/unity/resource.h>
|
||||||
|
|
||||||
#include <ripple/unity/basics.h>
|
#include <ripple/unity/basics.h>
|
||||||
#include <ripple/unity/core.h>
|
|
||||||
#include <ripple/unity/data.h>
|
#include <ripple/unity/data.h>
|
||||||
#include <ripple/module/websocket/autosocket/AutoSocket.h>
|
#include <ripple/module/websocket/autosocket/AutoSocket.h>
|
||||||
|
|
||||||
|
|||||||
@@ -20,9 +20,9 @@
|
|||||||
#ifndef RIPPLE_TESTOVERLAY_H_INCLUDED
|
#ifndef RIPPLE_TESTOVERLAY_H_INCLUDED
|
||||||
#define RIPPLE_TESTOVERLAY_H_INCLUDED
|
#define RIPPLE_TESTOVERLAY_H_INCLUDED
|
||||||
|
|
||||||
#include <beast/module/core/core.h>
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <beast/strings/String.h>
|
||||||
|
#include <beast/module/core/maths/Random.h>
|
||||||
|
|
||||||
/** Provides a template based peer to peer network simulator.
|
/** Provides a template based peer to peer network simulator.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user