x=FilterChain::GetByte(); // Get the next byte from source. | x=FilterChain::GetByte(); // Get the next byte from source. | ||||
} // If we get the empty signal | } // If we get the empty signal | ||||
// here, we've failed to match. | // here, we've failed to match. | ||||
catch(Empty) { // If so - and we haven't | |||||
catch(const Empty&) { // If so - and we haven't | |||||
if(0==ScanIx) throw Empty("FilterChainBase64: No more data"); // started then just throw Empty. | if(0==ScanIx) throw Empty("FilterChainBase64: No more data"); // started then just throw Empty. | ||||
State=DEQUEING;DequeIx=0; // If we have then we'll dequeue | State=DEQUEING;DequeIx=0; // If we have then we'll dequeue | ||||
return GetByte(); // it and throw when that's done | return GetByte(); // it and throw when that's done | ||||
StoreBuffer[InputPosition++] = x; // and storing it. | StoreBuffer[InputPosition++] = x; // and storing it. | ||||
} | } | ||||
catch(Empty) { // When we get the Empty | |||||
catch(const Empty&) { // When we get the Empty | |||||
Master = &FilterChainDefunker::ReadOut; // signal it is time for us | Master = &FilterChainDefunker::ReadOut; // signal it is time for us | ||||
return GetByte(); // to read out our data. | return GetByte(); // to read out our data. | ||||
} | } | ||||
return GetByte(); // Return the first byte from there :-) | return GetByte(); // Return the first byte from there :-) | ||||
} | } | ||||
void FilterChainHeaderAnalysis::SetOutputBuffer(string& s) { // Setup the OutputBuffer. | |||||
void FilterChainHeaderAnalysis::SetOutputBuffer(std::string& s) { // Setup the OutputBuffer. | |||||
OutputBuffer = (char*) s.c_str(); OutputIndex = 0; // Capture the c_str and reset the index. | OutputBuffer = (char*) s.c_str(); OutputIndex = 0; // Capture the c_str and reset the index. | ||||
} | } | ||||
time(&rawtime); // Grab the current time and | time(&rawtime); // Grab the current time and | ||||
gmt=gmtime(&rawtime); // convert it to GMT. | gmt=gmtime(&rawtime); // convert it to GMT. | ||||
sprintf(TimestampBfr,"%04d%02d%02d%02d%02d%02d", // Format yyyymmddhhmmss | |||||
(void) snprintf(TimestampBfr,UTCBufferSize, "%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, |
msclock IntervalTimer::hack() { // Chop off a new interval & return it. | msclock IntervalTimer::hack() { // Chop off a new interval & return it. | ||||
Inactive().start(Active().stop()); // Stop the active clock and reference | Inactive().start(Active().stop()); // Stop the active clock and reference | ||||
ANotB = ~ANotB; // it to start the new Active clock. | |||||
ANotB = !ANotB; // it to start the new Active clock. | |||||
return Interval(); // Flip the bit and return the Interval. | return Interval(); // Flip the bit and return the Interval. | ||||
} | } | ||||
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", // Format yyyymmddhhmmss | |||||
snprintf(TimestampBfr, sizeof(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, |
char TimestampBfr[20]; // Timestamp buffer. | char TimestampBfr[20]; // Timestamp buffer. | ||||
sprintf(TimestampBfr,"%04d%02d%02d%02d%02d%02d", // Format yyyymmddhhmmss | |||||
(void) snprintf( // Format yyyymmddhhmmss | |||||
TimestampBfr, sizeof(TimestampBfr), | |||||
"%04d%02d%02d%02d%02d%02d", | |||||
RulebaseTime.tm_year+1900, | RulebaseTime.tm_year+1900, | ||||
RulebaseTime.tm_mon+1, | RulebaseTime.tm_mon+1, | ||||
RulebaseTime.tm_mday, | RulebaseTime.tm_mday, |
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. | ||||
NewAlert.R.Good(Alert_g); // Set the good count on the record. | NewAlert.R.Good(Alert_g); // Set the good count on the record. | ||||
strncpy(NewAlert.UTC, Alert_time.c_str(), UTCBufferSize); // Copy the timestamp. | |||||
strncpy(NewAlert.UTC, Alert_time.c_str(), UTCBufferSize-1); // Copy the timestamp. | |||||
switch(Alert_t.at(0)) { // Use the first byte to set the flag. | switch(Alert_t.at(0)) { // Use the first byte to set the flag. | ||||
case 'U': { // U means Ugly. | case 'U': { // U means Ugly. | ||||
NewAlert.R.Flag(Ugly); | NewAlert.R.Flag(Ugly); |