satyr  0.24.15.g3735.dirty
rpm.h
Go to the documentation of this file.
1 /*
2  rpm.h
3 
4  Copyright (C) 2012 Red Hat, Inc.
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program 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
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License along
17  with this program; if not, write to the Free Software Foundation, Inc.,
18  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20 #ifndef SATYR_RPM_H
21 #define SATYR_RPM_H
22 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #include <stdbool.h>
33 #include <inttypes.h>
34 
35 struct sr_json_value;
36 
37 /* XXX: Should be moved to separated header once we support more package types.
38  */
39 enum sr_package_role
40 {
41  /* The role the package has in the problem is either unknown or
42  * irrelevant.
43  */
44  SR_ROLE_UNKNOWN = 0,
45 
46  /* The packages contains the executable or script the execution of which
47  * caused the problem to manifest.
48  */
49  SR_ROLE_AFFECTED
50 };
51 
53 {
54  char *path;
55  bool owner_changed;
56  bool group_changed;
57  bool mode_changed;
58  bool md5_mismatch;
59  bool size_changed;
60  bool major_number_changed;
61  bool minor_number_changed;
62  bool symlink_changed;
63  bool modification_time_changed;
64  struct sr_rpm_consistency *next;
65 };
66 
68 {
69  char *name;
70  uint32_t epoch;
71  char *version;
72  char *release;
73  char *architecture;
74  uint64_t install_time;
75  enum sr_package_role role;
76  struct sr_rpm_consistency *consistency;
77  struct sr_rpm_package *next;
78 };
79 
80 struct sr_rpm_package *
81 sr_rpm_package_new(void);
82 
83 void
84 sr_rpm_package_init(struct sr_rpm_package *package);
85 
86 void
87 sr_rpm_package_free(struct sr_rpm_package *package,
88  bool recursive);
89 
103 int
104 sr_rpm_package_cmp(struct sr_rpm_package *package1,
105  struct sr_rpm_package *package2);
106 
120 int
121 sr_rpm_package_cmp_nvr(struct sr_rpm_package *package1,
122  struct sr_rpm_package *package2);
123 
138 int
140  struct sr_rpm_package *package2);
141 
148 struct sr_rpm_package *
150  struct sr_rpm_package *item);
151 
155 int
156 sr_rpm_package_count(struct sr_rpm_package *packages);
157 
158 struct sr_rpm_package *
159 sr_rpm_package_sort(struct sr_rpm_package *packages);
160 
161 struct sr_rpm_package *
162 sr_rpm_package_uniq(struct sr_rpm_package *packages);
163 
164 struct sr_rpm_package *
165 sr_rpm_package_get_by_name(const char *name,
166  char **error_message);
167 
168 struct sr_rpm_package *
169 sr_rpm_package_get_by_path(const char *path,
170  char **error_message);
171 
172 char *
173 sr_rpm_package_to_json(struct sr_rpm_package *package,
174  bool recursive);
175 
176 int
177 sr_rpm_package_from_json(struct sr_rpm_package **rpm_package, struct sr_json_value *list,
178  bool recursive, char **error_message);
179 
180 bool
181 sr_rpm_package_parse_nvr(const char *text,
182  char **name,
183  char **version,
184  char **release);
185 
186 bool
187 sr_rpm_package_parse_nevra(const char *text,
188  char **name,
189  uint32_t *epoch,
190  char **version,
191  char **release,
192  char **architecture);
193 
194 struct sr_rpm_consistency *
195 sr_rpm_consistency_new(void);
196 
197 void
198 sr_rpm_consistency_init(struct sr_rpm_consistency *consistency);
199 
200 void
201 sr_rpm_consistency_free(struct sr_rpm_consistency *consistency,
202  bool recursive);
203 
204 int
205 sr_rpm_consistency_cmp(struct sr_rpm_consistency *consistency1,
206  struct sr_rpm_consistency *consistency2);
207 
208 int
209 sr_rpm_consistency_cmp_recursive(struct sr_rpm_consistency *consistency1,
210  struct sr_rpm_consistency *consistency2);
211 
218 struct sr_rpm_consistency *
220  struct sr_rpm_consistency *item);
221 
222 #ifdef __cplusplus
223 }
224 #endif
225 
226 #endif
struct sr_rpm_package * sr_rpm_package_append(struct sr_rpm_package *dest, struct sr_rpm_package *item)
int sr_rpm_package_count(struct sr_rpm_package *packages)
int sr_rpm_package_cmp(struct sr_rpm_package *package1, struct sr_rpm_package *package2)
int sr_rpm_package_cmp_nevra(struct sr_rpm_package *package1, struct sr_rpm_package *package2)
int sr_rpm_package_cmp_nvr(struct sr_rpm_package *package1, struct sr_rpm_package *package2)
struct sr_rpm_consistency * sr_rpm_consistency_append(struct sr_rpm_consistency *dest, struct sr_rpm_consistency *item)