00001 #ifndef H_RPMFI
00002 #define H_RPMFI
00003
00009 #include <rpm/rpmtypes.h>
00010 #include <rpm/rpmvf.h>
00011 #include <rpm/rpmpgp.h>
00012
00013 #ifdef __cplusplus
00014 extern "C" {
00015 #endif
00016
00017 extern int _rpmfi_debug;
00018
00026 typedef enum rpmFileTypes_e {
00027 PIPE = 1,
00028 CDEV = 2,
00029 XDIR = 4,
00030 BDEV = 6,
00031 REG = 8,
00032 LINK = 10,
00033 SOCK = 12
00034 } rpmFileTypes;
00035
00039 typedef enum rpmfileState_e {
00040 RPMFILE_STATE_NORMAL = 0,
00041 RPMFILE_STATE_REPLACED = 1,
00042 RPMFILE_STATE_NOTINSTALLED = 2,
00043 RPMFILE_STATE_NETSHARED = 3,
00044 RPMFILE_STATE_WRONGCOLOR = 4
00045 } rpmfileState;
00046 #define RPMFILE_STATE_MISSING -1
00047
00051 typedef enum rpmfileAttrs_e {
00052 RPMFILE_NONE = 0,
00053 RPMFILE_CONFIG = (1 << 0),
00054 RPMFILE_DOC = (1 << 1),
00055 RPMFILE_ICON = (1 << 2),
00056 RPMFILE_MISSINGOK = (1 << 3),
00057 RPMFILE_NOREPLACE = (1 << 4),
00058 RPMFILE_SPECFILE = (1 << 5),
00059 RPMFILE_GHOST = (1 << 6),
00060 RPMFILE_LICENSE = (1 << 7),
00061 RPMFILE_README = (1 << 8),
00062 RPMFILE_EXCLUDE = (1 << 9),
00063 RPMFILE_UNPATCHED = (1 << 10),
00064 RPMFILE_PUBKEY = (1 << 11),
00065 RPMFILE_POLICY = (1 << 12)
00066 } rpmfileAttrs;
00067
00068 #define RPMFILE_ALL ~(RPMFILE_NONE)
00069
00073 typedef enum rpmFileAction_e {
00074 FA_UNKNOWN = 0,
00075 FA_CREATE,
00076 FA_COPYIN,
00077 FA_COPYOUT,
00078 FA_BACKUP,
00079 FA_SAVE,
00080 FA_SKIP,
00081 FA_ALTNAME,
00082 FA_ERASE,
00083 FA_SKIPNSTATE,
00084 FA_SKIPNETSHARED,
00085 FA_SKIPCOLOR
00086 } rpmFileAction;
00087
00088 #define XFA_SKIPPING(_a) \
00089 ((_a) == FA_SKIP || (_a) == FA_SKIPNSTATE || (_a) == FA_SKIPNETSHARED || (_a) == FA_SKIPCOLOR)
00090
00094 struct rpmRelocation_s {
00095 char * oldPath;
00096 char * newPath;
00097 };
00098
00105 rpmfi rpmfiUnlink (rpmfi fi,
00106 const char * msg);
00107
00114 rpmfi rpmfiLink (rpmfi fi, const char * msg);
00115
00121 rpm_count_t rpmfiFC(rpmfi fi);
00122
00128 int rpmfiFX(rpmfi fi);
00129
00136 int rpmfiSetFX(rpmfi fi, int fx);
00137
00143 rpm_count_t rpmfiDC(rpmfi fi);
00144
00150 int rpmfiDX(rpmfi fi);
00151
00158 int rpmfiSetDX(rpmfi fi, int dx);
00159
00165 const char * rpmfiBN(rpmfi fi);
00166
00172 const char * rpmfiDN(rpmfi fi);
00173
00179 const char * rpmfiFN(rpmfi fi);
00180
00186 rpmfileAttrs rpmfiFFlags(rpmfi fi);
00187
00193 rpmVerifyAttrs rpmfiVFlags(rpmfi fi);
00194
00200 rpm_mode_t rpmfiFMode(rpmfi fi);
00201
00207 rpmfileState rpmfiFState(rpmfi fi);
00208
00214 pgpHashAlgo rpmfiDigestAlgo(rpmfi fi);
00215
00223 const unsigned char * rpmfiFDigest(rpmfi fi, pgpHashAlgo *algo, size_t *diglen);
00224
00234 char * rpmfiFDigestHex(rpmfi fi, pgpHashAlgo *algo);
00235
00242 const unsigned char * rpmfiMD5(rpmfi fi) RPM_GNUC_DEPRECATED;
00243
00249 const char * rpmfiFLink(rpmfi fi);
00250
00256 rpm_loff_t rpmfiFSize(rpmfi fi);
00257
00263 rpm_rdev_t rpmfiFRdev(rpmfi fi);
00264
00270 rpm_ino_t rpmfiFInode(rpmfi fi);
00271
00277 rpm_color_t rpmfiColor(rpmfi fi);
00278
00284 rpm_color_t rpmfiFColor(rpmfi fi);
00285
00291 const char * rpmfiFClass(rpmfi fi);
00292
00299 uint32_t rpmfiFDepends(rpmfi fi,
00300 const uint32_t ** fddictp);
00301
00307 uint32_t rpmfiFNlink(rpmfi fi);
00308
00314 rpm_time_t rpmfiFMtime(rpmfi fi);
00315
00321 const char * rpmfiFUser(rpmfi fi);
00322
00328 const char * rpmfiFGroup(rpmfi fi);
00329
00337 const char * rpmfiFCaps(rpmfi fi);
00338
00344 const char * rpmfiFLangs(rpmfi fi);
00345
00351 int rpmfiNext(rpmfi fi);
00352
00359 rpmfi rpmfiInit(rpmfi fi, int fx);
00360
00366 int rpmfiNextD(rpmfi fi);
00367
00374 rpmfi rpmfiInitD(rpmfi fi, int dx);
00375
00381 rpmfi rpmfiFree(rpmfi fi);
00382
00383 typedef enum rpmfiFlags_e {
00384 RPMFI_NOHEADER = 0,
00385 RPMFI_KEEPHEADER = (1 << 0),
00386 RPMFI_NOFILECLASS = (1 << 1),
00387 RPMFI_NOFILEDEPS = (1 << 2),
00388 RPMFI_NOFILELANGS = (1 << 3),
00389 RPMFI_NOFILEUSER = (1 << 4),
00390 RPMFI_NOFILEGROUP = (1 << 5),
00391 RPMFI_NOFILEMODES = (1 << 6),
00392 RPMFI_NOFILESIZES = (1 << 7),
00393 RPMFI_NOFILECAPS = (1 << 8),
00394 RPMFI_NOFILELINKTOS = (1 << 9),
00395 RPMFI_NOFILEDIGESTS = (1 << 10),
00396 RPMFI_NOFILEMTIMES = (1 << 11),
00397 RPMFI_NOFILERDEVS = (1 << 12),
00398 RPMFI_NOFILEINODES = (1 << 13),
00399 RPMFI_NOFILESTATES = (1 << 14),
00400 RPMFI_NOFILECOLORS = (1 << 15),
00401 RPMFI_NOFILEVERIFYFLAGS = (1 << 16),
00402 RPMFI_NOFILEFLAGS = (1 << 17),
00403 RPMFI_ISBUILD = (1 << 30),
00404 RPMFI_ISSOURCE = (1 << 31),
00405 } rpmfiFlags;
00406
00407 #define RPMFI_FLAGS_ERASE \
00408 (RPMFI_NOFILECLASS | RPMFI_NOFILELANGS | \
00409 RPMFI_NOFILEMTIMES | RPMFI_NOFILERDEVS | RPMFI_NOFILEINODES | \
00410 RPMFI_NOFILEVERIFYFLAGS)
00411
00412 #define RPMFI_FLAGS_INSTALL \
00413 (RPMFI_NOFILECLASS | RPMFI_NOFILEVERIFYFLAGS)
00414
00415 #define RPMFI_FLAGS_VERIFY \
00416 (RPMFI_NOFILECLASS | RPMFI_NOFILEDEPS | RPMFI_NOFILELANGS | \
00417 RPMFI_NOFILECOLORS)
00418
00419 #define RPMFI_FLAGS_QUERY \
00420 (RPMFI_NOFILECLASS | RPMFI_NOFILEDEPS | RPMFI_NOFILELANGS | \
00421 RPMFI_NOFILECOLORS | RPMFI_NOFILEVERIFYFLAGS)
00422
00431 rpmfi rpmfiNew(const rpmts ts, Header h, rpmTag tagN, rpmfiFlags flags);
00432
00438 rpmFileTypes rpmfiWhatis(rpm_mode_t mode);
00439
00446 int rpmfiCompare(const rpmfi afi, const rpmfi bfi);
00447
00455 rpmFileAction rpmfiDecideFate(const rpmfi ofi, rpmfi nfi, int skipMissing);
00456
00462 int rpmfiConfigConflict(const rpmfi fi);
00463
00464 #ifdef __cplusplus
00465 }
00466 #endif
00467
00468 #endif