Eliminate unused and unnecessary rpmteBreadth() and rpmteSetBreadth()
[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 ordering chain linkage.
21  */
22 typedef struct tsortInfo_s *            tsortInfo;
23
24 /** \ingroup rpmte
25  * Transaction element iterator.
26  */
27 typedef struct rpmtsi_s *               rpmtsi;
28
29 /** \ingroup rpmte
30  * Transaction element type.
31  */
32 typedef enum rpmElementType_e {
33     TR_ADDED            = (1 << 0),     /*!< Package will be installed. */
34     TR_REMOVED          = (1 << 1)      /*!< Package will be removed. */
35 } rpmElementType;
36
37 /** \ingroup rpmte
38  * Destroy a transaction element.
39  * @param te            transaction element
40  * @return              NULL always
41  */
42 rpmte rpmteFree(rpmte te);
43
44 /** \ingroup rpmte
45  * Create a transaction element.
46  * @param ts            unused
47  * @param h             header
48  * @param type          TR_ADDED/TR_REMOVED
49  * @param key           (TR_ADDED) package retrieval key (e.g. file name)
50  * @param relocs        (TR_ADDED) package file relocations
51  * @param dboffset      unused
52  * @return              new transaction element
53  */
54 rpmte rpmteNew(const rpmts ts, Header h, rpmElementType type,
55                 fnpyKey key,
56                 rpmRelocation * relocs,
57                 int dboffset);
58
59 /** \ingroup rpmte
60  * Retrieve header from transaction element.
61  * @param te            transaction element
62  * @return              header
63  */
64 Header rpmteHeader(rpmte te);
65
66 /** \ingroup rpmte
67  * Save header into transaction element.
68  * @param te            transaction element
69  * @param h             header
70  * @return              NULL always
71  */
72 Header rpmteSetHeader(rpmte te, Header h);
73
74 /** \ingroup rpmte
75  * Retrieve type of transaction element.
76  * @param te            transaction element
77  * @return              type
78  */
79 rpmElementType rpmteType(rpmte te);
80
81 /** \ingroup rpmte
82  * Retrieve name string of transaction element.
83  * @param te            transaction element
84  * @return              name string
85  */
86 const char * rpmteN(rpmte te);
87
88 /** \ingroup rpmte
89  * Retrieve epoch string of transaction element.
90  * @param te            transaction element
91  * @return              epoch string
92  */
93 const char * rpmteE(rpmte te);
94
95 /** \ingroup rpmte
96  * Retrieve version string of transaction element.
97  * @param te            transaction element
98  * @return              version string
99  */
100 const char * rpmteV(rpmte te);
101
102 /** \ingroup rpmte
103  * Retrieve release string of transaction element.
104  * @param te            transaction element
105  * @return              release string
106  */
107 const char * rpmteR(rpmte te);
108
109 /** \ingroup rpmte
110  * Retrieve arch string of transaction element.
111  * @param te            transaction element
112  * @return              arch string
113  */
114 const char * rpmteA(rpmte te);
115
116 /** \ingroup rpmte
117  * Retrieve os string of transaction element.
118  * @param te            transaction element
119  * @return              os string
120  */
121 const char * rpmteO(rpmte te);
122
123 /** \ingroup rpmte
124  * Retrieve isSource attribute of transaction element.
125  * @param te            transaction element
126  * @return              isSource attribute
127  */
128 int rpmteIsSource(rpmte te);
129
130 /** \ingroup rpmte
131  * Retrieve color bits of transaction element.
132  * @param te            transaction element
133  * @return              color bits
134  */
135 rpm_color_t rpmteColor(rpmte te);
136
137 /** \ingroup rpmte
138  * Set color bits of transaction element.
139  * @param te            transaction element
140  * @param color         new color bits
141  * @return              previous color bits
142  */
143 rpm_color_t rpmteSetColor(rpmte te, rpm_color_t color);
144
145 /** \ingroup rpmte
146  * Retrieve last instance installed to the database.
147  * @param te            transaction element
148  * @return              last install instance.
149  */
150 unsigned int rpmteDBInstance(rpmte te);
151
152 /** \ingroup rpmte
153  * Set last instance installed to the database.
154  * @param te            transaction element
155  * @param instance      Database instance of last install element.
156  * @return              last install instance.
157  */
158 void rpmteSetDBInstance(rpmte te, unsigned int instance);
159
160 /** \ingroup rpmte
161  * Retrieve size in bytes of package file.
162  * @todo Signature header is estimated at 256b.
163  * @param te            transaction element
164  * @return              size in bytes of package file.
165  */
166 rpm_loff_t rpmtePkgFileSize(rpmte te);
167
168 /** \ingroup rpmte
169  * Retrieve dependency tree depth of transaction element.
170  * @param te            transaction element
171  * @return              depth
172  */
173 int rpmteDepth(rpmte te);
174
175 /** \ingroup rpmte
176  * Set dependency tree depth of transaction element.
177  * @param te            transaction element
178  * @param ndepth        new depth
179  * @return              previous depth
180  */
181 int rpmteSetDepth(rpmte te, int ndepth);
182
183 /** \ingroup rpmte
184  * Retrieve tsort no. of predecessors of transaction element.
185  * @param te            transaction element
186  * @return              no. of predecessors
187  */
188 int rpmteNpreds(rpmte te);
189
190 /** \ingroup rpmte
191  * Set tsort no. of predecessors of transaction element.
192  * @param te            transaction element
193  * @param npreds        new no. of predecessors
194  * @return              previous no. of predecessors
195  */
196 int rpmteSetNpreds(rpmte te, int npreds);
197
198 /** \ingroup rpmte
199  * Retrieve tree index of transaction element.
200  * @param te            transaction element
201  * @return              tree index
202  */
203 int rpmteTree(rpmte te);
204
205 /** \ingroup rpmte
206  * Set tree index of transaction element.
207  * @param te            transaction element
208  * @param ntree         new tree index
209  * @return              previous tree index
210  */
211 int rpmteSetTree(rpmte te, int ntree);
212
213 /** \ingroup rpmte
214  * Retrieve parent transaction element.
215  * @param te            transaction element
216  * @return              parent transaction element
217  */
218 rpmte rpmteParent(rpmte te);
219
220 /** \ingroup rpmte
221  * Set parent transaction element.
222  * @param te            transaction element
223  * @param pte           new parent transaction element
224  * @return              previous parent transaction element
225  */
226 rpmte rpmteSetParent(rpmte te, rpmte pte);
227
228 /** \ingroup rpmte
229  * Retrieve number of children of transaction element.
230  * @param te            transaction element
231  * @return              tree index
232  */
233 int rpmteDegree(rpmte te);
234
235 /** \ingroup rpmte
236  * Set number of children of transaction element.
237  * @param te            transaction element
238  * @param ndegree       new number of children
239  * @return              previous number of children
240  */
241 int rpmteSetDegree(rpmte te, int ndegree);
242
243 /** \ingroup rpmte
244  * Retrieve tsort info for transaction element.
245  * @param te            transaction element
246  * @return              tsort info
247  */
248 tsortInfo rpmteTSI(rpmte te);
249
250 /** \ingroup rpmte
251  * Destroy tsort info of transaction element.
252  * @param te            transaction element
253  */
254 void rpmteFreeTSI(rpmte te);
255
256 /** \ingroup rpmte
257  * Initialize tsort info of transaction element.
258  * @param te            transaction element
259  */
260 void rpmteNewTSI(rpmte te);
261
262 /** \ingroup rpmte
263  * Destroy dependency set info of transaction element.
264  * @param te            transaction element
265  */
266 void rpmteCleanDS(rpmte te);
267
268 /** \ingroup rpmte
269  * Set dependent element of TR_REMOVED transaction element.
270  * @param te            transaction element
271  * @param depends       dependent transaction element
272  */
273 void rpmteSetDependsOn(rpmte te, rpmte depends);
274
275 /** \ingroup rpmte
276  * Retrieve dependent element of TR_REMOVED transaction element.
277  * @param te            transaction element
278  * @return              dependent transaction element
279  */
280 rpmte rpmteDependsOn(rpmte te);
281
282 /** \ingroup rpmte
283  * Retrieve rpmdb instance of TR_REMOVED transaction element.
284  * @param te            transaction element
285  * @return              rpmdb instance
286  */
287 int rpmteDBOffset(rpmte te);
288
289 /** \ingroup rpmte
290  * Retrieve [epoch:]version-release string from transaction element.
291  * @param te            transaction element
292  * @return              [epoch:]version-release string
293  */
294 const char * rpmteEVR(rpmte te);
295
296 /** \ingroup rpmte
297  * Retrieve name-[epoch:]version-release string from transaction element.
298  * @param te            transaction element
299  * @return              name-[epoch:]version-release string
300  */
301 const char * rpmteNEVR(rpmte te);
302
303 /** \ingroup rpmte
304  * Retrieve name-[epoch:]version-release.arch string from transaction element.
305  * @param te            transaction element
306  * @return              name-[epoch:]version-release.arch string
307  */
308 const char * rpmteNEVRA(rpmte te);
309
310 /** \ingroup rpmte
311  * Retrieve key from transaction element.
312  * @param te            transaction element
313  * @return              key
314  */
315 fnpyKey rpmteKey(rpmte te);
316
317 /** \ingroup rpmte
318  * Return failed status of transaction element.
319  * @param te            transaction element
320  * @return              1 if transaction element (or its parents) failed
321  */
322 int rpmteFailed(rpmte te);
323
324 /** \ingroup rpmte
325  * Retrieve dependency tag set from transaction element.
326  * @param te            transaction element
327  * @param tag           dependency tag
328  * @return              dependency tag set
329  */
330 rpmds rpmteDS(rpmte te, rpmTag tag);
331
332 /** \ingroup rpmte
333  * Retrieve file info tag set from transaction element.
334  * @param te            transaction element
335  * @return              file info tag set
336  */
337 rpmfi rpmteFI(rpmte te);
338
339 /** \ingroup rpmte
340  * Calculate transaction element dependency colors/refs from file info.
341  * @param te            transaction element
342  * @param tag           dependency tag (RPMTAG_PROVIDENAME, RPMTAG_REQUIRENAME)
343  */
344 void rpmteColorDS(rpmte te, rpmTag tag);
345
346 /** \ingroup rpmte
347  * Destroy transaction element iterator.
348  * @param tsi           transaction element iterator
349  * @return              NULL always
350  */
351 rpmtsi rpmtsiFree(rpmtsi tsi);
352
353 /** \ingroup rpmte
354  * Create transaction element iterator.
355  * @param ts            transaction set
356  * @return              transaction element iterator
357  */
358 rpmtsi rpmtsiInit(rpmts ts);
359
360 /** \ingroup rpmte
361  * Return next transaction element of type.
362  * @param tsi           transaction element iterator
363  * @param type          transaction element type selector (0 for any)
364  * @return              next transaction element of type, NULL on termination
365  */
366 rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type);
367
368 #ifdef __cplusplus
369 }
370 #endif
371
372 #endif  /* H_RPMTE */