Browse Source

tidy namespace snf_sync

master
Pete McNeil 4 years ago
parent
commit
c109f59a3b
2 changed files with 16 additions and 16 deletions
  1. 4
    4
      snf_sync.cpp
  2. 12
    12
      snf_sync.hpp

+ 4
- 4
snf_sync.cpp View File

// snf_sync.cpp // snf_sync.cpp
// Copyright (C) 2006 - 2009 ARM Research Labs, LLC.
// Copyright (C) 2006 - 2020 ARM Research Labs, LLC.
// See www.armresearch.com for the copyright terms. // See www.armresearch.com for the copyright terms.
// See snf_sync.hpp for details. // See snf_sync.hpp for details.


Reader.interpret(Data); // the buffer and interpret it. Reader.interpret(Data); // the buffer and interpret it.
} }


snf_sync::snf_sync(string& input) : // Constructing with a string.
snf_sync::snf_sync(std::string& input) : // Constructing with a string.
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.
return good(); // Return true if it looked good. return good(); // Return true if it looked good.
} }


bool snf_sync::read(string& input) { // To read from a string we
bool snf_sync::read(std::string& input) { // To read from a string we
return read(input.c_str(), input.length()); // get the strings buffer and hand off return read(input.c_str(), input.length()); // get the strings buffer and hand off
} // to our buffer read() } // to our buffer read()


void GBUAlertHandler::operator()( void GBUAlertHandler::operator()(
cd::ConfigurationElement& E, cd::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.
cd::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.
NewAlert.IP = IPAddress.getAddress(); // Put the IP into it's place. NewAlert.IP = IPAddress.getAddress(); // Put the IP into it's place.
NewAlert.R.Bad(Alert_b); // Set the bad count on the record. NewAlert.R.Bad(Alert_b); // Set the bad count on the record.

+ 12
- 12
snf_sync.hpp View File

// snf_sync.hpp // snf_sync.hpp
// Copyright (C) 2006 - 2009 ARM Research Labs, LLC.
// Copyright (C) 2006 - 2020 ARM Research Labs, LLC.
// See www.armresearch.com for the copyright terms. // See www.armresearch.com for the copyright terms.
// //
// SNF engine communications protocol interpreter. // SNF engine communications protocol interpreter.


void reset(); // Resets the list for a new run. void reset(); // Resets the list for a new run.


list<GBUdbAlert> AlertList; // Our list of alerts.
std::list<GBUdbAlert> AlertList; // Our list of alerts.


// Input variables. // Input variables.


string Alert_time; // time='YYYYMMDDhhmmss'
string Alert_ip; // ip='12.34.56.78'
string Alert_t; // t='Ugly', Good, Bad, Ignore
std::string Alert_time; // time='YYYYMMDDhhmmss'
std::string Alert_ip; // ip='12.34.56.78'
std::string Alert_t; // t='Ugly', Good, Bad, Ignore
int Alert_b; // b='0' int Alert_b; // b='0'
int Alert_g; // g='0' int Alert_g; // g='0'
}; };
public: public:
snf_sync(); // Construct empty. snf_sync(); // Construct empty.
snf_sync(const char* bfr, int len); // Construct from buffer. snf_sync(const char* bfr, int len); // Construct from buffer.
snf_sync(string& input); // Construct from string.
snf_sync(std::string& input); // Construct from string.
bool read(const char* bfr, int len); // Read from buffer. bool read(const char* bfr, int len); // Read from buffer.
bool read(string& input); // Read from string.
bool read(std::string& input); // Read from string.


//// And now the interpreted results //// //// And now the interpreted results ////
bool good(); // True if read was good. bool good(); // True if read was good.
bool bad(); // True if read was not good. bool bad(); // True if read was not good.


string snf_sync_challenge_txt;
string snf_sync_response_nodeid;
string snf_sync_response_text;
string snf_sync_error_message;
std::string snf_sync_challenge_txt;
std::string snf_sync_response_nodeid;
std::string snf_sync_response_text;
std::string snf_sync_error_message;
int snf_sync_error_code; int snf_sync_error_code;
string snf_sync_rulebase_utc;
std::string snf_sync_rulebase_utc;
int snf_sync_server_resync_secs; int snf_sync_server_resync_secs;


GBUAlertHandler ClientGBUAlertHandler; // GBU Alerts received from client GBUAlertHandler ClientGBUAlertHandler; // GBU Alerts received from client

Loading…
Cancel
Save