|
|
|
|
|
|
|
|
#include "Command.hpp"
|
|
|
#include "Command.hpp"
|
|
|
#include "ScannerPool.hpp"
|
|
|
#include "ScannerPool.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
#include "../SNFMulti/SNFMulti.hpp"
|
|
|
|
|
|
|
|
|
#include "../CodeDweller/threading.hpp"
|
|
|
#include "../CodeDweller/threading.hpp"
|
|
|
#include "../CodeDweller/faults.hpp"
|
|
|
#include "../CodeDweller/faults.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
|
|
//// Tuning Constants //////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
const int ReadBufferSize = snf_ScanHorizon;
|
|
|
|
|
|
const int StringReserveSize = 2048;
|
|
|
|
|
|
|
|
|
//// Job ///////////////////////////////////////////////////////////////////////
|
|
|
//// Job ///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
void Job::emitCommentPrefix() {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Job::emitComment(string Comment) {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Job::emitResponsePrevix() {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Job::emitOK() {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Job::emitINTF() {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Job::emitFAIL() {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Job::emitADDHEADER(string Headers) {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Job::emitERROR() {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Job::emitDISCARD() {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void job::finalize() {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
void Job::doWakeUp() {
|
|
|
void Job::doWakeUp() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Job::doFILE() {
|
|
|
void Job::doFILE() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Job::readTopOfMessage(ifstream& Reader) {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
void Job::doRead() {
|
|
|
void Job::doRead() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Job::doDelete() {
|
|
|
void Job::doDelete() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
void Job::doHold() {
|
|
|
|
|
|
|
|
|
void Job::moveMessageToHoldPath(ifstream& Reader) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
ScannerPool& Scanners; // Knows where to get scanners.
|
|
|
|
|
|
OutputProcessor& Output;
|
|
|
|
|
|
Command CurrentCommand; // Has a current comand.
|
|
|
|
|
|
string OutputBuffer; // Preserves an output buffer.
|
|
|
|
|
|
vector<unsigned char> ReadBuffer; // Preserves a file read buffer.
|
|
|
|
|
|
unsigned int ReadLength; // How much data in the buffer.
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
void Job::doHold() {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Job::Job(ScannerPool& S, OutputProcessor& O) : // Construct with important links.
|
|
|
Job::Job(ScannerPool& S, OutputProcessor& O) : // Construct with important links.
|
|
|
Scanners(S),
|
|
|
Scanners(S),
|
|
|
Output(O),
|
|
|
Output(O),
|
|
|
ReadLength(0) {
|
|
|
|
|
|
|
|
|
ScanResultCode(0),
|
|
|
|
|
|
ReadLength(0) { // Minimize heap thrashing.
|
|
|
|
|
|
OutputBuffer.reserve(StringReserveSize);
|
|
|
|
|
|
HeadersToInject.researve(StringReserveSize);
|
|
|
|
|
|
ReadBuffer.reserve(ReadBufferSize);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
Job::~Job() { // Cleanup when destructing.
|
|
|
Job::~Job() { // Cleanup when destructing.
|
|
|
|
|
|
try { clear(); }
|
|
|
|
|
|
catch(...) {}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Job::clear() { // Cleanup for the next command.
|
|
|
|
|
|
CurrentCommand.clear();
|
|
|
|
|
|
ScanResultCode = 0;
|
|
|
|
|
|
OutputBuffer.clear();
|
|
|
|
|
|
HeadersToInject.clear();
|
|
|
|
|
|
MessageMoveFilePath.clear();
|
|
|
|
|
|
ReadBuffer.clear();
|
|
|
|
|
|
ReadLength = 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
void Job::setCommand(Command& C) { // Assign a command for this job.
|
|
|
void Job::setCommand(Command& C) { // Assign a command for this job.
|
|
|
|
|
|
CurrentCommand = C;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
void Job::doIt() { // Get the job done.
|
|
|
void Job::doIt() { // Get the job done.
|
|
|
|
|
|
switch(CurrentCommand.Type) {
|
|
|
|
|
|
case Command::WAKE: { doWakeUp(); break; }
|
|
|
|
|
|
case Command::INTF: { doINTF(); break; }
|
|
|
|
|
|
case Command::FILE: { doFILE(); break; }
|
|
|
|
|
|
default: { doFAIL(); break; }
|
|
|
|
|
|
}
|
|
|
|
|
|
finalize();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
string& Job::Responses() { // Read the job's report.
|
|
|
string& Job::Responses() { // Read the job's report.
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Job::clear() { // Cleanup for the next command.
|
|
|
|
|
|
|
|
|
return OutputBuffer;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//// JobPool ///////////////////////////////////////////////////////////////////
|
|
|
//// JobPool ///////////////////////////////////////////////////////////////////
|