Go to the documentation of this file.00001 #ifndef RPMDAV_H
00002 #define RPMDAV_H
00003
00008 #include <argv.h>
00009
00012
00013 extern int rpmioHttpReadTimeoutSecs;
00014
00015 extern int rpmioHttpConnectTimeoutSecs;
00016
00017 extern const char * rpmioHttpAccept;
00018
00019 extern const char * rpmioHttpUserAgent;
00020
00021 #if defined(_RPMDAV_INTERNAL)
00022 struct __dirstream {
00023 int fd;
00024 char * data;
00025 size_t allocation;
00026 size_t size;
00027 size_t offset;
00028 off_t filepos;
00029 #if defined(WITH_PTHREADS)
00030 pthread_mutex_t lock;
00031 #endif
00032 };
00033 #endif
00034
00035 #if !defined(DT_DIR) || defined(__APPLE__)
00036 # define DT_UNKNOWN 0
00037 # define DT_FIFO 1
00038 # define DT_CHR 2
00039 # define DT_DIR 4
00040 # define DT_BLK 6
00041 # define DT_REG 8
00042 # define DT_LNK 10
00043 # define DT_SOCK 12
00044 # define DT_WHT 14
00045 typedef struct __dirstream * AVDIR;
00046 typedef struct __dirstream * DAVDIR;
00047 #else
00048 # if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__OpenBSD__)
00049 typedef struct __dirstream * AVDIR;
00050 typedef struct __dirstream * DAVDIR;
00051 #else
00052 typedef DIR * AVDIR;
00053 typedef DIR * DAVDIR;
00054 #endif
00055 #endif
00056
00057
00058 #ifdef __cplusplus
00059 extern "C" {
00060 #endif
00061
00062 #if defined(_RPMAV_INTERNAL)
00063
00065 typedef struct avContext_s * avContext;
00066
00069
00070 extern int avmagicdir;
00071 #define ISAVMAGIC(_dir) (!memcmp((_dir), &avmagicdir, sizeof(avmagicdir)))
00072
00075 struct avContext_s {
00076
00077 void ** resrock;
00078 const char *uri;
00079
00080 urlinfo u;
00081 int ac;
00082 int nalloced;
00083 ARGV_t av;
00084
00085 struct stat *st;
00086 rpmuint16_t * modes;
00087 size_t * sizes;
00088 time_t * mtimes;
00089 };
00090
00093
00094 void * avContextDestroy( avContext ctx)
00095
00096 ;
00097
00100
00101 void * avContextCreate(const char *uri, struct stat *st)
00102
00103 ;
00104
00107 int avContextAdd(avContext ctx, const char * path,
00108 mode_t mode, size_t size, time_t mtime)
00109
00110 ;
00111
00117 int avClosedir( DIR * dir)
00118
00119 ;
00120
00126
00127 struct dirent * avReaddir(DIR * dir)
00128
00129 ;
00130
00138
00139 DIR * avOpendir(const char * path,
00140 const char ** av, rpmuint16_t * modes)
00141
00142 ;
00143 #endif
00144
00150 int davDisconnect(void * _u)
00151
00152 ;
00153
00159 int davFree(urlinfo u)
00160
00161 ;
00162
00166 void davDestroy(void)
00167
00168 ;
00169
00177 int davReq(FD_t ctrl, const char * httpCmd, const char * httpArg)
00178
00179 ;
00180
00188
00189 int davResp(urlinfo u, FD_t ctrl, char *const * str)
00190
00191 ;
00192
00193
00202
00203 FD_t davOpen(const char * url, int flags,
00204 mode_t mode, urlinfo * uret)
00205
00206 ;
00207
00208
00209 FD_t httpOpen(const char * url, int flags,
00210 mode_t mode, urlinfo * uret)
00211
00212 ;
00213
00216 ssize_t davRead(void * cookie, char * buf, size_t count)
00217
00218 ;
00219
00222 ssize_t davWrite(void * cookie, const char * buf, size_t count)
00223
00224 ;
00225
00228 int davSeek(void * cookie, _libio_pos_t pos, int whence)
00229
00230 ;
00231
00234 int davClose(void * cookie)
00235
00236 ;
00237
00240 int davMkdir(const char * path, mode_t mode)
00241
00242 ;
00243
00246 int davRmdir(const char * path)
00247
00248 ;
00249
00252 int davRename(const char * oldpath, const char * newpath)
00253
00254 ;
00255
00258 int davUnlink(const char * path)
00259
00260 ;
00261
00267 int davClosedir( DIR * dir)
00268
00269 ;
00270
00276
00277 struct dirent * davReaddir(DIR * dir)
00278
00279 ;
00280
00286
00287 DIR * davOpendir(const char * path)
00288
00289 ;
00290
00294 int davStat(const char * path, struct stat * st)
00295
00296 ;
00297
00301 int davLstat(const char * path, struct stat * st)
00302
00303 ;
00304
00308 char * davRealpath(const char * path, char * resolved_path)
00309 ;
00310
00311 #ifdef __cplusplus
00312 }
00313 #endif
00314
00315 #endif