rpm 5.2.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

rpmio/rpmurl.h
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 /*@abstract@*/ /*@refcounted@*/ struct urlinfo_s * urlinfo;
    00031
    00034 extern int (*urlNotify) (const urlinfo u, unsigned status)
    00035         /*@*/;
    00036
    00039 /*@unchecked@*/ /*@null@*/ /*@shared@*/
    00040 extern void * urlNotifyArg;
    00041
    00045 struct urlinfo_s {
    00046     struct rpmioItem_s _item;
    00047 /*@owned@*/ /*@relnull@*/
    00048     const char * url;
    00049 /*@owned@*/ /*@relnull@*/
    00050     const char * scheme;
    00051 /*@owned@*/ /*@null@*/
    00052     const char * user;
    00053 /*@owned@*/ /*@null@*/
    00054     const char * password;
    00055 /*@owned@*/ /*@relnull@*/
    00056     const char * host;
    00057 /*@owned@*/ /*@null@*/
    00058     const char * portstr;
    00059 /*@owned@*/ /*@null@*/
    00060     const char * query;
    00061 /*@owned@*/ /*@null@*/
    00062     const char * fragment;
    00063 /*@owned@*/ /*@null@*/
    00064     const char * proxyu;
    00065 /*@owned@*/ /*@null@*/
    00066     const char * proxyh;
    00067     int proxyp;
    00068     int port;
    00069     int urltype;
    00070 /*@relnull@*/
    00071     FD_t ctrl;
    00072 /*@relnull@*/
    00073     FD_t data;
    00075 /*@relnull@*/
    00076     void * capabilities;
    00077 /*@relnull@*/
    00078     void * lockstore;
    00079 /*@relnull@*/
    00080     void * sess;
    00082 /*@null@*/
    00083     const char * location;
    00084 /*@null@*/
    00085     const char * etag;
    00086 /*@null@*/
    00087     int (*notify) (const urlinfo u, unsigned status);
    00088 /*@null@*/ /*@shared@*/
    00089     void * arg;
    00090     struct fdNotify_s {
    00091         unsigned status;
    00092 /*@null@*/
    00093         const char * hostname;
    00094 /*@null@*/
    00095         const char * address;
    00096         int64_t progress;
    00097         int64_t total;
    00098     } info;
    00099 /*@null@*/
    00100     rpmop rop;
    00101 /*@null@*/
    00102     rpmop sop;
    00103 /*@null@*/
    00104     rpmop top;
    00106     int bufAlloced;
    00107 /*@owned@*/
    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 /*@refs@*/
    00123     int nrefs;
    00124 #endif
    00125 };
    00126
    00127 #ifdef __cplusplus
    00128 extern "C" {
    00129 #endif
    00130
    00131 /*@unchecked@*/
    00132 extern int _url_count;
    00134 /*@unchecked@*/
    00135 /*@only@*/ /*@null@*/
    00136 extern urlinfo * _url_cache;
    00138 /*@unchecked@*/
    00139 extern int _url_iobuf_size;
    00140 #define RPMURL_IOBUF_SIZE       4096
    00141
    00142 /*@unchecked@*/
    00143 extern int _url_debug;
    00144 #define RPMURL_DEBUG_IO         0x40000000
    00145 #define RPMURL_DEBUG_REFS       0x20000000
    00146
    00152 /*@unused@*/ /*@null@*/
    00153 urlinfo urlNew(const char * msg)
    00154         /*@*/;
    00155
    00157 /*@null@*/
    00158 urlinfo XurlNew(const char * msg, const char * fn, unsigned ln)
    00159         /*@globals fileSystem @*/
    00160         /*@modifies fileSystem @*/;
    00161 #define urlNew(_msg) XurlNew(_msg, __FILE__, __LINE__)
    00162
    00169 /*@unused@*/ /*@newref@*/
    00170 urlinfo urlLink(/*@returned@*/ urlinfo u, const char * msg)
    00171         /*@modifies u @*/;
    00172 #define urlLink(_u, _msg)       \
    00173         (urlinfo) rpmioLinkPoolItem((rpmioItem)(_u), _msg, __FILE__, __LINE__)
    00174
    00181 /*@unused@*/ /*@null@*/
    00182 urlinfo urlFree( /*@killref@*/ urlinfo u, const char * msg)
    00183         /*@globals fileSystem, internalState @*/
    00184         /*@modifies u, fileSystem, internalState @*/;
    00185 #define urlFree(_u, _msg)       \
    00186         ((urlinfo)rpmioFreePoolItem((rpmioItem)(_u), _msg, __FILE__, __LINE__))
    00187
    00191 void urlFreeCache(void)
    00192         /*@globals _url_cache, _url_count, fileSystem, internalState @*/
    00193         /*@modifies _url_cache, _url_count, fileSystem, internalState @*/;
    00194
    00200 urltype urlIsURL(const char * url)
    00201         /*@*/;
    00202
    00209 /*@-incondefs@*/
    00210 urltype urlPath(const char * url, /*@out@*/ const char ** pathp)
    00211         /*@modifies *pathp @*/;
    00212 /*@=incondefs@*/
    00213
    00220 int urlSplit(const char * url, /*@out@*/ urlinfo * uret)
    00221         /*@globals h_errno, internalState @*/
    00222         /*@modifies *uret, internalState @*/;
    00223
    00230 int urlGetFile(const char * url, /*@null@*/ const char * dest)
    00231         /*@globals h_errno, fileSystem, internalState @*/
    00232         /*@modifies fileSystem, internalState @*/;
    00233
    00234 #ifdef __cplusplus
    00235 }
    00236 #endif
    00237
    00238 #endif  /* H_RPMURL */