18 #ifndef OJOS_AGENT_UTILS_HPP 19 #define OJOS_AGENT_UTILS_HPP 21 #define AGENT_NAME "ojo" 22 #define AGENT_DESC "ojo agent" 23 #define AGENT_ARS "ojo_ars" 27 #include <json/json.h> 28 #include <boost/program_options.hpp> 30 #include "ojomatch.hpp" 46 void bail(
int exitval);
53 std::vector<std::string> &fileNames, std::string &directoryToScan);
55 const pair<
string, vector<ojomatch>> resultPair,
bool &printComma);
57 const pair<
string, vector<ojomatch>> resultPair);
59 #endif // OJOS_AGENT_UTILS_HPP void bail(int exitval)
Disconnect with scheduler returning an error code and exit.
bool storeResultInDb(const vector< ojomatch > &matches, OjosDatabaseHandler &databaseHandle, const int agent_fk, const int pfile_fk)
Store the results from scan to DB.
void printResultToStdout(const std::string fileName, const std::pair< string, list< match >> resultPair)
CopyrightState getState(CliOptions &&cliOptions)
Create a new state for the current agent based on CliOptions.
void appendToJson(const std::string fileName, const std::pair< string, list< match >> resultPair, bool &printComma)
Database handler for OJO.
Store the state of the agent.
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.
The main FOSSology C library.
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.
fo_dbManager * dbManager
fo_dbManager 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.
The main FOSSology CPP library.
Store the options sent through the CLI.