7 #ifndef OJOS_AGENT_UTILS_HPP
8 #define OJOS_AGENT_UTILS_HPP
10 #define AGENT_NAME "ojo"
11 #define AGENT_DESC "ojo agent"
12 #define AGENT_ARS "ojo_ars"
16 #include <json/json.h>
17 #include <boost/program_options.hpp>
19 #include "ojomatch.hpp"
35 void bail(
int exitval);
42 std::vector<std::string> &fileNames, std::string &directoryToScan);
44 const pair<
string, vector<ojomatch>> resultPair,
bool &printComma);
46 const pair<
string, vector<ojomatch>> resultPair);
bool storeResultInDb(const vector< ojomatch > &matches, OjosDatabaseHandler &databaseHandle, const int agent_fk, const int pfile_fk)
Store the results from scan to DB.
Database handler for OJO.
Store the options sent through the CLI.
Store the state of the agent.
bool parseCliOptions(int argc, char **argv, CliOptions &dest, std::vector< std::string > &fileNames, std::string &directoryToScan)
Parse the options sent by CLI to CliOptions object.
int queryAgentId(PGconn *dbConn)
Get agent id, exit if agent id is incorrect.
int writeARS(int agentId, int arsId, int uploadId, int success, const fo::DbManager &dbManager)
Call C function fo_WriteARS() and translate the arguments.
CopyrightState getState(CliOptions &&cliOptions)
Create a new state for the current agent based on CliOptions.
bool processUploadId(const CopyrightState &state, int agentId, int uploadId, CopyrightDatabaseHandler &databaseHandler, bool ignoreFilesWithMimeType)
Process a given upload id, scan from statements and add to database.
void appendToJson(const std::string fileName, const std::pair< string, list< match >> resultPair, bool &printComma)
void printResultToStdout(const std::string fileName, const std::pair< string, list< match >> resultPair)
void bail(int exitval)
Disconnect with scheduler returning an error code and exit.
The main FOSSology CPP library.
The main FOSSology C library.
fo_dbManager * dbManager
fo_dbManager object