Go to the documentation of this file.00001 #ifndef H_RPMURL
00002 #define H_RPMURL
00003
00008 #include <assert.h>
00009 #include <rpmio.h>
00010 #include <rpmsw.h>
00011
00015 typedef enum urltype_e {
00016 URL_IS_UNKNOWN = 0,
00017 URL_IS_DASH = 1,
00018 URL_IS_PATH = 2,
00019 URL_IS_FTP = 3,
00020 URL_IS_HTTP = 4,
00021 URL_IS_HTTPS = 5,
00022 URL_IS_HKP = 6
00023 } urltype;
00024
00025 #define URLMAGIC 0xd00b1ed0U
00026 #define URLSANE(u) assert(u && u->magic == URLMAGIC)
00027
00030 typedef struct urlinfo_s * urlinfo;
00031
00034 extern int (*urlNotify) (const urlinfo u, unsigned status)
00035 ;
00036
00039
00040 extern void * urlNotifyArg;
00041
00045 struct urlinfo_s {
00046 struct rpmioItem_s _item;
00047
00048 const char * url;
00049
00050 const char * scheme;
00051
00052 const char * user;
00053
00054 const char * password;
00055
00056 const char * host;
00057
00058 const char * portstr;
00059
00060 const char * query;
00061
00062 const char * fragment;
00063
00064 const char * proxyu;
00065
00066 const char * proxyh;
00067 int proxyp;
00068 int port;
00069 int urltype;
00070
00071 FD_t ctrl;
00072
00073 FD_t data;
00075
00076 void * capabilities;
00077
00078 void * lockstore;
00079
00080 void * sess;
00082
00083 const char * location;
00084
00085 const char * etag;
00086
00087 int (*notify) (const urlinfo u, unsigned status);
00088
00089 void * arg;
00090 struct fdNotify_s {
00091 unsigned status;
00092
00093 const char * hostname;
00094
00095 const char * address;
00096 int64_t progress;
00097 int64_t total;
00098 } info;
00099
00100 rpmop rop;
00101
00102 rpmop sop;
00103
00104 rpmop top;
00106 int bufAlloced;
00107
00108 char * buf;
00109 int openError;
00110 int httpVersion;
00111 int allow;
00112 #define RPMURL_SERVER_HASRANGE ( 1 << 0)
00113 #define RPMURL_SERVER_HASDAVCLASS1 ( 1 << 1)
00114 #define RPMURL_SERVER_HASDAVCLASS2 ( 1 << 2)
00115 #define RPMURL_SERVER_HASDAVEXEC ( 1 << 3)
00116
00117 #define RPMURL_SERVER_OPTIONSDONE ( 1 << 8)
00118
00119 #define RPMURL_SERVER_HASDAV (RPMURL_SERVER_HASDAVCLASS1|RPMURL_SERVER_HASDAVCLASS2|RPMURL_SERVER_HASDAVEXEC)
00120 unsigned magic;
00121 #if defined(__LCLINT__)
00122
00123 int nrefs;
00124 #endif
00125 };
00126
00127 #ifdef __cplusplus
00128 extern "C" {
00129 #endif
00130
00131
00132 extern int _url_count;
00134
00135
00136 extern urlinfo * _url_cache;
00138
00139 extern int _url_iobuf_size;
00140 #define RPMURL_IOBUF_SIZE 4096
00141
00142
00143 extern int _url_debug;
00144 #define RPMURL_DEBUG_IO 0x40000000
00145 #define RPMURL_DEBUG_REFS 0x20000000
00146
00152
00153 urlinfo urlNew(const char * msg)
00154 ;
00155
00157
00158 urlinfo XurlNew(const char * msg, const char * fn, unsigned ln)
00159
00160 ;
00161 #define urlNew(_msg) XurlNew(_msg, __FILE__, __LINE__)
00162
00169
00170 urlinfo urlLink( urlinfo u, const char * msg)
00171 ;
00172 #define urlLink(_u, _msg) \
00173 (urlinfo) rpmioLinkPoolItem((rpmioItem)(_u), _msg, __FILE__, __LINE__)
00174
00181
00182 urlinfo urlFree( urlinfo u, const char * msg)
00183
00184 ;
00185 #define urlFree(_u, _msg) \
00186 ((urlinfo)rpmioFreePoolItem((rpmioItem)(_u), _msg, __FILE__, __LINE__))
00187
00191 void urlFreeCache(void)
00192
00193 ;
00194
00200 urltype urlIsURL(const char * url)
00201 ;
00202
00209
00210 urltype urlPath(const char * url, const char ** pathp)
00211 ;
00212
00213
00220 int urlSplit(const char * url, urlinfo * uret)
00221
00222 ;
00223
00230 int urlGetFile(const char * url, const char * dest)
00231
00232 ;
00233
00234 #ifdef __cplusplus
00235 }
00236 #endif
00237
00238 #endif