FOSSology  4.4.0
Open Source License Compliance by Open Source Software
monk.h
1 /*
2  Author: Daniele Fognini, Andreas Wuerl
3  SPDX-FileCopyrightText: © 2013-2014 Siemens AG
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
8 #ifndef MONK_AGENT_MONK_H
9 #define MONK_AGENT_MONK_H
10 
11 #define AGENT_NAME "monk"
12 #define AGENT_DESC "monk agent"
13 #define AGENT_ARS "monk_ars"
14 
15 #define MODE_SCHEDULER 1
16 #define MODE_CLI 2
17 #define MODE_BULK 3
18 #define MODE_EXPORT_KOWLEDGEBASE 4
19 #define MODE_CLI_OFFLINE 5
20 
21 #define FULL_MATCH "M"
22 #define DIFF_TYPE_MATCH "M0"
23 #define DIFF_TYPE_ADDITION "M+"
24 #define DIFF_TYPE_REMOVAL "M-"
25 #define DIFF_TYPE_REPLACE "MR"
26 
27 #define DELIMITERS " \t\n\r\f#^%,*"
28 
29 #define MONK_CASE_INSENSITIVE
30 #define MAX_ALLOWED_DIFF_LENGTH 256
31 #define MIN_ADJACENT_MATCHES 3
32 #define MAX_LEADING_DIFF 10
33 #define MIN_ALLOWED_RANK 66
34 
35 #include <glib.h>
36 #include <stdbool.h>
37 #include "libfossdbmanager.h"
38 
39 #if GLIB_CHECK_VERSION(2,32,0)
40 #define MONK_MULTI_THREAD
41 #endif
42 
43 
44 typedef struct {
46  int agentId;
47  int scanMode;
48  int verbosity;
49  char* knowledgebaseFile;
50  int json;
51  bool ignoreFilesWithMimeType;
52  void* ptr;
53 } MonkState;
54 
55 typedef struct {
56  long refId;
57  gchar* shortname;
58  GArray* tokens;
59 } License;
60 
61 typedef struct {
62  long id;
63  char* fileName;
64  GArray* tokens;
65 } File;
66 
67 typedef struct {
68  GArray* licenses;
69 
70  /* germ of licenses with the same starting tokens
71  * GArray<GHash<Germ, GArray<License>>> : { [#skippedTokens]{ germ -> [License] } } */
72  GArray* indexes;
73  /* number of tokens used as germ when the index was built */
74  unsigned minAdjacentMatches;
75 
76  /* licenses shorter than what is needed to compute the germ are in this class */
77  GArray* shortLicenses;
78 } Licenses;
79 
80 #endif // MONK_AGENT_MONK_H
fo_dbManager * dbManager
fo_dbManager object
Definition: process.c:16
Definition: monk.h:61
Definition: monk.h:55
Definition: monk.h:67
Definition: monk.h:44