95ba0b8e201870617d0dd9fc2932a34d95402a90
[platform/upstream/rpm.git] / lib / rpmts.h
1 #ifndef H_RPMTS
2 #define H_RPMTS
3
4 /** \ingroup rpmts
5  * \file lib/rpmts.h
6  * Structures and prototypes used for an "rpmts" transaction set.
7  */
8
9 #include "rpmps.h"
10 #include "rpmsw.h"
11
12 /*@-exportlocal@*/
13 /*@unchecked@*/
14 extern int _rpmts_debug;
15 /*@unchecked@*/
16 extern int _rpmts_stats;
17 /*@unchecked@*/
18 extern int _fps_debug;
19 /*@=exportlocal@*/
20
21 /**
22  * Bit(s) to control digest and signature verification.
23  */
24 typedef enum rpmVSFlags_e {
25     RPMVSF_DEFAULT      = 0,
26     RPMVSF_NOHDRCHK     = (1 <<  0),
27     RPMVSF_NEEDPAYLOAD  = (1 <<  1),
28     /* bit(s) 2-7 unused */
29     RPMVSF_NOSHA1HEADER = (1 <<  8),
30     RPMVSF_NOMD5HEADER  = (1 <<  9),    /* unimplemented */
31     RPMVSF_NODSAHEADER  = (1 << 10),
32     RPMVSF_NORSAHEADER  = (1 << 11),    /* unimplemented */
33     /* bit(s) 12-15 unused */
34     RPMVSF_NOSHA1       = (1 << 16),    /* unimplemented */
35     RPMVSF_NOMD5        = (1 << 17),
36     RPMVSF_NODSA        = (1 << 18),
37     RPMVSF_NORSA        = (1 << 19)
38     /* bit(s) 16-31 unused */
39 } rpmVSFlags;
40
41 #define _RPMVSF_NODIGESTS       \
42   ( RPMVSF_NOSHA1HEADER |       \
43     RPMVSF_NOMD5HEADER |        \
44     RPMVSF_NOSHA1 |             \
45     RPMVSF_NOMD5 )
46
47 #define _RPMVSF_NOSIGNATURES    \
48   ( RPMVSF_NODSAHEADER |        \
49     RPMVSF_NORSAHEADER |        \
50     RPMVSF_NODSA |              \
51     RPMVSF_NORSA )
52
53 #define _RPMVSF_NOHEADER        \
54   ( RPMVSF_NOSHA1HEADER |       \
55     RPMVSF_NOMD5HEADER |        \
56     RPMVSF_NODSAHEADER |        \
57     RPMVSF_NORSAHEADER )
58
59 #define _RPMVSF_NOPAYLOAD       \
60   ( RPMVSF_NOSHA1 |             \
61     RPMVSF_NOMD5 |              \
62     RPMVSF_NODSA |              \
63     RPMVSF_NORSA )
64
65 #if defined(_RPMTS_INTERNAL)
66
67 #include "rpmhash.h"    /* XXX hashTable */
68 #include "rpmal.h"      /* XXX availablePackage/relocateFileList ,*/
69
70 /*@unchecked@*/
71 /*@-exportlocal@*/
72 extern int _cacheDependsRC;
73 /*@=exportlocal@*/
74
75 /** \ingroup rpmts
76  */
77 typedef /*@abstract@*/ struct diskspaceInfo_s * rpmDiskSpaceInfo;
78
79 /** \ingroup rpmts
80  */
81 struct diskspaceInfo_s {
82     dev_t dev;                  /*!< File system device number. */
83     signed long bneeded;        /*!< No. of blocks needed. */
84     signed long ineeded;        /*!< No. of inodes needed. */
85     int bsize;                  /*!< File system block size. */
86     signed long long bavail;    /*!< No. of blocks available. */
87     signed long long iavail;    /*!< No. of inodes available. */
88 };
89
90 /** \ingroup rpmts
91  * Adjust for root only reserved space. On linux e2fs, this is 5%.
92  */
93 #define adj_fs_blocks(_nb)      (((_nb) * 21) / 20)
94
95 /* argon thought a shift optimization here was a waste of time...  he's
96    probably right :-( */
97 #define BLOCK_ROUND(size, block) (((size) + (block) - 1) / (block))
98
99 /** \ingroup rpmts
100  */
101 typedef enum tsStage_e {
102     TSM_UNKNOWN         =  0,
103     TSM_INSTALL         =  7,
104     TSM_ERASE           =  8,
105 } tsmStage;
106
107 /** \ingroup rpmts
108  * The set of packages to be installed/removed atomically.
109  */
110 struct rpmts_s {
111     rpmtransFlags transFlags;   /*!< Bit(s) to control operation. */
112     tsmStage goal;              /*!< Transaction goal (i.e. mode) */
113
114 /*@refcounted@*/ /*@null@*/
115     rpmdb sdb;                  /*!< Solve database handle. */
116     int sdbmode;                /*!< Solve database open mode. */
117 /*@null@*/
118     int (*solve) (rpmts ts, rpmds key, const void * data)
119         /*@modifies ts @*/;     /*!< Search for NEVRA key. */
120 /*@relnull@*/
121     const void * solveData;     /*!< Solve callback data */
122     int nsuggests;              /*!< No. of depCheck suggestions. */
123 /*@only@*/ /*@null@*/
124     const void ** suggests;     /*!< Possible depCheck suggestions. */
125
126 /*@observer@*/ /*@null@*/
127     rpmCallbackFunction notify; /*!< Callback function. */
128 /*@observer@*/ /*@null@*/
129     rpmCallbackData notifyData; /*!< Callback private data. */
130
131 /*@refcounted@*/ /*@null@*/
132     rpmps probs;                /*!< Current problems in transaction. */
133     rpmprobFilterFlags ignoreSet;
134                                 /*!< Bits to filter current problems. */
135
136     int filesystemCount;        /*!< No. of mounted filesystems. */
137 /*@dependent@*/ /*@null@*/
138     const char ** filesystems;  /*!< Mounted filesystem names. */
139 /*@only@*/ /*@null@*/
140     rpmDiskSpaceInfo dsi;       /*!< Per filesystem disk/inode usage. */
141
142 /*@refcounted@*/ /*@null@*/
143     rpmdb rdb;                  /*!< Install database handle. */
144     int dbmode;                 /*!< Install database open mode. */
145 /*@only@*/
146     hashTable ht;               /*!< Fingerprint hash table. */
147
148 /*@only@*/ /*@null@*/
149     int * removedPackages;      /*!< Set of packages being removed. */
150     int numRemovedPackages;     /*!< No. removed package instances. */
151     int allocedRemovedPackages; /*!< Size of removed packages array. */
152
153 /*@only@*/
154     rpmal addedPackages;        /*!< Set of packages being installed. */
155     int numAddedPackages;       /*!< No. added package instances. */
156
157 #ifndef DYING
158 /*@only@*/
159     rpmal availablePackages;    /*!< Universe of available packages. */
160     int numAvailablePackages;   /*!< No. available package instances. */
161 #endif
162
163 /*@null@*/
164     rpmte relocateElement;      /*!< Element to use when relocating packages. */
165
166 /*@owned@*/ /*@relnull@*/
167     rpmte * order;              /*!< Packages sorted by dependencies. */
168     int orderCount;             /*!< No. of transaction elements. */
169     int orderAlloced;           /*!< No. of allocated transaction elements. */
170     int unorderedSuccessors;    /*!< Index of 1st element of successors. */
171
172     int chrootDone;             /*!< Has chroot(2) been been done? */
173 /*@only@*/ /*@null@*/
174     const char * rootDir;       /*!< Path to top of install tree. */
175 /*@only@*/ /*@null@*/
176     const char * currDir;       /*!< Current working directory. */
177 /*@null@*/
178     FD_t scriptFd;              /*!< Scriptlet stdout/stderr. */
179     int delta;                  /*!< Delta for reallocation. */
180     int_32 tid;                 /*!< Transaction id. */
181
182     uint_32 color;              /*!< Transaction color bits. */
183
184     rpmVSFlags vsflags;         /*!< Signature/digest verification flags. */
185
186 /*@observer@*/ /*@dependent@*/ /*@null@*/
187     const char * fn;            /*!< Current package fn. */
188     int_32  sigtag;             /*!< Current package signature tag. */
189     int_32  sigtype;            /*!< Current package signature data type. */
190 /*@null@*/
191     const void * sig;           /*!< Current package signature. */
192     int_32 siglen;              /*!< Current package signature length. */
193
194 /*@only@*/ /*@null@*/
195     const unsigned char * pkpkt;/*!< Current pubkey packet. */
196     size_t pkpktlen;            /*!< Current pubkey packet length. */
197     unsigned char pksignid[8];  /*!< Current pubkey fingerprint. */
198
199     struct rpmop_s op_total;
200     struct rpmop_s op_check;
201     struct rpmop_s op_order;
202     struct rpmop_s op_fingerprint;
203     struct rpmop_s op_repackage;
204     struct rpmop_s op_install;
205     struct rpmop_s op_erase;
206     struct rpmop_s op_scriptlets;
207     struct rpmop_s op_compress;
208     struct rpmop_s op_uncompress;
209     struct rpmop_s op_digest;
210     struct rpmop_s op_signature;
211     struct rpmop_s op_dbadd;
212     struct rpmop_s op_dbremove;
213     struct rpmop_s op_dbget;
214     struct rpmop_s op_dbput;
215     struct rpmop_s op_dbdel;
216
217 /*@null@*/
218     pgpDig dig;                 /*!< Current signature/pubkey parameters. */
219
220 /*@null@*/
221     Spec spec;                  /*!< Spec file control structure. */
222
223 /*@refs@*/
224     int nrefs;                  /*!< Reference count. */
225
226 };
227 #endif  /* _RPMTS_INTERNAL */
228
229 #ifdef __cplusplus
230 extern "C" {
231 #endif
232
233 /** \ingroup rpmts
234  * Check that all dependencies can be resolved.
235  * @param ts            transaction set
236  * @return              0 on success
237  */
238 int rpmtsCheck(rpmts ts)
239         /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
240         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
241
242 /** \ingroup rpmts
243  * Determine package order in a transaction set according to dependencies.
244  *
245  * Order packages, returning error if circular dependencies cannot be
246  * eliminated by removing Requires's from the loop(s). Only dependencies from
247  * added or removed packages are used to determine ordering using a
248  * topological sort (Knuth vol. 1, p. 262). Use rpmtsCheck() to verify
249  * that all dependencies can be resolved.
250  *
251  * The final order ends up as installed packages followed by removed packages,
252  * with packages removed for upgrades immediately following the new package
253  * to be installed.
254  *
255  * @param ts            transaction set
256  * @return              no. of (added) packages that could not be ordered
257  */
258 int rpmtsOrder(rpmts ts)
259         /*@globals fileSystem, internalState@*/
260         /*@modifies ts, fileSystem, internalState @*/;
261
262 /** \ingroup rpmts
263  * Process all package elements in a transaction set.
264  *
265  * @param ts            transaction set
266  * @param okProbs       previously known problems (or NULL)
267  * @param ignoreSet     bits to filter problem types
268  * @return              0 on success, -1 on error, >0 with newProbs set
269  */
270 int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
271         /*@globals rpmGlobalMacroContext,
272                 fileSystem, internalState@*/
273         /*@modifies ts, rpmGlobalMacroContext,
274                 fileSystem, internalState @*/;
275
276 /** \ingroup rpmts
277  * Unreference a transaction instance.
278  * @param ts            transaction set
279  * @param msg
280  * @return              NULL always
281  */
282 /*@unused@*/ /*@null@*/
283 rpmts rpmtsUnlink (/*@killref@*/ /*@only@*/ rpmts ts,
284                 const char * msg)
285         /*@modifies ts @*/;
286
287 /** @todo Remove debugging entry from the ABI. */
288 /*@-exportlocal@*/
289 /*@null@*/
290 rpmts XrpmtsUnlink (/*@killref@*/ /*@only@*/ rpmts ts,
291                 const char * msg, const char * fn, unsigned ln)
292         /*@modifies ts @*/;
293 /*@=exportlocal@*/
294 #define rpmtsUnlink(_ts, _msg)  XrpmtsUnlink(_ts, _msg, __FILE__, __LINE__)
295
296 /** \ingroup rpmts
297  * Reference a transaction set instance.
298  * @param ts            transaction set
299  * @param msg
300  * @return              new transaction set reference
301  */
302 /*@unused@*/
303 rpmts rpmtsLink (rpmts ts, const char * msg)
304         /*@modifies ts @*/;
305
306 /** @todo Remove debugging entry from the ABI. */
307 rpmts XrpmtsLink (rpmts ts,
308                 const char * msg, const char * fn, unsigned ln)
309         /*@modifies ts @*/;
310 #define rpmtsLink(_ts, _msg)    XrpmtsLink(_ts, _msg, __FILE__, __LINE__)
311
312 /** \ingroup rpmts
313  * Close the database used by the transaction.
314  * @param ts            transaction set
315  * @return              0 on success
316  */
317 int rpmtsCloseDB(rpmts ts)
318         /*@globals fileSystem @*/
319         /*@modifies ts, fileSystem @*/;
320
321 /** \ingroup rpmts
322  * Open the database used by the transaction.
323  * @param ts            transaction set
324  * @param dbmode        O_RDONLY or O_RDWR
325  * @return              0 on success
326  */
327 int rpmtsOpenDB(rpmts ts, int dbmode)
328         /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
329         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
330
331 /** \ingroup rpmts
332  * Initialize the database used by the transaction.
333  * @deprecated An explicit rpmdbInit() is almost never needed.
334  * @param ts            transaction set
335  * @param dbmode        O_RDONLY or O_RDWR
336  * @return              0 on success
337  */
338 int rpmtsInitDB(rpmts ts, int dbmode)
339         /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
340         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
341
342 /** \ingroup rpmts
343  * Rebuild the database used by the transaction.
344  * @param ts            transaction set
345  * @return              0 on success
346  */
347 int rpmtsRebuildDB(rpmts ts)
348         /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
349         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
350
351 /** \ingroup rpmts
352  * Verify the database used by the transaction.
353  * @param ts            transaction set
354  * @return              0 on success
355  */
356 int rpmtsVerifyDB(rpmts ts)
357         /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
358         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
359
360 /** \ingroup rpmts
361  * Return transaction database iterator.
362  * @param ts            transaction set
363  * @param rpmtag        rpm tag
364  * @param keyp          key data (NULL for sequential access)
365  * @param keylen        key data length (0 will use strlen(keyp))
366  * @return              NULL on failure
367  */
368 /*@only@*/ /*@null@*/
369 rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
370                         /*@null@*/ const void * keyp, size_t keylen)
371         /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
372         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
373
374 /**
375  * Retrieve pubkey from rpm database.
376  * @param ts            rpm transaction
377  * @return              RPMRC_OK on success, RPMRC_NOKEY if not found
378  */
379 rpmRC rpmtsFindPubkey(rpmts ts)
380         /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
381         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState */;
382
383 /** \ingroup rpmts
384  * Close the database used by the transaction to solve dependencies.
385  * @param ts            transaction set
386  * @return              0 on success
387  */
388 /*@-exportlocal@*/
389 int rpmtsCloseSDB(rpmts ts)
390         /*@globals fileSystem @*/
391         /*@modifies ts, fileSystem @*/;
392 /*@=exportlocal@*/
393
394 /** \ingroup rpmts
395  * Open the database used by the transaction to solve dependencies.
396  * @param ts            transaction set
397  * @param dbmode        O_RDONLY or O_RDWR
398  * @return              0 on success
399  */
400 /*@-exportlocal@*/
401 int rpmtsOpenSDB(rpmts ts, int dbmode)
402         /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
403         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
404 /*@=exportlocal@*/
405
406 /**
407  * Attempt to solve a needed dependency using the solve database.
408  * @param ts            transaction set
409  * @param ds            dependency set
410  * @param data          opaque data associated with callback
411  * @return              -1 retry, 0 ignore, 1 not found
412  */
413 /*@-exportlocal@*/
414 int rpmtsSolve(rpmts ts, rpmds ds, const void * data)
415         /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
416         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
417 /*@=exportlocal@*/
418
419 /**
420  * Attempt to solve a needed dependency using memory resident tables.
421  * @deprecated This function will move from rpmlib to the python bindings.
422  * @param ts            transaction set
423  * @param ds            dependency set
424  * @return              0 if resolved (and added to ts), 1 not found
425  */
426 /*@unused@*/
427 int rpmtsAvailable(rpmts ts, const rpmds ds)
428         /*@globals fileSystem @*/
429         /*@modifies ts, fileSystem @*/;
430
431 /**
432  * Set dependency solver callback.
433  * @param ts            transaction set
434  * @param (*solve)      dependency solver callback
435  * @param solveData     dependency solver callback data (opaque)
436  * @return              0 on success
437  */
438 int rpmtsSetSolveCallback(rpmts ts,
439                 int (*solve) (rpmts ts, rpmds ds, const void * data),
440                 const void * solveData)
441         /*@modifies ts @*/;
442
443 /**
444  * Return current transaction set problems.
445  * @param ts            transaction set
446  * @return              current problem set (or NULL)
447  */
448 /*@null@*/
449 rpmps rpmtsProblems(rpmts ts)
450         /*@modifies ts @*/;
451
452 /** \ingroup rpmts
453  * Free signature verification data.
454  * @param ts            transaction set
455  */
456 void rpmtsCleanDig(rpmts ts)
457         /*@modifies ts @*/;
458
459 /** \ingroup rpmts
460  * Free memory needed only for dependency checks and ordering.
461  * @param ts            transaction set
462  */
463 void rpmtsClean(rpmts ts)
464         /*@globals fileSystem @*/
465         /*@modifies ts, fileSystem @*/;
466
467 /** \ingroup rpmts
468  * Re-create an empty transaction set.
469  * @param ts            transaction set
470  */
471 void rpmtsEmpty(rpmts ts)
472         /*@globals fileSystem @*/
473         /*@modifies ts, fileSystem @*/;
474
475 /** \ingroup rpmts
476  * Destroy transaction set, closing the database as well.
477  * @param ts            transaction set
478  * @return              NULL always
479  */
480 /*@null@*/
481 rpmts rpmtsFree(/*@killref@*/ /*@only@*//*@null@*/ rpmts ts)
482         /*@globals fileSystem @*/
483         /*@modifies ts, fileSystem @*/;
484
485 /** \ingroup rpmts
486  * Get verify signatures flag(s).
487  * @param ts            transaction set
488  * @return              verify signatures flags
489  */
490 rpmVSFlags rpmtsVSFlags(rpmts ts)
491         /*@*/;
492
493 /** \ingroup rpmts
494  * Set verify signatures flag(s).
495  * @param ts            transaction set
496  * @param vsflags       new verify signatures flags
497  * @return              previous value
498  */
499 rpmVSFlags rpmtsSetVSFlags(rpmts ts, rpmVSFlags vsflags)
500         /*@modifies ts @*/;
501
502 /** \ingroup rpmts
503  * Set index of 1st element of successors.
504  * @param ts            transaction set
505  * @param first         new index of 1st element of successors
506  * @return              previous value
507  */
508 int rpmtsUnorderedSuccessors(rpmts ts, int first)
509         /*@modifies ts @*/;
510
511 /** \ingroup rpmts
512  * Get transaction rootDir, i.e. path to chroot(2).
513  * @param ts            transaction set
514  * @return              transaction rootDir
515  */
516 /*@observer@*/ /*@null@*/
517 extern const char * rpmtsRootDir(rpmts ts)
518         /*@*/;
519
520 /** \ingroup rpmts
521  * Set transaction rootDir, i.e. path to chroot(2).
522  * @param ts            transaction set
523  * @param rootDir       new transaction rootDir (or NULL)
524  */
525 void rpmtsSetRootDir(rpmts ts, /*@null@*/ const char * rootDir)
526         /*@modifies ts @*/;
527
528 /** \ingroup rpmts
529  * Get transaction currDir, i.e. current directory before chroot(2).
530  * @param ts            transaction set
531  * @return              transaction currDir
532  */
533 /*@observer@*/ /*@null@*/
534 extern const char * rpmtsCurrDir(rpmts ts)
535         /*@*/;
536
537 /** \ingroup rpmts
538  * Set transaction currDir, i.e. current directory before chroot(2).
539  * @param ts            transaction set
540  * @param currDir       new transaction currDir (or NULL)
541  */
542 void rpmtsSetCurrDir(rpmts ts, /*@null@*/ const char * currDir)
543         /*@modifies ts @*/;
544
545 /** \ingroup rpmts
546  * Get transaction script file handle, i.e. stdout/stderr on scriptlet execution
547  * @param ts            transaction set
548  * @return              transaction script file handle
549  */
550 /*@null@*/
551 FD_t rpmtsScriptFd(rpmts ts)
552         /*@*/;
553
554 /** \ingroup rpmts
555  * Set transaction script file handle, i.e. stdout/stderr on scriptlet execution
556  * @param ts            transaction set
557  * @param scriptFd      new script file handle (or NULL)
558  */
559 void rpmtsSetScriptFd(rpmts ts, /*@null@*/ FD_t scriptFd)
560         /*@modifies ts, scriptFd @*/;
561
562 /** \ingroup rpmts
563  * Get chrootDone flag, i.e. has chroot(2) been performed?
564  * @param ts            transaction set
565  * @return              chrootDone flag
566  */
567 int rpmtsChrootDone(rpmts ts)
568         /*@*/;
569
570 /** \ingroup rpmts
571  * Set chrootDone flag, i.e. has chroot(2) been performed?
572  * @param ts            transaction set
573  * @param chrootDone    new chrootDone flag
574  * @return              previous chrootDone flag
575  */
576 int rpmtsSetChrootDone(rpmts ts, int chrootDone)
577         /*@modifies ts @*/;
578
579 /** \ingroup rpmts
580  * Get transaction id, i.e. transaction time stamp.
581  * @param ts            transaction set
582  * @return              chrootDone flag
583  */
584 int_32 rpmtsGetTid(rpmts ts)
585         /*@*/;
586
587 /** \ingroup rpmts
588  * Set transaction id, i.e. transaction time stamp.
589  * @param ts            transaction set
590  * @param tid           new transaction id
591  * @return              previous transaction id
592  */
593 int_32 rpmtsSetTid(rpmts ts, int_32 tid)
594         /*@modifies ts @*/;
595
596 /** \ingroup rpmts
597  * Get signature tag.
598  * @param ts            transaction set
599  * @return              signature tag
600  */
601 int_32 rpmtsSigtag(const rpmts ts)
602         /*@*/;
603
604 /** \ingroup rpmts
605  * Get signature tag type.
606  * @param ts            transaction set
607  * @return              signature tag type
608  */
609 int_32 rpmtsSigtype(const rpmts ts)
610         /*@*/;
611
612 /** \ingroup rpmts
613  * Get signature tag data, i.e. from header.
614  * @param ts            transaction set
615  * @return              signature tag data
616  */
617 /*@observer@*/ /*@null@*/
618 extern const void * rpmtsSig(const rpmts ts)
619         /*@*/;
620
621 /** \ingroup rpmts
622  * Get signature tag data length, i.e. no. of bytes of data.
623  * @param ts            transaction set
624  * @return              signature tag data length
625  */
626 int_32 rpmtsSiglen(const rpmts ts)
627         /*@*/;
628
629 /** \ingroup rpmts
630  * Set signature tag info, i.e. from header.
631  * @param ts            transaction set
632  * @param sigtag        signature tag
633  * @param sigtype       signature tag type
634  * @param sig           signature tag data
635  * @param siglen        signature tag data length
636  * @return              0 always
637  */
638 int rpmtsSetSig(rpmts ts,
639                 int_32 sigtag, int_32 sigtype,
640                 /*@kept@*/ /*@null@*/ const void * sig, int_32 siglen)
641         /*@modifies ts @*/;
642
643 /** \ingroup rpmts
644  * Get OpenPGP packet parameters, i.e. signature/pubkey constants.
645  * @param ts            transaction set
646  * @return              signature/pubkey constants.
647  */
648 /*@exposed@*/ /*@null@*/
649 pgpDig rpmtsDig(rpmts ts)
650         /*@*/;
651
652 /** \ingroup rpmts
653  * Get OpenPGP signature constants.
654  * @param ts            transaction set
655  * @return              signature constants.
656  */
657 /*@exposed@*/ /*@null@*/
658 pgpDigParams rpmtsSignature(const rpmts ts)
659         /*@*/;
660
661 /** \ingroup rpmts
662  * Get OpenPGP pubkey constants.
663  * @param ts            transaction set
664  * @return              pubkey constants.
665  */
666 /*@exposed@*/ /*@null@*/
667 pgpDigParams rpmtsPubkey(const rpmts ts)
668         /*@*/;
669
670 /** \ingroup rpmts
671  * Get transaction set database handle.
672  * @param ts            transaction set
673  * @return              transaction database handle
674  */
675 /*@null@*/
676 rpmdb rpmtsGetRdb(rpmts ts)
677         /*@*/;
678
679 /** \ingroup rpmts
680  * Initialize disk space info for each and every mounted file systems.
681  * @param ts            transaction set
682  * @return              0 on success
683  */
684 int rpmtsInitDSI(const rpmts ts)
685         /*@globals fileSystem, internalState @*/
686         /*@modifies ts, fileSystem, internalState @*/;
687
688 /** \ingroup rpmts
689  * Update disk space info for a file.
690  * @param ts            transaction set
691  * @param dev           mount point device
692  * @param fileSize      file size
693  * @param prevSize      previous file size (if upgrading)
694  * @param fixupSize     size difference (if
695  * @param action        file disposition
696  */
697 void rpmtsUpdateDSI(const rpmts ts, dev_t dev,
698                 uint_32 fileSize, uint_32 prevSize, uint_32 fixupSize,
699                 fileAction action)
700         /*@modifies ts @*/;
701
702 /** \ingroup rpmts
703  * Check a transaction element for disk space problems.
704  * @param ts            transaction set
705  * @param te            current transaction element
706  */
707 void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te)
708         /*@modifies ts @*/;
709
710 /**
711  * Perform transaction progress notify callback.
712  * @param ts            transaction set
713  * @param te            current transaction element
714  * @param what          type of call back
715  * @param amount        current value
716  * @param total         final value
717  * @return              callback dependent pointer
718  */
719 /*@null@*/
720 void * rpmtsNotify(rpmts ts, rpmte te,
721                 rpmCallbackType what, unsigned long amount, unsigned long total)
722         /*@*/;
723
724 /**
725  * Return number of (ordered) transaction set elements.
726  * @param ts            transaction set
727  * @return              no. of transaction set elements
728  */
729 int rpmtsNElements(rpmts ts)
730         /*@*/;
731
732 /**
733  * Return (ordered) transaction set element.
734  * @param ts            transaction set
735  * @param ix            transaction element index
736  * @return              transaction element (or NULL)
737  */
738 /*@null@*/ /*@dependent@*/
739 rpmte rpmtsElement(rpmts ts, int ix)
740         /*@*/;
741
742 /** \ingroup rpmts
743  * Get problem ignore bit mask, i.e. bits to filter encountered problems.
744  * @param ts            transaction set
745  * @return              ignore bit mask
746  */
747 rpmprobFilterFlags rpmtsFilterFlags(rpmts ts)
748         /*@*/;
749
750 /** \ingroup rpmts
751  * Get transaction flags, i.e. bits that control rpmtsRun().
752  * @param ts            transaction set
753  * @return              transaction flags
754  */
755 rpmtransFlags rpmtsFlags(rpmts ts)
756         /*@*/;
757
758 /** \ingroup rpmts
759  * Set transaction flags, i.e. bits that control rpmtsRun().
760  * @param ts            transaction set
761  * @param transFlags    new transaction flags
762  * @return              previous transaction flags
763  */
764 rpmtransFlags rpmtsSetFlags(rpmts ts, rpmtransFlags transFlags)
765         /*@modifies ts @*/;
766
767 /** \ingroup rpmts
768  * Get spec control structure from transaction set.
769  * @param ts            transaction set
770  * @return              spec control structure
771  */
772 /*@null@*/
773 Spec rpmtsSpec(rpmts ts)
774         /*@*/;
775
776 /** \ingroup rpmts
777  * Set a spec control structure in transaction set.
778  * @param ts            transaction set
779  * @param spec          new spec control structure
780  * @return              previous spec control structure
781  */
782 /*@null@*/
783 Spec rpmtsSetSpec(rpmts ts, /*@null@*/ Spec spec)
784         /*@modifies ts @*/;
785
786 /** \ingroup rpmts
787  * Get current relocate transaction element.
788  * @param ts            transaction set
789  * @return              current relocate transaction element
790  */
791 /*@null@*/
792 rpmte rpmtsRelocateElement(rpmts ts)
793         /*@*/;
794
795 /**
796  * Retrieve color bits of transaction set.
797  * @param ts            transaction set
798  * @return              color bits
799  */
800 uint_32 rpmtsColor(rpmts ts)
801         /*@*/;
802
803 /**
804  * Set color bits of transaction set.
805  * @param ts            transaction set
806  * @param color         new color bits
807  * @return              previous color bits
808  */
809 uint_32 rpmtsSetColor(rpmts ts, uint_32 color)
810         /*@modifies ts @*/;
811
812 /** \ingroup rpmts
813  * Set current relocate transaction element.
814  * @param ts            transaction set
815  * @param relocateElement new relocate transaction element
816  * @return              previous relocate transaction element
817  */
818 /*@null@*/
819 rpmte rpmtsSetRelocateElement(rpmts ts, /*@null@*/ rpmte relocateElement)
820         /*@modifies ts @*/;
821
822 /** \ingroup rpmts
823  * Set transaction notify callback function and argument.
824  *
825  * @warning This call must be made before rpmtsRun() for
826  *      install/upgrade/freshen to function correctly.
827  *
828  * @param ts            transaction set
829  * @param notify        progress callback
830  * @param notifyData    progress callback private data
831  * @return              0 on success
832  */
833 int rpmtsSetNotifyCallback(rpmts ts,
834                 /*@observer@*/ rpmCallbackFunction notify,
835                 /*@observer@*/ rpmCallbackData notifyData)
836         /*@modifies ts @*/;
837
838 /** \ingroup rpmts
839  * Create an empty transaction set.
840  * @return              new transaction set
841  */
842 /*@newref@*/
843 rpmts rpmtsCreate(void)
844         /*@globals rpmGlobalMacroContext, internalState @*/
845         /*@modifies rpmGlobalMacroContext, internalState @*/;
846
847 /** \ingroup rpmts
848  * Add package to be installed to transaction set.
849  *
850  * The transaction set is checked for duplicate package names.
851  * If found, the package with the "newest" EVR will be replaced.
852  *
853  * @param ts            transaction set
854  * @param h             header
855  * @param key           package retrieval key (e.g. file name)
856  * @param upgrade       is package being upgraded?
857  * @param relocs        package file relocations
858  * @return              0 on success, 1 on I/O error, 2 needs capabilities
859  */
860 int rpmtsAddInstallElement(rpmts ts, Header h,
861                 /*@exposed@*/ /*@null@*/ const fnpyKey key, int upgrade,
862                 /*@null@*/ rpmRelocation * relocs)
863         /*@globals rpmcliPackagesTotal, rpmGlobalMacroContext,
864                 fileSystem, internalState @*/
865         /*@modifies ts, h, rpmcliPackagesTotal, rpmGlobalMacroContext,
866                 fileSystem, internalState @*/;
867
868 /** \ingroup rpmts
869  * Add package to be erased to transaction set.
870  * @param ts            transaction set
871  * @param h             header
872  * @param dboffset      rpm database instance
873  * @return              0 on success
874  */
875 int rpmtsAddEraseElement(rpmts ts, Header h, int dboffset)
876         /*@globals fileSystem @*/
877         /*@modifies ts, h, fileSystem @*/;
878
879 /** \ingroup rpmts
880  * Retrieve keys from ordered transaction set.
881  * @todo Removed packages have no keys, returned as interleaved NULL pointers.
882  * @param ts            transaction set
883  * @retval ep           address of returned element array pointer (or NULL)
884  * @retval nep          address of no. of returned elements (or NULL)
885  * @return              0 always
886  */
887 /*@unused@*/
888 int rpmtsGetKeys(rpmts ts,
889                 /*@null@*/ /*@out@*/ fnpyKey ** ep,
890                 /*@null@*/ /*@out@*/ int * nep)
891         /*@globals fileSystem @*/
892         /*@modifies ts, ep, nep, fileSystem @*/;
893
894 /**
895  * Return (malloc'd) header name-version-release string.
896  * @param h             header
897  * @retval np           name tag value
898  * @return              name-version-release string
899  */
900 /*@only@*/ char * hGetNEVR(Header h, /*@null@*/ /*@out@*/ const char ** np )
901         /*@modifies *np @*/;
902
903 /**
904  * Return header color.
905  * @param h             header
906  * @return              header color
907  */
908 uint_32 hGetColor(Header h)
909         /*@modifies h @*/;
910
911 #ifdef __cplusplus
912 }
913 #endif
914
915 #endif  /* H_RPMTS */