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

rpmio/rpmio_internal.h File Reference

More...

#include <rpmio.h>
#include <rpmurl.h>
#include <rpmpgp.h>

Go to the source code of this file.

Data Structures

struct  _FD_s
struct  _FDDIGEST_s
struct  _FDSTACK_s
struct  OPSTAT_t

Defines

#define RPMIO_DEBUG_IO   0x40000000
#define RPMIO_DEBUG_REFS   0x20000000
#define FDMAGIC   0x04463138
#define FDDIGEST_MAX   4
#define FDSANE(fd)   assert(fd && fd->magic == FDMAGIC)
#define DBG(_f, _m, _x)   if ((_rpmio_debug | ((_f) ? ((FD_t)(_f))->flags : 0)) & (_m)) fprintf _x
#define DBGIO(_f, _x)   DBG((_f), RPMIO_DEBUG_IO, _x)
#define DBGREFS(_f, _x)   DBG((_f), RPMIO_DEBUG_REFS, _x)

Typedefs

typedef _FDSTACK_s FDSTACK_t
struct {
   timeval   create
   timeval   begin
   OPSTAT_t   ops [4]
FDSTAT_t
typedef enum rpmDigestFlags_e rpmDigestFlags
typedef _FDDIGEST_sFDDIGEST_t

Enumerations

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

Functions

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)
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)
int rpmioSlurp (const char *fn, const unsigned char **bp, ssize_t *blenp)

Variables

int _rpmio_debug
int _ftp_debug


Detailed Description

Definition in file rpmio_internal.h.


Define Documentation

#define DBG _f,
_m,
_x       if ((_rpmio_debug | ((_f) ? ((FD_t)(_f))->flags : 0)) & (_m)) fprintf _x
 

Definition at line 157 of file rpmio_internal.h.

#define DBGIO _f,
_x       DBG((_f), RPMIO_DEBUG_IO, _x)
 

Definition at line 164 of file rpmio_internal.h.

Referenced by Fclose(), fdClose(), fdDup(), Fdopen(), fdOpen(), fdRead(), fdSeek(), fdSize(), fdWrite(), Ferror(), Fileno(), Fread(), Fseek(), ftpAbort(), Fwrite(), ufdCopy(), and ufdOpen().

#define DBGREFS _f,
_x       DBG((_f), RPMIO_DEBUG_REFS, _x)
 

Definition at line 165 of file rpmio_internal.h.

Referenced by XfdFree(), and XfdLink().

#define FDDIGEST_MAX   4
 

Definition at line 136 of file rpmio_internal.h.

Referenced by fdInitDigest().

#define FDMAGIC   0x04463138
 

Definition at line 118 of file rpmio_internal.h.

Referenced by XfdNew().

#define FDSANE fd       assert(fd && fd->magic == FDMAGIC)
 

Definition at line 146 of file rpmio_internal.h.

Referenced by c2f(), Fclose(), fdGetCpioPos(), fdGetFdno(), fdGetFILE(), fdGetFp(), fdGetIo(), fdGetRdTimeoutSecs(), Fdopen(), fdPop(), fdPush(), fdSeekNot(), fdSetContentLength(), fdSetCpioPos(), fdSetFdno(), fdSetFp(), fdSetIo(), fdSetSyserrno(), fdSize(), Fread(), Fseek(), Fstrerror(), Fwrite(), ufdGetFile(), ufdGetUrlinfo(), and XfdFree().

#define RPMIO_DEBUG_IO   0x40000000
 

Definition at line 115 of file rpmio_internal.h.

#define RPMIO_DEBUG_REFS   0x20000000
 

Definition at line 116 of file rpmio_internal.h.


Function Documentation

int fdFgets FD_t    fd,
char *    buf,
size_t    len
 

Definition at line 585 of file rpmio.c.

References errno, fdFileno, fdRead, fdReadable(), _FD_s::rd_timeoutsecs, and _FD_s::syserrno.

Referenced by checkResponse(), and ftpNLST().

int fdFileno void *    cookie [inline, static]
 

Definition at line 531 of file rpmio_internal.h.

References c2f(), _FDSTACK_s::fdno, and _FD_s::fps.

int ftpCmd const char *    cmd,
const char *    url,
const char *    arg2
 

Definition at line 1395 of file rpmio.c.

References urlinfo_s::ctrl, fdFree, ftpCommand(), urlConnect(), and urlPath().

Referenced by ftpChdir(), ftpMkdir(), ftpRename(), ftpReq(), ftpRmdir(), and ftpUnlink().

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

Definition at line 1926 of file rpmio.c.

References _FD_s::bytesRemain, _FD_s::contentLength, urlinfo_s::data, fdLink, fdNew, fdSetIo(), _FD_s::ftpFileDoneNeeded, ftpTimeoutSecs, _FD_s::rd_timeoutsecs, ufdio, _FD_s::url, URL_IS_FTP, urlConnect(), urlLink, and _FD_s::urlType.

Referenced by ftpNLST(), and ufdOpen().

int ftpReq FD_t    data,
const char *    ftpCmd,
const char *    ftpArg
 

Definition at line 1123 of file rpmio.c.

References alloca(), _FD_s::contentLength, urlinfo_s::ctrl, errno, fdClose(), fdFileno, fdLink, fdSetFdno(), fdSetSyserrno(), fdWrite, ftpCheckResponse(), ftpCmd(), ftpCommand(), FTPERR_BAD_SERVER_RESPONSE, FTPERR_FAILED_CONNECT, FTPERR_FAILED_DATA_CONNECT, FTPERR_PASSIVE_ERROR, FTPERR_SERVER_IO_ERROR, FTPERR_UNKNOWN, _FD_s::ftpFileDoneNeeded, ftpStrerror(), inet_aton(), stpcpy(), _FD_s::url, and URLSANE.

Referenced by ftpNLST(), and ufdOpen().

DIGEST_CTX rpmDigestDup DIGEST_CTX    octx
 

Duplicate a digest context.

Parameters:
octx  existing digest context
Returns:
duplicated digest context

Definition at line 39 of file digest.c.

References DIGEST_CTX_s::param, DIGEST_CTX_s::paramlen, and xcalloc().

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.

References DIGEST_CTX_s::Digest, DIGEST_CTX_s::digestlen, DPRINTF, IS_LITTLE_ENDIAN, DIGEST_CTX_s::param, DIGEST_CTX_s::paramlen, and xmalloc().

Referenced by fdFiniDigest(), pgpFreeDig(), rpmVerifyDigest(), and XfdFree().

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

References DIGEST_CTX_s::datalen, DIGEST_CTX_s::Digest, DIGEST_CTX_s::digestlen, DPRINTF, DIGEST_CTX_s::flags, DIGEST_CTX_s::param, DIGEST_CTX_s::paramlen, pgpHashAlgo, PGPHASHALGO_HAVAL_5_160, PGPHASHALGO_MD2, PGPHASHALGO_MD5, PGPHASHALGO_RIPEMD160, PGPHASHALGO_SHA1, PGPHASHALGO_TIGER192, DIGEST_CTX_s::Reset, rpmDigestFlags, DIGEST_CTX_s::Update, and xcalloc().

Referenced by fdInitDigest(), and rpmVerifyDigest().

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.

References DPRINTF, DIGEST_CTX_s::param, and DIGEST_CTX_s::Update.

Referenced by fdUpdateDigests(), and rpmVerifyDigest().

int rpmioSlurp const char *    fn,
const unsigned char **    bp,
ssize_t *    blenp
 

Referenced by pgpReadPkts(), and rpmPlatform().

int ufdClose void *    cookie
 

Definition at line 1805 of file rpmio.c.

References _FD_s::bytesRemain, c2f(), _FD_s::contentLength, urlinfo_s::ctrl, urlinfo_s::data, fdClose(), fdFree, fdGetFILE, fdReadable(), fdSetFp(), fdWrite, ftpAbort(), ftpFileDone(), _FD_s::ftpFileDoneNeeded, httpResp(), urlinfo_s::httpVersion, noLibio, _FD_s::persist, urlinfo_s::service, UFDONLY, _FD_s::url, URL_IS_FTP, urlFree, urlinfo_s::urltype, and _FD_s::wr_chunked.

Referenced by Fclose(), ftpNLST(), and ufdOpen().


Variable Documentation

int _ftp_debug
 

Definition at line 154 of file rpmio_internal.h.

Referenced by httpResp().

int _rpmio_debug
 

Definition at line 150 of file rpmio_internal.h.

struct timeval begin
 

Operation start time.

Definition at line 45 of file rpmio_internal.h.

Referenced by rpmCleanPath().

struct timeval create
 

Structure creation time.

Definition at line 44 of file rpmio_internal.h.

OPSTAT_t ops[4]
 

Cumulative statistics.

Definition at line 46 of file rpmio_internal.h.

Referenced by fdstat_print().


Generated on Sun Feb 2 23:32:12 2003 for rpm by doxygen1.2.18