00001 #ifndef H_RPMIO
00002 #define H_RPMIO
00003 
00009 #include <sys/types.h>
00010 #include <sys/stat.h>
00011 #include <stdio.h>
00012 #include <stdlib.h>
00013 #include <unistd.h>
00014 
00015 #include <rpm/rpmtypes.h>
00016 #include <rpm/rpmsw.h>
00017 
00018 #ifdef __cplusplus
00019 extern "C" {
00020 #endif
00021 
00028 #if defined(__GLIBC__) && \
00029         (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2))
00030 #define USE_COOKIE_SEEK_POINTER 1
00031 typedef _IO_off64_t     _libio_off_t;
00032 typedef _libio_off_t *  _libio_pos_t;
00033 #else
00034 typedef off_t           _libio_off_t;
00035 typedef off_t           _libio_pos_t;
00036 #endif
00037 
00040 typedef const struct FDIO_s * FDIO_t;
00041 
00042 
00050 const char * Fstrerror(FD_t fd);
00051 
00055 ssize_t Fread(void * buf, size_t size, size_t nmemb, FD_t fd);
00056 
00060 ssize_t Fwrite(const void * buf, size_t size, size_t nmemb, FD_t fd);
00061 
00065 int Fseek(FD_t fd, _libio_off_t offset, int whence);
00066 
00070 int Fclose( FD_t fd);
00071 
00074 FD_t    Fdopen(FD_t ofd, const char * fmode);
00075 
00079 FD_t    Fopen(const char * path,
00080                         const char * fmode);
00081 
00082 
00086 int Fflush(FD_t fd);
00087 
00091 int Ferror(FD_t fd);
00092 
00096 int Fileno(FD_t fd);
00097 
00101 int Fcntl(FD_t fd, int op, void *lip);
00102 
00109 off_t   fdSize(FD_t fd);
00110 
00113 FD_t fdDup(int fdno);
00114 
00118 FILE * fdGetFILE(FD_t fd);
00119 
00122 FD_t fdLink (void * cookie, const char * msg);
00123 
00126 FD_t fdFree(FD_t fd, const char * msg);
00127 
00130 FD_t fdNew (const char * msg);
00131 
00134 int fdWritable(FD_t fd, int secs);
00135 
00138 int fdReadable(FD_t fd, int secs);
00139 
00142 int ufdCopy(FD_t sfd, FD_t tfd);
00143 
00149 ssize_t timedRead(FD_t fd, void * bufptr, size_t length);
00150 
00154 typedef enum fdOpX_e {
00155     FDSTAT_READ         = 0,    
00156     FDSTAT_WRITE        = 1,    
00157     FDSTAT_SEEK         = 2,    
00158     FDSTAT_CLOSE        = 3,    
00159     FDSTAT_DIGEST       = 4,    
00160     FDSTAT_MAX          = 5
00161 } fdOpX;
00162 
00166 rpmop fdOp(FD_t fd, fdOpX opx);
00167 
00168 #ifdef __cplusplus
00169 }
00170 #endif
00171 
00172 #endif