00001 #ifndef H_RPMDB
00002 #define H_RPMDB
00003
00009 #include <rpm/rpmtypes.h>
00010 #include <rpm/rpmsw.h>
00011
00012 #ifdef __cplusplus
00013 extern "C" {
00014 #endif
00015
00016 extern int _rpmdb_debug;
00017
00021 typedef enum rpmMireMode_e {
00022 RPMMIRE_DEFAULT = 0,
00023 RPMMIRE_STRCMP = 1,
00024 RPMMIRE_REGEX = 2,
00025 RPMMIRE_GLOB = 3
00026 } rpmMireMode;
00027
00028 typedef enum rpmdbOpX_e {
00029 RPMDB_OP_DBGET = 1,
00030 RPMDB_OP_DBPUT = 2,
00031 RPMDB_OP_DBDEL = 3,
00032 RPMDB_OP_MAX = 4
00033 } rpmdbOpX;
00034
00041 rpmop rpmdbOp(rpmdb db, rpmdbOpX opx);
00042
00049 int rpmdbSetChrootDone(rpmdb db, int chrootDone);
00050
00057 rpmdb rpmdbUnlink (rpmdb db, const char * msg);
00058
00065 rpmdb rpmdbLink (rpmdb db, const char * msg);
00066
00075 int rpmdbOpen (const char * prefix, rpmdb * dbp,
00076 int mode, int perms);
00077
00084 int rpmdbInit(const char * prefix, int perms);
00085
00091 int rpmdbVerify(const char * prefix);
00092
00099 int rpmdbCloseDBI(rpmdb db, rpmTag rpmtag);
00100
00106 int rpmdbClose (rpmdb db);
00107
00113 int rpmdbSync (rpmdb db);
00114
00120 int rpmdbOpenAll (rpmdb db);
00121
00128 int rpmdbCountPackages(rpmdb db, const char * name);
00129
00135 unsigned int rpmdbGetIteratorOffset(rpmdbMatchIterator mi);
00136
00142 int rpmdbGetIteratorCount(rpmdbMatchIterator mi);
00143
00146 unsigned int rpmdbGetIteratorFileNum(rpmdbMatchIterator mi);
00147
00155 int rpmdbAppendIterator(rpmdbMatchIterator mi,
00156 const int * hdrNums, int nHdrNums);
00157
00167 int rpmdbPruneIterator(rpmdbMatchIterator mi,
00168 int * hdrNums, int nHdrNums, int sorted);
00169
00178 int rpmdbSetIteratorRE(rpmdbMatchIterator mi, rpmTag tag,
00179 rpmMireMode mode, const char * pattern);
00180
00188 int rpmdbSetIteratorRewrite(rpmdbMatchIterator mi, int rewrite);
00189
00196 int rpmdbSetIteratorModified(rpmdbMatchIterator mi, int modified);
00197
00205 int rpmdbSetHdrChk(rpmdbMatchIterator mi, rpmts ts,
00206 rpmRC (*hdrchk) (rpmts ts, const void * uh, size_t uc, char ** msg));
00207
00216 rpmdbMatchIterator rpmdbInitIterator(rpmdb db, rpmTag rpmtag,
00217 const void * keyp, size_t keylen);
00218
00224 Header rpmdbNextIterator(rpmdbMatchIterator mi);
00225
00229 int rpmdbCheckSignals(void);
00230
00239 int rpmdbCheckTerminate(int terminate);
00240
00246 rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
00247
00257 int rpmdbAdd(rpmdb db, int iid, Header h, rpmts ts,
00258 rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, char ** msg));
00259
00269 int rpmdbRemove(rpmdb db, int rid, unsigned int hdrNum,
00270 rpmts ts,
00271 rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, char ** msg));
00272
00280 int rpmdbRebuild(const char * prefix, rpmts ts,
00281 rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, char ** msg));
00282
00283 #ifdef __cplusplus
00284 }
00285 #endif
00286
00287 #endif