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