19 #ifndef COPYRIGHTUTILS_HPP_ 20 #define COPYRIGHTUTILS_HPP_ 22 #include "identity.hpp" 24 #define AGENT_NAME IDENTITY 25 #define AGENT_DESC IDENTITY " agent" 26 #define AGENT_ARS IDENTITY "_ars" 31 #include <json/json.h> 34 #include "regscan.hpp" 35 #include "copyscan.hpp" 37 #include "copyrightState.hpp" 38 #include "database.hpp" 39 #include "cleanEntries.hpp" 47 void bail(
int exitval);
52 std::vector<std::string>& fileNames, std::string& directoryToScan);
60 void normalizeContent(std::string& content);
65 const std::string fileName);
68 const std::pair<
string,
list<match>> resultPair,
bool &printComma);
void bail(int exitval)
Disconnect with scheduler returning an error code and exit.
void printResultToStdout(const std::string fileName, const std::pair< string, list< match >> resultPair)
Utilities to help scanners.
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)
Manages database related requests for agent.
scanner * makeRegexScanner(const std::string ®exDesc, const std::string &defaultType)
Make a boost regex scanner object based on regex desc and type.
Abstract class to provide interface to scanners.
Holds information about state of one 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.
list_t type structure used to keep various lists. (e.g. there are multiple lists).
Store the options sent through the CLI.
int writeARS(int agentId, int arsId, int uploadId, int success, const fo::DbManager &dbManager)
Call C function fo_WriteARS() and translate the arguments.
pair< string, list< match > > processSingleFile(const CopyrightState &state, const string fileName)