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 #include "rpmsw.h"
00011 
00012 /*@-exportlocal@*/
00013 /*@unchecked@*/
00014 extern int _rpmts_debug;
00015 /*@unchecked@*/
00016 extern int _rpmts_stats;
00017 /*@unchecked@*/
00018 extern int _fps_debug;
00019 /*@=exportlocal@*/
00020 
00024 typedef enum rpmVSFlags_e {
00025     RPMVSF_DEFAULT      = 0,
00026     RPMVSF_NOHDRCHK     = (1 <<  0),
00027     RPMVSF_NEEDPAYLOAD  = (1 <<  1),
00028     /* bit(s) 2-7 unused */
00029     RPMVSF_NOSHA1HEADER = (1 <<  8),
00030     RPMVSF_NOMD5HEADER  = (1 <<  9),    /* unimplemented */
00031     RPMVSF_NODSAHEADER  = (1 << 10),
00032     RPMVSF_NORSAHEADER  = (1 << 11),    /* unimplemented */
00033     /* bit(s) 12-15 unused */
00034     RPMVSF_NOSHA1       = (1 << 16),    /* unimplemented */
00035     RPMVSF_NOMD5        = (1 << 17),
00036     RPMVSF_NODSA        = (1 << 18),
00037     RPMVSF_NORSA        = (1 << 19)
00038     /* bit(s) 16-31 unused */
00039 } rpmVSFlags;
00040 
00041 #define _RPMVSF_NODIGESTS       \
00042   ( RPMVSF_NOSHA1HEADER |       \
00043     RPMVSF_NOMD5HEADER |        \
00044     RPMVSF_NOSHA1 |             \
00045     RPMVSF_NOMD5 )
00046 
00047 #define _RPMVSF_NOSIGNATURES    \
00048   ( RPMVSF_NODSAHEADER |        \
00049     RPMVSF_NORSAHEADER |        \
00050     RPMVSF_NODSA |              \
00051     RPMVSF_NORSA )
00052 
00053 #define _RPMVSF_NOHEADER        \
00054   ( RPMVSF_NOSHA1HEADER |       \
00055     RPMVSF_NOMD5HEADER |        \
00056     RPMVSF_NODSAHEADER |        \
00057     RPMVSF_NORSAHEADER )
00058 
00059 #define _RPMVSF_NOPAYLOAD       \
00060   ( RPMVSF_NOSHA1 |             \
00061     RPMVSF_NOMD5 |              \
00062     RPMVSF_NODSA |              \
00063     RPMVSF_NORSA )
00064 
00068 typedef enum rpmtsOpX_e {
00069     RPMTS_OP_TOTAL              =  0,
00070     RPMTS_OP_CHECK              =  1,
00071     RPMTS_OP_ORDER              =  2,
00072     RPMTS_OP_FINGERPRINT        =  3,
00073     RPMTS_OP_REPACKAGE          =  4,
00074     RPMTS_OP_INSTALL            =  5,
00075     RPMTS_OP_ERASE              =  6,
00076     RPMTS_OP_SCRIPTLETS         =  7,
00077     RPMTS_OP_COMPRESS           =  8,
00078     RPMTS_OP_UNCOMPRESS         =  9,
00079     RPMTS_OP_DIGEST             = 10,
00080     RPMTS_OP_SIGNATURE          = 11,
00081     RPMTS_OP_DBADD              = 12,
00082     RPMTS_OP_DBREMOVE           = 13,
00083     RPMTS_OP_DBGET              = 14,
00084     RPMTS_OP_DBPUT              = 15,
00085     RPMTS_OP_DBDEL              = 16,
00086     RPMTS_OP_MAX                = 17
00087 } rpmtsOpX;
00088 
00089 #if defined(_RPMTS_INTERNAL)
00090 
00091 #include "rpmhash.h"    /* XXX hashTable */
00092 #include "rpmal.h"      /* XXX availablePackage/relocateFileList ,*/
00093 
00094 /*@unchecked@*/
00095 /*@-exportlocal@*/
00096 extern int _cacheDependsRC;
00097 /*@=exportlocal@*/
00098 
00101 typedef /*@abstract@*/ struct diskspaceInfo_s * rpmDiskSpaceInfo;
00102 
00105 struct diskspaceInfo_s {
00106     dev_t dev;                  
00107     signed long bneeded;        
00108     signed long ineeded;        
00109     int bsize;                  
00110     signed long long bavail;    
00111     signed long long iavail;    
00112 };
00113 
00117 #define adj_fs_blocks(_nb)      (((_nb) * 21) / 20)
00118 
00119 /* argon thought a shift optimization here was a waste of time...  he's
00120    probably right :-( */
00121 #define BLOCK_ROUND(size, block) (((size) + (block) - 1) / (block))
00122 
00125 typedef enum tsStage_e {
00126     TSM_UNKNOWN         =  0,
00127     TSM_INSTALL         =  7,
00128     TSM_ERASE           =  8,
00129 } tsmStage;
00130 
00134 struct rpmts_s {
00135     rpmtransFlags transFlags;   
00136     tsmStage goal;              
00138 /*@refcounted@*/ /*@null@*/
00139     rpmdb sdb;                  
00140     int sdbmode;                
00141 /*@null@*/
00142     int (*solve) (rpmts ts, rpmds key, const void * data)
00143         /*@modifies ts @*/;     
00144 /*@relnull@*/
00145     const void * solveData;     
00146     int nsuggests;              
00147 /*@only@*/ /*@null@*/
00148     const void ** suggests;     
00150 /*@observer@*/ /*@null@*/
00151     rpmCallbackFunction notify; 
00152 /*@observer@*/ /*@null@*/
00153     rpmCallbackData notifyData; 
00155 /*@refcounted@*/ /*@null@*/
00156     rpmps probs;                
00157     rpmprobFilterFlags ignoreSet;
00160     int filesystemCount;        
00161 /*@dependent@*/ /*@null@*/
00162     const char ** filesystems;  
00163 /*@only@*/ /*@null@*/
00164     rpmDiskSpaceInfo dsi;       
00166 /*@refcounted@*/ /*@null@*/
00167     rpmdb rdb;                  
00168     int dbmode;                 
00169 /*@only@*/
00170     hashTable ht;               
00172 /*@only@*/ /*@null@*/
00173     int * removedPackages;      
00174     int numRemovedPackages;     
00175     int allocedRemovedPackages; 
00177 /*@only@*/
00178     rpmal addedPackages;        
00179     int numAddedPackages;       
00181 #ifndef DYING
00182 /*@only@*/
00183     rpmal availablePackages;    
00184     int numAvailablePackages;   
00185 #endif
00186 
00187 /*@null@*/
00188     rpmte relocateElement;      
00190 /*@owned@*/ /*@relnull@*/
00191     rpmte * order;              
00192     int orderCount;             
00193     int orderAlloced;           
00194     int unorderedSuccessors;    
00196     int chrootDone;             
00197 /*@only@*/ /*@null@*/
00198     const char * rootDir;       
00199 /*@only@*/ /*@null@*/
00200     const char * currDir;       
00201 /*@null@*/
00202     FD_t scriptFd;              
00203     int delta;                  
00204     int_32 tid;                 
00206     uint_32 color;              
00208     rpmVSFlags vsflags;         
00210 /*@observer@*/ /*@dependent@*/ /*@null@*/
00211     const char * fn;            
00212     int_32  sigtag;             
00213     int_32  sigtype;            
00214 /*@null@*/
00215     const void * sig;           
00216     int_32 siglen;              
00218 /*@only@*/ /*@null@*/
00219     const unsigned char * pkpkt;
00220     size_t pkpktlen;            
00221     unsigned char pksignid[8];  
00223     struct rpmop_s ops[RPMTS_OP_MAX];
00224 
00225 /*@null@*/
00226     pgpDig dig;                 
00228 /*@null@*/
00229     Spec spec;                  
00231 /*@refs@*/
00232     int nrefs;                  
00234 };
00235 #endif  /* _RPMTS_INTERNAL */
00236 
00237 #ifdef __cplusplus
00238 extern "C" {
00239 #endif
00240 
00246 int rpmtsCheck(rpmts ts)
00247         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00248         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
00249 
00266 int rpmtsOrder(rpmts ts)
00267         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00268         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
00269 
00278 int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
00279         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00280         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
00281 
00288 /*@unused@*/ /*@null@*/
00289 rpmts rpmtsUnlink (/*@killref@*/ /*@only@*/ rpmts ts,
00290                 const char * msg)
00291         /*@modifies ts @*/;
00292 
00294 /*@-exportlocal@*/
00295 /*@null@*/
00296 rpmts XrpmtsUnlink (/*@killref@*/ /*@only@*/ rpmts ts,
00297                 const char * msg, const char * fn, unsigned ln)
00298         /*@modifies ts @*/;
00299 /*@=exportlocal@*/
00300 #define rpmtsUnlink(_ts, _msg)  XrpmtsUnlink(_ts, _msg, __FILE__, __LINE__)
00301 
00308 /*@unused@*/
00309 rpmts rpmtsLink (rpmts ts, const char * msg)
00310         /*@modifies ts @*/;
00311 
00313 rpmts XrpmtsLink (rpmts ts,
00314                 const char * msg, const char * fn, unsigned ln)
00315         /*@modifies ts @*/;
00316 #define rpmtsLink(_ts, _msg)    XrpmtsLink(_ts, _msg, __FILE__, __LINE__)
00317 
00323 int rpmtsCloseDB(rpmts ts)
00324         /*@globals fileSystem @*/
00325         /*@modifies ts, fileSystem @*/;
00326 
00333 int rpmtsOpenDB(rpmts ts, int dbmode)
00334         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00335         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
00336 
00344 int rpmtsInitDB(rpmts ts, int dbmode)
00345         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00346         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
00347 
00353 int rpmtsRebuildDB(rpmts ts)
00354         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00355         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
00356 
00362 int rpmtsVerifyDB(rpmts ts)
00363         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00364         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
00365 
00374 /*@only@*/ /*@null@*/
00375 rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
00376                         /*@null@*/ const void * keyp, size_t keylen)
00377         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00378         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
00379 
00385 rpmRC rpmtsFindPubkey(rpmts ts)
00386         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00387         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState */;
00388 
00394 /*@-exportlocal@*/
00395 int rpmtsCloseSDB(rpmts ts)
00396         /*@globals fileSystem @*/
00397         /*@modifies ts, fileSystem @*/;
00398 /*@=exportlocal@*/
00399 
00406 /*@-exportlocal@*/
00407 int rpmtsOpenSDB(rpmts ts, int dbmode)
00408         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00409         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
00410 /*@=exportlocal@*/
00411 
00419 /*@-exportlocal@*/
00420 int rpmtsSolve(rpmts ts, rpmds ds, const void * data)
00421         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00422         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
00423 /*@=exportlocal@*/
00424 
00432 /*@unused@*/
00433 int rpmtsAvailable(rpmts ts, const rpmds ds)
00434         /*@globals fileSystem @*/
00435         /*@modifies ts, fileSystem @*/;
00436 
00444 int rpmtsSetSolveCallback(rpmts ts,
00445                 int (*solve) (rpmts ts, rpmds ds, const void * data),
00446                 const void * solveData)
00447         /*@modifies ts @*/;
00448 
00454 /*@null@*/
00455 rpmps rpmtsProblems(rpmts ts)
00456         /*@modifies ts @*/;
00457 
00462 void rpmtsCleanDig(rpmts ts)
00463         /*@modifies ts @*/;
00464 
00469 void rpmtsClean(rpmts ts)
00470         /*@globals fileSystem, internalState @*/
00471         /*@modifies ts, fileSystem , internalState@*/;
00472 
00477 void rpmtsEmpty(rpmts ts)
00478         /*@globals fileSystem, internalState @*/
00479         /*@modifies ts, fileSystem, internalState @*/;
00480 
00486 /*@null@*/
00487 rpmts rpmtsFree(/*@killref@*/ /*@only@*//*@null@*/ rpmts ts)
00488         /*@globals fileSystem, internalState @*/
00489         /*@modifies ts, fileSystem, internalState @*/;
00490 
00496 rpmVSFlags rpmtsVSFlags(rpmts ts)
00497         /*@*/;
00498 
00505 rpmVSFlags rpmtsSetVSFlags(rpmts ts, rpmVSFlags vsflags)
00506         /*@modifies ts @*/;
00507 
00514 int rpmtsUnorderedSuccessors(rpmts ts, int first)
00515         /*@modifies ts @*/;
00516 
00522 /*@observer@*/ /*@null@*/
00523 extern const char * rpmtsRootDir(rpmts ts)
00524         /*@*/;
00525 
00531 void rpmtsSetRootDir(rpmts ts, /*@null@*/ const char * rootDir)
00532         /*@modifies ts @*/;
00533 
00539 /*@observer@*/ /*@null@*/
00540 extern const char * rpmtsCurrDir(rpmts ts)
00541         /*@*/;
00542 
00548 void rpmtsSetCurrDir(rpmts ts, /*@null@*/ const char * currDir)
00549         /*@modifies ts @*/;
00550 
00556 /*@null@*/
00557 FD_t rpmtsScriptFd(rpmts ts)
00558         /*@*/;
00559 
00565 void rpmtsSetScriptFd(rpmts ts, /*@null@*/ FD_t scriptFd)
00566         /*@modifies ts, scriptFd @*/;
00567 
00573 int rpmtsChrootDone(rpmts ts)
00574         /*@*/;
00575 
00582 int rpmtsSetChrootDone(rpmts ts, int chrootDone)
00583         /*@modifies ts @*/;
00584 
00590 int_32 rpmtsGetTid(rpmts ts)
00591         /*@*/;
00592 
00599 int_32 rpmtsSetTid(rpmts ts, int_32 tid)
00600         /*@modifies ts @*/;
00601 
00607 int_32 rpmtsSigtag(const rpmts ts)
00608         /*@*/;
00609 
00615 int_32 rpmtsSigtype(const rpmts ts)
00616         /*@*/;
00617 
00623 /*@observer@*/ /*@null@*/
00624 extern const void * rpmtsSig(const rpmts ts)
00625         /*@*/;
00626 
00632 int_32 rpmtsSiglen(const rpmts ts)
00633         /*@*/;
00634 
00644 int rpmtsSetSig(rpmts ts,
00645                 int_32 sigtag, int_32 sigtype,
00646                 /*@kept@*/ /*@null@*/ const void * sig, int_32 siglen)
00647         /*@modifies ts @*/;
00648 
00654 /*@exposed@*/ /*@null@*/
00655 pgpDig rpmtsDig(rpmts ts)
00656         /*@*/;
00657 
00663 /*@exposed@*/ /*@null@*/
00664 pgpDigParams rpmtsSignature(const rpmts ts)
00665         /*@*/;
00666 
00672 /*@exposed@*/ /*@null@*/
00673 pgpDigParams rpmtsPubkey(const rpmts ts)
00674         /*@*/;
00675 
00681 /*@null@*/
00682 rpmdb rpmtsGetRdb(rpmts ts)
00683         /*@*/;
00684 
00690 int rpmtsInitDSI(const rpmts ts)
00691         /*@globals fileSystem, internalState @*/
00692         /*@modifies ts, fileSystem, internalState @*/;
00693 
00703 void rpmtsUpdateDSI(const rpmts ts, dev_t dev,
00704                 uint_32 fileSize, uint_32 prevSize, uint_32 fixupSize,
00705                 fileAction action)
00706         /*@modifies ts @*/;
00707 
00713 void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te)
00714         /*@modifies ts @*/;
00715 
00725 /*@null@*/
00726 void * rpmtsNotify(rpmts ts, rpmte te,
00727                 rpmCallbackType what, unsigned long amount, unsigned long total)
00728         /*@*/;
00729 
00735 int rpmtsNElements(rpmts ts)
00736         /*@*/;
00737 
00744 /*@null@*/ /*@dependent@*/
00745 rpmte rpmtsElement(rpmts ts, int ix)
00746         /*@*/;
00747 
00753 rpmprobFilterFlags rpmtsFilterFlags(rpmts ts)
00754         /*@*/;
00755 
00761 rpmtransFlags rpmtsFlags(rpmts ts)
00762         /*@*/;
00763 
00770 rpmtransFlags rpmtsSetFlags(rpmts ts, rpmtransFlags transFlags)
00771         /*@modifies ts @*/;
00772 
00778 /*@null@*/
00779 Spec rpmtsSpec(rpmts ts)
00780         /*@*/;
00781 
00788 /*@null@*/
00789 Spec rpmtsSetSpec(rpmts ts, /*@null@*/ Spec spec)
00790         /*@modifies ts @*/;
00791 
00797 /*@null@*/
00798 rpmte rpmtsRelocateElement(rpmts ts)
00799         /*@*/;
00800 
00807 /*@null@*/
00808 rpmte rpmtsSetRelocateElement(rpmts ts, /*@null@*/ rpmte relocateElement)
00809         /*@modifies ts @*/;
00810 
00816 uint_32 rpmtsColor(rpmts ts)
00817         /*@*/;
00818 
00825 uint_32 rpmtsSetColor(rpmts ts, uint_32 color)
00826         /*@modifies ts @*/;
00827 
00834 /*@null@*/
00835 rpmop rpmtsOp(rpmts ts, rpmtsOpX opx)
00836         /*@*/;
00837 
00849 int rpmtsSetNotifyCallback(rpmts ts,
00850                 /*@observer@*/ rpmCallbackFunction notify,
00851                 /*@observer@*/ rpmCallbackData notifyData)
00852         /*@modifies ts @*/;
00853 
00858 /*@newref@*/
00859 rpmts rpmtsCreate(void)
00860         /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
00861         /*@modifies rpmGlobalMacroContext, internalState @*/;
00862 
00876 int rpmtsAddInstallElement(rpmts ts, Header h,
00877                 /*@exposed@*/ /*@null@*/ const fnpyKey key, int upgrade,
00878                 /*@null@*/ rpmRelocation * relocs)
00879         /*@globals rpmcliPackagesTotal, rpmGlobalMacroContext, h_errno,
00880                 fileSystem, internalState @*/
00881         /*@modifies ts, h, rpmcliPackagesTotal, rpmGlobalMacroContext,
00882                 fileSystem, internalState @*/;
00883 
00891 int rpmtsAddEraseElement(rpmts ts, Header h, int dboffset)
00892         /*@globals fileSystem @*/
00893         /*@modifies ts, h, fileSystem @*/;
00894 
00903 /*@unused@*/
00904 int rpmtsGetKeys(rpmts ts,
00905                 /*@null@*/ /*@out@*/ fnpyKey ** ep,
00906                 /*@null@*/ /*@out@*/ int * nep)
00907         /*@globals fileSystem, internalState @*/
00908         /*@modifies ts, ep, nep, fileSystem, internalState @*/;
00909 
00916 /*@only@*/ char * hGetNEVR(Header h, /*@null@*/ /*@out@*/ const char ** np )
00917         /*@modifies *np @*/;
00918 
00924 uint_32 hGetColor(Header h)
00925         /*@modifies h @*/;
00926 
00927 #ifdef __cplusplus
00928 }
00929 #endif
00930 
00931 #endif  /* H_RPMTS */

Generated on Sun Oct 26 13:02:01 2003 for rpm by doxygen1.2.18