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

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 #include "rpmsx.h"
00012 
00013 /*@-exportlocal@*/
00014 /*@unchecked@*/
00015 extern int _rpmts_debug;
00016 /*@unchecked@*/
00017 extern int _rpmts_stats;
00018 /*@unchecked@*/
00019 extern int _fps_debug;
00020 /*@=exportlocal@*/
00021 
00025 typedef enum rpmVSFlags_e {
00026     RPMVSF_DEFAULT      = 0,
00027     RPMVSF_NOHDRCHK     = (1 <<  0),
00028     RPMVSF_NEEDPAYLOAD  = (1 <<  1),
00029     /* bit(s) 2-7 unused */
00030     RPMVSF_NOSHA1HEADER = (1 <<  8),
00031     RPMVSF_NOMD5HEADER  = (1 <<  9),    /* unimplemented */
00032     RPMVSF_NODSAHEADER  = (1 << 10),
00033     RPMVSF_NORSAHEADER  = (1 << 11),    /* unimplemented */
00034     /* bit(s) 12-15 unused */
00035     RPMVSF_NOSHA1       = (1 << 16),    /* unimplemented */
00036     RPMVSF_NOMD5        = (1 << 17),
00037     RPMVSF_NODSA        = (1 << 18),
00038     RPMVSF_NORSA        = (1 << 19)
00039     /* bit(s) 16-31 unused */
00040 } rpmVSFlags;
00041 
00042 #define _RPMVSF_NODIGESTS       \
00043   ( RPMVSF_NOSHA1HEADER |       \
00044     RPMVSF_NOMD5HEADER |        \
00045     RPMVSF_NOSHA1 |             \
00046     RPMVSF_NOMD5 )
00047 
00048 #define _RPMVSF_NOSIGNATURES    \
00049   ( RPMVSF_NODSAHEADER |        \
00050     RPMVSF_NORSAHEADER |        \
00051     RPMVSF_NODSA |              \
00052     RPMVSF_NORSA )
00053 
00054 #define _RPMVSF_NOHEADER        \
00055   ( RPMVSF_NOSHA1HEADER |       \
00056     RPMVSF_NOMD5HEADER |        \
00057     RPMVSF_NODSAHEADER |        \
00058     RPMVSF_NORSAHEADER )
00059 
00060 #define _RPMVSF_NOPAYLOAD       \
00061   ( RPMVSF_NOSHA1 |             \
00062     RPMVSF_NOMD5 |              \
00063     RPMVSF_NODSA |              \
00064     RPMVSF_NORSA )
00065 
00069 typedef enum rpmtsOpX_e {
00070     RPMTS_OP_TOTAL              =  0,
00071     RPMTS_OP_CHECK              =  1,
00072     RPMTS_OP_ORDER              =  2,
00073     RPMTS_OP_FINGERPRINT        =  3,
00074     RPMTS_OP_REPACKAGE          =  4,
00075     RPMTS_OP_INSTALL            =  5,
00076     RPMTS_OP_ERASE              =  6,
00077     RPMTS_OP_SCRIPTLETS         =  7,
00078     RPMTS_OP_COMPRESS           =  8,
00079     RPMTS_OP_UNCOMPRESS         =  9,
00080     RPMTS_OP_DIGEST             = 10,
00081     RPMTS_OP_SIGNATURE          = 11,
00082     RPMTS_OP_DBADD              = 12,
00083     RPMTS_OP_DBREMOVE           = 13,
00084     RPMTS_OP_DBGET              = 14,
00085     RPMTS_OP_DBPUT              = 15,
00086     RPMTS_OP_DBDEL              = 16,
00087     RPMTS_OP_MAX                = 17
00088 } rpmtsOpX;
00089 
00090 #if defined(_RPMTS_INTERNAL)
00091 
00092 #include "rpmhash.h"    /* XXX hashTable */
00093 #include "rpmal.h"      /* XXX availablePackage/relocateFileList ,*/
00094 
00095 /*@unchecked@*/
00096 /*@-exportlocal@*/
00097 extern int _cacheDependsRC;
00098 /*@=exportlocal@*/
00099 
00102 typedef /*@abstract@*/ struct diskspaceInfo_s * rpmDiskSpaceInfo;
00103 
00106 struct diskspaceInfo_s {
00107     dev_t dev;                  
00108     signed long bneeded;        
00109     signed long ineeded;        
00110     int bsize;                  
00111     signed long long bavail;    
00112     signed long long iavail;    
00113 };
00114 
00118 #define adj_fs_blocks(_nb)      (((_nb) * 21) / 20)
00119 
00120 /* argon thought a shift optimization here was a waste of time...  he's
00121    probably right :-( */
00122 #define BLOCK_ROUND(size, block) (((size) + (block) - 1) / (block))
00123 
00126 typedef enum tsStage_e {
00127     TSM_UNKNOWN         =  0,
00128     TSM_INSTALL         =  7,
00129     TSM_ERASE           =  8,
00130 } tsmStage;
00131 
00135 struct rpmts_s {
00136     rpmtransFlags transFlags;   
00137     tsmStage goal;              
00139 /*@refcounted@*/ /*@null@*/
00140     rpmdb sdb;                  
00141     int sdbmode;                
00142 /*@null@*/
00143     int (*solve) (rpmts ts, rpmds key, const void * data)
00144         /*@modifies ts @*/;     
00145 /*@relnull@*/
00146     const void * solveData;     
00147     int nsuggests;              
00148 /*@only@*/ /*@null@*/
00149     const void ** suggests;     
00151 /*@observer@*/ /*@null@*/
00152     rpmCallbackFunction notify; 
00153 /*@observer@*/ /*@null@*/
00154     rpmCallbackData notifyData; 
00156 /*@refcounted@*/ /*@null@*/
00157     rpmps probs;                
00158     rpmprobFilterFlags ignoreSet;
00161     int filesystemCount;        
00162 /*@dependent@*/ /*@null@*/
00163     const char ** filesystems;  
00164 /*@only@*/ /*@null@*/
00165     rpmDiskSpaceInfo dsi;       
00167 /*@refcounted@*/ /*@null@*/
00168     rpmdb rdb;                  
00169     int dbmode;                 
00170 /*@only@*/
00171     hashTable ht;               
00173 /*@only@*/ /*@null@*/
00174     int * removedPackages;      
00175     int numRemovedPackages;     
00176     int allocedRemovedPackages; 
00178 /*@only@*/
00179     rpmal addedPackages;        
00180     int numAddedPackages;       
00182 #ifndef DYING
00183 /*@only@*/
00184     rpmal availablePackages;    
00185     int numAvailablePackages;   
00186 #endif
00187 
00188 /*@refcounted@*/ /*@null@*/
00189     rpmsx sx;                   
00191 /*@null@*/
00192     rpmte relocateElement;      
00194 /*@owned@*/ /*@relnull@*/
00195     rpmte * order;              
00196     int orderCount;             
00197     int orderAlloced;           
00198     int unorderedSuccessors;    
00200     int selinuxEnabled;         
00201     int chrootDone;             
00202 /*@only@*/ /*@null@*/
00203     const char * rootDir;       
00204 /*@only@*/ /*@null@*/
00205     const char * currDir;       
00206 /*@null@*/
00207     FD_t scriptFd;              
00208     int delta;                  
00209     int_32 tid;                 
00211     uint_32 color;              
00213     rpmVSFlags vsflags;         
00215 /*@observer@*/ /*@dependent@*/ /*@null@*/
00216     const char * fn;            
00217     int_32  sigtag;             
00218     int_32  sigtype;            
00219 /*@null@*/
00220     const void * sig;           
00221     int_32 siglen;              
00223 /*@only@*/ /*@null@*/
00224     const unsigned char * pkpkt;
00225     size_t pkpktlen;            
00226     unsigned char pksignid[8];  
00228     struct rpmop_s ops[RPMTS_OP_MAX];
00229 
00230 /*@null@*/
00231     pgpDig dig;                 
00233 /*@null@*/
00234     Spec spec;                  
00236 /*@refs@*/
00237     int nrefs;                  
00239 };
00240 #endif  /* _RPMTS_INTERNAL */
00241 
00242 #ifdef __cplusplus
00243 extern "C" {
00244 #endif
00245 
00251 int rpmtsCheck(rpmts ts)
00252         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00253         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
00254 
00271 int rpmtsOrder(rpmts ts)
00272         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00273         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
00274 
00283 int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
00284         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00285         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
00286 
00293 /*@unused@*/ /*@null@*/
00294 rpmts rpmtsUnlink (/*@killref@*/ /*@only@*/ rpmts ts,
00295                 const char * msg)
00296         /*@modifies ts @*/;
00297 
00299 /*@-exportlocal@*/
00300 /*@null@*/
00301 rpmts XrpmtsUnlink (/*@killref@*/ /*@only@*/ rpmts ts,
00302                 const char * msg, const char * fn, unsigned ln)
00303         /*@modifies ts @*/;
00304 /*@=exportlocal@*/
00305 #define rpmtsUnlink(_ts, _msg)  XrpmtsUnlink(_ts, _msg, __FILE__, __LINE__)
00306 
00313 /*@unused@*/
00314 rpmts rpmtsLink (rpmts ts, const char * msg)
00315         /*@modifies ts @*/;
00316 
00318 rpmts XrpmtsLink (rpmts ts,
00319                 const char * msg, const char * fn, unsigned ln)
00320         /*@modifies ts @*/;
00321 #define rpmtsLink(_ts, _msg)    XrpmtsLink(_ts, _msg, __FILE__, __LINE__)
00322 
00328 int rpmtsCloseDB(rpmts ts)
00329         /*@globals fileSystem @*/
00330         /*@modifies ts, fileSystem @*/;
00331 
00338 int rpmtsOpenDB(rpmts ts, int dbmode)
00339         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00340         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
00341 
00349 int rpmtsInitDB(rpmts ts, int dbmode)
00350         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00351         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
00352 
00358 int rpmtsRebuildDB(rpmts ts)
00359         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00360         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
00361 
00367 int rpmtsVerifyDB(rpmts ts)
00368         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00369         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
00370 
00379 /*@only@*/ /*@null@*/
00380 rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
00381                         /*@null@*/ const void * keyp, size_t keylen)
00382         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00383         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
00384 
00390 rpmRC rpmtsFindPubkey(rpmts ts)
00391         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00392         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState */;
00393 
00399 /*@-exportlocal@*/
00400 int rpmtsCloseSDB(rpmts ts)
00401         /*@globals fileSystem @*/
00402         /*@modifies ts, fileSystem @*/;
00403 /*@=exportlocal@*/
00404 
00411 /*@-exportlocal@*/
00412 int rpmtsOpenSDB(rpmts ts, int dbmode)
00413         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00414         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
00415 /*@=exportlocal@*/
00416 
00424 /*@-exportlocal@*/
00425 int rpmtsSolve(rpmts ts, rpmds ds, const void * data)
00426         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00427         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
00428 /*@=exportlocal@*/
00429 
00437 /*@unused@*/
00438 int rpmtsAvailable(rpmts ts, const rpmds ds)
00439         /*@globals fileSystem @*/
00440         /*@modifies ts, fileSystem @*/;
00441 
00449 int rpmtsSetSolveCallback(rpmts ts,
00450                 int (*solve) (rpmts ts, rpmds ds, const void * data),
00451                 const void * solveData)
00452         /*@modifies ts @*/;
00453 
00459 /*@null@*/
00460 rpmps rpmtsProblems(rpmts ts)
00461         /*@modifies ts @*/;
00462 
00467 void rpmtsCleanDig(rpmts ts)
00468         /*@modifies ts @*/;
00469 
00474 void rpmtsClean(rpmts ts)
00475         /*@globals fileSystem, internalState @*/
00476         /*@modifies ts, fileSystem , internalState@*/;
00477 
00482 void rpmtsEmpty(rpmts ts)
00483         /*@globals fileSystem, internalState @*/
00484         /*@modifies ts, fileSystem, internalState @*/;
00485 
00491 /*@null@*/
00492 rpmts rpmtsFree(/*@killref@*/ /*@only@*//*@null@*/ rpmts ts)
00493         /*@globals fileSystem, internalState @*/
00494         /*@modifies ts, fileSystem, internalState @*/;
00495 
00501 rpmVSFlags rpmtsVSFlags(rpmts ts)
00502         /*@*/;
00503 
00510 rpmVSFlags rpmtsSetVSFlags(rpmts ts, rpmVSFlags vsflags)
00511         /*@modifies ts @*/;
00512 
00519 int rpmtsUnorderedSuccessors(rpmts ts, int first)
00520         /*@modifies ts @*/;
00521 
00527 /*@observer@*/ /*@null@*/
00528 extern const char * rpmtsRootDir(rpmts ts)
00529         /*@*/;
00530 
00536 void rpmtsSetRootDir(rpmts ts, /*@null@*/ const char * rootDir)
00537         /*@modifies ts @*/;
00538 
00544 /*@observer@*/ /*@null@*/
00545 extern const char * rpmtsCurrDir(rpmts ts)
00546         /*@*/;
00547 
00553 void rpmtsSetCurrDir(rpmts ts, /*@null@*/ const char * currDir)
00554         /*@modifies ts @*/;
00555 
00561 /*@null@*/
00562 FD_t rpmtsScriptFd(rpmts ts)
00563         /*@*/;
00564 
00570 void rpmtsSetScriptFd(rpmts ts, /*@null@*/ FD_t scriptFd)
00571         /*@modifies ts, scriptFd @*/;
00572 
00578 int rpmtsSELinuxEnabled(rpmts ts)
00579         /*@*/;
00580 
00586 int rpmtsChrootDone(rpmts ts)
00587         /*@*/;
00588 
00595 int rpmtsSetChrootDone(rpmts ts, int chrootDone)
00596         /*@modifies ts @*/;
00597 
00603 /*@null@*/
00604 rpmsx rpmtsREContext(const rpmts ts)
00605         /*@modifies ts @*/;
00606 
00613 int rpmtsSetREContext(rpmts ts, rpmsx sx)
00614         /*@modifies ts, sx @*/;
00615 
00621 int_32 rpmtsGetTid(rpmts ts)
00622         /*@*/;
00623 
00630 int_32 rpmtsSetTid(rpmts ts, int_32 tid)
00631         /*@modifies ts @*/;
00632 
00638 int_32 rpmtsSigtag(const rpmts ts)
00639         /*@*/;
00640 
00646 int_32 rpmtsSigtype(const rpmts ts)
00647         /*@*/;
00648 
00654 /*@observer@*/ /*@null@*/
00655 extern const void * rpmtsSig(const rpmts ts)
00656         /*@*/;
00657 
00663 int_32 rpmtsSiglen(const rpmts ts)
00664         /*@*/;
00665 
00675 int rpmtsSetSig(rpmts ts,
00676                 int_32 sigtag, int_32 sigtype,
00677                 /*@kept@*/ /*@null@*/ const void * sig, int_32 siglen)
00678         /*@modifies ts @*/;
00679 
00685 /*@exposed@*/ /*@null@*/
00686 pgpDig rpmtsDig(rpmts ts)
00687         /*@*/;
00688 
00694 /*@exposed@*/ /*@null@*/
00695 pgpDigParams rpmtsSignature(const rpmts ts)
00696         /*@*/;
00697 
00703 /*@exposed@*/ /*@null@*/
00704 pgpDigParams rpmtsPubkey(const rpmts ts)
00705         /*@*/;
00706 
00712 /*@null@*/
00713 rpmdb rpmtsGetRdb(rpmts ts)
00714         /*@*/;
00715 
00721 int rpmtsInitDSI(const rpmts ts)
00722         /*@globals fileSystem, internalState @*/
00723         /*@modifies ts, fileSystem, internalState @*/;
00724 
00734 void rpmtsUpdateDSI(const rpmts ts, dev_t dev,
00735                 uint_32 fileSize, uint_32 prevSize, uint_32 fixupSize,
00736                 fileAction action)
00737         /*@modifies ts @*/;
00738 
00744 void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te)
00745         /*@modifies ts @*/;
00746 
00756 /*@null@*/
00757 void * rpmtsNotify(rpmts ts, rpmte te,
00758                 rpmCallbackType what, unsigned long amount, unsigned long total)
00759         /*@*/;
00760 
00766 int rpmtsNElements(rpmts ts)
00767         /*@*/;
00768 
00775 /*@null@*/ /*@dependent@*/
00776 rpmte rpmtsElement(rpmts ts, int ix)
00777         /*@*/;
00778 
00784 rpmprobFilterFlags rpmtsFilterFlags(rpmts ts)
00785         /*@*/;
00786 
00792 rpmtransFlags rpmtsFlags(rpmts ts)
00793         /*@*/;
00794 
00801 rpmtransFlags rpmtsSetFlags(rpmts ts, rpmtransFlags transFlags)
00802         /*@modifies ts @*/;
00803 
00809 /*@null@*/
00810 Spec rpmtsSpec(rpmts ts)
00811         /*@*/;
00812 
00819 /*@null@*/
00820 Spec rpmtsSetSpec(rpmts ts, /*@null@*/ Spec spec)
00821         /*@modifies ts @*/;
00822 
00828 /*@null@*/
00829 rpmte rpmtsRelocateElement(rpmts ts)
00830         /*@*/;
00831 
00838 /*@null@*/
00839 rpmte rpmtsSetRelocateElement(rpmts ts, /*@null@*/ rpmte relocateElement)
00840         /*@modifies ts @*/;
00841 
00847 uint_32 rpmtsColor(rpmts ts)
00848         /*@*/;
00849 
00856 uint_32 rpmtsSetColor(rpmts ts, uint_32 color)
00857         /*@modifies ts @*/;
00858 
00865 /*@null@*/
00866 rpmop rpmtsOp(rpmts ts, rpmtsOpX opx)
00867         /*@*/;
00868 
00880 int rpmtsSetNotifyCallback(rpmts ts,
00881                 /*@observer@*/ rpmCallbackFunction notify,
00882                 /*@observer@*/ rpmCallbackData notifyData)
00883         /*@modifies ts @*/;
00884 
00889 /*@newref@*/
00890 rpmts rpmtsCreate(void)
00891         /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
00892         /*@modifies rpmGlobalMacroContext, internalState @*/;
00893 
00907 int rpmtsAddInstallElement(rpmts ts, Header h,
00908                 /*@exposed@*/ /*@null@*/ const fnpyKey key, int upgrade,
00909                 /*@null@*/ rpmRelocation * relocs)
00910         /*@globals rpmcliPackagesTotal, rpmGlobalMacroContext, h_errno,
00911                 fileSystem, internalState @*/
00912         /*@modifies ts, h, rpmcliPackagesTotal, rpmGlobalMacroContext,
00913                 fileSystem, internalState @*/;
00914 
00922 int rpmtsAddEraseElement(rpmts ts, Header h, int dboffset)
00923         /*@globals rpmGlobalMacroContext, h_errno, fileSystem @*/
00924         /*@modifies ts, h, rpmGlobalMacroContext, fileSystem @*/;
00925 
00934 /*@unused@*/
00935 int rpmtsGetKeys(rpmts ts,
00936                 /*@null@*/ /*@out@*/ fnpyKey ** ep,
00937                 /*@null@*/ /*@out@*/ int * nep)
00938         /*@globals fileSystem, internalState @*/
00939         /*@modifies ts, ep, nep, fileSystem, internalState @*/;
00940 
00947 /*@only@*/ char * hGetNEVR(Header h, /*@null@*/ /*@out@*/ const char ** np )
00948         /*@modifies *np @*/;
00949 
00956 /*@only@*/ char * hGetNEVRA(Header h, /*@null@*/ /*@out@*/ const char ** np )
00957         /*@modifies *np @*/;
00958 
00964 uint_32 hGetColor(Header h)
00965         /*@modifies h @*/;
00966 
00967 #ifdef __cplusplus
00968 }
00969 #endif
00970 
00971 #endif  /* H_RPMTS */

Generated on Sat Aug 12 17:01:17 2006 for rpm by  doxygen 1.3.9.1