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

rpmio/rpmio.c File Reference

More...

#include "system.h"
#include <stdarg.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <rpmio_internal.h>
#include "ugid.h"
#include "rpmmessages.h"
#include "debug.h"

Go to the source code of this file.

RPMIO Utilities.

off_t fdSize (FD_t fd)
FD_t fdDup (int fdno)
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 fdOpen (const char *path, int flags, mode_t mode)
int fdWritable (FD_t fd, int secs)
int fdReadable (FD_t fd, int secs)
const char* const ftpStrerror (int errorNumber)
const char* urlStrerror (const char *url)
int ufdCopy (FD_t sfd, FD_t tfd)
int ufdGetFile (FD_t sfd, FD_t tfd)
void* ufdGetUrlinfo (FD_t fd)
FDIO_t fdio = &fdio_s
FDIO_t ufdio = &ufdio_s
FDIO_t fpio = &fpio_s

RPMIO Interface.

const char* Fstrerror (FD_t fd)
 strerror(3) clone. More...

size_t Fread (void *buf, size_t size, size_t nmemb, FD_t fd)
 fread(3) clone. More...

size_t Fwrite (const void *buf, size_t size, size_t nmemb, FD_t fd)
 fwrite(3) clone. More...

int Fseek (FD_t fd, _libio_off_t offset, int whence)
 fseek(3) clone. More...

int Fclose (FD_t fd)
 fclose(3) clone. More...

FD_t Fdopen (FD_t ofd, const char *fmode)
FD_t Fopen (const char *path, const char *fmode)
 fopen(3) clone. More...

int Fflush (FD_t fd)
 fflush(3) clone. More...

int Ferror (FD_t fd)
 ferror(3) clone. More...

int Fileno (FD_t fd)
 fileno(3) clone. More...

int Fcntl (FD_t fd, int op, void *lip)
 fcntl(2) clone. More...

ssize_t Pread (FD_t fd, void *buf, size_t count, _libio_off_t offset)
 pread(2) clone. More...

ssize_t Pwrite (FD_t fd, const void *buf, size_t count, _libio_off_t offset)
 pwrite(2) clone. More...


Defines

#define IPPORT_FTP   21
#define IPPORT_HTTP   80
#define FDNREFS(fd)   (fd ? ((FD_t)fd)->nrefs : -9)
#define FDTO(fd)   (fd ? ((FD_t)fd)->rd_timeoutsecs : -99)
#define FDCPIOPOS(fd)   (fd ? ((FD_t)fd)->fd_cpioPos : -99)
#define FDONLY(fd)   assert(fdGetIo(fd) == fdio)
#define GZDONLY(fd)   assert(fdGetIo(fd) == gzdio)
#define BZDONLY(fd)   assert(fdGetIo(fd) == bzdio)
#define UFDONLY(fd)
#define fdGetFILE(_fd)   ((FILE *)fdGetFp(_fd))
#define TIMEOUT_SECS   60
#define IAC   255
#define IP   244
#define DM   242
#define SHUT_RDWR   1+1
#define FDIOVEC(_fd, _vec)

Functions

int inet_aton (const char *cp, struct in_addr *inp)
void* _free (const void *p)
 Wrapper to free(3), hides const compilation noise, permit NULL, return NULL. More...

const char* fdbg (FD_t fd)
int fdSeekNot (void *cookie, _libio_pos_t pos, int whence)
FD_t XfdLink (void *cookie, const char *msg, const char *file, unsigned line)
FD_t XfdFree (FD_t fd, const char *msg, const char *file, unsigned line)
FD_t XfdNew (const char *msg, const char *file, unsigned line)
int fdSeek (void *cookie, _libio_pos_t pos, int whence)
int fdFgets (FD_t fd, char *buf, size_t len)
int mygethostbyname (const char *host, struct in_addr *address)
int getHostAddress (const char *host, struct in_addr *address)
int tcpConnect (FD_t ctrl, const char *host, int port)
int checkResponse (void *uu, FD_t ctrl, int *ecp, char **str)
int ftpCheckResponse (urlinfo u, char **str)
int ftpCommand (urlinfo u, char **str,...)
int ftpLogin (urlinfo u)
int ftpReq (FD_t data, const char *ftpCmd, const char *ftpArg)
void urlSetCallback (rpmCallbackFunction notify, void *notifyData, int notifyCount)
int urlConnect (const char *url, urlinfo *uret)
int ftpCmd (const char *cmd, const char *url, const char *arg2)
int ftpAbort (urlinfo u, FD_t data)
int ftpFileDone (urlinfo u, FD_t data)
int httpResp (urlinfo u, FD_t ctrl, char **str)
int httpReq (FD_t ctrl, const char *httpCmd, const char *httpArg)
ssize_t ufdRead (void *cookie, char *buf, size_t count)
ssize_t ufdWrite (void *cookie, const char *buf, size_t count)
int ufdSeek (void *cookie, _libio_pos_t pos, int whence)
int ufdClose (void *cookie)
FD_t ftpOpen (const char *url, int flags, mode_t mode, urlinfo *uret)
FD_t httpOpen (const char *url, int flags, mode_t mode, urlinfo *uret)
FD_t ufdOpen (const char *url, int flags, mode_t mode)
const char* getFdErrstr (FD_t fd)
void cvtfmode (const char *m, char *stdio, size_t nstdio, char *other, size_t nother, const char **end, int *f)

Variables

int noLibio = 1
int ftpTimeoutSecs = 60
int httpTimeoutSecs = 60
int _ftp_debug = 0
int _rpmio_debug = 0
struct FDIO_s fdio_s
FDIO_t fadio
rpmCallbackFunction urlNotify = NULL
void* urlNotifyData = NULL
int urlNotifyCount = -1
struct FDIO_s ufdio_s
struct FDIO_s fpio_s


Detailed Description

Definition in file rpmio.c.


Define Documentation

#define BZDONLY( fd )   assert(fdGetIo(fd) == bzdio)
 

Definition at line 82 of file rpmio.c.

#define DM   242
 

Definition at line 1311 of file rpmio.c.

#define FDCPIOPOS( fd )   (fd ? ((FD_t)fd)->fd_cpioPos : -99)
 

Definition at line 78 of file rpmio.c.

#define FDIOVEC( _fd, _vec )
 

Value:

  ((fdGetIo(_fd) && fdGetIo(_fd)->_vec) ? fdGetIo(_fd)->_vec : NULL)

Definition at line 2381 of file rpmio.c.

Referenced by Fclose(), Fread(), Fseek(), and Fwrite().

#define FDNREFS( fd )   (fd ? ((FD_t)fd)->nrefs : -9)
 

Definition at line 76 of file rpmio.c.

Referenced by XfdFree(), and XfdLink().

#define FDONLY( fd )   assert(fdGetIo(fd) == fdio)
 

Definition at line 80 of file rpmio.c.

#define FDTO( fd )   (fd ? ((FD_t)fd)->rd_timeoutsecs : -99)
 

Definition at line 77 of file rpmio.c.

#define GZDONLY( fd )   assert(fdGetIo(fd) == gzdio)
 

Definition at line 81 of file rpmio.c.

#define IAC   255
 

Definition at line 1305 of file rpmio.c.

#define IP   244
 

Definition at line 1308 of file rpmio.c.

#define IPPORT_FTP   21
 

Definition at line 38 of file rpmio.c.

#define IPPORT_HTTP   80
 

Definition at line 41 of file rpmio.c.

#define SHUT_RDWR   1+1
 

Definition at line 1314 of file rpmio.c.

#define TIMEOUT_SECS   60
 

Definition at line 94 of file rpmio.c.

#define UFDONLY( fd )
 

Definition at line 84 of file rpmio.c.

Referenced by ufdClose(), ufdRead(), and ufdWrite().

#define fdGetFILE( _fd )   ((FILE *)fdGetFp(_fd))
 

Definition at line 86 of file rpmio.c.

Referenced by Fclose(), Ferror(), Fflush(), Fread(), Fseek(), Fwrite(), rdcl(), and ufdClose().


Function Documentation

FD_t XfdFree ( FD_t fd,
const char * msg,
const char * file,
unsigned line ) [inline, static]
 

Definition at line 266 of file rpmio.c.

FD_t XfdLink ( void * cookie,
const char * msg,
const char * file,
unsigned line ) [inline, static]
 

Definition at line 249 of file rpmio.c.

Referenced by XfdNew().

FD_t XfdNew ( const char * msg,
const char * file,
unsigned line ) [inline, static]
 

Definition at line 284 of file rpmio.c.

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

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

Parameters:
p   memory to free
Return values:
NULL   always

Definition at line 107 of file rpmio.c.

int checkResponse ( void * uu,
FD_t ctrl,
int * ecp,
char ** str ) [static]
 

Definition at line 738 of file rpmio.c.

Referenced by ftpCheckResponse(), and httpResp().

void cvtfmode ( const char * m,
char * stdio,
size_t nstdio,
char * other,
size_t nother,
const char ** end,
int * f ) [inline, static]
 

Definition at line 2541 of file rpmio.c.

Referenced by Fdopen(), and Fopen().

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

Definition at line 528 of file rpmio.c.

int fdSeek ( void * cookie,
_libio_pos_t pos,
int whence ) [inline, static]
 

Definition at line 379 of file rpmio.c.

Referenced by ufdSeek().

int fdSeekNot ( void * cookie,
_libio_pos_t pos,
int whence ) [inline, static]
 

Definition at line 216 of file rpmio.c.

const char * fdbg ( FD_t fd ) [static]
 

Definition at line 116 of file rpmio.c.

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

int ftpAbort ( urlinfo u,
FD_t data ) [static]
 

Definition at line 1317 of file rpmio.c.

Referenced by ufdClose().

int ftpCheckResponse ( urlinfo u,
char ** str ) [static]
 

Definition at line 900 of file rpmio.c.

Referenced by ftpAbort(), ftpCommand(), ftpFileDone(), ftpLogin(), and ftpReq().

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

Definition at line 1287 of file rpmio.c.

int ftpCommand ( urlinfo u,
char ** str,
... ) [static]
 

Definition at line 925 of file rpmio.c.

Referenced by ftpCmd(), ftpLogin(), and ftpReq().

int ftpFileDone ( urlinfo u,
FD_t data ) [static]
 

Definition at line 1377 of file rpmio.c.

Referenced by ufdClose().

int ftpLogin ( urlinfo u ) [static]
 

Definition at line 962 of file rpmio.c.

Referenced by urlConnect().

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

Definition at line 1794 of file rpmio.c.

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

Definition at line 1036 of file rpmio.c.

const char * getFdErrstr ( FD_t fd ) [static]
 

Definition at line 2347 of file rpmio.c.

Referenced by Fstrerror().

int getHostAddress ( const char * host,
struct in_addr * address ) [static]
 

Definition at line 675 of file rpmio.c.

Referenced by tcpConnect().

FD_t httpOpen ( const char * url,
int flags,
mode_t mode,
urlinfo * uret ) [static]
 

Definition at line 1832 of file rpmio.c.

Referenced by ufdOpen().

int httpReq ( FD_t ctrl,
const char * httpCmd,
const char * httpArg ) [static]
 

Definition at line 1417 of file rpmio.c.

Referenced by ufdOpen().

int httpResp ( urlinfo u,
FD_t ctrl,
char ** str ) [static]
 

Definition at line 1394 of file rpmio.c.

Referenced by httpReq(), and ufdClose().

int inet_aton ( const char * cp,
struct in_addr * inp ) [static]
 

Definition at line 45 of file rpmio.c.

Referenced by ftpReq(), and getHostAddress().

int mygethostbyname ( const char * host,
struct in_addr * address ) [static]
 

Definition at line 659 of file rpmio.c.

Referenced by getHostAddress().

int tcpConnect ( FD_t ctrl,
const char * host,
int port ) [static]
 

Definition at line 691 of file rpmio.c.

Referenced by ftpLogin(), and httpReq().

int ufdClose ( void * cookie )
 

Definition at line 1679 of file rpmio.c.

FD_t ufdOpen ( const char * url,
int flags,
mode_t mode ) [static]
 

Definition at line 1874 of file rpmio.c.

Referenced by Fopen().

ssize_t ufdRead ( void * cookie,
char * buf,
size_t count ) [static]
 

Definition at line 1532 of file rpmio.c.

int ufdSeek ( void * cookie,
_libio_pos_t pos,
int whence ) [inline, static]
 

Definition at line 1659 of file rpmio.c.

ssize_t ufdWrite ( void * cookie,
const char * buf,
size_t count ) [static]
 

Definition at line 1595 of file rpmio.c.

int urlConnect ( const char * url,
urlinfo * uret ) [static]
 

Definition at line 1231 of file rpmio.c.

Referenced by ftpCmd(), and ftpOpen().

void urlSetCallback ( rpmCallbackFunction notify,
void * notifyData,
int notifyCount )
 

Definition at line 1173 of file rpmio.c.


Variable Documentation

int _ftp_debug = 0
 

Definition at line 98 of file rpmio.c.

int _rpmio_debug = 0
 

Definition at line 99 of file rpmio.c.

FDIO_t fadio
 

Definition at line 447 of file rpmio.c.

struct FDIO_s fdio_s [static]
 

Initial value:

 {
  fdRead, fdWrite, fdSeek, fdClose, XfdLink, XfdFree, XfdNew, fdFileno,
  fdOpen, NULL, fdGetFp, NULL,  mkdir, chdir, rmdir, rename, unlink
}

Definition at line 440 of file rpmio.c.

struct FDIO_s fpio_s [static]
 

Initial value:

 {
  ufdRead, ufdWrite, fdSeek, ufdClose, XfdLink, XfdFree, XfdNew, fdFileno,
  ufdOpen, NULL, fdGetFp, NULL, Mkdir, Chdir, Rmdir, Rename, Unlink
}

Definition at line 2867 of file rpmio.c.

int ftpTimeoutSecs = 60 [static]
 

Definition at line 95 of file rpmio.c.

int httpTimeoutSecs = 60 [static]
 

Definition at line 96 of file rpmio.c.

int noLibio = 1
 

Definition at line 91 of file rpmio.c.

struct FDIO_s ufdio_s [static]
 

Initial value:

 {
  ufdRead, ufdWrite, ufdSeek, ufdClose, XfdLink, XfdFree, XfdNew, fdFileno,
  ufdOpen, NULL, fdGetFp, NULL, Mkdir, Chdir, Rmdir, Rename, Unlink
}

Definition at line 1959 of file rpmio.c.

rpmCallbackFunction urlNotify = NULL [static]
 

Definition at line 1169 of file rpmio.c.

int urlNotifyCount = -1 [static]
 

Definition at line 1171 of file rpmio.c.

void * urlNotifyData = NULL [static]
 

Definition at line 1170 of file rpmio.c.


Generated at Mon Sep 24 10:37:51 2001 for rpm by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001