FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
monk.h
1 /*
2 Author: Daniele Fognini, Andreas Wuerl
3 Copyright (C) 2013-2014, Siemens AG
4 
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 version 2 as published by the Free Software Foundation.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18 
19 #ifndef MONK_AGENT_MONK_H
20 #define MONK_AGENT_MONK_H
21 
22 #define AGENT_NAME "monk"
23 #define AGENT_DESC "monk agent"
24 #define AGENT_ARS "monk_ars"
25 
26 #define MODE_SCHEDULER 1
27 #define MODE_CLI 2
28 #define MODE_BULK 3
29 #define MODE_EXPORT_KOWLEDGEBASE 4
30 #define MODE_CLI_OFFLINE 5
31 
32 #define FULL_MATCH "M"
33 #define DIFF_TYPE_MATCH "M0"
34 #define DIFF_TYPE_ADDITION "M+"
35 #define DIFF_TYPE_REMOVAL "M-"
36 #define DIFF_TYPE_REPLACE "MR"
37 
38 #define DELIMITERS " \t\n\r\f#^%"
39 
40 #define MONK_CASE_INSENSITIVE
41 #define MAX_ALLOWED_DIFF_LENGTH 256
42 #define MIN_ADJACENT_MATCHES 3
43 #define MAX_LEADING_DIFF 10
44 #define MIN_ALLOWED_RANK 66
45 
46 #include <glib.h>
47 #include <stdbool.h>
48 #include "libfossdbmanager.h"
49 
50 #if GLIB_CHECK_VERSION(2,32,0)
51 #define MONK_MULTI_THREAD
52 #endif
53 
54 
55 typedef struct {
57  int agentId;
58  int scanMode;
59  int verbosity;
60  char* knowledgebaseFile;
61  int json;
62  bool ignoreFilesWithMimeType;
63  void* ptr;
64 } MonkState;
65 
66 typedef struct {
67  long refId;
68  gchar* shortname;
69  GArray* tokens;
70 } License;
71 
72 typedef struct {
73  long id;
74  char* fileName;
75  GArray* tokens;
76 } File;
77 
78 typedef struct {
79  GArray* licenses;
80 
81  /* germ of licenses with the same starting tokens
82  * GArray<GHash<Germ, GArray<License>>> : { [#skippedTokens]{ germ -> [License] } } */
83  GArray* indexes;
84  /* number of tokens used as germ when the index was built */
85  unsigned minAdjacentMatches;
86 
87  /* licenses shorter than what is needed to compute the germ are in this class */
88  GArray* shortLicenses;
89 } Licenses;
90 
91 #endif // MONK_AGENT_MONK_H
Definition: monk.h:78
Definition: monk.h:55
Definition: monk.h:72
Definition: monk.h:66
fo_dbManager * dbManager
fo_dbManager object
Definition: process.c:28