Main Page Modules Data Structures File List Data Fields Globals Related Pages

# lib/rpmts.h

Go to the documentation of this file.

    00001 #ifndef H_RPMTS
    00002 #define H_RPMTS
    00003
    00009 #include "rpmps.h"
    00010
    00011 /*@-exportlocal@*/
    00012 /*@unchecked@*/
    00013 extern int _rpmts_debug;
    00014 /*@unchecked@*/
    00015 extern int _fps_debug;
    00016 /*@=exportlocal@*/
    00017
    00021 typedef enum rpmVSFlags_e {
    00022     RPMVSF_DEFAULT      = 0,
    00023     RPMVSF_NOHDRCHK     = (1 <<  0),
    00024     RPMVSF_NEEDPAYLOAD  = (1 <<  1),
    00025     /* bit(s) 2-7 unused */
    00026     RPMVSF_NOSHA1HEADER = (1 <<  8),
    00027     RPMVSF_NOMD5HEADER  = (1 <<  9),    /* unimplemented */
    00028     RPMVSF_NODSAHEADER  = (1 << 10),
    00029     RPMVSF_NORSAHEADER  = (1 << 11),    /* unimplemented */
    00030     /* bit(s) 12-15 unused */
    00031     RPMVSF_NOSHA1       = (1 << 16),    /* unimplemented */
    00032     RPMVSF_NOMD5        = (1 << 17),
    00033     RPMVSF_NODSA        = (1 << 18),
    00034     RPMVSF_NORSA        = (1 << 19)
    00035     /* bit(s) 16-31 unused */
    00036 } rpmVSFlags;
    00037
    00038 #define _RPMVSF_NODIGESTS       \
    00039   ( RPMVSF_NOSHA1HEADER |       \
    00040     RPMVSF_NOMD5HEADER |        \
    00041     RPMVSF_NOSHA1 |             \
    00042     RPMVSF_NOMD5 )
    00043
    00044 #define _RPMVSF_NOSIGNATURES    \
    00045   ( RPMVSF_NODSAHEADER |        \
    00046     RPMVSF_NORSAHEADER |        \
    00047     RPMVSF_NODSA |              \
    00048     RPMVSF_NORSA )
    00049
    00050 #define _RPMVSF_NOHEADER        \
    00051   ( RPMVSF_NOSHA1HEADER |       \
    00052     RPMVSF_NOMD5HEADER |        \
    00053     RPMVSF_NODSAHEADER |        \
    00054     RPMVSF_NORSAHEADER )
    00055
    00056 #define _RPMVSF_NOPAYLOAD       \
    00057   ( RPMVSF_NOSHA1 |             \
    00058     RPMVSF_NOMD5 |              \
    00059     RPMVSF_NODSA |              \
    00060     RPMVSF_NORSA )
    00061
    00062 #if defined(_RPMTS_INTERNAL)
    00063
    00064 #include "rpmhash.h"    /* XXX hashTable */
    00065 #include "rpmal.h"      /* XXX availablePackage/relocateFileList ,*/
    00066
    00067 /*@unchecked@*/
    00068 /*@-exportlocal@*/
    00069 extern int _cacheDependsRC;
    00070 /*@=exportlocal@*/
    00071
    00074 typedef /*@abstract@*/ struct diskspaceInfo_s * rpmDiskSpaceInfo;
    00075
    00078 struct diskspaceInfo_s {
    00079     dev_t dev;
    00080     signed long bneeded;
    00081     signed long ineeded;
    00082     int bsize;
    00083     signed long bavail;
    00084     signed long iavail;
    00085 };
    00086
    00090 #define adj_fs_blocks(_nb)      (((_nb) * 21) / 20)
    00091
    00092 /* argon thought a shift optimization here was a waste of time...  he's
    00093    probably right :-( */
    00094 #define BLOCK_ROUND(size, block) (((size) + (block) - 1) / (block))
    00095
    00098 typedef enum tsStage_e {
    00099     TSM_UNKNOWN         =  0,
    00100     TSM_INSTALL         =  7,
    00101     TSM_ERASE           =  8,
    00102 } tsmStage;
    00103
    00107 struct rpmts_s {
    00108     rpmtransFlags transFlags;
    00109     tsmStage goal;
    00111 /*@refcounted@*/ /*@null@*/
    00112     rpmdb sdb;
    00113     int sdbmode;
    00114 /*@null@*/
    00115     int (*solve) (rpmts ts, rpmds key, const void * data)
    00116         /*@modifies ts @*/;
    00117     const void * solveData;
    00118     int nsuggests;
    00119 /*@only@*/ /*@null@*/
    00120     const void ** suggests;
    00122 /*@observer@*/ /*@null@*/
    00123     rpmCallbackFunction notify;
    00124 /*@observer@*/ /*@null@*/
    00125     rpmCallbackData notifyData;
    00127 /*@refcounted@*/ /*@null@*/
    00128     rpmps probs;
    00129     rpmprobFilterFlags ignoreSet;
    00132     int filesystemCount;
    00133 /*@dependent@*/ /*@null@*/
    00134     const char ** filesystems;
    00135 /*@only@*/ /*@null@*/
    00136     rpmDiskSpaceInfo dsi;
    00138 /*@refcounted@*/ /*@null@*/
    00139     rpmdb rdb;
    00140     int dbmode;
    00141 /*@only@*/
    00142     hashTable ht;
    00144 /*@only@*/ /*@null@*/
    00145     int * removedPackages;
    00146     int numRemovedPackages;
    00147     int allocedRemovedPackages;
    00149 /*@only@*/
    00150     rpmal addedPackages;
    00151     int numAddedPackages;
    00153 #ifndef DYING
    00154 /*@only@*/
    00155     rpmal availablePackages;
    00156     int numAvailablePackages;
    00157 #endif
    00158
    00159 /*@owned@*/ /*@relnull@*/
    00160     rpmte * order;
    00161     int orderCount;
    00162     int orderAlloced;
    00163     int unorderedSuccessors;
    00165     int chrootDone;
    00166 /*@only@*/ /*@null@*/
    00167     const char * rootDir;
    00168 /*@only@*/ /*@null@*/
    00169     const char * currDir;
    00170 /*@null@*/
    00171     FD_t scriptFd;
    00172     int delta;
    00173     int_32 tid;
    00175     rpmVSFlags vsflags;
    00177 /*@observer@*/ /*@dependent@*/ /*@null@*/
    00178     const char * fn;
    00179     int_32  sigtag;
    00180     int_32  sigtype;
    00181 /*@null@*/
    00182     const void * sig;
    00183     int_32 siglen;
    00185 /*@only@*/ /*@null@*/
    00186     const unsigned char * pkpkt;
    00187     size_t pkpktlen;
    00188     unsigned char pksignid[8];
    00190 /*@null@*/
    00191     pgpDig dig;
    00193 /*@refs@*/
    00194     int nrefs;
    00196 };
    00197 #endif  /* _RPMTS_INTERNAL */
    00198
    00199 #ifdef __cplusplus
    00200 extern "C" {
    00201 #endif
    00202
    00208 int rpmtsCheck(rpmts ts)
    00209         /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
    00210         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00211
    00228 int rpmtsOrder(rpmts ts)
    00229         /*@globals fileSystem, internalState@*/
    00230         /*@modifies ts, fileSystem, internalState @*/;
    00231
    00240 int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
    00241         /*@globals rpmGlobalMacroContext,
    00242                 fileSystem, internalState@*/
    00243         /*@modifies ts, rpmGlobalMacroContext,
    00244                 fileSystem, internalState @*/;
    00245
    00252 /*@unused@*/ /*@null@*/
    00253 rpmts rpmtsUnlink (/*@killref@*/ /*@only@*/ rpmts ts,
    00254                 const char * msg)
    00255         /*@modifies ts @*/;
    00256
    00258 /*@-exportlocal@*/
    00259 /*@null@*/
    00260 rpmts XrpmtsUnlink (/*@killref@*/ /*@only@*/ rpmts ts,
    00261                 const char * msg, const char * fn, unsigned ln)
    00262         /*@modifies ts @*/;
    00263 /*@=exportlocal@*/
    00264 #define rpmtsUnlink(_ts, _msg)  XrpmtsUnlink(_ts, _msg, __FILE__, __LINE__)
    00265
    00272 /*@unused@*/
    00273 rpmts rpmtsLink (rpmts ts, const char * msg)
    00274         /*@modifies ts @*/;
    00275
    00277 rpmts XrpmtsLink (rpmts ts,
    00278                 const char * msg, const char * fn, unsigned ln)
    00279         /*@modifies ts @*/;
    00280 #define rpmtsLink(_ts, _msg)    XrpmtsLink(_ts, _msg, __FILE__, __LINE__)
    00281
    00287 int rpmtsCloseDB(rpmts ts)
    00288         /*@globals fileSystem @*/
    00289         /*@modifies ts, fileSystem @*/;
    00290
    00297 int rpmtsOpenDB(rpmts ts, int dbmode)
    00298         /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
    00299         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00300
    00308 int rpmtsInitDB(rpmts ts, int dbmode)
    00309         /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
    00310         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00311
    00317 int rpmtsRebuildDB(rpmts ts)
    00318         /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
    00319         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00320
    00326 int rpmtsVerifyDB(rpmts ts)
    00327         /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
    00328         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00329
    00338 /*@only@*/ /*@null@*/
    00339 rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
    00340                         /*@null@*/ const void * keyp, size_t keylen)
    00341         /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
    00342         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00343
    00349 rpmRC rpmtsFindPubkey(rpmts ts)
    00350         /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
    00351         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState */;
    00352
    00358 /*@-exportlocal@*/
    00359 int rpmtsCloseSDB(rpmts ts)
    00360         /*@globals fileSystem @*/
    00361         /*@modifies ts, fileSystem @*/;
    00362 /*@=exportlocal@*/
    00363
    00370 /*@-exportlocal@*/
    00371 int rpmtsOpenSDB(rpmts ts, int dbmode)
    00372         /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
    00373         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00374 /*@=exportlocal@*/
    00375
    00383 /*@-exportlocal@*/
    00384 int rpmtsSolve(rpmts ts, rpmds ds, const void * data)
    00385         /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
    00386         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00387 /*@=exportlocal@*/
    00388
    00396 /*@unused@*/
    00397 int rpmtsAvailable(rpmts ts, const rpmds ds)
    00398         /*@globals fileSystem @*/
    00399         /*@modifies ts, fileSystem @*/;
    00400
    00408 int rpmtsSetSolveCallback(rpmts ts,
    00409                 int (*solve) (rpmts ts, rpmds ds, const void * data),
    00410                 const void * solveData)
    00411         /*@modifies ts @*/;
    00412
    00418 /*@null@*/
    00419 rpmps rpmtsProblems(rpmts ts)
    00420         /*@modifies ts @*/;
    00421
    00426 void rpmtsCleanDig(rpmts ts)
    00427         /*@modifies ts @*/;
    00428
    00433 void rpmtsClean(rpmts ts)
    00434         /*@globals fileSystem @*/
    00435         /*@modifies ts, fileSystem @*/;
    00436
    00441 void rpmtsEmpty(rpmts ts)
    00442         /*@globals fileSystem @*/
    00443         /*@modifies ts, fileSystem @*/;
    00444
    00450 /*@null@*/
    00451 rpmts rpmtsFree(/*@killref@*/ /*@only@*//*@null@*/ rpmts ts)
    00452         /*@globals fileSystem @*/
    00453         /*@modifies ts, fileSystem @*/;
    00454
    00460 rpmVSFlags rpmtsVSFlags(rpmts ts)
    00461         /*@*/;
    00462
    00469 rpmVSFlags rpmtsSetVSFlags(rpmts ts, rpmVSFlags vsflags)
    00470         /*@modifies ts @*/;
    00471
    00478 int rpmtsUnorderedSuccessors(rpmts ts, int first)
    00479         /*@modifies ts @*/;
    00480
    00486 /*@observer@*/ /*@null@*/
    00487 extern const char * rpmtsRootDir(rpmts ts)
    00488         /*@*/;
    00489
    00495 void rpmtsSetRootDir(rpmts ts, /*@null@*/ const char * rootDir)
    00496         /*@modifies ts @*/;
    00497
    00503 /*@observer@*/ /*@null@*/
    00504 extern const char * rpmtsCurrDir(rpmts ts)
    00505         /*@*/;
    00506
    00512 void rpmtsSetCurrDir(rpmts ts, /*@null@*/ const char * currDir)
    00513         /*@modifies ts @*/;
    00514
    00520 /*@null@*/
    00521 FD_t rpmtsScriptFd(rpmts ts)
    00522         /*@*/;
    00523
    00529 void rpmtsSetScriptFd(rpmts ts, /*@null@*/ FD_t scriptFd)
    00530         /*@modifies ts, scriptFd @*/;
    00531
    00537 int rpmtsChrootDone(rpmts ts)
    00538         /*@*/;
    00539
    00546 int rpmtsSetChrootDone(rpmts ts, int chrootDone)
    00547         /*@modifies ts @*/;
    00548
    00554 int_32 rpmtsGetTid(rpmts ts)
    00555         /*@*/;
    00556
    00563 int_32 rpmtsSetTid(rpmts ts, int_32 tid)
    00564         /*@modifies ts @*/;
    00565
    00571 int_32 rpmtsSigtag(const rpmts ts)
    00572         /*@*/;
    00573
    00579 int_32 rpmtsSigtype(const rpmts ts)
    00580         /*@*/;
    00581
    00587 /*@observer@*/ /*@null@*/
    00588 extern const void * rpmtsSig(const rpmts ts)
    00589         /*@*/;
    00590
    00596 int_32 rpmtsSiglen(const rpmts ts)
    00597         /*@*/;
    00598
    00608 int rpmtsSetSig(rpmts ts,
    00609                 int_32 sigtag, int_32 sigtype,
    00610                 /*@kept@*/ /*@null@*/ const void * sig, int_32 siglen)
    00611         /*@modifies ts @*/;
    00612
    00618 /*@exposed@*/ /*@null@*/
    00619 pgpDig rpmtsDig(rpmts ts)
    00620         /*@*/;
    00621
    00627 /*@exposed@*/ /*@null@*/
    00628 pgpDigParams rpmtsSignature(const rpmts ts)
    00629         /*@*/;
    00630
    00636 /*@exposed@*/ /*@null@*/
    00637 pgpDigParams rpmtsPubkey(const rpmts ts)
    00638         /*@*/;
    00639
    00645 /*@null@*/
    00646 rpmdb rpmtsGetRdb(rpmts ts)
    00647         /*@*/;
    00648
    00654 int rpmtsInitDSI(const rpmts ts)
    00655         /*@globals fileSystem, internalState @*/
    00656         /*@modifies ts, fileSystem, internalState @*/;
    00657
    00667 void rpmtsUpdateDSI(const rpmts ts, dev_t dev,
    00668                 uint_32 fileSize, uint_32 prevSize, uint_32 fixupSize,
    00669                 fileAction action)
    00670         /*@modifies ts @*/;
    00671
    00677 void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te)
    00678         /*@modifies ts @*/;
    00679
    00689 /*@null@*/
    00690 void * rpmtsNotify(rpmts ts, rpmte te,
    00691                 rpmCallbackType what, unsigned long amount, unsigned long total)
    00692         /*@*/;
    00693
    00699 int rpmtsNElements(rpmts ts)
    00700         /*@*/;
    00701
    00708 rpmte rpmtsElement(rpmts ts, int ix)
    00709         /*@*/;
    00710
    00716 rpmprobFilterFlags rpmtsFilterFlags(rpmts ts)
    00717         /*@*/;
    00718
    00724 rpmtransFlags rpmtsFlags(rpmts ts)
    00725         /*@*/;
    00726
    00733 rpmtransFlags rpmtsSetFlags(rpmts ts, rpmtransFlags transFlags)
    00734         /*@modifies ts @*/;
    00735
    00747 int rpmtsSetNotifyCallback(rpmts ts,
    00748                 /*@observer@*/ rpmCallbackFunction notify,
    00749                 /*@observer@*/ rpmCallbackData notifyData)
    00750         /*@modifies ts @*/;
    00751
    00756 /*@newref@*/
    00757 rpmts rpmtsCreate(void)
    00758         /*@*/;
    00759
    00773 int rpmtsAddInstallElement(rpmts ts, Header h,
    00774                 /*@exposed@*/ /*@null@*/ const fnpyKey key, int upgrade,
    00775                 /*@null@*/ rpmRelocation * relocs)
    00776         /*@globals rpmcliPackagesTotal, rpmGlobalMacroContext,
    00777                 fileSystem, internalState @*/
    00778         /*@modifies ts, h, rpmcliPackagesTotal, rpmGlobalMacroContext,
    00779                 fileSystem, internalState @*/;
    00780
    00788 int rpmtsAddEraseElement(rpmts ts, Header h, int dboffset)
    00789         /*@globals fileSystem @*/
    00790         /*@modifies ts, h, fileSystem @*/;
    00791
    00800 /*@unused@*/
    00801 int rpmtsGetKeys(rpmts ts,
    00802                 /*@null@*/ /*@out@*/ fnpyKey ** ep,
    00803                 /*@null@*/ /*@out@*/ int * nep)
    00804         /*@globals fileSystem @*/
    00805         /*@modifies ts, ep, nep, fileSystem @*/;
    00806
    00813 /*@only@*/ char * hGetNEVR(Header h, /*@null@*/ /*@out@*/ const char ** np )
    00814         /*@modifies *np @*/;
    00815
    00816 #ifdef __cplusplus
    00817 }
    00818 #endif
    00819
    00820 #endif  /* H_RPMTS */