FOSSology  4.7.1
Open Source License Compliance by Open Source Software
database.h
1 /*
2  Author: Daniele Fognini, Andreas Wuerl
3  SPDX-FileCopyrightText: © 2013-2014 Siemens AG
4  SPDX-FileCopyrightText: © Fossology contributors
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
8 
9 #ifndef MONK_AGENT_DATABASE_H
10 #define MONK_AGENT_DATABASE_H
11 
12 #include <glib.h>
13 #include <libfossology.h>
14 #include "highlight.h"
15 
16 #define DECISION_TYPE_FOR_IRRELEVANT 4
17 
18 // Kotoba-specific structures for custom phrase scanning
22 typedef struct LicenseMapping_t {
23  long rfPk;
24  int removing;
26 
30 typedef struct Phrase_t {
31  long cpId; /* cp_pk from custom_phrase table */
32  char* text; /* phrase text to match */
33  char* acknowledgement; /* acknowledgement text (nullable) */
34  char* comments; /* comments (nullable) */
35  GArray* licenseMappings; /* array of LicenseMapping */
36  char* stmtName; /* pre-built prepared-statement name (per upload) */
37 } Phrase;
38 
39 PGresult* queryFileIdsForUploadAndLimits(fo_dbManager* dbManager, int uploadId,
40  long left, long right, long groupId,
41  bool ignoreIrre, bool scanFindings);
42 PGresult* queryAllLicenses(fo_dbManager* dbManager);
43 char* getLicenseTextForLicenseRefId(fo_dbManager* dbManager, long refId);
44 int hasAlreadyResultsFor(fo_dbManager* dbManager, int agentId, long pFileId);
45 long saveToDb(fo_dbManager* dbManager, int agentId, long int refId, long int pFileId, unsigned int percent);
46 int saveNoResultToDb(fo_dbManager* dbManager, int agentId, long pFileId);
47 int saveDiffHighlightToDb(fo_dbManager* dbManager, const DiffMatchInfo* diffInfo, long licenseFileId);
48 int saveDiffHighlightsToDb(fo_dbManager* dbManager, const GArray* matchedInfo, long licenseFileId);
49 
50 // Kotoba phrase-mode database functions
51 GArray* queryActiveCustomPhrases(fo_dbManager* dbManager);
52 void phrase_free(Phrase* phrase);
53 void phrases_free(GArray* phrases);
54 
55 #endif // MONK_AGENT_DATABASE_H
The main FOSSology C library.
fo_dbManager * dbManager
fo_dbManager object
Definition: process.c:16
Structure to hold a license mapping with add/remove flag.
Definition: database.h:22
int removing
0 = add license, 1 = remove license
Definition: database.h:24
long rfPk
rf_pk from license_ref table
Definition: database.h:23
Structure to hold a custom phrase and its mapped licenses.
Definition: database.h:30