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

- 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
    00013 typedef enum urltype_e {
    00014     URL_IS_UNKNOWN      = 0,
    00015     URL_IS_DASH         = 1,
    00016     URL_IS_PATH         = 2,
    00017     URL_IS_FTP          = 3,
    00018     URL_IS_HTTP         = 4
    00019 } urltype;
    00020
    00021 #define URLMAGIC        0xd00b1ed0
    00022 #define URLSANE(u)      assert(u && u->magic == URLMAGIC)
    00023
    00024 typedef /*@abstract@*/ /*@refcounted@*/ struct urlinfo_s * urlinfo;
    00028 struct urlinfo_s {
    00029 /*@refs@*/ int nrefs;
    00030 /*@owned@*/ /*@null@*/
    00031     const char * url;
    00032 /*@owned@*/ /*@null@*/
    00033     const char * service;
    00034 /*@owned@*/ /*@null@*/
    00035     const char * user;
    00036 /*@owned@*/ /*@null@*/
    00037     const char * password;
    00038 /*@owned@*/ /*@null@*/
    00039     const char * host;
    00040 /*@owned@*/ /*@null@*/
    00041     const char * portstr;
    00042 /*@owned@*/ /*@null@*/
    00043     const char * proxyu;
    00044 /*@owned@*/ /*@null@*/
    00045     const char * proxyh;
    00046     int proxyp;
    00047     int port;
    00048     int urltype;
    00049     FD_t ctrl;
    00050     FD_t data;
    00051     int bufAlloced;
    00052 /*@owned@*/ char * buf;
    00053     int openError;
    00054     int httpVersion;
    00055     int httpHasRange;
    00056     int magic;
    00057 };
    00058
    00059 #ifdef __cplusplus
    00060 extern "C" {
    00061 #endif
    00062
    00063 /*@unchecked@*/
    00064 extern int _url_count;
    00066 /*@unchecked@*/
    00067 /*@only@*/ /*@null@*/
    00068 extern urlinfo * _url_cache;
    00070 /*@unchecked@*/
    00071 extern int _url_iobuf_size;
    00072 #define RPMURL_IOBUF_SIZE       4096
    00073
    00074 /*@unchecked@*/
    00075 extern int _url_debug;
    00076 #define RPMURL_DEBUG_IO         0x40000000
    00077 #define RPMURL_DEBUG_REFS       0x20000000
    00078
    00079
    00085 /*@unused@*/ urlinfo    urlNew(const char * msg)        /*@*/;
    00086
    00088 urlinfo XurlNew(const char * msg, const char * file, unsigned line)     /*@*/;
    00089 #define urlNew(_msg) XurlNew(_msg, __FILE__, __LINE__)
    00090
    00097 /*@unused@*/ urlinfo    urlLink(urlinfo u, const char * msg)
    00098         /*@modifies u @*/;
    00099
    00101 urlinfo XurlLink(urlinfo u, const char * msg, const char * file, unsigned line)
    00102         /*@modifies u @*/;
    00103 #define urlLink(_u, _msg) XurlLink(_u, _msg, __FILE__, __LINE__)
    00104
    00111 /*@unused@*/ urlinfo    urlFree( /*@killref@*/ urlinfo u, const char * msg)
    00112         /*@modifies u @*/;
    00113
    00115 urlinfo XurlFree( /*@killref@*/ urlinfo u, const char * msg,
    00116                 const char * file, unsigned line)
    00117         /*@globals fileSystem@*/
    00118         /*@modifies u, fileSystem @*/;
    00119 #define urlFree(_u, _msg) XurlFree(_u, _msg, __FILE__, __LINE__)
    00120
    00124 void urlFreeCache(void)
    00125         /*@globals _url_cache, _url_count, fileSystem @*/
    00126         /*@modifies _url_cache, _url_count, fileSystem @*/;
    00127
    00133 urltype urlIsURL(const char * url)
    00134         /*@*/;
    00135
    00142 urltype urlPath(const char * url, /*@out@*/ const char ** pathp)
    00143         /*@modifies *pathp @*/;
    00144
    00151 int urlSplit(const char * url, /*@out@*/ urlinfo * uret)
    00152         /*@modifies *uret @*/;
    00153
    00160 int urlGetFile(const char * url, /*@null@*/ const char * dest)
    00161         /*@globals fileSystem @*/
    00162         /*@modifies fileSystem @*/;
    00163
    00164 #ifdef __cplusplus
    00165 }
    00166 #endif
    00167
    00168 #endif  /* H_RPMURL */