8 #ifndef COPYRIGHTUTILS_HPP_
9 #define COPYRIGHTUTILS_HPP_
11 #include "identity.hpp"
13 #define AGENT_NAME IDENTITY
14 #define AGENT_DESC IDENTITY " agent"
15 #define AGENT_ARS IDENTITY "_ars"
20 #include <json/json.h>
23 #include "regscan.hpp"
24 #include "copyscan.hpp"
26 #include "copyrightState.hpp"
27 #include "database.hpp"
28 #include "cleanEntries.hpp"
37 void bail(
int exitval);
42 std::vector<std::string>& fileNames, std::string& directoryToScan);
50 void normalizeContent(std::string& content);
55 const std::string fileName);
58 const std::pair<
string,
list<match>> resultPair,
bool &printComma);
Store the options sent through the CLI.
Manages database related requests for agent.
Holds information about state of one agent.
Abstract class to provide interface to scanners.
scanner * makeRegexScanner(const std::string ®exDesc, const std::string &defaultType)
Make a boost regex scanner object based on regex desc and type.
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.
pair< string, list< match > > processSingleFile(const CopyrightState &state, const string fileName)
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 C library.
fo_dbManager * dbManager
fo_dbManager object
Utilities to help scanners.
list_t type structure used to keep various lists. (e.g. there are multiple lists).