|
|
|
|
|
|
|
|
|
|
|
|
|
|
//// Version Info |
|
|
//// Version Info |
|
|
|
|
|
|
|
|
const char* SNF_ENGINE_VERSION = "SNFMulti Engine Version 3.0.22 Build: " __DATE__ " " __TIME__; |
|
|
|
|
|
|
|
|
const char* SNF_ENGINE_VERSION = "SNFMulti Engine Version 3.0.23 Build: " __DATE__ " " __TIME__; |
|
|
|
|
|
|
|
|
//// Script Caller Methods |
|
|
//// Script Caller Methods |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IPPattern, |
|
|
IPPattern, |
|
|
AboveBandPattern |
|
|
AboveBandPattern |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// In order to optimize message file reads when header injection is not activated
|
|
|
|
|
|
// we need to look ahead to see if header injection is likely to be turned on when
|
|
|
|
|
|
// we do the scan. This is a short term fix. The better fix might be to perform
|
|
|
|
|
|
// the configuration load prior to scanning the message -- but that is a much larger
|
|
|
|
|
|
// refactoring that ties up configuration and rulebase resources for a longer time.
|
|
|
|
|
|
// Instead we're going to take an optimistic route and just peek at the configuration.
|
|
|
|
|
|
// If the configuration changes while we're loading the file to be scanned then
|
|
|
|
|
|
// we have two cases. If we go from XHDRInject off to XHDRInject on then we will
|
|
|
|
|
|
// miss adding headers to the message - not a bad outcome. If we go from XHDRInject
|
|
|
|
|
|
// on to XHDRInject off then we might emit headers for an extra message - also not
|
|
|
|
|
|
// a bad outcome.
|
|
|
|
|
|
|
|
|
|
|
|
bool snf_RulebaseHandler::testXHDRInjectOn() {
|
|
|
|
|
|
ScopeMutex HoldStillPlease(MyMutex); // Lock the rulebase until we're done. |
|
|
|
|
|
snfCFGData* myCFG = MyCFGmgr.ActiveConfiguration(); // Grab the active configuration. |
|
|
|
|
|
bool myXHDRInjectOnFlag = (LogOutputMode_Inject == myCFG->XHDROutput_Mode); // True if output mode is inject.
|
|
|
|
|
|
return myXHDRInjectOnFlag; // return the result.
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
int snf_EngineHandler::scanMessageFile( // Scan this message file. |
|
|
int snf_EngineHandler::scanMessageFile( // Scan this message file. |
|
|
const string MessageFilePath, // -- this is the file path (and id) |
|
|
const string MessageFilePath, // -- this is the file path (and id) |
|
|
|
|
|
|
|
|
throw FileError("snf_EngineHandler::scanMessageFile() FileEmpty!"); |
|
|
throw FileError("snf_EngineHandler::scanMessageFile() FileEmpty!"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
bool isXHeaderInjectionOn = (MyScanData.XHeaderInjectOn);
|
|
|
|
|
|
bool isNoNeedToReadFullFile = (false == isXHeaderInjectionOn);
|
|
|
|
|
|
if(isNoNeedToReadFullFile) {
|
|
|
|
|
|
|
|
|
bool isXHeaderInjectionOn = MyRulebase->testXHDRInjectOn();
|
|
|
|
|
|
bool noNeedToReadFullFile = (false == isXHeaderInjectionOn);
|
|
|
|
|
|
if(noNeedToReadFullFile) {
|
|
|
MessageFileSize = min(MessageFileSize, snf_ScanHorizon);
|
|
|
MessageFileSize = min(MessageFileSize, snf_ScanHorizon);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|