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>

Include dependency graph for rpmio.h:

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

Go to the source code of this file.

Data Structures

struct  FDIO_s

Typedefs

typedef struct pgpDig_spgpDig
typedef struct pgpDigParams_spgpDigParams
typedef struct _FD_sFD_t
typedef struct FDIO_sFDIO_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_fopen_function_t )(const char *path, const char *fmode)
typedef FD_t(* fdio_fdopen_function_t )(void *cookie, const char *fmode)

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 xiscntrl (int c)
static int xisascii (int c)
static int xisprint (int c)
static int xisgraph (int c)
static int xispunct (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).
const char * xstrtolocale (const char *str)
 Force encoding of string.
static void * _free (const void *p)
 Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
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.


Detailed Description

Definition in file rpmio.h.


Define Documentation

#define fdClose ( _fd   )     fdio->close(_fd)

Definition at line 481 of file rpmio.h.

#define fdFree ( _fd,
_msg   )     XfdFree(_fd, _msg, __FILE__, __LINE__)

#define fdLink ( _fd,
_msg   )     XfdLink(_fd, _msg, __FILE__, __LINE__)

#define fdNew ( _msg   )     XfdNew(_msg, __FILE__, __LINE__)

Definition at line 530 of file rpmio.h.

Referenced by __fdOpen(), fdDup(), ftpOpen(), packageBinaries(), packageSources(), and urlConnect().

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

Definition at line 488 of file rpmio.h.

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

Definition at line 466 of file rpmio.h.

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

Definition at line 474 of file rpmio.h.

#define timedRead   (ufdio->read)


Typedef Documentation

typedef int(* fdio_close_function_t)(void *cookie)

Definition at line 84 of file rpmio.h.

typedef FD_t(* fdio_fdopen_function_t)(void *cookie, const char *fmode)

Definition at line 96 of file rpmio.h.

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

Definition at line 90 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 int(* fdio_seek_function_t)(void *cookie, _libio_pos_t pos, int whence)

Definition at line 78 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 enum ftperrCode_e ftperrCode

FTP and HTTP error codes.

typedef struct pgpDig_s* pgpDig

Definition at line 21 of file rpmio.h.

typedef struct pgpDigParams_s* pgpDigParams

Definition at line 25 of file rpmio.h.


Enumeration Type Documentation

FTP and HTTP error codes.

Enumerator:
FTPERR_NE_ERROR  Generic error.
FTPERR_NE_LOOKUP  Hostname lookup failed.
FTPERR_NE_AUTH  Server authentication failed.
FTPERR_NE_PROXYAUTH  Proxy authentication failed.
FTPERR_NE_CONNECT  Could not connect to server.
FTPERR_NE_TIMEOUT  Connection timed out.
FTPERR_NE_FAILED  The precondition failed.
FTPERR_NE_RETRY  Retry request.
FTPERR_NE_REDIRECT  Redirect received.
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 584 of file rpmio.h.


Function Documentation

static void* _free ( const void *  p  )  [inline, static]

Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.

Parameters:
p memory to free
Returns:
NULL always

Definition at line 749 of file rpmio.h.

char* _GetPass ( const char *  prompt  ) 

Definition at line 12 of file getpass.c.

char* _RequestPass ( const char *  prompt  ) 

Definition at line 19 of file getpass.c.

References argvSplit().

int Access ( const char *  path,
int  amode 
)

access(2) clone.

Todo:
Implement remotely.

Definition at line 1617 of file rpmrpc.c.

References _rpmio_debug, errno, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by rpmdbRebuild(), rpmInstallSourcePackage(), and rpmioAccess().

int Chdir ( const char *  path  ) 

chdir(2) clone.

Definition at line 95 of file rpmrpc.c.

References errno, ftpChdir(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by getOutputFrom(), rpmpsmStage(), rpmtsRun(), and runScript().

int Chmod ( const char *  path,
mode_t  mode 
)

chmod(2) clone.

Todo:
Implement remotely.

Definition at line 1425 of file rpmrpc.c.

References _rpmio_debug, errno, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by fsmStage().

int Chown ( const char *  path,
uid_t  owner,
gid_t  group 
)

chown(2) clone.

Todo:
Implement remotely.

Definition at line 1373 of file rpmrpc.c.

References _rpmio_debug, errno, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by fsmStage().

int Chroot ( const char *  path  ) 

chroot(2) clone.

Todo:
Implement remotely.

Definition at line 145 of file rpmrpc.c.

References _chroot_prefix, _free(), _rpmio_debug, errno, rpmGetPath(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by rpmpsmStage(), rpmtsRun(), and runScript().

int Closedir ( DIR *  dir  ) 

closedir(3) clone.

Definition at line 1776 of file rpmrpc.c.

References _rpmio_debug.

Referenced by Fts_open(), and Glob().

int Fclose ( FD_t  fd  ) 

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

fcntl(2) clone.

Definition at line 3256 of file rpmio.c.

References Fileno().

Referenced by rpmShowProgress().

int fdClose ( void *  cookie  ) 

FD_t fdDup ( int  fdno  ) 

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 
)

FD_t Fdopen ( FD_t  ofd,
const char *  fmode 
)

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

int fdReadable ( FD_t  fd,
int  secs 
)

Definition at line 564 of file rpmio.c.

References errno, and fdFileno().

Referenced by fdFgets(), ftpAbort(), ufdClose(), and ufdRead().

off_t fdSize ( FD_t  fd  ) 

int fdWritable ( FD_t  fd,
int  secs 
)

Definition at line 513 of file rpmio.c.

References _rpmio_debug, errno, and fdFileno().

Referenced by checkResponse(), ftpLogin(), and ufdWrite().

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

int Ferror ( FD_t  fd  ) 

int Fflush ( FD_t  fd  ) 

fflush(3) clone.

Definition at line 3183 of file rpmio.c.

References fdGetFILE, fdGetFp(), fdGetIo(), and fpio.

Referenced by copyFile(), cpio_doio(), extractRegular(), rpmpsmStage(), and writeRPM().

int Fileno ( FD_t  fd  ) 

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

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

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

fseek(3) clone.

Definition at line 2804 of file rpmio.c.

References DBGIO, fdbg(), fdGetFILE, fdGetIo(), FDIOVEC, FDSANE, fpio, and FDIO_s::seek.

Referenced by readRPM(), and writeRPM().

const char* Fstrerror ( FD_t  fd  ) 

const char* ftpStrerror ( int  errorNumber  ) 

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

fwrite(3) clone.

Definition at line 2779 of file rpmio.c.

References DBGIO, fdbg(), fdGetFILE, fdGetIo(), FDIOVEC, FDSANE, fpio, and FDIO_s::write.

Referenced by copyFile(), cpio_copy(), fsmStage(), rpmWriteSignature(), runScript(), ufdCopy(), writeLead(), and writeRPM().

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

int Glob_error ( const char *  epath,
int  eerrno 
)

glob_error(3) clone.

Definition at line 1688 of file rpmrpc.c.

Referenced by rpmGlob().

int Glob_pattern_p ( const char *  pattern,
int  quote 
)

glob_pattern_p(3) clone.

Definition at line 1648 of file rpmrpc.c.

References URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, and urlPath().

Referenced by processBinaryFile(), and rpmGlob().

void Globfree ( glob_t *  pglob  ) 

globfree(3) clone.

Definition at line 1731 of file rpmrpc.c.

References _rpmio_debug.

Referenced by rpmGlob().

int Lchown ( const char *  path,
uid_t  owner,
gid_t  group 
)

lchown(2) clone.

Todo:
Implement remotely.

Definition at line 1399 of file rpmrpc.c.

References _rpmio_debug, errno, lchown, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by fsmStage().

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

link(2) clone.

Definition at line 269 of file rpmrpc.c.

References _rpmio_debug, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, urlPath(), and xstrncasecmp().

Referenced by fsmStage().

off_t Lseek ( int  fdno,
off_t  offset,
int  whence 
)

lseek(2) clone.

Todo:
Implement SEEK_HOLE/SEEK_DATA.

Definition at line 1861 of file rpmrpc.c.

References _rpmio_debug.

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

int Mkdir ( const char *  path,
mode_t  mode 
)

mkdir(2) clone.

Definition at line 72 of file rpmrpc.c.

References ftpMkdir(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by fsmStage(), packageBinaries(), rpmdbRebuild(), rpmioMkpath(), and rpmMkdirPath().

int Mkfifo ( const char *  path,
mode_t  mode 
)

mkfifo(3) clone.

Todo:
Implement remotely.

Definition at line 1451 of file rpmrpc.c.

References _rpmio_debug, errno, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by fsmStage().

int Mknod ( const char *  path,
mode_t  mode,
dev_t  dev 
)

mknod(3) clone.

Todo:
Implement remotely.

Definition at line 1477 of file rpmrpc.c.

References _rpmio_debug, errno, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by fsmStage().

int Open ( const char *  path,
int  flags,
mode_t  mode 
)

open(2) clone.

Todo:
Implement remotely.

Definition at line 178 of file rpmrpc.c.

References _chroot_prefix, _rpmio_debug, errno, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by db_init().

DIR* Opendir ( const char *  path  ) 

opendir(3) clone.

Definition at line 1738 of file rpmrpc.c.

References _rpmio_debug, ftpOpendir(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by Fts_open(), and Glob().

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

readdir(3) clone.

Definition at line 1765 of file rpmrpc.c.

References _rpmio_debug.

Referenced by Fts_open(), and Glob().

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

readlink(2) clone.

Todo:
Implement remotely.

Definition at line 1589 of file rpmrpc.c.

References _rpmio_debug, errno, ftpReadlink(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by fsmStage(), genCpioListAndHeader(), rpmVerifyFile(), and statFormat().

char* Realpath ( const char *  path,
char *  resolved_path 
)

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

rename(2) clone.

Definition at line 220 of file rpmrpc.c.

References _rpmio_debug, ftpRename(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, urlPath(), and xstrncasecmp().

Referenced by fsmStage().

int Rmdir ( const char *  path  ) 

rmdir(2) clone.

Definition at line 119 of file rpmrpc.c.

References ftpRmdir(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by fsmStage(), and rpmdbRebuild().

int rpmioAccess ( const char *  FN,
const char *  path,
int  mode 
)

Check FN access, expanding relative paths and twiddles.

Parameters:
FN file path to check
path colon separated search path (NULL uses $PATH)
mode type of access(2) to check (0 uses X_OK)
Returns:
0 if accessible

Definition at line 3322 of file rpmio.c.

References _rpmio_debug, Access(), alloca_strdup, F_OK, getenv(), R_OK, rpmCleanPath(), stpcpy(), W_OK, and X_OK.

Referenced by rpmtsCreate(), and unsatisfiedDepend().

int rpmioMkpath ( const char *  path,
mode_t  mode,
uid_t  uid,
gid_t  gid 
)

Insure that directories in path exist, creating as needed.

Parameters:
path directory path
mode directory mode (if created)
uid directory uid (if created), or -1 to skip
gid directory uid (if created), or -1 to skip
Returns:
0 on success, errno (or -1) on error

Definition at line 3265 of file rpmio.c.

References alloca(), D_, errno, Mkdir(), RPMMESS_DEBUG, rpmMessage, Stat(), and stpcpy().

Referenced by db3open(), and makeTempFile().

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

int Symlink ( const char *  oldpath,
const char *  newpath 
)

symlink(3) clone.

Todo:
Implement remotely.

Definition at line 1559 of file rpmrpc.c.

References _rpmio_debug, errno, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by fsmStage().

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

int ufdCopy ( FD_t  sfd,
FD_t  tfd 
)

int ufdGetFile ( FD_t  sfd,
FD_t  tfd 
)

Definition at line 1605 of file rpmio.c.

References Fclose(), FDSANE, and ufdCopy().

Referenced by urlGetFile().

void* ufdGetUrlinfo ( FD_t  fd  ) 

Definition at line 1883 of file rpmio.c.

References FDSANE, _FD_s::url, and urlLink.

int Unlink ( const char *  path  ) 

const char* urlStrerror ( const char *  url  ) 

int Utime ( const char *  path,
const struct utimbuf *  buf 
)

utime(2) clone.

Todo:
Implement remotely.

Definition at line 1505 of file rpmrpc.c.

References _rpmio_debug, errno, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by fsmStage(), and rpmdbExportInfo().

int Utimes ( const char *  path,
const struct timeval *  times 
)

utimes(2) clone.

Todo:
Implement remotely.

FD_t XfdFree ( FD_t  fd,
const char *  msg,
const char *  fn,
unsigned  ln 
)

FD_t XfdLink ( void *  cookie,
const char *  msg,
const char *  fn,
unsigned  ln 
)

Definition at line 276 of file rpmio.c.

References c2f(), DBGREFS, fdbg(), FDNREFS, and _FD_s::nrefs.

Referenced by XfdNew().

FD_t XfdNew ( const char *  msg,
const char *  fn,
unsigned  ln 
)

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

Definition at line 693 of file rpmio.h.

References xisalpha(), and xisdigit().

Referenced by expandMacro(), parseRCPOT(), rdToken(), rpmdsPipe(), rpmdsSysinfoFile(), and xispunct().

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

Definition at line 687 of file rpmio.h.

References xislower(), and xisupper().

Referenced by doDefine(), doUndefine(), dpkgEVRctype(), parseBits(), rdToken(), xisalnum(), and xisrpmalpha().

static int xisascii ( int  c  )  [inline, static]

Definition at line 705 of file rpmio.h.

Referenced by xisgraph(), and xisprint().

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

Definition at line 696 of file rpmio.h.

Referenced by xisspace().

static int xiscntrl ( int  c  )  [inline, static]

Definition at line 702 of file rpmio.h.

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

static int xisgraph ( int  c  )  [inline, static]

Definition at line 711 of file rpmio.h.

References xisascii().

Referenced by xispunct().

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

Definition at line 681 of file rpmio.h.

Referenced by xisalpha(), and xtoupper().

static int xisprint ( int  c  )  [inline, static]

Definition at line 708 of file rpmio.h.

References xisascii().

static int xispunct ( int  c  )  [inline, static]

Definition at line 714 of file rpmio.h.

References xisalnum(), and xisgraph().

Referenced by xisrpmalpha().

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

Definition at line 699 of file rpmio.h.

References xisblank().

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

Definition at line 684 of file rpmio.h.

Referenced by xisalpha(), and xtolower().

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

Definition at line 718 of file rpmio.h.

References xisupper().

Referenced by _tagName(), myTagName(), rpmRebuildTargetVars(), xstrcasecmp(), and xstrncasecmp().

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

Definition at line 721 of file rpmio.h.

References xislower().


Variable Documentation

const char* _chroot_prefix

Definition at line 143 of file rpmrpc.c.

Referenced by Chroot(), and Open().

Referenced by fdbg().

Definition at line 511 of file rpmio.c.

Referenced by fdbg(), and XurlFree().

Definition at line 3516 of file rpmio.c.

Referenced by Fclose(), fdbg(), Fdopen(), Ferror(), Fflush(), Fopen(), Fread(), Fseek(), Fwrite(), and XurlFree().

char*(* Getpass)(const char *prompt)

Return a password.

Parameters:
prompt prompt string
Returns:
password

Referenced by rpmGetPassPhrase(), and urlFind().

Referenced by fdbg().

Referenced by fdbg(), Fdopen(), Ferror(), and getFdErrstr().

Definition at line 2286 of file rpmio.c.

Referenced by fdbg(), ftpOpen(), ufdOpen(), urlConnect(), and XfdNew().


Generated on Fri Jun 19 18:50:08 2009 for rpm by  doxygen 1.5.7.1