# RPMIO.

## Data Structures

struct | FDIO_s
struct | _FDSTACK_s
struct | OPSTAT_t
| Cumulative statistics for an I/O operation. More...
struct | _FDDIGEST_s
struct | _FD_s
| The FD_t File Handle data structure. More...

## Files

file | falloc.c

| The entire file space is thus divided into blocks with a "struct fablock" at the header of each.
file | macro.c
file | rpmlog.c
file | rpmerr.h
file | rpmio.c
file | rpmio.h
file | rpmio_internal.h
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

## Typedefs

typedef struct _FD_s * | FD_t
typedef struct FDIO_s * | FDIO_t
typedef struct _FDSTACK_s | FDSTACK_t
struct {
struct timeval create
struct timeval begin
OPSTAT_t ops [4]
} | FDSTAT_t
| Cumulative statistics for a descriptor.
typedef enum rpmDigestFlags_e | rpmDigestFlags
| Bit(s) to control digest operation.
typedef struct _FDDIGEST_s * | FDDIGEST_t

## Enumerations

enum | FDSTAT_e { FDSTAT_READ = 0, FDSTAT_WRITE = 1, FDSTAT_SEEK = 2, FDSTAT_CLOSE = 3 }
| Identify per-desciptor I/O operation statistics. More...
enum | rpmDigestFlags_e { RPMDIGEST_NONE = 0 }
| Bit(s) to control digest operation. More...

## Functions

int | xstrcasecmp (const char *s1, const char *s2)
| Locale insensitive strcasecmp(3).
int | xstrncasecmp (const char *s1, const char *s2, size_t n)
| Locale insensitive strncasecmp(3).
DIGEST_CTX | rpmDigestDup (DIGEST_CTX octx)
| Duplicate a digest context.
DIGEST_CTX | rpmDigestInit (pgpHashAlgo hashalgo, rpmDigestFlags flags)
| Initialize digest.
int | rpmDigestUpdate (DIGEST_CTX ctx, const void *data, size_t len)
| Update context with next plain text buffer.
int | rpmDigestFinal (DIGEST_CTX ctx, void **datap, size_t *lenp, int asAscii)
| Return digest and destroy context.
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)
static const FDIO_t | fdGetIo (FD_t fd)
static void | fdSetIo (FD_t fd, FDIO_t io)
static FILE * | fdGetFILE (FD_t fd)
static void * | fdGetFp (FD_t fd)
static void | fdSetFp (FD_t fd, void *fp)
static int | fdGetFdno (FD_t fd)
static void | fdSetFdno (FD_t fd, int fdno)
static void | fdSetContentLength (FD_t fd, ssize_t contentLength)
static void | fdPush (FD_t fd, FDIO_t io, void *fp, int fdno)
static void | fdPop (FD_t fd)
static void | fdstat_enter (FD_t fd, int opx)
static time_t | tvsub (const struct timeval *etv, const struct timeval *btv)
static void | fdstat_exit (FD_t fd, int opx, ssize_t rc)
static void | fdstat_print (FD_t fd, const char *msg, FILE *fp)
static void | fdSetSyserrno (FD_t fd, int syserrno, const void *errcookie)
static int | fdGetRdTimeoutSecs (FD_t fd)
static long int | fdGetCpioPos (FD_t fd)
static void | fdSetCpioPos (FD_t fd, long int cpioPos)
static FD_t | c2f (void *cookie)
static void | fdInitDigest (FD_t fd, pgpHashAlgo hashalgo, int flags)
| Attach digest to fd.
static void | fdUpdateDigests (FD_t fd, const byte *buf, ssize_t buflen)
| Update digest(s) attached to fd.
static void | fdFiniDigest (FD_t fd, pgpHashAlgo hashalgo, void **datap, size_t *lenp, int asAscii)
static int fdio | _fileno (void *cookie)
typedef off_t | _libio_off_t
| Hide libio API lossage.
typedef off_t | _libio_pos_t

## Typedef Documentation

typedef off_t _libio_off_t

Hide libio API lossage.

The libio interface changed after glibc-2.1.3 to pass the seek offset argument as a pointer rather than as an off_t. The snarl below defines typedefs to isolate the lossage. API unchanged.

Definition at line 38 of file rpmio.h.

typedef off_t _libio_pos_t

Definition at line 39 of file rpmio.h.

typedef struct _FD_s* FD_t

Definition at line 45 of file rpmio.h.

typedef struct _FDDIGEST_s * FDDIGEST_t

typedef struct FDIO_s* FDIO_t

Definition at line 49 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.

## Enumeration Type Documentation

enum FDSTAT_e

Identify per-desciptor I/O operation statistics.

Enumerator:

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

Definition at line 33 of file rpmio_internal.h.

enum rpmDigestFlags_e

Bit(s) to control digest operation.

Enumerator:

  RPMDIGEST_NONE |

Definition at line 52 of file rpmio_internal.h.

## Function Documentation

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

Definition at line 521 of file rpmio_internal.h.

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

Definition at line 441 of file rpmio_internal.h.

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

Definition at line 605 of file rpmio.c.

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

Definition at line 487 of file rpmio_internal.h.

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

Definition at line 421 of file rpmio_internal.h.

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

Definition at line 256 of file rpmio_internal.h.

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

Definition at line 220 of file rpmio_internal.h.

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

Definition at line 232 of file rpmio_internal.h.

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

Definition at line 196 of file rpmio_internal.h.

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

Definition at line 411 of file rpmio_internal.h.

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

Attach digest to fd.

Definition at line 455 of file rpmio_internal.h.

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

Definition at line 300 of file rpmio_internal.h.

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

Definition at line 286 of file rpmio_internal.h.

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

Definition at line 276 of file rpmio_internal.h.

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

Definition at line 431 of file rpmio_internal.h.

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

Definition at line 266 of file rpmio_internal.h.

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

Definition at line 243 of file rpmio_internal.h.

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

Definition at line 207 of file rpmio_internal.h.

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

Definition at line 398 of file rpmio_internal.h.

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

Definition at line 313 of file rpmio_internal.h.

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

Definition at line 339 of file rpmio_internal.h.

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

Definition at line 365 of file rpmio_internal.h.

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

Update digest(s) attached to fd.

Definition at line 470 of file rpmio_internal.h.

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

Definition at line 1415 of file rpmio.c.

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

Definition at line 1946 of file rpmio.c.

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

Definition at line 1143 of file rpmio.c.

DIGEST_CTX rpmDigestDup | ( | DIGEST_CTX | octx | ) |

Duplicate a digest context.

Parameters:

  | ctx | existing digest context

Returns:
  duplicated digest context

Definition at line 39 of file digest.c.

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 119 of file digest.c.

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

Initialize digest.

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

Parameters:

  | flags | bit(s) to control digest operation

Returns:
  digest context

Definition at line 47 of file digest.c.

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.

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

Definition at line 324 of file rpmio_internal.h.

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

Definition at line 1825 of file rpmio.c.

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 30 of file strcasecmp.c.