Browse Source

Minor tweaks to snfLOGmgr.* to eliminate compiler warnings.

git-svn-id: https://svn.microneil.com/svn/SNFMulti/trunk@8 dc71a809-1921-45c4-985c-09c81d0142d9
wx
madscientist 15 years ago
parent
commit
64ea95611e
3 changed files with 18 additions and 16 deletions
  1. 13
    12
      snfLOGmgr.cpp
  2. 3
    3
      snfLOGmgr.hpp
  3. 2
    1
      snfLOGmgr.inline.hpp

+ 13
- 12
snfLOGmgr.cpp View File

//// 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,

+ 3
- 3
snfLOGmgr.hpp View File

Mutex SampleMutex; // Protects Sample Loop Counter. Mutex SampleMutex; // Protects Sample Loop Counter.
Mutex StatusReportMutex; // Protects status report post & get. Mutex StatusReportMutex; // Protects status report post & get.


volatile int PeekEnableCounter; // How many peek attempts recently?
volatile int SampleEnableCounter; // How many sample attempts recently?

snfCounterPack CounterPackA, CounterPackB; // Swapable counter packs. snfCounterPack CounterPackA, CounterPackB; // Swapable counter packs.


snfCounterPack* CurrentCounters; // Current Event Counters. snfCounterPack* CurrentCounters; // Current Event Counters.
volatile bool Configured; // True if we're properly configured. volatile bool Configured; // True if we're properly configured.
volatile bool TimeToDie; // True when the thread should stop. volatile bool TimeToDie; // True when the thread should stop.


volatile int PeekEnableCounter; // How many peek attempts recently?
volatile int SampleEnableCounter; // How many sample attempts recently?
void myTask(); // Thread task. void myTask(); // Thread task.


time_t StartupTime; // Time since engine started. time_t StartupTime; // Time since engine started.

+ 2
- 1
snfLOGmgr.inline.hpp View File



inline IPScanRecord& snfScanData::SourceIPRecord(IPScanRecord& X) { // Sets the source IP record. inline IPScanRecord& snfScanData::SourceIPRecord(IPScanRecord& X) { // Sets the source IP record.
SourceIPOrdinal = X.Ordinal; // Here's the ordinal. SourceIPOrdinal = X.Ordinal; // Here's the ordinal.
SourceIPFoundFlag = true; // Here's the truth flag.
SourceIPFoundFlag = true; // Here's the truth flag.
return X; // Return what was set.
} }


inline IPScanRecord& snfScanData::SourceIPRecord() { // Gets the source IP record. inline IPScanRecord& snfScanData::SourceIPRecord() { // Gets the source IP record.

Loading…
Cancel
Save