lib/rpmlib.h

Go to the documentation of this file.
00001 #ifndef H_RPMLIB
00002 #define H_RPMLIB
00003 
00011 #include "rpmio.h"
00012 #include "rpmmessages.h"
00013 #include "rpmerr.h"
00014 #include "header.h"
00015 #include "popt.h"
00016 
00020 typedef enum rpmRC_e {
00021     RPMRC_OK            = 0,    
00022     RPMRC_NOTFOUND      = 1,    
00023     RPMRC_FAIL          = 2,    
00024     RPMRC_NOTTRUSTED    = 3,    
00025     RPMRC_NOKEY         = 4     
00026 } rpmRC;
00027 
00028 /*@-redecl@*/
00029 /*@checked@*/
00030 extern struct MacroContext_s * rpmGlobalMacroContext;
00031 
00032 /*@checked@*/
00033 extern struct MacroContext_s * rpmCLIMacroContext;
00034 
00035 /*@unchecked@*/ /*@observer@*/
00036 extern const char * RPMVERSION;
00037 
00038 /*@unchecked@*/ /*@observer@*/
00039 extern const char * rpmNAME;
00040 
00041 /*@unchecked@*/ /*@observer@*/
00042 extern const char * rpmEVR;
00043 
00044 /*@unchecked@*/
00045 extern int rpmFLAGS;
00046 /*@=redecl@*/
00047 
00048 #ifdef __cplusplus
00049 extern "C" {
00050 #endif
00051 
00057 /*@unused@*/ static inline /*@null@*/
00058 void * _free(/*@only@*/ /*@null@*/ /*@out@*/ const void * p)
00059         /*@modifies p @*/
00060 {
00061     if (p != NULL)      free((void *)p);
00062     return NULL;
00063 }
00064 
00071 typedef /*@abstract@*/ /*@refcounted@*/ struct rpmts_s * rpmts;
00072 
00075 typedef struct Spec_s * Spec;
00076 
00080 typedef /*@abstract@*/ void * alKey;
00081 #define RPMAL_NOMATCH   ((alKey)-1L)
00082 
00086 /*@-mutrep@*/
00087 typedef /*@abstract@*/ int alNum;
00088 /*@=mutrep@*/
00089 
00093 typedef /*@abstract@*/ /*@refcounted@*/ struct rpmds_s * rpmds;
00094 
00098 typedef /*@abstract@*/ /*@refcounted@*/ struct rpmfi_s * rpmfi;
00099 
00103 typedef /*@abstract@*/ struct rpmte_s * rpmte;
00104 
00108 typedef /*@abstract@*/ /*@refcounted@*/ struct rpmdb_s * rpmdb;
00109 
00113 typedef /*@abstract@*/ struct _rpmdbMatchIterator * rpmdbMatchIterator;
00114 
00118 typedef /*@abstract@*/ /*@refcounted@*/ struct rpmgi_s * rpmgi;
00119 
00128 int headerNVR(Header h,
00129                 /*@null@*/ /*@out@*/ const char ** np,
00130                 /*@null@*/ /*@out@*/ const char ** vp,
00131                 /*@null@*/ /*@out@*/ const char ** rp)
00132         /*@modifies *np, *vp, *rp @*/;
00133 
00144 int headerNEVRA(Header h,
00145                 /*@null@*/ /*@out@*/ const char ** np,
00146                 /*@null@*/ /*@out@*/ /*@unused@*/ const char ** ep,
00147                 /*@null@*/ /*@out@*/ const char ** vp,
00148                 /*@null@*/ /*@out@*/ const char ** rp,
00149                 /*@null@*/ /*@out@*/ const char ** ap)
00150         /*@modifies *np, *vp, *rp, *ap @*/;
00151 
00158 void headerMergeLegacySigs(Header h, const Header sigh)
00159         /*@modifies h, sigh @*/;
00160 
00168 Header headerRegenSigHeader(const Header h, int noArchiveSize)
00169         /*@modifies h @*/;
00170 
00184 /*@unused@*/
00185 int rpmHeaderGetEntry(Header h, int_32 tag, /*@out@*/ int_32 *type,
00186                 /*@out@*/ void **p, /*@out@*/ int_32 *c)
00187         /*@modifies *type, *p, *c @*/;
00188 
00192 /*@-redecl@*/
00193 /*@observer@*/ /*@unchecked@*/
00194 extern const struct headerTagTableEntry_s * rpmTagTable;
00195 /*@=redecl@*/
00196 
00200 /*@-redecl@*/
00201 /*@unchecked@*/
00202 extern const int rpmTagTableSize;
00203 /*@=redecl@*/
00204 
00209 /*@-redecl@*/
00210 /*@unchecked@*/
00211 extern const struct headerSprintfExtension_s rpmHeaderFormats[];
00212 /*@=redecl@*/
00213 
00217 #define RPMDBI_PACKAGES         0       /* Installed package headers. */
00218 #define RPMDBI_DEPENDS          1       /* Dependency resolution cache. */
00219 #define RPMDBI_LABEL            2       /* Fingerprint search marker. */
00220 #define RPMDBI_ADDED            3       /* Added package headers. */
00221 #define RPMDBI_REMOVED          4       /* Removed package headers. */
00222 #define RPMDBI_AVAILABLE        5       /* Available package headers. */
00223 #define RPMDBI_HDLIST           6       /* (rpmgi) Header list. */
00224 #define RPMDBI_ARGLIST          7       /* (rpmgi) Argument list. */
00225 #define RPMDBI_FTSWALK          8       /* (rpmgi) File tree  walk. */
00226 
00232 typedef enum rpmTag_e {
00233 
00234     RPMTAG_HEADERIMAGE          = HEADER_IMAGE,         
00235     RPMTAG_HEADERSIGNATURES     = HEADER_SIGNATURES,    
00236     RPMTAG_HEADERIMMUTABLE      = HEADER_IMMUTABLE,     
00237 /*@-enummemuse@*/
00238     RPMTAG_HEADERREGIONS        = HEADER_REGIONS,       
00240     RPMTAG_HEADERI18NTABLE      = HEADER_I18NTABLE, 
00241 /*@=enummemuse@*/
00242 
00243 /* Retrofit (and uniqify) signature tags for use by tagName() and rpmQuery. */
00244 /* the md5 sum was broken *twice* on big endian machines */
00245 /* XXX 2nd underscore prevents tagTable generation */
00246     RPMTAG_SIG_BASE             = HEADER_SIGBASE,
00247     RPMTAG_SIGSIZE              = RPMTAG_SIG_BASE+1,    /* i */
00248     RPMTAG_SIGLEMD5_1           = RPMTAG_SIG_BASE+2,    
00249     RPMTAG_SIGPGP               = RPMTAG_SIG_BASE+3,    /* x */
00250     RPMTAG_SIGLEMD5_2           = RPMTAG_SIG_BASE+4,    
00251     RPMTAG_SIGMD5               = RPMTAG_SIG_BASE+5,    /* x */
00252 #define RPMTAG_PKGID    RPMTAG_SIGMD5                   /* x */
00253     RPMTAG_SIGGPG               = RPMTAG_SIG_BASE+6,    /* x */
00254     RPMTAG_SIGPGP5              = RPMTAG_SIG_BASE+7,    
00256     RPMTAG_BADSHA1_1            = RPMTAG_SIG_BASE+8,    
00257     RPMTAG_BADSHA1_2            = RPMTAG_SIG_BASE+9,    
00258     RPMTAG_PUBKEYS              = RPMTAG_SIG_BASE+10,   /* s[] */
00259     RPMTAG_DSAHEADER            = RPMTAG_SIG_BASE+11,   /* x */
00260     RPMTAG_RSAHEADER            = RPMTAG_SIG_BASE+12,   /* x */
00261     RPMTAG_SHA1HEADER           = RPMTAG_SIG_BASE+13,   /* s */
00262 #define RPMTAG_HDRID    RPMTAG_SHA1HEADER       /* s */
00263 
00264     RPMTAG_NAME                 = 1000, /* s */
00265 #define RPMTAG_N        RPMTAG_NAME     /* s */
00266     RPMTAG_VERSION              = 1001, /* s */
00267 #define RPMTAG_V        RPMTAG_VERSION  /* s */
00268     RPMTAG_RELEASE              = 1002, /* s */
00269 #define RPMTAG_R        RPMTAG_RELEASE  /* s */
00270     RPMTAG_EPOCH                = 1003, /* i */
00271 #define RPMTAG_E        RPMTAG_EPOCH    /* i */
00272 #define RPMTAG_SERIAL   RPMTAG_EPOCH    /* i backward comaptibility */
00273     RPMTAG_SUMMARY              = 1004, /* s{} */
00274     RPMTAG_DESCRIPTION          = 1005, /* s{} */
00275     RPMTAG_BUILDTIME            = 1006, /* i */
00276     RPMTAG_BUILDHOST            = 1007, /* s */
00277     RPMTAG_INSTALLTIME          = 1008, /* i */
00278     RPMTAG_SIZE                 = 1009, /* i */
00279     RPMTAG_DISTRIBUTION         = 1010, /* s */
00280     RPMTAG_VENDOR               = 1011, /* s */
00281     RPMTAG_GIF                  = 1012, /* x */
00282     RPMTAG_XPM                  = 1013, /* x */
00283     RPMTAG_LICENSE              = 1014, /* s */
00284 #define RPMTAG_COPYRIGHT RPMTAG_LICENSE /* s backward comaptibility */
00285     RPMTAG_PACKAGER             = 1015, /* s */
00286     RPMTAG_GROUP                = 1016, /* s{} */
00287 /*@-enummemuse@*/
00288     RPMTAG_CHANGELOG            = 1017, 
00289 /*@=enummemuse@*/
00290     RPMTAG_SOURCE               = 1018, /* s[] */
00291     RPMTAG_PATCH                = 1019, /* s[] */
00292     RPMTAG_URL                  = 1020, /* s */
00293     RPMTAG_OS                   = 1021, /* s legacy used int */
00294     RPMTAG_ARCH                 = 1022, /* s legacy used int */
00295     RPMTAG_PREIN                = 1023, /* s */
00296     RPMTAG_POSTIN               = 1024, /* s */
00297     RPMTAG_PREUN                = 1025, /* s */
00298     RPMTAG_POSTUN               = 1026, /* s */
00299     RPMTAG_OLDFILENAMES         = 1027, /* s[] obsolete */
00300     RPMTAG_FILESIZES            = 1028, /* i */
00301     RPMTAG_FILESTATES           = 1029, /* c */
00302     RPMTAG_FILEMODES            = 1030, /* h */
00303     RPMTAG_FILEUIDS             = 1031, 
00304     RPMTAG_FILEGIDS             = 1032, 
00305     RPMTAG_FILERDEVS            = 1033, /* h */
00306     RPMTAG_FILEMTIMES           = 1034, /* i */
00307     RPMTAG_FILEMD5S             = 1035, /* s[] */
00308     RPMTAG_FILELINKTOS          = 1036, /* s[] */
00309     RPMTAG_FILEFLAGS            = 1037, /* i */
00310 /*@-enummemuse@*/
00311     RPMTAG_ROOT                 = 1038, 
00312 /*@=enummemuse@*/
00313     RPMTAG_FILEUSERNAME         = 1039, /* s[] */
00314     RPMTAG_FILEGROUPNAME        = 1040, /* s[] */
00315 /*@-enummemuse@*/
00316     RPMTAG_EXCLUDE              = 1041, 
00317     RPMTAG_EXCLUSIVE            = 1042, 
00318 /*@=enummemuse@*/
00319     RPMTAG_ICON                 = 1043,
00320     RPMTAG_SOURCERPM            = 1044, /* s */
00321     RPMTAG_FILEVERIFYFLAGS      = 1045, /* i */
00322     RPMTAG_ARCHIVESIZE          = 1046, /* i */
00323     RPMTAG_PROVIDENAME          = 1047, /* s[] */
00324 #define RPMTAG_PROVIDES RPMTAG_PROVIDENAME      /* s[] */
00325 #define RPMTAG_P        RPMTAG_PROVIDENAME      /* s[] */
00326     RPMTAG_REQUIREFLAGS         = 1048, /* i */
00327     RPMTAG_REQUIRENAME          = 1049, /* s[] */
00328 #define RPMTAG_REQUIRES RPMTAG_REQUIRENAME      /* s[] */
00329 #define RPMTAG_D        RPMTAG_REQUIRENAME      /* s[] */
00330     RPMTAG_REQUIREVERSION       = 1050, /* s[] */
00331     RPMTAG_NOSOURCE             = 1051, 
00332     RPMTAG_NOPATCH              = 1052, 
00333     RPMTAG_CONFLICTFLAGS        = 1053, /* i */
00334     RPMTAG_CONFLICTNAME         = 1054, /* s[] */
00335 #define RPMTAG_CONFLICTS RPMTAG_CONFLICTNAME    /* s[] */
00336 #define RPMTAG_C        RPMTAG_CONFLICTNAME     /* s[] */
00337     RPMTAG_CONFLICTVERSION      = 1055, /* s[] */
00338     RPMTAG_DEFAULTPREFIX        = 1056, 
00339     RPMTAG_BUILDROOT            = 1057, 
00340     RPMTAG_INSTALLPREFIX        = 1058, 
00341     RPMTAG_EXCLUDEARCH          = 1059,
00342     RPMTAG_EXCLUDEOS            = 1060,
00343     RPMTAG_EXCLUSIVEARCH        = 1061,
00344     RPMTAG_EXCLUSIVEOS          = 1062,
00345     RPMTAG_AUTOREQPROV          = 1063, 
00346     RPMTAG_RPMVERSION           = 1064, /* s */
00347     RPMTAG_TRIGGERSCRIPTS       = 1065, /* s[] */
00348     RPMTAG_TRIGGERNAME          = 1066, /* s[] */
00349     RPMTAG_TRIGGERVERSION       = 1067, /* s[] */
00350     RPMTAG_TRIGGERFLAGS         = 1068, /* i */
00351     RPMTAG_TRIGGERINDEX         = 1069, /* i */
00352     RPMTAG_VERIFYSCRIPT         = 1079, /* s */
00353     RPMTAG_CHANGELOGTIME        = 1080, /* i */
00354     RPMTAG_CHANGELOGNAME        = 1081, /* s[] */
00355     RPMTAG_CHANGELOGTEXT        = 1082, /* s[] */
00356 /*@-enummemuse@*/
00357     RPMTAG_BROKENMD5            = 1083, 
00358 /*@=enummemuse@*/
00359     RPMTAG_PREREQ               = 1084, 
00360     RPMTAG_PREINPROG            = 1085, /* s */
00361     RPMTAG_POSTINPROG           = 1086, /* s */
00362     RPMTAG_PREUNPROG            = 1087, /* s */
00363     RPMTAG_POSTUNPROG           = 1088, /* s */
00364     RPMTAG_BUILDARCHS           = 1089,
00365     RPMTAG_OBSOLETENAME         = 1090, /* s[] */
00366 #define RPMTAG_OBSOLETES RPMTAG_OBSOLETENAME    /* s[] */
00367 #define RPMTAG_O        RPMTAG_OBSOLETENAME     /* s[] */
00368     RPMTAG_VERIFYSCRIPTPROG     = 1091, /* s */
00369     RPMTAG_TRIGGERSCRIPTPROG    = 1092, /* s */
00370     RPMTAG_DOCDIR               = 1093, 
00371     RPMTAG_COOKIE               = 1094, /* s */
00372     RPMTAG_FILEDEVICES          = 1095, /* i */
00373     RPMTAG_FILEINODES           = 1096, /* i */
00374     RPMTAG_FILELANGS            = 1097, /* s[] */
00375     RPMTAG_PREFIXES             = 1098, /* s[] */
00376     RPMTAG_INSTPREFIXES         = 1099, /* s[] */
00377     RPMTAG_TRIGGERIN            = 1100, 
00378     RPMTAG_TRIGGERUN            = 1101, 
00379     RPMTAG_TRIGGERPOSTUN        = 1102, 
00380     RPMTAG_AUTOREQ              = 1103, 
00381     RPMTAG_AUTOPROV             = 1104, 
00382 /*@-enummemuse@*/
00383     RPMTAG_CAPABILITY           = 1105, 
00384 /*@=enummemuse@*/
00385     RPMTAG_SOURCEPACKAGE        = 1106, 
00386 /*@-enummemuse@*/
00387     RPMTAG_OLDORIGFILENAMES     = 1107, 
00388 /*@=enummemuse@*/
00389     RPMTAG_BUILDPREREQ          = 1108, 
00390     RPMTAG_BUILDREQUIRES        = 1109, 
00391     RPMTAG_BUILDCONFLICTS       = 1110, 
00392 /*@-enummemuse@*/
00393     RPMTAG_BUILDMACROS          = 1111, 
00394 /*@=enummemuse@*/
00395     RPMTAG_PROVIDEFLAGS         = 1112, /* i */
00396     RPMTAG_PROVIDEVERSION       = 1113, /* s[] */
00397     RPMTAG_OBSOLETEFLAGS        = 1114, /* i */
00398     RPMTAG_OBSOLETEVERSION      = 1115, /* s[] */
00399     RPMTAG_DIRINDEXES           = 1116, /* i */
00400     RPMTAG_BASENAMES            = 1117, /* s[] */
00401     RPMTAG_DIRNAMES             = 1118, /* s[] */
00402     RPMTAG_ORIGDIRINDEXES       = 1119, 
00403     RPMTAG_ORIGBASENAMES        = 1120, 
00404     RPMTAG_ORIGDIRNAMES         = 1121, 
00405     RPMTAG_OPTFLAGS             = 1122, /* s */
00406     RPMTAG_DISTURL              = 1123, /* s */
00407     RPMTAG_PAYLOADFORMAT        = 1124, /* s */
00408     RPMTAG_PAYLOADCOMPRESSOR    = 1125, /* s */
00409     RPMTAG_PAYLOADFLAGS         = 1126, /* s */
00410     RPMTAG_INSTALLCOLOR         = 1127, 
00411     RPMTAG_INSTALLTID           = 1128, /* i */
00412     RPMTAG_REMOVETID            = 1129, /* i */
00413 /*@-enummemuse@*/
00414     RPMTAG_SHA1RHN              = 1130, 
00415 /*@=enummemuse@*/
00416     RPMTAG_RHNPLATFORM          = 1131, /* s */
00417     RPMTAG_PLATFORM             = 1132, /* s */
00418     RPMTAG_PATCHESNAME          = 1133, 
00419     RPMTAG_PATCHESFLAGS         = 1134, 
00420     RPMTAG_PATCHESVERSION       = 1135, 
00421     RPMTAG_CACHECTIME           = 1136, /* i */
00422     RPMTAG_CACHEPKGPATH         = 1137, /* s */
00423     RPMTAG_CACHEPKGSIZE         = 1138, /* i */
00424     RPMTAG_CACHEPKGMTIME        = 1139, /* i */
00425     RPMTAG_FILECOLORS           = 1140, /* i */
00426     RPMTAG_FILECLASS            = 1141, /* i */
00427     RPMTAG_CLASSDICT            = 1142, /* s[] */
00428     RPMTAG_FILEDEPENDSX         = 1143, /* i */
00429     RPMTAG_FILEDEPENDSN         = 1144, /* i */
00430     RPMTAG_DEPENDSDICT          = 1145, /* i */
00431     RPMTAG_SOURCEPKGID          = 1146, /* x */
00432     RPMTAG_FILECONTEXTS         = 1147, /* s[] */
00433     RPMTAG_FSCONTEXTS           = 1148, 
00434     RPMTAG_RECONTEXTS           = 1149, 
00435     RPMTAG_POLICIES             = 1150, 
00436     RPMTAG_PRETRANS             = 1151, /* s */
00437     RPMTAG_POSTTRANS            = 1152, /* s */
00438     RPMTAG_PRETRANSPROG         = 1153, /* s */
00439     RPMTAG_POSTTRANSPROG        = 1154, /* s */
00440     RPMTAG_DISTTAG              = 1155, /* s */
00441     RPMTAG_SUGGESTSNAME         = 1156, /* s[] extension placeholder */
00442     RPMTAG_SUGGESTSVERSION      = 1157, /* s[] extension placeholder */
00443     RPMTAG_SUGGESTSFLAGS        = 1158, /* i   extension placeholder */
00444     RPMTAG_ENHANCESNAME         = 1159, /* s[] extension placeholder */
00445     RPMTAG_ENHANCESVERSION      = 1160, /* s[] extension placeholder */
00446     RPMTAG_ENHANCESFLAGS        = 1161, /* i   extension placeholder */
00447     RPMTAG_PRIORITY             = 1162, /* i   extension placeholder */
00448     RPMTAG_CVSID                = 1163, /* s */
00449 #define RPMTAG_SVNID    RPMTAG_CVSID    /* s */
00450 
00451 /*@-enummemuse@*/
00452     RPMTAG_FIRSTFREE_TAG        
00453 /*@=enummemuse@*/
00454 } rpmTag;
00455 
00456 #define RPMTAG_EXTERNAL_TAG             1000000
00457 
00461 typedef enum rpmfileState_e {
00462     RPMFILE_STATE_NORMAL        = 0,
00463     RPMFILE_STATE_REPLACED      = 1,
00464     RPMFILE_STATE_NOTINSTALLED  = 2,
00465     RPMFILE_STATE_NETSHARED     = 3,
00466     RPMFILE_STATE_WRONGCOLOR    = 4
00467 } rpmfileState;
00468 #define RPMFILE_STATE_MISSING   -1      /* XXX used for unavailable data */
00469 
00473 typedef enum rpmfileAttrs_e {
00474 /*@-enummemuse@*/
00475     RPMFILE_NONE        = 0,
00476 /*@=enummemuse@*/
00477     RPMFILE_CONFIG      = (1 <<  0),    
00478     RPMFILE_DOC         = (1 <<  1),    
00479     RPMFILE_ICON        = (1 <<  2),    
00480     RPMFILE_MISSINGOK   = (1 <<  3),    
00481     RPMFILE_NOREPLACE   = (1 <<  4),    
00482     RPMFILE_SPECFILE    = (1 <<  5),    
00483     RPMFILE_GHOST       = (1 <<  6),    
00484     RPMFILE_LICENSE     = (1 <<  7),    
00485     RPMFILE_README      = (1 <<  8),    
00486     RPMFILE_EXCLUDE     = (1 <<  9),    
00487     RPMFILE_UNPATCHED   = (1 << 10),    
00488     RPMFILE_PUBKEY      = (1 << 11),    
00489     RPMFILE_POLICY      = (1 << 12)     
00490 } rpmfileAttrs;
00491 
00492 #define RPMFILE_ALL     ~(RPMFILE_NONE)
00493 
00497 typedef enum rpmsenseFlags_e {
00498     RPMSENSE_ANY        = 0,
00499 /*@-enummemuse@*/
00500     RPMSENSE_SERIAL     = (1 << 0),     
00501 /*@=enummemuse@*/
00502     RPMSENSE_LESS       = (1 << 1),
00503     RPMSENSE_GREATER    = (1 << 2),
00504     RPMSENSE_EQUAL      = (1 << 3),
00505     RPMSENSE_PROVIDES   = (1 << 4), /* only used internally by builds */
00506     RPMSENSE_CONFLICTS  = (1 << 5), /* only used internally by builds */
00507     RPMSENSE_PREREQ     = (1 << 6),     
00508     RPMSENSE_OBSOLETES  = (1 << 7), /* only used internally by builds */
00509     RPMSENSE_INTERP     = (1 << 8),     
00510     RPMSENSE_SCRIPT_PRE = ((1 << 9)|RPMSENSE_PREREQ), 
00511     RPMSENSE_SCRIPT_POST = ((1 << 10)|RPMSENSE_PREREQ), 
00512     RPMSENSE_SCRIPT_PREUN = ((1 << 11)|RPMSENSE_PREREQ), 
00513     RPMSENSE_SCRIPT_POSTUN = ((1 << 12)|RPMSENSE_PREREQ), 
00514     RPMSENSE_SCRIPT_VERIFY = (1 << 13), 
00515     RPMSENSE_FIND_REQUIRES = (1 << 14), 
00516     RPMSENSE_FIND_PROVIDES = (1 << 15), 
00518     RPMSENSE_TRIGGERIN  = (1 << 16),    
00519     RPMSENSE_TRIGGERUN  = (1 << 17),    
00520     RPMSENSE_TRIGGERPOSTUN = (1 << 18), 
00521     RPMSENSE_MISSINGOK  = (1 << 19),    
00522     RPMSENSE_SCRIPT_PREP = (1 << 20),   
00523     RPMSENSE_SCRIPT_BUILD = (1 << 21),  
00524     RPMSENSE_SCRIPT_INSTALL = (1 << 22),
00525     RPMSENSE_SCRIPT_CLEAN = (1 << 23),  
00526     RPMSENSE_RPMLIB = ((1 << 24) | RPMSENSE_PREREQ), 
00527 /*@-enummemuse@*/
00528     RPMSENSE_TRIGGERPREIN = (1 << 25),  
00529 /*@=enummemuse@*/
00530     RPMSENSE_KEYRING    = (1 << 26),
00531     RPMSENSE_PATCHES    = (1 << 27),
00532     RPMSENSE_CONFIG     = (1 << 28)
00533 } rpmsenseFlags;
00534 
00535 #define RPMSENSE_SENSEMASK      15       /* Mask to get senses, ie serial, */
00536                                          /* less, greater, equal.          */
00537 
00538 #define RPMSENSE_TRIGGER        \
00539         (RPMSENSE_TRIGGERIN | RPMSENSE_TRIGGERUN | RPMSENSE_TRIGGERPOSTUN)
00540 
00541 #define _ALL_REQUIRES_MASK      (\
00542     RPMSENSE_INTERP | \
00543     RPMSENSE_SCRIPT_PRE | \
00544     RPMSENSE_SCRIPT_POST | \
00545     RPMSENSE_SCRIPT_PREUN | \
00546     RPMSENSE_SCRIPT_POSTUN | \
00547     RPMSENSE_SCRIPT_VERIFY | \
00548     RPMSENSE_FIND_REQUIRES | \
00549     RPMSENSE_SCRIPT_PREP | \
00550     RPMSENSE_SCRIPT_BUILD | \
00551     RPMSENSE_SCRIPT_INSTALL | \
00552     RPMSENSE_SCRIPT_CLEAN | \
00553     RPMSENSE_RPMLIB | \
00554     RPMSENSE_KEYRING )
00555 
00556 #define _notpre(_x)             ((_x) & ~RPMSENSE_PREREQ)
00557 #define _INSTALL_ONLY_MASK \
00558     _notpre(RPMSENSE_SCRIPT_PRE|RPMSENSE_SCRIPT_POST|RPMSENSE_RPMLIB|RPMSENSE_KEYRING)
00559 #define _ERASE_ONLY_MASK  \
00560     _notpre(RPMSENSE_SCRIPT_PREUN|RPMSENSE_SCRIPT_POSTUN)
00561 
00562 #define isLegacyPreReq(_x)  (((_x) & _ALL_REQUIRES_MASK) == RPMSENSE_PREREQ)
00563 #define isInstallPreReq(_x)     ((_x) & _INSTALL_ONLY_MASK)
00564 #define isErasePreReq(_x)       ((_x) & _ERASE_ONLY_MASK)
00565 
00566 /* ==================================================================== */
00569 
00570 /* Stuff for maintaining "variables" like SOURCEDIR, BUILDDIR, etc */
00571 #define RPMVAR_OPTFLAGS                 3
00572 #define RPMVAR_PROVIDES                 38
00573 #define RPMVAR_INCLUDE                  43
00574 #define RPMVAR_MACROFILES               49
00575 
00576 #define RPMVAR_NUM                      55      /* number of RPMVAR entries */
00577 
00583 /*@-redecl@*/
00584 /*@observer@*/ /*@null@*/ extern const char * rpmGetVar(int var)
00585         /*@*/;
00586 /*@=redecl@*/
00587 
00593 void rpmSetVar(int var, const char * val)
00594         /*@globals internalState@*/
00595         /*@modifies internalState @*/;
00596 
00601 enum rpm_machtable_e {
00602     RPM_MACHTABLE_INSTARCH      = 0,    
00603     RPM_MACHTABLE_INSTOS        = 1,    
00604     RPM_MACHTABLE_BUILDARCH     = 2,    
00605     RPM_MACHTABLE_BUILDOS       = 3     
00606 };
00607 #define RPM_MACHTABLE_COUNT     4       
00615 int rpmReadConfigFiles(/*@null@*/ const char * file,
00616                 /*@null@*/ const char * target)
00617         /*@globals rpmGlobalMacroContext, rpmCLIMacroContext, h_errno,
00618                 fileSystem, internalState @*/
00619         /*@modifies rpmGlobalMacroContext, rpmCLIMacroContext,
00620                 fileSystem, internalState @*/;
00621 
00628 void rpmGetArchInfo( /*@null@*/ /*@out@*/ const char ** name,
00629                 /*@null@*/ /*@out@*/ int * num)
00630         /*@modifies *name, *num @*/;
00631 
00638 void rpmGetOsInfo( /*@null@*/ /*@out@*/ const char ** name,
00639                 /*@null@*/ /*@out@*/ int * num)
00640         /*@modifies *name, *num @*/;
00641 
00655 int rpmMachineScore(int type, const char * name)
00656         /*@*/;
00657 
00663 int rpmShowRC(FILE * fp)
00664         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00665         /*@modifies *fp, rpmGlobalMacroContext, fileSystem, internalState  @*/;
00666 
00674 void rpmSetTables(int archTable, int osTable)
00675         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00676         /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
00677 
00688 void rpmSetMachine(/*@null@*/ const char * arch, /*@null@*/ const char * os)
00689         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00690         /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
00691 
00700 /*@unused@*/
00701 void rpmGetMachine( /*@null@*/ /*@out@*/ const char **arch,
00702                 /*@null@*/ /*@out@*/ const char **os)
00703         /*@modifies *arch, *os @*/;
00704 
00709 void rpmFreeRpmrc(void)
00710         /*@globals internalState @*/
00711         /*@modifies internalState @*/;
00712 
00714 /* ==================================================================== */
00724 typedef /*@null@*/
00725     void * (*HFD_t) (/*@only@*/ /*@null@*/ const void * data, rpmTagType type)
00726         /*@modifies data @*/;
00727 
00742 typedef int (*HGE_t) (Header h, rpmTag tag,
00743                         /*@null@*/ /*@out@*/ rpmTagType * type,
00744                         /*@null@*/ /*@out@*/ void ** p,
00745                         /*@null@*/ /*@out@*/ int_32 * c)
00746         /*@modifies *type, *p, *c @*/;
00747 
00763 typedef int (*HAE_t) (Header h, rpmTag tag, rpmTagType type,
00764                         const void * p, int_32 c)
00765         /*@modifies h @*/;
00766 
00778 typedef int (*HME_t) (Header h, rpmTag tag, rpmTagType type,
00779                         const void * p, int_32 c)
00780         /*@modifies h @*/;
00781 
00792 typedef int (*HRE_t) (Header h, int_32 tag)
00793         /*@modifies h @*/;
00794 
00798 typedef enum rpmprobFilterFlags_e {
00799     RPMPROB_FILTER_NONE         = 0,
00800     RPMPROB_FILTER_IGNOREOS     = (1 << 0),     
00801     RPMPROB_FILTER_IGNOREARCH   = (1 << 1),     
00802     RPMPROB_FILTER_REPLACEPKG   = (1 << 2),     
00803     RPMPROB_FILTER_FORCERELOCATE= (1 << 3),     
00804     RPMPROB_FILTER_REPLACENEWFILES= (1 << 4),   
00805     RPMPROB_FILTER_REPLACEOLDFILES= (1 << 5),   
00806     RPMPROB_FILTER_OLDPACKAGE   = (1 << 6),     
00807     RPMPROB_FILTER_DISKSPACE    = (1 << 7),     
00808     RPMPROB_FILTER_DISKNODES    = (1 << 8)      
00809 } rpmprobFilterFlags;
00810 
00814 typedef struct rpmRelocation_s {
00815 /*@only@*/ /*@null@*/
00816     const char * oldPath;       
00817 /*@only@*/ /*@null@*/
00818     const char * newPath;       
00819 } rpmRelocation;
00820 
00827 int rpmVersionCompare(Header first, Header second)
00828         /*@*/;
00829 
00833 typedef enum fileAction_e {
00834     FA_UNKNOWN = 0,     
00835     FA_CREATE,          
00836     FA_COPYIN,          
00837     FA_COPYOUT,         
00838     FA_BACKUP,          
00839     FA_SAVE,            
00840     FA_SKIP,            
00841     FA_ALTNAME,         
00842     FA_ERASE,           
00843     FA_SKIPNSTATE,      
00844     FA_SKIPNETSHARED,   
00845     FA_SKIPCOLOR        
00846 } fileAction;
00847 
00848 #define XFA_SKIPPING(_a)        \
00849     ((_a) == FA_SKIP || (_a) == FA_SKIPNSTATE || (_a) == FA_SKIPNETSHARED || (_a) == FA_SKIPCOLOR)
00850 
00858 typedef enum fileTypes_e {
00859     PIPE        =  1,   
00860     CDEV        =  2,   
00861     XDIR        =  4,   
00862     BDEV        =  6,   
00863     REG         =  8,   
00864     LINK        = 10,   
00865     SOCK        = 12    
00866 } fileTypes;
00867 
00871 typedef /*@abstract@*/ struct fsmIterator_s * FSMI_t;
00872 
00876 typedef /*@abstract@*/ struct fsm_s * FSM_t;
00877 
00881 typedef /*@abstract@*/ /*@refcounted@*/ struct rpmpsm_s * rpmpsm;
00882 
00892 int headerVerifyInfo(int il, int dl, const void * pev, void * iv, int negate)
00893         /*@modifies *iv @*/;
00894 
00900 rpmRC headerCheckPayloadFormat(Header h);
00901 
00915 rpmRC headerCheck(rpmts ts, const void * uh, size_t uc,
00916                 /*@out@*/ /*@null@*/ const char ** msg)
00917         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00918         /*@modifies ts, *msg, rpmGlobalMacroContext,
00919                 fileSystem, internalState @*/;
00920 
00929 rpmRC rpmReadHeader(rpmts ts, FD_t fd, /*@out@*/ Header *hdrp,
00930                 /*@out@*/ /*@null@*/ const char ** msg)
00931         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00932         /*@modifies ts, *hdrp, *msg, rpmGlobalMacroContext,
00933                 fileSystem, internalState @*/;
00934 
00943 rpmRC rpmReadPackageFile(rpmts ts, FD_t fd,
00944                 const char * fn, /*@null@*/ /*@out@*/ Header * hdrp)
00945         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00946         /*@modifies ts, fd, *hdrp, rpmGlobalMacroContext,
00947                 fileSystem, internalState @*/;
00948 
00957 rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
00958                         /*@null@*/ /*@out@*/ const char ** specFilePtr,
00959                         /*@null@*/ /*@out@*/ const char ** cookie)
00960         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00961         /*@modifies ts, fd, *specFilePtr, *cookie, rpmGlobalMacroContext,
00962                 fileSystem, internalState @*/;
00963 
00967 typedef enum rpmtransFlags_e {
00968     RPMTRANS_FLAG_NONE          = 0,
00969     RPMTRANS_FLAG_TEST          = (1 <<  0),    
00970     RPMTRANS_FLAG_BUILD_PROBS   = (1 <<  1),    
00971     RPMTRANS_FLAG_NOSCRIPTS     = (1 <<  2),    
00972     RPMTRANS_FLAG_JUSTDB        = (1 <<  3),    
00973     RPMTRANS_FLAG_NOTRIGGERS    = (1 <<  4),    
00974     RPMTRANS_FLAG_NODOCS        = (1 <<  5),    
00975     RPMTRANS_FLAG_ALLFILES      = (1 <<  6),    
00976 /*@-enummemuse@*/
00977     RPMTRANS_FLAG_KEEPOBSOLETE  = (1 <<  7),    
00978 /*@=enummemuse@*/
00979     RPMTRANS_FLAG_NOCONTEXTS    = (1 <<  8),    
00980     RPMTRANS_FLAG_DIRSTASH      = (1 <<  9),    
00981     RPMTRANS_FLAG_REPACKAGE     = (1 << 10),    
00983     RPMTRANS_FLAG_PKGCOMMIT     = (1 << 11),
00984 /*@-enummemuse@*/
00985     RPMTRANS_FLAG_PKGUNDO       = (1 << 12),
00986 /*@=enummemuse@*/
00987     RPMTRANS_FLAG_COMMIT        = (1 << 13),
00988 /*@-enummemuse@*/
00989     RPMTRANS_FLAG_UNDO          = (1 << 14),
00990 /*@=enummemuse@*/
00991     RPMTRANS_FLAG_REVERSE       = (1 << 15),
00992 
00993     RPMTRANS_FLAG_NOTRIGGERPREIN= (1 << 16),    
00994     RPMTRANS_FLAG_NOPRE         = (1 << 17),    
00995     RPMTRANS_FLAG_NOPOST        = (1 << 18),    
00996     RPMTRANS_FLAG_NOTRIGGERIN   = (1 << 19),    
00997     RPMTRANS_FLAG_NOTRIGGERUN   = (1 << 20),    
00998     RPMTRANS_FLAG_NOPREUN       = (1 << 21),    
00999     RPMTRANS_FLAG_NOPOSTUN      = (1 << 22),    
01000     RPMTRANS_FLAG_NOTRIGGERPOSTUN = (1 << 23),  
01001 /*@-enummemuse@*/
01002     RPMTRANS_FLAG_NOPAYLOAD     = (1 << 24),
01003 /*@=enummemuse@*/
01004     RPMTRANS_FLAG_APPLYONLY     = (1 << 25),
01005 
01006     RPMTRANS_FLAG_ANACONDA      = (1 << 26),    
01007     RPMTRANS_FLAG_NOMD5         = (1 << 27),    
01008     RPMTRANS_FLAG_NOSUGGEST     = (1 << 28),    
01009     RPMTRANS_FLAG_ADDINDEPS     = (1 << 29),    
01010     RPMTRANS_FLAG_NOCONFIGS     = (1 << 30),    
01011     RPMTRANS_FLAG_DEPLOOPS      = (1 << 31)     
01012 } rpmtransFlags;
01013 
01014 #define _noTransScripts         \
01015   ( RPMTRANS_FLAG_NOPRE |       \
01016     RPMTRANS_FLAG_NOPOST |      \
01017     RPMTRANS_FLAG_NOPREUN |     \
01018     RPMTRANS_FLAG_NOPOSTUN      \
01019   )
01020 
01021 #define _noTransTriggers        \
01022   ( RPMTRANS_FLAG_NOTRIGGERPREIN | \
01023     RPMTRANS_FLAG_NOTRIGGERIN | \
01024     RPMTRANS_FLAG_NOTRIGGERUN | \
01025     RPMTRANS_FLAG_NOTRIGGERPOSTUN \
01026   )
01027 
01035 /*@unused@*/
01036 int rpmGetRpmlibProvides(/*@null@*/ /*@out@*/ const char *** provNames,
01037                         /*@null@*/ /*@out@*/ int ** provFlags,
01038                         /*@null@*/ /*@out@*/ const char *** provVersions)
01039         /*@modifies *provNames, *provFlags, *provVersions @*/;
01040 
01048 int rpmvercmp(const char * a, const char * b)
01049         /*@*/;
01050 
01056 int rpmCheckRpmlibProvides(const rpmds key)
01057         /*@*/;
01058 
01063 void rpmShowRpmlibProvides(FILE * fp)
01064         /*@globals fileSystem @*/
01065         /*@modifies *fp, fileSystem @*/;
01066 
01074 int tagType(int tag)
01075         /*@*/;
01076 
01082 /*@-redecl@*/
01083 /*@observer@*/ extern const char *const tagName(int tag)
01084         /*@*/;
01085 /*@=redecl@*/
01086 
01092 int tagValue(const char * tagstr)
01093         /*@*/;
01094 
01095 #define RPMLEAD_BINARY 0
01096 #define RPMLEAD_SOURCE 1
01097 
01098 #define RPMLEAD_MAGIC0 0xed
01099 #define RPMLEAD_MAGIC1 0xab
01100 #define RPMLEAD_MAGIC2 0xee
01101 #define RPMLEAD_MAGIC3 0xdb
01102 
01103 #define RPMLEAD_SIZE 96         
01111 struct rpmlead {
01112     unsigned char magic[4];
01113     unsigned char major;
01114     unsigned char minor;
01115     short type;
01116     short archnum;
01117     char name[66];
01118     short osnum;
01119     short signature_type;       
01120 /*@unused@*/ char reserved[16]; 
01121 } ;
01122 
01126 void freeFilesystems(void)
01127         /*@globals internalState@*/
01128         /*@modifies internalState@*/;
01129 
01136 /*@-incondefs@*/
01137 int rpmGetFilesystemList( /*@null@*/ /*@out@*/ const char *** listptr,
01138                 /*@null@*/ /*@out@*/ int * num)
01139         /*@globals fileSystem, internalState @*/
01140         /*@modifies *listptr, *num, fileSystem, internalState @*/
01141         /*@requires maxSet(listptr) >= 0 /\ maxSet(num) >= 0 @*/
01142         /*@ensures maxRead(num) == 0 @*/;
01143 /*@=incondefs@*/
01144 
01154 /*@-incondefs@*/
01155 int rpmGetFilesystemUsage(const char ** fileList, int_32 * fssizes,
01156                 int numFiles, /*@null@*/ /*@out@*/ uint_32 ** usagesPtr,
01157                 int flags)
01158         /*@globals rpmGlobalMacroContext, h_errno,
01159                 fileSystem, internalState @*/
01160         /*@modifies *usagesPtr, rpmGlobalMacroContext,
01161                 fileSystem, internalState @*/
01162         /*@requires maxSet(fileList) >= 0 /\ maxSet(fssizes) == 0
01163                 /\ maxSet(usagesPtr) >= 0 @*/
01164         /*@ensures maxRead(usagesPtr) == 0 @*/;
01165 /*@=incondefs@*/
01166 
01167 /* ==================================================================== */
01170 /* --- install/upgrade/erase modes */
01171 
01176 typedef enum rpmInstallInterfaceFlags_e {
01177     INSTALL_NONE        = 0,
01178     INSTALL_PERCENT     = (1 << 0),     
01179     INSTALL_HASH        = (1 << 1),     
01180     INSTALL_NODEPS      = (1 << 2),     
01181     INSTALL_NOORDER     = (1 << 3),     
01182     INSTALL_LABEL       = (1 << 4),     
01183     INSTALL_UPGRADE     = (1 << 5),     
01184     INSTALL_FRESHEN     = (1 << 6),     
01185     INSTALL_INSTALL     = (1 << 7),     
01186     INSTALL_ERASE       = (1 << 8)      
01187 } rpmInstallInterfaceFlags;
01188 
01192 typedef enum rpmEraseInterfaceFlags_e {
01193     UNINSTALL_NONE      = 0,
01194     UNINSTALL_NODEPS    = (1 << 0),     
01195     UNINSTALL_ALLMATCHES= (1 << 1)      
01196 } rpmEraseInterfaceFlags;
01197 
01199 /* ==================================================================== */
01202 
01206 enum rpmtagSignature {
01207     RPMSIGTAG_SIZE      = 1000, 
01208     RPMSIGTAG_LEMD5_1   = 1001, 
01209     RPMSIGTAG_PGP       = 1002, 
01210     RPMSIGTAG_LEMD5_2   = 1003, 
01211     RPMSIGTAG_MD5       = 1004, 
01212     RPMSIGTAG_GPG       = 1005, 
01213     RPMSIGTAG_PGP5      = 1006, 
01214     RPMSIGTAG_PAYLOADSIZE = 1007,
01215     RPMSIGTAG_BADSHA1_1 = RPMTAG_BADSHA1_1,     
01216     RPMSIGTAG_BADSHA1_2 = RPMTAG_BADSHA1_2,     
01217     RPMSIGTAG_SHA1      = RPMTAG_SHA1HEADER,    
01218     RPMSIGTAG_DSA       = RPMTAG_DSAHEADER,     
01219     RPMSIGTAG_RSA       = RPMTAG_RSAHEADER      
01220 };
01221 
01235 rpmRC rpmVerifySignature(const rpmts ts,
01236                 /*@out@*/ char * result)
01237         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
01238         /*@modifies ts, *result, rpmGlobalMacroContext,
01239                 fileSystem, internalState @*/;
01240 
01246 /*@null@*/ Header rpmFreeSignature(/*@null@*/ /*@killref@*/ Header h)
01247         /*@modifies h @*/;
01248 
01251 #ifdef __cplusplus
01252 }
01253 #endif
01254 
01255 #endif  /* H_RPMLIB */

Generated on Fri Oct 12 08:44:53 2007 for rpm by  doxygen 1.5.2