# rpmio/rpmio.h File Reference

`#include <sys/types.h>`
`#include <sys/stat.h>`
`#include <dirent.h>`
`#include <glob.h>`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <unistd.h>`

Go to the source code of this file.

## Data Structures
struct | FDIO_s
## Typedefs
typedef struct _FD_s * | FD_t
typedef struct FDIO_s * | FDIO_t
typedef off_t | _libio_off_t
| Hide libio API lossage.
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)
RPMRPC Vectors.
typedef int(* | fdio_mkdir_function_t )(const char *path, mode_t mode)
typedef int(* | fdio_chdir_function_t )(const char *path)
typedef int(* | fdio_rmdir_function_t )(const char *path)
typedef int(* | fdio_rename_function_t )(const char *oldpath, const char *newpath)
typedef int(* | fdio_unlink_function_t )(const char *path)
typedef int(* | fdio_stat_function_t )(const char *path, struct stat *st)
typedef int(* | fdio_lstat_function_t )(const char *path, struct stat *st)
typedef int(* | fdio_access_function_t )(const char *path, int amode)
## Functions
static int | xislower (int c)
static int | xisupper (int c)
static int | xisalpha (int c)
static int | xisdigit (int c)
static int | xisalnum (int c)
static int | xisblank (int c)
static int | xisspace (int c)
static int | xtolower (int c)
static int | xtoupper (int c)
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).
RPMIO Interface.
const char * | Fstrerror (FD_t fd)
| strerror(3) clone.
size_t | Fread (void *buf, size_t size, size_t nmemb, FD_t fd)
| fread(3) clone.
size_t | Fwrite (const void *buf, size_t size, size_t nmemb, FD_t fd)
| fwrite(3) clone.
int | Fseek (FD_t fd, _libio_off_t offset, int whence)
| fseek(3) clone.
int | Fclose (FD_t fd)
| fclose(3) clone.
FD_t | Fdopen (FD_t ofd, const char *fmode)
FD_t | Fopen (const char *path, const char *fmode)
| fopen(3) clone.
int | Fflush (FD_t fd)
| fflush(3) clone.
int | Ferror (FD_t fd)
| ferror(3) clone.
int | Fileno (FD_t fd)
| fileno(3) clone.
int | Fcntl (FD_t fd, int op, void *lip)
| fcntl(2) clone.
RPMRPC Interface.
int | Mkdir (const char *path, mode_t mode)
| mkdir(2) clone.
int | Chdir (const char *path)
| chdir(2) clone.
int | Rmdir (const char *path)
| rmdir(2) clone.
int | Rename (const char *oldpath, const char *newpath)
| rename(2) clone.
int | Link (const char *oldpath, const char *newpath)
| link(2) clone.
int | Unlink (const char *path)
| unlink(2) clone.
int | Readlink (const char *path, char *buf, size_t bufsiz)
| readlink(2) clone.
int | Stat (const char *path, struct stat *st)
| stat(2) clone.
int | Lstat (const char *path, struct stat *st)
| lstat(2) clone.
int | Access (const char *path, int amode)
| access(2) clone.
int | Glob (const char *pattern, int flags, int errfunc(const char *epath, int eerrno), glob_t *pglob)
| glob(3) clone.
void | Globfree (glob_t *pglob)
| globfree(3) clone.
DIR * | Opendir (const char *path)
| opendir(3) clone.
struct dirent * | Readdir (DIR *dir)
| readdir(3) clone.
int | Closedir (DIR *dir)
| closedir(3) clone.
## RPMIO Utilities.
#define | fdFileno(_fd) fdio->_fileno(_fd)
#define | fdOpen(_path, _flags, _mode) fdio->_open((_path), (_flags), (_mode))
#define | fdRead(_fd, _buf, _count) fdio->read((_fd), (_buf), (_count))
#define | fdWrite(_fd, _buf, _count) fdio->write((_fd), (_buf), (_count))
#define | fdCLose(_fd) fdio->close(_fd)
#define | fdLink(_fd, _msg) fdio->_fdref(_fd, _msg, __FILE__, __LINE__)
#define | fdFree(_fd, _msg) fdio->_fdderef(_fd, _msg, __FILE__, __LINE__)
#define | fdNew(_msg) fdio->_fdnew(_msg, __FILE__, __LINE__)
#define | timedRead ufdio->read
enum | ftperrCode_e { FTPERR_BAD_SERVER_RESPONSE = -1, FTPERR_SERVER_IO_ERROR = -2, FTPERR_SERVER_TIMEOUT = -3, FTPERR_BAD_HOST_ADDR = -4, FTPERR_BAD_HOSTNAME = -5, FTPERR_FAILED_CONNECT = -6, FTPERR_FILE_IO_ERROR = -7, FTPERR_PASSIVE_ERROR = -8, FTPERR_FAILED_DATA_CONNECT = -9, FTPERR_FILE_NOT_FOUND = -10, FTPERR_NIC_ABORT_IN_PROGRESS = -11, FTPERR_UNKNOWN = -100 }
| FTP and HTTP error codes. More...
typedef enum ftperrCode_e | ftperrCode
| FTP and HTTP error codes.
FDIO_t | fdio
FDIO_t | fpio
FDIO_t | ufdio
FDIO_t | gzdio
FDIO_t | bzdio
FDIO_t | fadio
off_t | fdSize (FD_t fd)
FD_t | fdDup (int fdno)
int | fdFileno (void *cookie)
FD_t | fdOpen (const char *path, int flags, mode_t mode)
ssize_t | fdRead (void *cookie, char *buf, size_t count)
ssize_t | fdWrite (void *cookie, const char *buf, size_t count)
int | fdClose (void *cookie)
FD_t | fdLink (void *cookie, const char *msg)
FD_t | fdFree (FD_t fd, const char *msg)
FD_t | fdNew (const char *msg)
int | fdWritable (FD_t fd, int secs)
int | fdReadable (FD_t fd, int secs)
const char *const | ftpStrerror (int errorNumber)
void * | ufdGetUrlinfo (FD_t fd)
const char * | urlStrerror (const char *url)
int | ufdCopy (FD_t sfd, FD_t tfd)
int | ufdGetFile (FD_t sfd, FD_t tfd)
int | timedRead (FD_t fd, void *bufptr, int length)

## Detailed Description

Definition in file rpmio.h.

## Define Documentation

#define fdCLose | ( | _fd |  | ) | fdio->close(_fd)

Definition at line 485 of file rpmio.h.

#define fdFileno | ( | _fd |  | ) | fdio->_fileno(_fd)

Definition at line 456 of file rpmio.h.

#define fdFree | ( | _fd,
|  | _msg |  | ) | fdio->_fdderef(_fd, _msg, __FILE__, __LINE__)

Definition at line 503 of file rpmio.h.

#define fdLink | ( | _fd,
|  | _msg |  | ) | fdio->_fdref(_fd, _msg, __FILE__, __LINE__)

Definition at line 494 of file rpmio.h.

#define fdNew | ( | _msg |  | ) | fdio->_fdnew(_msg, __FILE__, __LINE__)

Definition at line 512 of file rpmio.h.

#define fdOpen | ( | _path,
|  | _flags,
|  | _mode |  | ) | fdio->_open((_path), (_flags), (_mode))

Definition at line 464 of file rpmio.h.

#define fdRead | ( | _fd,
|  | _buf,
|  | _count |  | ) | fdio->read((_fd), (_buf), (_count))

Definition at line 471 of file rpmio.h.

#define fdWrite | ( | _fd,
|  | _buf,
|  | _count |  | ) | fdio->write((_fd), (_buf), (_count))

Definition at line 478 of file rpmio.h.

#define timedRead ufdio->read

Definition at line 585 of file rpmio.h.

## Typedef Documentation

typedef int(* fdio_access_function_t)(const char *path, int amode)

Definition at line 191 of file rpmio.h.

typedef int(* fdio_chdir_function_t)(const char *path)

Definition at line 154 of file rpmio.h.

typedef int(* fdio_close_function_t)(void *cookie)

Definition at line 80 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 94 of file rpmio.h.

typedef void*(* fdio_ffileno_function_t)(FD_t fd)

Definition at line 129 of file rpmio.h.

typedef int(* fdio_fflush_function_t)(FD_t fd)

Definition at line 135 of file rpmio.h.

typedef int(* fdio_fileno_function_t)(void *cookie)

Definition at line 110 of file rpmio.h.

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

Definition at line 123 of file rpmio.h.

typedef int(* fdio_lstat_function_t)(const char *path,struct stat *st)

Definition at line 185 of file rpmio.h.

typedef int(* fdio_mkdir_function_t)(const char *path, mode_t mode)

Definition at line 148 of file rpmio.h.

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

Definition at line 102 of file rpmio.h.

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

Definition at line 117 of file rpmio.h.

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

Definition at line 62 of file rpmio.h.

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

Definition at line 87 of file rpmio.h.

typedef int(* fdio_rename_function_t)(const char *oldpath, const char *newpath)

Definition at line 166 of file rpmio.h.

typedef int(* fdio_rmdir_function_t)(const char *path)

Definition at line 160 of file rpmio.h.

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

Definition at line 74 of file rpmio.h.

typedef int(* fdio_stat_function_t)(const char *path,struct stat *st)

Definition at line 179 of file rpmio.h.

typedef int(* fdio_unlink_function_t)(const char *path)

Definition at line 172 of file rpmio.h.

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

Definition at line 68 of file rpmio.h.

typedef enum ftperrCode_e ftperrCode

FTP and HTTP error codes.

## Enumeration Type Documentation

enum ftperrCode_e

FTP and HTTP error codes.

Enumerator:

  FTPERR_BAD_SERVER_RESPONSE | Bad server response
  FTPERR_SERVER_IO_ERROR | Server I/O error
  FTPERR_SERVER_TIMEOUT | Server timeout
  FTPERR_BAD_HOST_ADDR | Unable to lookup server host address
  FTPERR_BAD_HOSTNAME | Unable to lookup server host name
  FTPERR_FAILED_CONNECT | Failed to connect to server
  FTPERR_FILE_IO_ERROR | Failed to establish data connection to server
  FTPERR_PASSIVE_ERROR | I/O error to local file
  FTPERR_FAILED_DATA_CONNECT | Error setting remote server to passive mode
  FTPERR_FILE_NOT_FOUND | File not found on server
  FTPERR_NIC_ABORT_IN_PROGRESS | Abort in progress
  FTPERR_UNKNOWN | Unknown or unexpected error

Definition at line 531 of file rpmio.h.

## Function Documentation

int Access | ( | const char * | path,
|  | int | amode |
| ) |  |  |

access(2) clone.

Definition at line 1137 of file rpmrpc.c.

int Chdir | ( | const char * | path | ) |

chdir(2) clone.

Definition at line 92 of file rpmrpc.c.

int Closedir | ( | DIR * | dir | ) |

closedir(3) clone.

Definition at line 1233 of file rpmrpc.c.

int Fclose | ( | FD_t | fd | ) |

fclose(3) clone.

Definition at line 2699 of file rpmio.c.

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

fcntl(2) clone.

Definition at line 3108 of file rpmio.c.

int fdClose | ( | void * | cookie | ) |

Definition at line 456 of file rpmio.c.

FD_t fdDup | ( | int | fdno | ) |

Definition at line 229 of file rpmio.c.

int fdFileno | ( | void * | cookie | ) |

FD_t fdFree | ( | FD_t | fd,
|  | const char * | msg |
| ) |  |  |

FD_t fdLink | ( | void * | cookie,
|  | const char * | msg |
| ) |  |  |

FD_t fdNew | ( | const char * | msg | ) |

FD_t fdOpen | ( | const char * | path,
|  | int | flags,
|  | mode_t | mode |
| ) |  |  |

Definition at line 482 of file rpmio.c.

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

Definition at line 2850 of file rpmio.c.

ssize_t fdRead | ( | void * | cookie,
|  | char * | buf,
|  | size_t | count |
| ) |  |  |

Definition at line 373 of file rpmio.c.

int fdReadable | ( | FD_t | fd,
|  | int | secs |
| ) |  |  |

Definition at line 567 of file rpmio.c.

off_t fdSize | ( | FD_t | fd | ) |

Definition at line 204 of file rpmio.c.

int fdWritable | ( | FD_t | fd,
|  | int | secs |
| ) |  |  |

Definition at line 527 of file rpmio.c.

ssize_t fdWrite | ( | void * | cookie,
|  | const char * | buf,
|  | size_t | count |
| ) |  |  |

Definition at line 395 of file rpmio.c.

int Ferror | ( | FD_t | fd | ) |

ferror(3) clone.

Definition at line 3059 of file rpmio.c.

int Fflush | ( | FD_t | fd | ) |

fflush(3) clone.

Definition at line 3039 of file rpmio.c.

int Fileno | ( | FD_t | fd | ) |

fileno(3) clone.

Definition at line 3094 of file rpmio.c.

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

fopen(3) clone.

Definition at line 2962 of file rpmio.c.

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

fread(3) clone.

Definition at line 2613 of file rpmio.c.

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

fseek(3) clone.

Definition at line 2665 of file rpmio.c.

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

strerror(3) clone.

Definition at line 2602 of file rpmio.c.

const char* const ftpStrerror | ( | int | errorNumber | ) |

Definition at line 671 of file rpmio.c.

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

fwrite(3) clone.

Definition at line 2640 of file rpmio.c.

int Glob | ( | const char * | pattern,
|  | int | flags,
|  | int | errfuncconst char *epath, int eerrno,
|  | glob_t * | pglob |
| ) |  |  |

glob(3) clone.

Definition at line 1160 of file rpmrpc.c.

void Globfree | ( | glob_t * | pglob | ) |

globfree(3) clone.

Definition at line 1188 of file rpmrpc.c.

int Link | ( | const char * | oldpath,
|  | const char * | newpath |
| ) |  |  |

link(2) clone.

Definition at line 187 of file rpmrpc.c.

int Lstat | ( | const char * | path,
|  | struct stat * | st |
| ) |  |  |

lstat(2) clone.

Definition at line 1089 of file rpmrpc.c.

int Mkdir | ( | const char * | path,
|  | mode_t | mode |
| ) |  |  |

mkdir(2) clone.

Definition at line 69 of file rpmrpc.c.

DIR* Opendir | ( | const char * | path | ) |

opendir(3) clone.

Definition at line 1200 of file rpmrpc.c.

struct dirent* Readdir | ( | DIR * | dir | ) | `[read]`

readdir(3) clone.

Definition at line 1226 of file rpmrpc.c.

int Readlink | ( | const char * | path,
|  | char * | buf,
|  | size_t | bufsiz |
| ) |  |  |

readlink(2) clone.

Definition at line 1114 of file rpmrpc.c.

int Rename | ( | const char * | oldpath,
|  | const char * | newpath |
| ) |  |  |

rename(2) clone.

Definition at line 140 of file rpmrpc.c.

int Rmdir | ( | const char * | path | ) |

rmdir(2) clone.

Definition at line 115 of file rpmrpc.c.

int Stat | ( | const char * | path,
|  | struct stat * | st |
| ) |  |  |

stat(2) clone.

Definition at line 1064 of file rpmrpc.c.

int timedRead | ( | FD_t | fd,
|  | void * | bufptr,
|  | int | length |
| ) |  |  |

int ufdCopy | ( | FD_t | sfd,
|  | FD_t | tfd |
| ) |  |  |

Definition at line 1298 of file rpmio.c.

int ufdGetFile | ( | FD_t | sfd,
|  | FD_t | tfd |
| ) |  |  |

Definition at line 1402 of file rpmio.c.

void* ufdGetUrlinfo | ( | FD_t | fd | ) |

Definition at line 1665 of file rpmio.c.

int Unlink | ( | const char * | path | ) |

unlink(2) clone.

Definition at line 231 of file rpmrpc.c.

const char* urlStrerror | ( | const char * | url | ) |

Definition at line 715 of file rpmio.c.

static int xisalnum | ( | int | c | ) | `[inline, static]`

Definition at line 626 of file rpmio.h.

static int xisalpha | ( | int | c | ) | `[inline, static]`

Definition at line 620 of file rpmio.h.

static int xisblank | ( | int | c | ) | `[inline, static]`

Definition at line 629 of file rpmio.h.

static int xisdigit | ( | int | c | ) | `[inline, static]`

Definition at line 623 of file rpmio.h.

static int xislower | ( | int | c | ) | `[inline, static]`

Definition at line 614 of file rpmio.h.

static int xisspace | ( | int | c | ) | `[inline, static]`

Definition at line 632 of file rpmio.h.

static int xisupper | ( | int | c | ) | `[inline, static]`

Definition at line 617 of file rpmio.h.

static int xtolower | ( | int | c | ) | `[inline, static]`

Definition at line 636 of file rpmio.h.

static int xtoupper | ( | int | c | ) | `[inline, static]`

Definition at line 639 of file rpmio.h.

## Variable Documentation

FDIO_t bzdio

FDIO_t fadio

Definition at line 51 of file falloc.c.

FDIO_t fdio

Definition at line 521 of file rpmio.c.

FDIO_t fpio

Definition at line 3173 of file rpmio.c.

FDIO_t gzdio

FDIO_t ufdio

Definition at line 2124 of file rpmio.c.