1 /*
2  * Copyright (C) 2012-2014 Red Hat, Inc.
3  *
4  * Licensed under the GNU Lesser General Public License Version 2.1
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef HY_TYPES_H
22 #define HY_TYPES_H
23 
24 #ifdef __cplusplus
25 namespace libdnf {
26     struct Goal;
27     struct Nevra;
28     struct Query;
29     struct Repo;
30     struct Selector;
31 }
32 typedef struct libdnf::Goal * HyGoal;
33 typedef struct libdnf::Nevra * HyNevra;
34 typedef struct libdnf::Query * HyQuery;
35 typedef struct libdnf::Repo * HyRepo;
36 typedef struct libdnf::Selector * HySelector;
37 #else
38 typedef struct Goal * HyGoal;
39 typedef struct Nevra * HyNevra;
40 typedef struct Query * HyQuery;
41 typedef struct _HyRepo * HyRepo;
42 typedef struct Selector * HySelector;
43 #endif
44 
45 typedef char * HySubject;
46 
47 typedef const unsigned char HyChecksum;
48 
49 typedef int (*hy_solution_callback)(HyGoal goal, void *callback_data);
50 
51 #define HY_SYSTEM_REPO_NAME "@System"
52 #define HY_CMDLINE_REPO_NAME "@commandline"
53 #define LIBDNF_MODULE_FAIL_SAFE_REPO_NAME "@modulefailsafe"
54 #define HY_EXT_FILENAMES "-filenames"
55 #define HY_EXT_UPDATEINFO "-updateinfo"
56 #define HY_EXT_PRESTO "-presto"
57 #define HY_EXT_OTHER "-other"
58 
59 enum _hy_key_name_e {
60     HY_PKG = 0,
61     HY_PKG_ALL = 1, /* DEPRECATED, used only to make empty query. Replaced by HY_PKG_EMPTY */
62     HY_PKG_ARCH = 2,
63     HY_PKG_CONFLICTS = 3,
64     HY_PKG_DESCRIPTION = 4,
65     HY_PKG_EPOCH = 5,
66     HY_PKG_EVR = 6,
67     HY_PKG_FILE = 7,
68     HY_PKG_NAME = 8,
69     HY_PKG_NEVRA = 9,
70     HY_PKG_OBSOLETES = 10,
71     HY_PKG_PROVIDES = 11,
72     HY_PKG_RELEASE = 12,
73     HY_PKG_REPONAME = 13,
74     HY_PKG_REQUIRES = 14,
75     HY_PKG_SOURCERPM = 15,
76     HY_PKG_SUMMARY = 16,
77     HY_PKG_URL = 17,
78     HY_PKG_VERSION = 18,
79     HY_PKG_LOCATION = 19,
80     HY_PKG_ENHANCES = 20,
81     HY_PKG_RECOMMENDS = 21,
82     HY_PKG_SUGGESTS = 22,
83     HY_PKG_SUPPLEMENTS = 23,
84     HY_PKG_ADVISORY = 24,
85     HY_PKG_ADVISORY_BUG = 25,
86     HY_PKG_ADVISORY_CVE = 26,
87     HY_PKG_ADVISORY_SEVERITY = 27,
88     HY_PKG_ADVISORY_TYPE = 28,
89     HY_PKG_DOWNGRADABLE = 29,
90     HY_PKG_DOWNGRADES = 30,
91     HY_PKG_EMPTY = 31,
92     HY_PKG_LATEST_PER_ARCH = 32,
93     HY_PKG_LATEST = 33,
94     HY_PKG_UPGRADABLE = 34,
95     HY_PKG_UPGRADES = 35,
96     /**
97     * @brief Use for strings of whole NEVRA (missing epoch is handled as epoch 0)
98     * Allowed compare types - only HY_EQ or HY_NEQ
99     */
100     HY_PKG_NEVRA_STRICT = 36,
101     HY_PKG_UPGRADES_BY_PRIORITY = 37,
102     HY_PKG_OBSOLETES_BY_PRIORITY = 38,
103     HY_PKG_LATEST_PER_ARCH_BY_PRIORITY = 39,
104 };
105 
106 enum _hy_comparison_type_e {
107     /* part 1: flags that mix with all types */
108     HY_ICASE  = 1 << 0,
109     HY_NOT    = 1 << 1,
110     HY_COMPARISON_FLAG_MASK = HY_ICASE | HY_NOT,
111 
112     /* part 2: comparison types that mix with each other */
113     HY_EQ        = (1 << 8),
114     HY_LT        = (1 << 9),
115     HY_GT        = (1 << 10),
116 
117     /* part 3: comparison types that only make sense for strings */
118     HY_SUBSTR        = (1 << 11),
119     HY_GLOB     = (1 << 12),
120 
121     /* part 4: frequently used combinations */
122     HY_NEQ        = HY_EQ | HY_NOT,
123 
124     /* part 5: additional flags, not necessarily used for queries */
125     HY_NAME_ONLY = (1 << 16),
126 
127     /* part 6: additional flags for addvisory filters*/
128     /// EQ or the first higher
129     HY_EQG        = (1 << 17),
130     /// skip advisory packages with lower EVR than latest installed
131     HY_UPGRADE    = (1 << 18),
132 };
133 
134 #endif /* HY_TYPES_H */
135