|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "snf_sync.hpp" |
|
|
#include "snf_sync.hpp" |
|
|
|
|
|
|
|
|
|
|
|
namespace cd = codedweller; |
|
|
|
|
|
|
|
|
void snf_sync::construct() { // Encapsulate initial construction. |
|
|
void snf_sync::construct() { // Encapsulate initial construction. |
|
|
ClientGBUAlertInitializer.link(ClientGBUAlertHandler); // Link the alert configurators. |
|
|
ClientGBUAlertInitializer.link(ClientGBUAlertHandler); // Link the alert configurators. |
|
|
ServerGBUAlertInitializer.link(ServerGBUAlertHandler); |
|
|
ServerGBUAlertInitializer.link(ServerGBUAlertHandler); |
|
|
|
|
|
|
|
|
Reader("snf"), // Start with our blank construction. |
|
|
Reader("snf"), // Start with our blank construction. |
|
|
ReadWasGood(false) { |
|
|
ReadWasGood(false) { |
|
|
construct(); // Internal wiring & initialization. |
|
|
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. |
|
|
Reader.interpret(Data); // the buffer and interpret it. |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Reader("snf"), // Start with our blank construction. |
|
|
Reader("snf"), // Start with our blank construction. |
|
|
ReadWasGood(false) { |
|
|
ReadWasGood(false) { |
|
|
construct(); // Internal wiring & initialization. |
|
|
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. |
|
|
Reader.interpret(Data); // the string and interpret it. |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
bool snf_sync::read(const char* bfr, int len) { // To read from a buffer we |
|
|
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. |
|
|
Reader.interpret(Data); // the buffer and interpret it. |
|
|
return good(); // Return true if it looked good. |
|
|
return good(); // Return true if it looked good. |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void GBUAlertHandler::operator()( |
|
|
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. |
|
|
GBUdbAlert NewAlert; // Create an alert object. |
|
|
SocketAddress IPAddress; // Grab one of these for a converter. |
|
|
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. |
|
|
IPAddress.setAddress(const_cast<char*>(Alert_ip.c_str())); // Conver the IP address to an int. |