7 #ifndef SCANCODE_AGENT_UTILS_HPP
8 #define SCANCODE_AGENT_UTILS_HPP
10 #define AGENT_NAME "scancode"
11 #define AGENT_DESC "scancode agent"
12 #define AGENT_ARS "scancode_ars"
17 #include <unordered_map>
19 #include <boost/program_options.hpp>
23 #include "scancode_state.hpp"
24 #include "scancode_wrapper.hpp"
40 void bail(
int exitval);
42 void mapFileNameWithId(
unsigned long pFileId, unordered_map<unsigned long, string> &fileIdsMap, unordered_map<string, unsigned long> &fileIdsMapReverse,
ScancodeDatabaseHandler &databaseHandler);
43 void writeFileNameToTextFile(unordered_map<unsigned long, string> &fileIdsMap,
string fileLocation);
44 string getScanResult(
const string& line);
46 bool saveLicenseMatchesToDatabase(
const State& state,
const vector<Match>& matches,
unsigned long pFileId,
ScancodeDatabaseHandler& databaseHandler);
47 bool saveOtherMatchesToDatabase(
const State& state,
const vector<Match>& matches,
unsigned long pFileId,
ScancodeDatabaseHandler& databaseHandler);
48 bool parseCommandLine(
int argc,
char** argv,
string& cliOption,
bool& ignoreFilesWithMimeType);
bool processUploadId(const CompatibilityState &state, int uploadId, CompatibilityDatabaseHandler &databaseHandler, int groupId)
CompatibilityState getState(DbManager &dbManager, CompatibilityCliOptions &&cliOptions)
Create a new state for the current agent based on CliOptions.
int writeARS(const CompatibilityState &state, int arsId, int uploadId, int success, DbManager &dbManager)
int queryAgentId(DbManager &dbManager)
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.
Utility functions for file handling.
The main FOSSology C library.
fo_dbManager * dbManager
fo_dbManager object
fo namespace holds the FOSSology library functions.