|
|
|
|
|
|
|
|
//// snfScanData /////////////////////////////////////////////////////////////// |
|
|
//// snfScanData /////////////////////////////////////////////////////////////// |
|
|
|
|
|
|
|
|
snfScanData::snfScanData(int ScanHorizon) : // How to create. |
|
|
snfScanData::snfScanData(int ScanHorizon) : // How to create. |
|
|
FilteredData(ScanHorizon, 0), // Allocate the Filtered Data buffer. |
|
|
|
|
|
ReadyToClear(true) { // Make sure the clear will happen. |
|
|
|
|
|
|
|
|
ReadyToClear(true), // Make sure initial clear will happen. |
|
|
|
|
|
FilteredData(ScanHorizon, 0) { // Allocate the Filtered Data buffer.
|
|
|
clear(); // Start with no data. |
|
|
clear(); // Start with no data. |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const ThreadType snfLOGmgr::Type("snfLOGmgr"); // The thread's type. |
|
|
const ThreadType snfLOGmgr::Type("snfLOGmgr"); // The thread's type. |
|
|
|
|
|
|
|
|
snfLOGmgr::snfLOGmgr() : // Constructor for the LOG manager |
|
|
snfLOGmgr::snfLOGmgr() : // Constructor for the LOG manager |
|
|
Thread(snfLOGmgr::Type, "Log Manager"), // snfLOGmgr Type and Name. |
|
|
|
|
|
|
|
|
Thread(snfLOGmgr::Type, "Log Manager"), // snfLOGmgr Type and Name.
|
|
|
|
|
|
Configured(false), // Not yet configured. |
|
|
|
|
|
TimeToDie(false), // Not yet time to die.
|
|
|
|
|
|
PeekEnableCounter(0), // No peeking yet.
|
|
|
|
|
|
SampleEnableCounter(0), // No sampling yet.
|
|
|
|
|
|
myNETmgr(NULL), // No NET mgr yet.
|
|
|
|
|
|
myGBUdb(NULL), // No GBUdb yet.
|
|
|
|
|
|
NewerRulebaseIsAvailable(false), // No newer rulebase yet.
|
|
|
SecondStatusLogger("Second Status Logger"), // Lazy writer for Second status. |
|
|
SecondStatusLogger("Second Status Logger"), // Lazy writer for Second status. |
|
|
MinuteStatusLogger("Minute Status Logger"), // Lazy writer for Minute status. |
|
|
MinuteStatusLogger("Minute Status Logger"), // Lazy writer for Minute status. |
|
|
HourStatusLogger("Hour Status Logger"), // Lazy writer for Hour status. |
|
|
HourStatusLogger("Hour Status Logger"), // Lazy writer for Hour status. |
|
|
XMLScanLogger("XML Scan Logger"), // Lazy writer for XML Scan log. |
|
|
XMLScanLogger("XML Scan Logger"), // Lazy writer for XML Scan log. |
|
|
ClassicScanLogger("Classic Scan Logger"), // Lazy writer for Classic Scan log. |
|
|
|
|
|
PeekEnableCounter(0), |
|
|
|
|
|
SampleEnableCounter(0), |
|
|
|
|
|
myNETmgr(NULL), |
|
|
|
|
|
myGBUdb(NULL), |
|
|
|
|
|
NewerRulebaseIsAvailable(false), |
|
|
|
|
|
TimeToDie(false) { |
|
|
|
|
|
|
|
|
ClassicScanLogger("Classic Scan Logger") { // Lazy writer for Classic Scan log. |
|
|
StartupTime = Timestamp(); // Record when did we start. |
|
|
StartupTime = Timestamp(); // Record when did we start. |
|
|
CurrentCounters = &CounterPackA; // Assign the active CounterPack. |
|
|
CurrentCounters = &CounterPackA; // Assign the active CounterPack. |
|
|
ReportingCounters = &CounterPackB; // Assign the reporting CounterPack. |
|
|
ReportingCounters = &CounterPackB; // Assign the reporting CounterPack. |
|
|
|
|
|
|
|
|
char TimestampBfr[20]; // Create a small buffer. |
|
|
char TimestampBfr[20]; // Create a small buffer. |
|
|
tm* gmt; // Get a ptr to a tm structure. |
|
|
tm* gmt; // Get a ptr to a tm structure. |
|
|
gmt = gmtime(&t); // Fill it with UTC. |
|
|
gmt = gmtime(&t); // Fill it with UTC. |
|
|
sprintf(TimestampBfr,"%04d%02d%02d%02d%02d%02d\0", // Format yyyymmddhhmmss |
|
|
|
|
|
|
|
|
sprintf(TimestampBfr,"%04d%02d%02d%02d%02d%02d", // Format yyyymmddhhmmss |
|
|
gmt->tm_year+1900, |
|
|
gmt->tm_year+1900, |
|
|
gmt->tm_mon+1, |
|
|
gmt->tm_mon+1, |
|
|
gmt->tm_mday, |
|
|
gmt->tm_mday, |
|
|
|
|
|
|
|
|
char TimestampBfr[20]; // Create a small buffer. |
|
|
char TimestampBfr[20]; // Create a small buffer. |
|
|
tm* localt; // Get a ptr to a tm structure. |
|
|
tm* localt; // Get a ptr to a tm structure. |
|
|
localt = localtime(&t); // Fill it with local time. |
|
|
localt = localtime(&t); // Fill it with local time. |
|
|
sprintf(TimestampBfr,"%04d%02d%02d%02d%02d%02d\0", // Format yyyymmddhhmmss |
|
|
|
|
|
|
|
|
sprintf(TimestampBfr,"%04d%02d%02d%02d%02d%02d", // Format yyyymmddhhmmss |
|
|
localt->tm_year+1900, |
|
|
localt->tm_year+1900, |
|
|
localt->tm_mon+1, |
|
|
localt->tm_mon+1, |
|
|
localt->tm_mday, |
|
|
localt->tm_mday, |