|
|
|
|
|
|
|
|
// SNF4CGP/JobPool.cpp
|
|
|
// SNF4CGP/JobPool.cpp
|
|
|
// Copyright (C) 2009 ARM Research Labs, LLC.
|
|
|
// Copyright (C) 2009 ARM Research Labs, LLC.
|
|
|
// See www.armresearch.com for more information.
|
|
|
// See www.armresearch.com for more information.
|
|
|
|
|
|
|
|
|
|
|
|
#include "JobPool.hpp"
|
|
|
|
|
|
#include "Command.hpp"
|
|
|
|
|
|
#include "ScannerPool.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
#include "../CodeDweller/threading.hpp"
|
|
|
|
|
|
#include "../CodeDweller/faults.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
|
|
//// Job ///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
void Job::doWakeUp() {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Job::doINTF() {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Job::doFAIL() {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Job::doFILE() {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Job::doRead() {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Job::doScan() {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Job::doAction() {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Job::doBypass() {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Job::doAllow() {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Job::doReject() {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Job::doDelete() {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Job::doHold() {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
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.
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
Job::Job(ScannerPool& S, OutputProcessor& O) : // Construct with important links.
|
|
|
|
|
|
Scanners(S),
|
|
|
|
|
|
Output(O),
|
|
|
|
|
|
ReadLength(0) {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Job::~Job() { // Cleanup when destructing.
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Job::setCommand(Command& C) { // Assign a command for this job.
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Job::doIt() { // Get the job done.
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string& Job::Responses() { // Read the job's report.
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Job::clear() { // Cleanup for the next command.
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//// JobPool ///////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
JobPool::JobPool() : // Simple constructor.
|
|
|
|
|
|
Output_(0),
|
|
|
|
|
|
Scanners_(0),
|
|
|
|
|
|
AllocatedJobs(0),
|
|
|
|
|
|
Started(false) {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
JobPool::~JobPool() { // Clean up on the way out.
|
|
|
|
|
|
try { stop(); }
|
|
|
|
|
|
catch(...) {}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Watch out -- Initializing the JobPool also means starting up SNFMulti and
|
|
|
|
|
|
// the ScannerPool.
|
|
|
|
|
|
|
|
|
|
|
|
void JobPool::init(string Configuration, OutputProcessor& O) { // Initialize the JobPool.
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Job* JobPool::makeJob() { // Create and count a Job.
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Job& JobPool::grab() { // Grab a job (prefer from the pool).
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void JobPool::drop(Job& J) { // Drop a job into the pool.
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void JobPool::killJobFromPool() { // Kill and count a Job from the pool.
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Watch out -- Stopping the JobPool also means shutting down SNFMulti and
|
|
|
|
|
|
// the ScannerPool.
|
|
|
|
|
|
|
|
|
|
|
|
void JobPool::stop() { // Shut down the JobPool.
|
|
|
|
|
|
// Kill off all of the allocated Jobs.
|
|
|
|
|
|
// Shut down and destroy the ScannerPool.
|
|
|
|
|
|
}
|
|
|
|
|
|
|