Add a few API bits for problem sets in transaction elements
[platform/upstream/rpm.git] / lib / rpmte.h
1 #ifndef H_RPMTE
2 #define H_RPMTE
3
4 /** \ingroup rpmts rpmte
5  * \file lib/rpmte.h
6  * Structures used for an "rpmte" transaction element.
7  */
8
9 #include <rpm/rpmtypes.h>
10
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14
15 /**
16  */
17 extern int _rpmte_debug;
18
19 /** \ingroup rpmte
20  * Transaction element type.
21  */
22 typedef enum rpmElementType_e {
23     TR_ADDED            = 1,    /*!< Package will be installed. */
24     TR_REMOVED          = 2,    /*!< Package will be removed. */
25 } rpmElementType;
26
27 /** \ingroup rpmte
28  * Destroy a transaction element.
29  * @param te            transaction element
30  * @return              NULL always
31  */
32 rpmte rpmteFree(rpmte te);
33
34 /** \ingroup rpmte
35  * Create a transaction element.
36  * @param ts            unused
37  * @param h             header
38  * @param type          TR_ADDED/TR_REMOVED
39  * @param key           (TR_ADDED) package retrieval key (e.g. file name)
40  * @param relocs        (TR_ADDED) package file relocations
41  * @param dboffset      unused
42  * @return              new transaction element
43  */
44 rpmte rpmteNew(const rpmts ts, Header h, rpmElementType type,
45                 fnpyKey key,
46                 rpmRelocation * relocs,
47                 int dboffset);
48
49 /** \ingroup rpmte
50  * Retrieve header from transaction element.
51  * @param te            transaction element
52  * @return              header
53  */
54 Header rpmteHeader(rpmte te);
55
56 /** \ingroup rpmte
57  * Save header into transaction element.
58  * @param te            transaction element
59  * @param h             header
60  * @return              NULL always
61  */
62 Header rpmteSetHeader(rpmte te, Header h);
63
64 /** \ingroup rpmte
65  * Retrieve type of transaction element.
66  * @param te            transaction element
67  * @return              type
68  */
69 rpmElementType rpmteType(rpmte te);
70
71 /** \ingroup rpmte
72  * Retrieve name string of transaction element.
73  * @param te            transaction element
74  * @return              name string
75  */
76 const char * rpmteN(rpmte te);
77
78 /** \ingroup rpmte
79  * Retrieve epoch string of transaction element.
80  * @param te            transaction element
81  * @return              epoch string
82  */
83 const char * rpmteE(rpmte te);
84
85 /** \ingroup rpmte
86  * Retrieve version string of transaction element.
87  * @param te            transaction element
88  * @return              version string
89  */
90 const char * rpmteV(rpmte te);
91
92 /** \ingroup rpmte
93  * Retrieve release string of transaction element.
94  * @param te            transaction element
95  * @return              release string
96  */
97 const char * rpmteR(rpmte te);
98
99 /** \ingroup rpmte
100  * Retrieve arch string of transaction element.
101  * @param te            transaction element
102  * @return              arch string
103  */
104 const char * rpmteA(rpmte te);
105
106 /** \ingroup rpmte
107  * Retrieve os string of transaction element.
108  * @param te            transaction element
109  * @return              os string
110  */
111 const char * rpmteO(rpmte te);
112
113 /** \ingroup rpmte
114  * Retrieve isSource attribute of transaction element.
115  * @param te            transaction element
116  * @return              isSource attribute
117  */
118 int rpmteIsSource(rpmte te);
119
120 /** \ingroup rpmte
121  * Retrieve color bits of transaction element.
122  * @param te            transaction element
123  * @return              color bits
124  */
125 rpm_color_t rpmteColor(rpmte te);
126
127 /** \ingroup rpmte
128  * Set color bits of transaction element.
129  * @param te            transaction element
130  * @param color         new color bits
131  * @return              previous color bits
132  */
133 rpm_color_t rpmteSetColor(rpmte te, rpm_color_t color);
134
135 /** \ingroup rpmte
136  * Retrieve last instance installed to the database.
137  * @param te            transaction element
138  * @return              last install instance.
139  */
140 unsigned int rpmteDBInstance(rpmte te);
141
142 /** \ingroup rpmte
143  * Set last instance installed to the database.
144  * @param te            transaction element
145  * @param instance      Database instance of last install element.
146  * @return              last install instance.
147  */
148 void rpmteSetDBInstance(rpmte te, unsigned int instance);
149
150 /** \ingroup rpmte
151  * Retrieve size in bytes of package file.
152  * @todo Signature header is estimated at 256b.
153  * @param te            transaction element
154  * @return              size in bytes of package file.
155  */
156 rpm_loff_t rpmtePkgFileSize(rpmte te);
157
158 /** \ingroup rpmte
159  * Retrieve parent transaction element.
160  * @param te            transaction element
161  * @return              parent transaction element
162  */
163 rpmte rpmteParent(rpmte te);
164
165 /** \ingroup rpmte
166  * Set parent transaction element.
167  * @param te            transaction element
168  * @param pte           new parent transaction element
169  * @return              previous parent transaction element
170  */
171 rpmte rpmteSetParent(rpmte te, rpmte pte);
172
173 /** \ingroup rpmte
174  * Return problem set info of transaction element.
175  * @param te            transaction element
176  * @return              problem set (or NULL if none)
177  */
178 rpmps rpmteProblems(rpmte te);
179
180 /** \ingroup rpmte
181  * Destroy problem set info of transaction element.
182  * @param te            transaction element
183  */
184 void rpmteCleanProblems(rpmte te);
185
186 /** \ingroup rpmte
187  * Destroy dependency set info of transaction element.
188  * @param te            transaction element
189  */
190 void rpmteCleanDS(rpmte te);
191
192 /** \ingroup rpmte
193  * Set dependent element of TR_REMOVED transaction element.
194  * @param te            transaction element
195  * @param depends       dependent transaction element
196  */
197 void rpmteSetDependsOn(rpmte te, rpmte depends);
198
199 /** \ingroup rpmte
200  * Retrieve dependent element of TR_REMOVED transaction element.
201  * @param te            transaction element
202  * @return              dependent transaction element
203  */
204 rpmte rpmteDependsOn(rpmte te);
205
206 /** \ingroup rpmte
207  * Retrieve rpmdb instance of TR_REMOVED transaction element.
208  * @param te            transaction element
209  * @return              rpmdb instance
210  */
211 int rpmteDBOffset(rpmte te);
212
213 /** \ingroup rpmte
214  * Retrieve [epoch:]version-release string from transaction element.
215  * @param te            transaction element
216  * @return              [epoch:]version-release string
217  */
218 const char * rpmteEVR(rpmte te);
219
220 /** \ingroup rpmte
221  * Retrieve name-[epoch:]version-release string from transaction element.
222  * @param te            transaction element
223  * @return              name-[epoch:]version-release string
224  */
225 const char * rpmteNEVR(rpmte te);
226
227 /** \ingroup rpmte
228  * Retrieve name-[epoch:]version-release.arch string from transaction element.
229  * @param te            transaction element
230  * @return              name-[epoch:]version-release.arch string
231  */
232 const char * rpmteNEVRA(rpmte te);
233
234 /** \ingroup rpmte
235  * Retrieve key from transaction element.
236  * @param te            transaction element
237  * @return              key
238  */
239 fnpyKey rpmteKey(rpmte te);
240
241 /** \ingroup rpmte
242  * Return failure status of transaction element.
243  * If the element itself failed, this is 1, larger count means one of
244  * it's parents failed.
245  * @param te            transaction element
246  * @return              number of failures for this transaction element
247  */
248 int rpmteFailed(rpmte te);
249
250 /** \ingroup rpmte
251  * Retrieve dependency tag set from transaction element.
252  * @param te            transaction element
253  * @param tag           dependency tag
254  * @return              dependency tag set
255  */
256 rpmds rpmteDS(rpmte te, rpmTag tag);
257
258 /** \ingroup rpmte
259  * Retrieve file info tag set from transaction element.
260  * @param te            transaction element
261  * @return              file info tag set
262  */
263 rpmfi rpmteFI(rpmte te);
264
265 /** \ingroup rpmte
266  * Calculate transaction element dependency colors/refs from file info.
267  * @param te            transaction element
268  * @param tag           dependency tag (RPMTAG_PROVIDENAME, RPMTAG_REQUIRENAME)
269  */
270 void rpmteColorDS(rpmte te, rpmTag tag);
271
272 #ifdef __cplusplus
273 }
274 #endif
275
276 #endif  /* H_RPMTE */