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

rpmio/rpmio.h File Reference

More...

#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

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
typedef enum ftperrCode_e ftperrCode
 FTP and HTTP error codes.

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...

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)
int rpmioMkpath (const char *path, mode_t mode, uid_t uid, gid_t gid)
 Insure that directories in path exist, creating as needed.

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)
FDIO_t fdio
FDIO_t fpio
FDIO_t ufdio
FDIO_t gzdio
FDIO_t bzdio
FDIO_t fadio

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)

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.

dirent * Readdir (DIR *dir)
 readdir(3) clone.

int Closedir (DIR *dir)
 closedir(3) clone.


Typedefs

typedef pgpDig_spgpDig
typedef pgpDigParams_spgpDigParams
typedef _FD_sFD_t
typedef FDIO_sFDIO_t

Functions

int xislower (int c)
int xisupper (int c)
int xisalpha (int c)
int xisdigit (int c)
int xisalnum (int c)
int xisblank (int c)
int xisspace (int c)
int xtolower (int c)
int xtoupper (int c)
int xstrcasecmp (const char *s1, const char *s2)
int xstrncasecmp (const char *s1, const char *s2, size_t n)


Detailed Description

Definition in file rpmio.h.


Define Documentation

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

Definition at line 504 of file rpmio.h.

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

Definition at line 471 of file rpmio.h.

Referenced by __fdClose(), __fdRead(), __fdWrite(), fdFgets(), fdReadable(), fdSeek(), fdWritable(), ftpLogin(), and urlConnect().

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

Definition at line 522 of file rpmio.h.

Referenced by __fdClose(), closeCallback(), delTE(), fsmTeardown(), manageFile(), packageBinaries(), packageSources(), rpmShowProgress(), rpmtsFree(), rpmtsSetScriptFd(), ufdClose(), and urlConnect().

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

Definition at line 513 of file rpmio.h.

Referenced by closeCallback(), fsmSetup(), ftpLogin(), ftpNLST(), manageFile(), rpmfd_Fopen(), rpmInstallSourcePackage(), rpmShowProgress(), rpmtsSetScriptFd(), and urlConnect().

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

Definition at line 531 of file rpmio.h.

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

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

Definition at line 479 of file rpmio.h.

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

Definition at line 489 of file rpmio.h.

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

Definition at line 497 of file rpmio.h.

#define timedRead   ufdio->read
 

Definition at line 619 of file rpmio.h.

Referenced by makeGPGSignature(), makePGPSignature(), readLead(), rpmReadHeader(), and rpmReadSignature().


Typedef Documentation

typedef enum ftperrCode_e ftperrCode
 

FTP and HTTP error codes.

typedef struct pgpDig_s* pgpDig
 

Definition at line 21 of file rpmio.h.

Referenced by getSignid(), headerCheck(), pgpCleanDig(), pgpFreeDig(), pgpNewDig(), pgpPrtPkts(), pgpsigFormat(), readFile(), rpmcliImportPubkey(), rpmdbAdd(), rpmdbRemove(), rpmReadPackageFile(), rpmtsDig(), rpmtsFindPubkey(), rpmtsPubkey(), rpmtsSignature(), rpmtsStashKeyid(), rpmVerifySignature(), rpmVerifySignatures(), verifyGPGSignature(), verifyMD5Signature(), verifyPGPSignature(), verifySHA1Signature(), and verifySizeSignature().

typedef struct pgpDigParams_s* pgpDigParams
 

Definition at line 25 of file rpmio.h.

Referenced by pgpsigFormat(), rpmcliImportPubkey(), rpmtsFindPubkey(), rpmtsPubkey(), rpmtsSignature(), rpmtsStashKeyid(), rpmVerifySignatures(), verifyGPGSignature(), and verifyPGPSignature().


Enumeration Type Documentation

enum ftperrCode_e
 

FTP and HTTP error codes.

Enumeration values:
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 562 of file rpmio.h.


Function Documentation

int fdClose void *  cookie  ) 
 

FD_t fdDup int  fdno  ) 
 

Definition at line 220 of file rpmio.c.

References DBGIO, FD_t, fdbg(), fdNew, and fdSetFdno().

Referenced by cpio_doio(), domd5(), main(), readRPM(), rpmHeaderFromFD(), rpmMergeHeadersFromFD(), rpmpsmStage(), rpmts_HdrFromFdno(), rpmts_setattr(), rpmtsCallback(), runScript(), and showVerifyPackage().

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
 

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

int fdReadable FD_t  fd,
int  secs
 

Definition at line 523 of file rpmio.c.

References errno, FD_t, and fdFileno.

Referenced by fdFgets(), and ufdClose().

int fdWritable FD_t  fd,
int  secs
 

Definition at line 483 of file rpmio.c.

References _rpmio_debug, errno, FD_t, fdFileno, and strerror().

Referenced by checkResponse(), and ftpLogin().

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

const char* const ftpStrerror int  errorNumber  ) 
 

Definition at line 629 of file rpmio.c.

References _, FTPERR_BAD_HOST_ADDR, FTPERR_BAD_HOSTNAME, FTPERR_BAD_SERVER_RESPONSE, FTPERR_FAILED_CONNECT, FTPERR_FAILED_DATA_CONNECT, FTPERR_FILE_IO_ERROR, FTPERR_FILE_NOT_FOUND, FTPERR_NIC_ABORT_IN_PROGRESS, FTPERR_PASSIVE_ERROR, FTPERR_SERVER_IO_ERROR, FTPERR_SERVER_TIMEOUT, and FTPERR_UNKNOWN.

Referenced by doUntar(), ftpLogin(), rpmInstall(), tcpConnect(), and urlStrerror().

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 diretory 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 3077 of file rpmio.c.

References errno.

Referenced by db3open(), and makeTempFile().

int timedRead FD_t  fd,
void *  bufptr,
int  length
 

int ufdCopy FD_t  sfd,
FD_t  tfd
 

Definition at line 1273 of file rpmio.c.

References RPMCALLBACK_INST_OPEN_FILE, urlNotify, and urlNotifyData.

Referenced by main().

int ufdGetFile FD_t  sfd,
FD_t  tfd
 

Definition at line 1383 of file rpmio.c.

void* ufdGetUrlinfo FD_t  fd  ) 
 

Definition at line 1648 of file rpmio.c.

const char* urlStrerror const char *  url  ) 
 

Definition at line 673 of file rpmio.c.

References errno, ftpStrerror(), urlinfo_s::openError, strerror(), URL_IS_FTP, URL_IS_HTTP, urlinfo, urlIsURL(), and urlSplit().

int xisalnum int  c  )  [inline, static]
 

Definition at line 660 of file rpmio.h.

References xisalpha(), and xisdigit().

Referenced by expandMacro(), parseRCPOT(), rdToken(), and rpmvercmp().

int xisalpha int  c  )  [inline, static]
 

Definition at line 654 of file rpmio.h.

References xislower(), and xisupper().

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

int xisblank int  c  )  [inline, static]
 

Definition at line 663 of file rpmio.h.

Referenced by xisspace().

int xisdigit int  c  )  [inline, static]
 

Definition at line 657 of file rpmio.h.

Referenced by defaultMachine(), doFoo(), getHostAddress(), parseEVR(), parseForDev(), parseFormat(), rdToken(), rpmtsInitIterator(), rpmvercmp(), and xisalnum().

int xislower int  c  )  [inline, static]
 

Definition at line 648 of file rpmio.h.

Referenced by xisalpha(), and xtoupper().

int xisspace int  c  )  [inline, static]
 

Definition at line 666 of file rpmio.h.

References xisblank().

Referenced by addChangelog(), copyNextLine(), db3New(), dbiTagsInit(), doReadRC(), findLastChar(), findPreambleTag(), isPart(), machCompatCacheAdd(), parseBits(), rdToken(), readLine(), stripTrailingBlanksStringBuf(), and unsatisfiedDepend().

int xisupper int  c  )  [inline, static]
 

Definition at line 651 of file rpmio.h.

Referenced by xisalpha(), and xtolower().

int xtolower int  c  )  [inline, static]
 

Definition at line 670 of file rpmio.h.

References xisupper().

Referenced by rpmRebuildTargetVars(), tagName(), xstrcasecmp(), and xstrncasecmp().

int xtoupper int  c  )  [inline, static]
 

Definition at line 673 of file rpmio.h.

References xislower().


Variable Documentation

FDIO_t bzdio
 

Definition at line 640 of file rpmio.h.

Referenced by fdbg(), and Fflush().

FDIO_t fadio
 

Definition at line 644 of file rpmio.h.

FDIO_t fdio
 

Definition at line 624 of file rpmio.h.

Referenced by fdbg(), Fdopen(), ufdRead(), ufdWrite(), XfdNew(), and XurlFree().

FDIO_t fpio
 

Definition at line 628 of file rpmio.h.

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

FDIO_t gzdio
 

Definition at line 636 of file rpmio.h.

Referenced by fdbg(), Fflush(), and getFdErrstr().

FDIO_t ufdio
 

Definition at line 632 of file rpmio.h.

Referenced by Fclose(), fdbg(), and urlConnect().


Generated on Thu Apr 21 23:00:34 2005 for rpm by doxygen 1.3.5