7 #ifndef NINKA_AGENT_UTILS_HPP
8 #define NINKA_AGENT_UTILS_HPP
10 #define AGENT_NAME "ninka"
11 #define AGENT_DESC "ninka agent"
12 #define AGENT_ARS "ninka_ars"
17 #include "licensematch.hpp"
29 void bail(
int exitval);
33 bool saveLicenseMatchesToDatabase(
const State& state,
const vector<LicenseMatch>& matches,
unsigned long pFileId,
NinkaDatabaseHandler& databaseHandler);
Class to handle file related operations.
void matchPFileWithLicenses(CopyrightState const &state, int agentId, unsigned long pFileId, CopyrightDatabaseHandler &databaseHandler)
Get the file contents, scan for statements and save findings to database.
int queryAgentId(PGconn *dbConn)
Get agent id, exit if agent id is incorrect.
void matchFileWithLicenses(const string &sContent, unsigned long pFileId, CopyrightState const &state, int agentId, CopyrightDatabaseHandler &databaseHandler)
Scan a given file with all available scanners and save findings to database.
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 bail(int exitval)
Disconnect with scheduler returning an error code and exit.
Utility functions for file handling.
The main FOSSology C library.
fo_dbManager * dbManager
fo_dbManager object