Functions

# rpmdb/pkgio.h File Reference

Methods to handle package elements. More...

`#include <rpmpgp.h>`
Include dependency graph for pkgio.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Functions
rpmRC | headerCheck (pgpDig dig, const void *uh, size_t uc, const char **msg)
| Check header consistency, performing headerGetEntry() the hard way.
size_t | rpmpkgSizeof (const char *fn, const void *ptr)
| Return size of item in bytes.
rpmRC | rpmpkgWrite (const char *fn, FD_t fd, void *ptr, const char **msg)
| Write item onto file descriptor.
rpmRC | rpmpkgRead (const char *fn, FD_t fd, void *ptr, const char **msg)
| Read item from file descriptor.
rpmRC | rpmpkgCheck (const char *fn, FD_t fd, const void *ptr, const char **msg)
| Verify item integrity.

## Detailed Description

Methods to handle package elements.

Definition in file pkgio.h.

## Function Documentation

rpmRC headerCheck | ( | pgpDig | dig,
|  | const void * | uh,
|  | size_t | uc,
|  | const char ** | msg
| ) |  |

Check header consistency, performing headerGetEntry() the hard way.

Sanity checks on the header are performed while looking for a header-only digest or signature to verify the blob. If found, the digest or signature is verified.

Parameters:

  dig | signature parameters container
  uh | unloaded header blob
  uc | no. of bytes in blob (or 0 to disable)

Return values:

  *msg | verification error message (or NULL)

Returns:
  RPMRC_OK on success

Check header consistency, performing headerGetEntry() the hard way.

Sanity checks on the header are performed while looking for a header-only digest or signature to verify the blob. If found, the digest or signature is verified.

Parameters:

  ts | transaction set
  uh | unloaded header blob
  uc | no. of bytes in blob (or 0 to disable)

Return values:

  *msg | signature verification msg

Returns:
  RPMRC_OK/RPMRC_NOTFOUND/RPMRC_FAIL

Definition at line 880 of file pkgio.c.

References _, _free(), _pkgio_debug, _print_pkts, alloca(), entryInfo_s::count, headerGetMagic(), headerVerifyInfo(), indexEntry_s::info, entryInfo_s::offset, pgpDigVSFlags, pgpGetSig(), PGPHASHALGO_SHA1, pgpPrtPkts(), pgpSetSig(), pgpStatsAccumulator(), REGION_TAG_COUNT, RPM_BIN_TYPE, RPM_STRING_TYPE, RPMDIGEST_NONE, rpmDigestInit(), rpmDigestUpdate(), rpmIsDebug, rpmlog(), RPMLOG_ERR, RPMRC_FAIL, RPMRC_NOTFOUND, RPMRC_OK, rpmswEnter(), rpmswExit(), RPMTAG_HEADERIMMUTABLE, rpmVerifySignature(), RPMVSF_NODSAHEADER, RPMVSF_NORSAHEADER, RPMVSF_NOSHA1HEADER, snprintf(), entryInfo_s::tag, entryInfo_s::type, xmalloc(), and xstrdup().

Referenced by miFreeHeader(), rpmdbAdd(), rpmdbNextIterator(), rpmReadHeader(), and rpmts_HdrCheck().

rpmRC rpmpkgCheck | ( | const char * | fn,
|  | FD_t | fd,
|  | const void * | ptr,
|  | const char ** | msg
| ) |  |

Verify item integrity.

Parameters:

  fn | item name
  fd | file handle
  ptr | item buffer

Return values:

  *msg | item check failure message

Returns:
  RPMRC_OK on success

Definition at line 1402 of file pkgio.c.

References ckHeader(), and RPMRC_FAIL.

rpmRC rpmpkgRead | ( | const char * | fn,
|  | FD_t | fd,
|  | void * | ptr,
|  | const char ** | msg
| ) |  |

Read item from file descriptor.

Parameters:

  fn | item name
  fd | file handle

Return values:

  *ptr | item buffer
  *msg | item check failure message

Returns:
  RPMRC_OK on success

Definition at line 1414 of file pkgio.c.

References rdHeader(), rdLead(), rdSignature(), and RPMRC_FAIL.

Referenced by makeHDRSignature(), readFile(), rpmgiNext(), rpmReadHeaders(), rpmReadPackageFile(), rpmReSign(), rpmSingleHeaderFromFD(), rpmVerifySignatures(), and writeRPM().

size_t rpmpkgSizeof | ( | const char * | fn,
|  | const void * | ptr
| ) |  |

Return size of item in bytes.

Parameters:

  fn | item name
  ptr | item buffer

Returns:
  size of item in bytes.

Definition at line 1386 of file pkgio.c.

References szHeader().

Referenced by printSize(), rpmpsmStage(), and writeRPM().

rpmRC rpmpkgWrite | ( | const char * | fn,
|  | FD_t | fd,
|  | void * | ptr,
|  | const char ** | msg
| ) |  |

Write item onto file descriptor.

Parameters:

  fn | item name
  fd | file handle
  ptr | item buffer

Return values:

  *msg | item check failure message

Returns:
  RPMRC_OK on success

Definition at line 1432 of file pkgio.c.

References RPMRC_FAIL, wrHeader(), wrLead(), and wrSignature().

Referenced by makeHDRSignature(), rpmpsmStage(), rpmReSign(), and writeRPM().