Main Page Modules Data Structures File List Data Fields Globals Related Pages

# RPMIO.

## Files

file | macro.c
file | rpmerr.h
file | rpmio.c
file | rpmio.h
file | rpmio_internal.h
file | rpmlog.c
file | rpmlog.h
| Yet Another syslog(3) API clone.

file | rpmmacro.h
file | rpmmalloc.c
file | rpmmessages.h
file | rpmpgp.c
| Routines to handle RFC-2440 detached signatures.

file | rpmpgp.h
| OpenPGP constants and structures from RFC-2440.

file | rpmrpc.c
file | rpmurl.h
file | strcasecmp.c
file | ugid.c
file | ugid.h
file | url.c

## Data Structures

struct | _FD_s
struct | _FDDIGEST_s
struct | _FDSTACK_s
struct | FDIO_s
struct | OPSTAT_t
struct | pgpDig_s
struct | pgpDigParams_s

## [NOHEADER]

typedef off_t | _libio_off_t
typedef off_t | _libio_pos_t

## RPMIO Vectors.

typedef ssize_t(* | fdio_read_function_t )(void *cookie, char *buf, size_t nbytes)
typedef ssize_t(* | fdio_write_function_t )(void *cookie, const char *buf, size_t nbytes)
typedef int(* | fdio_seek_function_t )(void *cookie, _libio_pos_t pos, int whence)
typedef int(* | fdio_close_function_t )(void *cookie)
typedef FD_t(* | fdio_ref_function_t )(void *cookie, const char *msg, const char *file, unsigned line)
typedef FD_t(* | fdio_deref_function_t )(FD_t fd, const char *msg, const char *file, unsigned line)
typedef FD_t(* | fdio_new_function_t )(const char *msg, const char *file, unsigned line)
typedef int(* | fdio_fileno_function_t )(void *cookie)
typedef FD_t(* | fdio_open_function_t )(const char *path, int flags, mode_t mode)
typedef FD_t(* | fdio_fopen_function_t )(const char *path, const char *fmode)
typedef void *(* | fdio_ffileno_function_t )(FD_t fd)
typedef int(* | fdio_fflush_function_t )(FD_t fd)

## RPMIO Interface.

const char * | Fstrerror (FD_t fd)
| strerror(3) clone. More...
size_t | Fread (void *buf, size_t size, size_t nmemb, FD_t fd)
| fread(3) clone. More...
size_t | Fwrite (const void *buf, size_t size, size_t nmemb, FD_t fd)
| fwrite(3) clone. More...
int | Fseek (FD_t fd, _libio_off_t offset, int whence)
| fseek(3) clone. More...
int | Fclose (FD_t fd)
| fclose(3) clone. More...
FD_t | Fdopen (FD_t ofd, const char *fmode)
FD_t | Fopen (const char *path, const char *fmode)
| fopen(3) clone. More...
int | Fflush (FD_t fd)
| fflush(3) clone. More...
int | Ferror (FD_t fd)
| ferror(3) clone. More...
int | Fileno (FD_t fd)
| fileno(3) clone. More...
int | Fcntl (FD_t fd, int op, void *lip)
| fcntl(2) clone. More...

## RPMIO Utilities.

off_t | fdSize (FD_t fd)

## Typedefs

typedef _FD_s * | FD_t
typedef FDIO_s * | FDIO_t
typedef _FDSTACK_s | FDSTACK_t
struct {
timeval create
timeval begin
OPSTAT_t ops [4]
} | FDSTAT_t
typedef _FDDIGEST_s * | FDDIGEST_t
typedef enum rpmDigestFlags_e | rpmDigestFlags

## Enumerations

enum | FDSTAT_e { FDSTAT_READ = 0, FDSTAT_WRITE = 1, FDSTAT_SEEK = 2, FDSTAT_CLOSE = 3 }
enum | rpmDigestFlags_e { RPMDIGEST_NONE = 0 }

## Functions

int | xstrcasecmp (const char *s1, const char *s2)
int | xstrncasecmp (const char *s1, const char *s2, size_t n)
int | fdFgets (FD_t fd, char *buf, size_t len)
FD_t | ftpOpen (const char *url, int flags, mode_t mode, urlinfo *uret)
int | ftpReq (FD_t data, const char *ftpCmd, const char *ftpArg)
int | ftpCmd (const char *cmd, const char *url, const char *arg2)
int | ufdClose (void *cookie)
FDIO_t | fdGetIo (FD_t fd)
void | fdSetIo (FD_t fd, FDIO_t io)
FILE * | fdGetFILE (FD_t fd)
void * | fdGetFp (FD_t fd)
void | fdSetFp (FD_t fd, void *fp)
int | fdGetFdno (FD_t fd)
void | fdSetFdno (FD_t fd, int fdno)
void | fdSetContentLength (FD_t fd, ssize_t contentLength)
void | fdPush (FD_t fd, FDIO_t io, void *fp, int fdno)
void | fdPop (FD_t fd)
void | fdstat_enter (FD_t fd, int opx)
time_t | tvsub (const struct timeval *etv, const struct timeval *btv)
void | fdstat_exit (FD_t fd, int opx, ssize_t rc)
void | fdstat_print (FD_t fd, const char *msg, FILE *fp)
void | fdSetSyserrno (FD_t fd, int syserrno, const void *errcookie)
int | fdGetRdTimeoutSecs (FD_t fd)
long int | fdGetCpioPos (FD_t fd)
void | fdSetCpioPos (FD_t fd, long int cpioPos)
FD_t | c2f (void *cookie)
void | fdInitDigest (FD_t fd, pgpHashAlgo hashalgo, int flags)
void | fdUpdateDigests (FD_t fd, const unsigned char *buf, ssize_t buflen)
void | fdFiniDigest (FD_t fd, pgpHashAlgo hashalgo, void **datap, size_t *lenp, int asAscii)
int | fdFileno (void *cookie)
DIGEST_CTX | rpmDigestDup (DIGEST_CTX octx)
DIGEST_CTX | rpmDigestInit (pgpHashAlgo hashalgo, rpmDigestFlags flags)
int | rpmDigestUpdate (DIGEST_CTX ctx, const void *data, size_t len)
int | rpmDigestFinal (DIGEST_CTX ctx, void **datap, size_t *lenp, int asAscii)

## Typedef Documentation

typedef off_t _libio_off_t

| Definition at line 40 of file rpmio.h.

typedef off_t _libio_pos_t

| Definition at line 41 of file rpmio.h.

typedef struct _FD_s* FD_t

| Definition at line 47 of file rpmio.h.

typedef struct _FDDIGEST_s * FDDIGEST_t

typedef int(* fdio_close_function_t)(void *cookie)

| Definition at line 84 of file rpmio.h.

typedef FD_t(* fdio_deref_function_t)( FD_t fd, const char * msg, const char * file, unsigned line)

| Definition at line 98 of file rpmio.h.

typedef void*(* fdio_ffileno_function_t)(FD_t fd)

| Definition at line 133 of file rpmio.h.

typedef int(* fdio_fflush_function_t)(FD_t fd)

| Definition at line 139 of file rpmio.h.

typedef int(* fdio_fileno_function_t)(void * cookie)

| Definition at line 114 of file rpmio.h.

typedef FD_t(* fdio_fopen_function_t)(const char * path, const char * fmode)

| Definition at line 127 of file rpmio.h.

typedef FD_t(* fdio_new_function_t)(const char * msg, const char * file, unsigned line)

| Definition at line 106 of file rpmio.h.

typedef FD_t(* fdio_open_function_t)(const char * path, int flags, mode_t mode)

| Definition at line 121 of file rpmio.h.

typedef ssize_t(* fdio_read_function_t)(void *cookie, char *buf, size_t nbytes)

| Definition at line 64 of file rpmio.h.

typedef FD_t(* fdio_ref_function_t)( void * cookie, const char * msg, const char * file, unsigned line)

| Definition at line 91 of file rpmio.h.

typedef int(* fdio_seek_function_t)(void *cookie, _libio_pos_t pos, int whence)

| Definition at line 78 of file rpmio.h.

typedef struct FDIO_s* FDIO_t

| Definition at line 51 of file rpmio.h.

typedef ssize_t(* fdio_write_function_t)(void *cookie, const char *buf, size_t nbytes)

| Definition at line 72 of file rpmio.h.

typedef struct _FDSTACK_s FDSTACK_t

typedef { ... } * FDSTAT_t

| Cumulative statistics for a descriptor.

typedef enum rpmDigestFlags_e rpmDigestFlags

| Bit(s) to control digest operation. Referenced by rpmDigestInit.

## Enumeration Type Documentation

enum FDSTAT_e

Identify per-desciptor I/O operation statistics.

Enumeration values:

  FDSTAT_READ | Read statistics index.
  FDSTAT_WRITE | Write statistics index.
  FDSTAT_SEEK | Seek statistics index.
  FDSTAT_CLOSE | Close statistics index

Definition at line 115 of file rpmio_internal.h.

enum rpmDigestFlags_e

Bit(s) to control digest operation.

Enumeration values:

  RPMDIGEST_NONE |

Definition at line 957 of file rpmpgp.h.

## Function Documentation

FD_t c2f | ( | void * | cookie | ) | `[inline, static]`

| Definition at line 501 of file rpmio_internal.h. References FDSANE. Referenced by fdFileno.

int Fclose | ( | FD_t | fd | ) |

fclose(3) clone.

Referenced by addFileToTagAux, closeCallback, closeSpec, cpio_doio, defaultMachine, domd5, doReadRC, doScript, ftsStashLatest, IDTXglob, isCompressed, isSpecFile, main, makeGPGSignature, makeHDRSignature, makePGPSignature, makeTempFile, manageFile, processPackageFiles, readIcon, readLine, readRPM, rewriteRPM, rpmcliSign, rpmGraph, rpmHeaderFromFD, rpmHeaderFromFile, rpmInitMacros, rpmInstall, rpmInstallSource, rpmMergeHeadersFromFD, rpmQueryVerify, rpmShowProgress, rpmts_dealloc, rpmts_HdrFromFdno, rpmtsCallback, rpmtsSolve, showVerifyPackage, urlGetFile, writeRPM, and XurlFree.

int Fcntl | ( | FD_t | fd,
|  | int | op,
|  | void * | lip
| ) |

| fcntl(2) clone.

int fdFgets | ( | FD_t | fd,
|  | char * | buf,
|  | size_t | len
| ) |

| Referenced by ftpNLST.

int fdFileno | ( | void * | cookie | ) | `[inline, static]`

| Definition at line 583 of file rpmio_internal.h. References c2f, _FDSTACK_s::fdno, and _FD_s::fps.

void fdFiniDigest | ( | FD_t | fd,
|  | pgpHashAlgo | hashalgo,
|  | void ** | datap,
|  | size_t * | lenp,
|  | int | asAscii
| ) | `[inline, static]`

| Definition at line 547 of file rpmio_internal.h. References _FD_s::digests, _FDDIGEST_s::hashalgo, _FDDIGEST_s::hashctx, _FD_s::ndigests, pgpHashAlgo, and rpmDigestFinal. Referenced by domd5, and writeRPM.

long int fdGetCpioPos | ( | FD_t | fd | ) | `[inline, static]`

| Definition at line 481 of file rpmio_internal.h. References _FD_s::fd_cpioPos, and FDSANE.

int fdGetFdno | ( | FD_t | fd | ) | `[inline, static]`

| Definition at line 306 of file rpmio_internal.h. References FDSANE, _FD_s::fps, and _FD_s::nfps.

FILE* fdGetFILE | ( | FD_t | fd | ) | `[inline, static]`

| Definition at line 264 of file rpmio_internal.h. References FDSANE, _FD_s::fps, and _FD_s::nfps. Referenced by rdcl.

void* fdGetFp | ( | FD_t | fd | ) | `[inline, static]`

| Definition at line 278 of file rpmio_internal.h. References FDSANE, _FD_s::fps, and _FD_s::nfps. Referenced by addFileToTagAux, doScript, processPackageFiles, readLine, rpmfd_Fopen, rpmReadPackageManifest, and XurlFree.

FDIO_t fdGetIo | ( | FD_t | fd | ) | `[inline, static]`

| Definition at line 236 of file rpmio_internal.h. References FDSANE, _FD_s::fps, and _FD_s::nfps.

int fdGetRdTimeoutSecs | ( | FD_t | fd | ) | `[inline, static]`

| Definition at line 471 of file rpmio_internal.h. References FDSANE, and _FD_s::rd_timeoutsecs.

void fdInitDigest | ( | FD_t | fd,
|  | pgpHashAlgo | hashalgo,
|  | int | flags
| ) | `[inline, static]`

| Attach digest to fd. Definition at line 515 of file rpmio_internal.h. References _FD_s::digests, FDDIGEST_MAX, _FDDIGEST_s::hashalgo, _FDDIGEST_s::hashctx, _FD_s::ndigests, pgpHashAlgo, and rpmDigestInit. Referenced by domd5, rpmReadPackageFile, rpmVerifySignatures, and writeRPM.

FD_t Fdopen | ( | FD_t | ofd,
|  | const char * | fmode
| ) |

| Referenced by cpio_doio, doScript, and main.

void fdPop | ( | FD_t | fd | ) | `[inline, static]`

| Definition at line 354 of file rpmio_internal.h. References FDSANE, fdSetFdno, fdSetFp, fdSetIo, and _FD_s::nfps.

void fdPush | ( | FD_t | fd,
|  | FDIO_t | io,
|  | void * | fp,
|  | int | fdno
| ) | `[inline, static]`

| Definition at line 340 of file rpmio_internal.h. References FDSANE, fdSetFdno, fdSetFp, fdSetIo, _FD_s::fps, and _FD_s::nfps. Referenced by XurlFree.

void fdSetContentLength | ( | FD_t | fd,
|  | ssize_t | contentLength
| ) | `[inline, static]`

| Definition at line 330 of file rpmio_internal.h. References _FD_s::bytesRemain, _FD_s::contentLength, and FDSANE.

void fdSetCpioPos | ( | FD_t | fd,
|  | long int | cpioPos
| ) | `[inline, static]`

| Definition at line 491 of file rpmio_internal.h. References _FD_s::fd_cpioPos, and FDSANE.

void fdSetFdno | ( | FD_t | fd,
|  | int | fdno
| ) | `[inline, static]`

| Definition at line 318 of file rpmio_internal.h. References FDSANE, _FD_s::fps, and _FD_s::nfps. Referenced by fdPop, and fdPush.

void fdSetFp | ( | FD_t | fd,
|  | void * | fp
| ) | `[inline, static]`

| Definition at line 291 of file rpmio_internal.h. References FDSANE, _FD_s::fps, and _FD_s::nfps. Referenced by fdPop, and fdPush.

void fdSetIo | ( | FD_t | fd,
|  | FDIO_t | io
| ) | `[inline, static]`

| Definition at line 249 of file rpmio_internal.h. References FDSANE, _FD_s::fps, and _FD_s::nfps. Referenced by fdPop, and fdPush.

void fdSetSyserrno | ( | FD_t | fd,
|  | int | syserrno,
|  | const void * | errcookie
| ) | `[inline, static]`

| Definition at line 458 of file rpmio_internal.h. References _FD_s::errcookie, FDSANE, and _FD_s::syserrno.

off_t fdSize | ( | FD_t | fd | ) |

| Referenced by doReadRC, and readIcon.

void fdstat_enter | ( | FD_t | fd,
|  | int | opx
| ) | `[inline, static]`

| Definition at line 367 of file rpmio_internal.h. References _FD_s::stats.

void fdstat_exit | ( | FD_t | fd,
|  | int | opx,
|  | ssize_t | rc
| ) | `[inline, static]`

| Definition at line 395 of file rpmio_internal.h. References _FD_s::bytesRemain, errno, FDSTAT_SEEK, _FD_s::stats, _FD_s::syserrno, and tvsub.

void fdstat_print | ( | FD_t | fd,
|  | const char * | msg,
|  | FILE * | fp
| ) | `[inline, static]`

| Definition at line 424 of file rpmio_internal.h. References OPSTAT_t::bytes, OPSTAT_t::count, FDSTAT_CLOSE, FDSTAT_READ, FDSTAT_SEEK, FDSTAT_WRITE, OPSTAT_t::msecs, ops, and _FD_s::stats.

void fdUpdateDigests | ( | FD_t | fd,
|  | const unsigned char * | buf,
|  | ssize_t | buflen
| ) | `[inline, static]`

| Update digest(s) attached to fd. Definition at line 530 of file rpmio_internal.h. References _FD_s::digests, _FDDIGEST_s::hashctx, _FD_s::ndigests, and rpmDigestUpdate.

int Ferror | ( | FD_t | fd | ) |

ferror(3) clone.

Referenced by addFileToTagAux, cpio_copy, defaultMachine, domd5, doReadRC, doScript, ftsStashLatest, IDTXglob, isCompressed, isSpecFile, main, makeGPGSignature, makeHDRSignature, makePGPSignature, makeTempFile, manageFile, processPackageFiles, readIcon, readLine, readRPM, rpmcliSign, rpmfd_Fopen, rpmGraph, rpmInitMacros, rpmInstall, rpmInstallSource, rpmQueryVerify, rpmReadRC, rpmShowProgress, rpmtsSolve, urlGetFile, and writeRPM.

int Fflush | ( | FD_t | fd | ) |

| fflush(3) clone. Referenced by cpio_doio, and writeRPM.

int Fileno | ( | FD_t | fd | ) |

| fileno(3) clone. Referenced by cpio_doio, doScript, makeTempFile, printSize, rpmReadPackageFile, and writeRPM.

FD_t Fopen | ( | const char * | path,
|  | const char * | fmode
| ) |

fopen(3) clone.

Referenced by addFileToTagAux, defaultMachine, domd5, doReadRC, ftsStashLatest, IDTXglob, isCompressed, isSpecFile, main, makeGPGSignature, makeHDRSignature, makePGPSignature, makeTempFile, manageFile, processPackageFiles, readIcon, readLine, readRPM, rpmcliSign, rpmfd_Fopen, rpmGraph, rpmHeaderFromFile, rpmInitMacros, rpmInstall, rpmInstallSource, rpmQueryVerify, rpmReadRC, rpmShowProgress, rpmtsSolve, urlGetFile, and writeRPM.

size_t Fread | ( | void * | buf,
|  | size_t | size,
|  | size_t | nmemb,
|  | FD_t | fd
| ) |

| fread(3) clone. Referenced by copyFile, cpio_copy, defaultMachine, domd5, doReadRC, isCompressed, isSpecFile, main, readFile, readIcon, readRPM, rpmReadPackageFile, and writeRPM.

int Fseek | ( | FD_t | fd,
|  | _libio_off_t | offset,
|  | int | whence
| ) |

| fseek(3) clone. Referenced by readRPM, and writeRPM.

const char* Fstrerror | ( | FD_t | fd | ) |

| strerror(3) clone. Referenced by copyFile, cpio_copy, doReadRC, IDTXglob, isCompressed, isSpecFile, main, manageFile, processPackageFiles, readFile, readIcon, readLead, readLine, readRPM, rpmfd_Fopen, rpmGraph, rpmInstall, rpmInstallSource, rpmQueryVerify, rpmReadPackageFile, rpmReadRC, rpmReSign, rpmShowProgress, rpmtsSolve, urlGetFile, and writeRPM.

int ftpCmd | ( | const char * | cmd,
|  | const char * | url,
|  | const char * | arg2
| ) |

| Referenced by ftpChdir, ftpMkdir, ftpRename, ftpRmdir, and ftpUnlink.

FD_t ftpOpen | ( | const char * | url,
|  | int | flags,
|  | mode_t | mode,
|  | urlinfo * | uret
| ) |

| Referenced by ftpNLST.

int ftpReq | ( | FD_t | data,
|  | const char * | ftpCmd,
|  | const char * | ftpArg
| ) |

| Referenced by ftpNLST.

size_t Fwrite | ( | const void * | buf,
|  | size_t | size,
|  | size_t | nmemb,
|  | FD_t | fd
| ) |

| fwrite(3) clone. Referenced by copyFile, cpio_copy, headerWrite, main, rpmWriteSignature, writeLead, and writeRPM.

DIGEST_CTX rpmDigestDup | ( | DIGEST_CTX | octx | ) |

Duplicate a digest context.

Parameters:

  octx | existing digest context

Returns:
  duplicated digest context

Definition at line 36 of file digest.c.

Referenced by verifyGPGSignature, verifyMD5Signature, verifyPGPSignature, and verifySHA1Signature.

int rpmDigestFinal | ( | DIGEST_CTX | ctx,
|  | void ** | datap,
|  | size_t * | lenp,
|  | int | asAscii
| ) |

Return digest and destroy context. Final wrapup - pad to 64-byte boundary with the bit pattern 1 0* (64-bit count of bits processed, MSB-first)

Parameters:

  ctx | digest context

Return values:

  datap | address of returned digest
  lenp | address of digest length

Parameters:

  asAscii | return digest as ascii string?

Returns:
  0 on success

Definition at line 122 of file digest.c.

References PGPSIGTYPE_CASUAL_CERT, PGPSIGTYPE_CERT_REVOKE, PGPSIGTYPE_KEY_REVOKE, PGPSIGTYPE_PERSONA_CERT, PGPSIGTYPE_POSITIVE_CERT, PGPSIGTYPE_SIGNED_KEY, PGPSIGTYPE_SUBKEY_BINDING, PGPSIGTYPE_SUBKEY_REVOKE, and PGPSIGTYPE_TIMESTAMP.

Referenced by domd5, fdFiniDigest, makeHDRSignature, pgpFreeDig, rhnUnload, verifyGPGSignature, verifyMD5Signature, verifyPGPSignature, and verifySHA1Signature.

DIGEST_CTX rpmDigestInit | ( | pgpHashAlgo | hashalgo,
|  | rpmDigestFlags | flags
| ) |

Initialize digest. Set bit count to 0 and buffer to mysterious initialization constants.

Parameters:

  hashalgo | type of digest
  flags | bit(s) to control digest operation

Returns:
  digest context

Definition at line 45 of file digest.c.

References PGPTAG_COMMENT, PGPTAG_COMMENT_OLD, PGPTAG_COMPRESSED_DATA, PGPTAG_CONTROL, PGPTAG_ENCRYPTED_MDC, PGPTAG_LITERAL_DATA, PGPTAG_MARKER, PGPTAG_MDC, PGPTAG_PHOTOID, PGPTAG_PRIVATE_60, PGPTAG_PRIVATE_62, PGPTAG_PUBLIC_SUBKEY, PGPTAG_SECRET_SUBKEY, PGPTAG_SYMMETRIC_DATA, PGPTAG_TRUST, and PGPTAG_USER_ID.

Referenced by domd5, fdInitDigest, headerCheck, makeHDRSignature, readFile, rhnUnload, and rpmReadPackageFile.

int rpmDigestUpdate | ( | DIGEST_CTX | ctx,
|  | const void * | data,
|  | size_t | len
| ) |

Update context with next plain text buffer.

Parameters:

  ctx | digest context
  data | next data buffer
  len | no. bytes of data

Returns:
  0 on success

Definition at line 99 of file digest.c.

Referenced by domd5, fdUpdateDigests, headerCheck, makeHDRSignature, readFile, rhnUnload, rpmReadPackageFile, verifyGPGSignature, and verifyPGPSignature.

time_t tvsub | ( | const struct timeval * | etv,
|  | const struct timeval * | btv
| ) | `[inline, static]`

| Definition at line 380 of file rpmio_internal.h. Referenced by fdstat_exit.

int ufdClose | ( | void * | cookie | ) |

| Referenced by ftpNLST.

int xstrcasecmp | ( | const char * | s1,
|  | const char * | s2
| ) |

| Locale insensitive strcasecmp(3). Definition at line 9 of file strcasecmp.c.

int xstrncasecmp | ( | const char * | s1,
|  | const char * | s2,
|  | size_t | n
| ) |

| Locale insensitive strncasecmp(3). Definition at line 32 of file strcasecmp.c.

## Variable Documentation

struct { ... } begin`[inherited]`

| Operation start time. Definition at line 127 of file rpmio_internal.h.

struct { ... } create`[inherited]`

| Structure creation time. Definition at line 126 of file rpmio_internal.h.

OPSTAT_t { ... } ops[4]`[inherited]`

| Cumulative statistics. Definition at line 128 of file rpmio_internal.h.