# lib/rpmgi.h File Reference

`#include <rpmlib.h>`
`#include <rpmds.h>`
`#include <rpmte.h>`
`#include <rpmts.h>`
`#include <fts.h>`
`#include <argv.h>`

Include dependency graph for rpmgi.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## RPMGI
#define | rpmgiUnlink(_gi, _msg) XrpmgiUnlink(_gi, _msg, __FILE__, __LINE__)
#define | rpmgiLink(_gi, _msg) XrpmgiLink(_gi, _msg, __FILE__, __LINE__)
rpmgi | rpmgiUnlink (rpmgi gi, const char *msg)
| Unreference a generalized iterator instance.
rpmgi | XrpmgiUnlink (rpmgi gi, const char *msg, const char *fn, unsigned ln)
rpmgi | rpmgiLink (rpmgi gi, const char *msg)
| Reference a generalized iterator instance.
rpmgi | XrpmgiLink (rpmgi gi, const char *msg, const char *fn, unsigned ln)
rpmgi | rpmgiFree (rpmgi gi)
| Destroy a generalized iterator.
rpmgi | rpmgiNew (rpmts ts, int tag, const void *keyp, size_t keylen)
| Return a generalized iterator.
rpmRC | rpmgiNext (rpmgi gi)
| Perform next iteration step.
rpmgiFlags | rpmgiGetFlags (rpmgi gi)
| Return current iteration flags.
const char * | rpmgiHdrPath (rpmgi gi)
| Return current header path.
Header | rpmgiHeader (rpmgi gi)
| Return current iteration header.
rpmts | rpmgiTs (rpmgi gi)
| Return current iteration transaction set.
const char * | rpmgiEscapeSpaces (const char *s)
| Escape isspace(3) characters in string.
rpmRC | rpmgiSetArgs (rpmgi gi, ARGV_t argv, int ftsOpts, rpmgiFlags flags)
| Load iterator args.
## Typedefs
typedef enum rpmgiFlags_e | rpmgiFlags
## Enumerations
enum | rpmgiFlags_e { RPMGI_NONE = 0, RPMGI_TSADD = (1 << 0), RPMGI_TSORDER = (1 << 1), RPMGI_NOGLOB = (1 << 2), RPMGI_NOMANIFEST = (1 << 3), RPMGI_NOHEADER = (1 << 4), RPMGI_ERASING = (1 << 5) }
## Variables
int | _rpmgi_debug
rpmgiFlags | giFlags

## Detailed Description

Definition in file rpmgi.h.

## Define Documentation

#define rpmgiLink | ( | _gi,
|  | _msg |  | ) | XrpmgiLink(_gi, _msg, __FILE__, __LINE__)

Definition at line 130 of file rpmgi.h.

Referenced by rpmgiNew().

#define rpmgiUnlink | ( | _gi,
|  | _msg |  | ) | XrpmgiUnlink(_gi, _msg, __FILE__, __LINE__)

Definition at line 111 of file rpmgi.h.

Referenced by rpmgiFree().

## Typedef Documentation

typedef enum rpmgiFlags_e rpmgiFlags

## Enumeration Type Documentation

enum rpmgiFlags_e

Enumerator:

  RPMGI_NONE |
  RPMGI_TSADD |
  RPMGI_TSORDER |
  RPMGI_NOGLOB |
  RPMGI_NOMANIFEST |
  RPMGI_NOHEADER |
  RPMGI_ERASING |

Definition at line 24 of file rpmgi.h.

## Function Documentation

const char* rpmgiEscapeSpaces | ( | const char * | s | ) |

Escape isspace(3) characters in string.

Parameters:

  | s | string

Returns:
  escaped string

Definition at line 327 of file rpmgi.c.

References xmalloc().

Referenced by IDTXglob(), and rpmgiGlobArgv().

rpmgi rpmgiFree | ( | rpmgi | gi | ) |

Destroy a generalized iterator.

Parameters:

  | gi | generalized iterator

Returns:
  NULL always

Definition at line 477 of file rpmgi.c.

References _free(), argvFree(), Fclose(), Fts_close(), headerFree(), rpmdbFreeIterator(), rpmgiUnlink, rpmtsFree(), and rpmtsiFree.

Referenced by rpmcliArgIter(), rpmcliInstall(), rpmcliSign(), and rpmReSign().

rpmgiFlags rpmgiGetFlags | ( | rpmgi | gi | ) |

Return current iteration flags.

Parameters:

  | gi | generalized iterator

Returns:
  flags

Definition at line 821 of file rpmgi.c.

References RPMGI_NONE.

Referenced by rpmcliArgIter().

const char* rpmgiHdrPath | ( | rpmgi | gi | ) |

Return current header path.

Parameters:

  | gi | generalized iterator

Returns:
  header path

Definition at line 826 of file rpmgi.c.

Referenced by rpmcliArgIter(), rpmcliInstall(), rpmcliSign(), and rpmReSign().

Header rpmgiHeader | ( | rpmgi | gi | ) |

Return current iteration header.

Parameters:

  | gi | generalized iterator

Returns:
  header

Definition at line 831 of file rpmgi.c.

Referenced by rpmcliInstall(), and rpmgiShowMatches().

rpmgi rpmgiLink | ( | rpmgi | gi,
|  | const char * | msg |
| ) |  |  |

Reference a generalized iterator instance.

Parameters:

  | gi | generalized iterator
  | msg |

Returns:
  new generalized iterator reference

rpmgi rpmgiNew | ( | rpmts | ts,
|  | int | tag,
|  | const void * | keyp,
|  | size_t | keylen |
| ) |  |  |

Return a generalized iterator.

Parameters:

  | ts | transaction set
  | tag | rpm tag
  | keyp | key data (NULL for sequential access)
  | keylen | key data length (0 will use strlen(keyp))

Returns:
  new iterator

Definition at line 516 of file rpmgi.c.

References rpmgiLink, rpmtsLink, rpmtsOrder(), and xcalloc().

Referenced by rpmcliArgIter(), rpmcliInstall(), rpmcliSign(), and rpmReSign().

rpmRC rpmgiNext | ( | rpmgi | gi | ) |

Perform next iteration step.

Parameters:

  | gi | generalized iterator

Returns:
  RPMRC_OK on success, RPMRC_NOTFOUND on EOI

Definition at line 555 of file rpmgi.c.

References _, _free(), _query_hdlist_path, _rpmgi_debug, Fclose(), Fts_close(), Fts_open(), headerFree(), headerGetInstance(), headerLink(), rpmdbBlockDBI(), rpmdbFreeIterator(), rpmdbGetIteratorOffset(), RPMDBI_ADDED, RPMDBI_ARGLIST, RPMDBI_DEPENDS, RPMDBI_FTSWALK, RPMDBI_HDLIST, RPMDBI_PACKAGES, RPMDBI_REMOVED, rpmdbNextIterator(), RPMDEPS_FLAG_DEPLOOPS, rpmExpand(), RPMGI_ERASING, RPMGI_NOHEADER, RPMGI_TSADD, RPMGI_TSORDER, rpmgiInitFilter(), rpmgiLoadNextKey(), rpmgiLoadReadHeader(), rpmgiOpen(), rpmgiWalkReadHeader(), rpmIsVerbose, rpmlog(), RPMLOG_ERR, RPMLOG_INFO, rpmpkgRead(), rpmpsFree(), rpmpsNumProblems(), rpmpsPrint(), RPMRC_NOTFOUND, RPMRC_OK, RPMTAG_BASENAMES, RPMTAG_PROVIDENAME, rpmteHeader(), rpmteType(), rpmtsAddEraseElement(), rpmtsAddInstallElement(), rpmtsCheck(), rpmtsDFlags(), rpmtsGetRdb(), rpmtsiFree, rpmtsiInit, rpmtsiNext(), rpmtsProblems(), rpmtsSetDFlags(), rpmtsSetGoal(), tagName(), TR_ADDED, TR_REMOVED, TSM_ERASE, TSM_INSTALL, and xstrdup().

Referenced by rpmcliArgIter(), rpmcliInstall(), rpmcliSign(), rpmgiShowMatches(), and rpmReSign().

rpmRC rpmgiSetArgs | ( | rpmgi | gi,
|  | ARGV_t | argv,
|  | int | ftsOpts,
|  | rpmgiFlags | flags |
| ) |  |  |

Load iterator args.

Parameters:

  | gi | generalized iterator
  | argv | arg list
  | ftsOpts | fts(3) flags
  | flags | iterator flags

Returns:
  RPMRC_OK on success

Definition at line 845 of file rpmgi.c.

References rpmgiGlobArgv(), and RPMRC_FAIL.

Referenced by rpmcliArgIter(), rpmcliInstall(), rpmcliSign(), and rpmReSign().

rpmts rpmgiTs | ( | rpmgi | gi | ) |

Return current iteration transaction set.

Parameters:

  | gi | generalized iterator

Returns:
  transaction set

Definition at line 838 of file rpmgi.c.

rpmgi rpmgiUnlink | ( | rpmgi | gi,
|  | const char * | msg |
| ) |  |  |

Unreference a generalized iterator instance.

Parameters:

  | gi | generalized iterator
  | msg |

Returns:
  NULL always

rpmgi XrpmgiLink | ( | rpmgi | gi,
|  | const char * | msg,
|  | const char * | fn,
|  | unsigned | ln |
| ) |  |  |

Todo:
  Remove debugging entry from the ABI.

Definition at line 466 of file rpmgi.c.

References _rpmgi_debug, and tagName().

rpmgi XrpmgiUnlink | ( | rpmgi | gi,
|  | const char * | msg,
|  | const char * | fn,
|  | unsigned | ln |
| ) |  |  |

Todo:
  Remove debugging entry from the ABI.

Definition at line 455 of file rpmgi.c.

References _rpmgi_debug, and tagName().

## Variable Documentation

int _rpmgi_debug

Definition at line 32 of file rpmgi.c.

rpmgiFlags giFlags

Definition at line 37 of file rpmgi.c.

Referenced by rpmcliArgIter().