|
|
@@ -5,6 +5,8 @@ |
|
|
|
|
|
|
|
#include "snf_sync.hpp" |
|
|
|
|
|
|
|
namespace cd = codedweller; |
|
|
|
|
|
|
|
void snf_sync::construct() { // Encapsulate initial construction. |
|
|
|
ClientGBUAlertInitializer.link(ClientGBUAlertHandler); // Link the alert configurators. |
|
|
|
ServerGBUAlertInitializer.link(ServerGBUAlertHandler); |
|
|
@@ -23,7 +25,7 @@ snf_sync::snf_sync(const char* bfr, int len) : |
|
|
|
Reader("snf"), // Start with our blank construction. |
|
|
|
ReadWasGood(false) { |
|
|
|
construct(); // Internal wiring & initialization. |
|
|
|
ConfigurationData Data(bfr, len); // Then build ConfigurationData from |
|
|
|
cd::ConfigurationData Data(bfr, len); // Then build ConfigurationData from |
|
|
|
Reader.interpret(Data); // the buffer and interpret it. |
|
|
|
} |
|
|
|
|
|
|
@@ -31,7 +33,7 @@ snf_sync::snf_sync(string& input) : |
|
|
|
Reader("snf"), // Start with our blank construction. |
|
|
|
ReadWasGood(false) { |
|
|
|
construct(); // Internal wiring & initialization. |
|
|
|
ConfigurationData Data(input.c_str(), input.length()); // Then build ConfigurationData from |
|
|
|
cd::ConfigurationData Data(input.c_str(), input.length()); // Then build ConfigurationData from |
|
|
|
Reader.interpret(Data); // the string and interpret it. |
|
|
|
} |
|
|
|
|
|
|
@@ -89,7 +91,7 @@ void snf_sync::reset() { |
|
|
|
}; |
|
|
|
|
|
|
|
bool snf_sync::read(const char* bfr, int len) { // To read from a buffer we |
|
|
|
ConfigurationData Data(bfr, len); // construct ConfigurationData from |
|
|
|
cd::ConfigurationData Data(bfr, len); // construct ConfigurationData from |
|
|
|
Reader.interpret(Data); // the buffer and interpret it. |
|
|
|
return good(); // Return true if it looked good. |
|
|
|
} |
|
|
@@ -107,7 +109,7 @@ bool snf_sync::bad() { |
|
|
|
} |
|
|
|
|
|
|
|
void GBUAlertHandler::operator()( |
|
|
|
ConfigurationElement& E, ConfigurationData& D) { // Add an alert. |
|
|
|
cd::ConfigurationElement& E, cd::ConfigurationData& D) { // Add an alert. |
|
|
|
GBUdbAlert NewAlert; // Create an alert object. |
|
|
|
SocketAddress IPAddress; // Grab one of these for a converter. |
|
|
|
IPAddress.setAddress(const_cast<char*>(Alert_ip.c_str())); // Conver the IP address to an int. |