Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

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 /*@checked@*/
00064 extern int _url_count;          
00066 /*@checked@*/
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         /*@globals fileSystem, internalState @*/
00113         /*@modifies u, fileSystem, internalState @*/;
00114 
00116 urlinfo XurlFree( /*@killref@*/ urlinfo u, const char * msg,
00117                 const char * file, unsigned line)
00118         /*@globals fileSystem, internalState @*/
00119         /*@modifies u, fileSystem, internalState @*/;
00120 #define urlFree(_u, _msg) XurlFree(_u, _msg, __FILE__, __LINE__)
00121 
00125 void urlFreeCache(void)
00126         /*@globals _url_cache, _url_count, fileSystem, internalState @*/
00127         /*@modifies _url_cache, _url_count, fileSystem, internalState @*/;
00128 
00134 urltype urlIsURL(const char * url)
00135         /*@*/;
00136 
00143 /*@-incondefs@*/
00144 urltype urlPath(const char * url, /*@out@*/ const char ** pathp)
00145         /*@ensures maxSet(*pathp) == 0 /\ maxRead(*pathp) == 0 @*/
00146         /*@modifies *pathp @*/;
00147 /*@=incondefs@*/
00148 
00155 int urlSplit(const char * url, /*@out@*/ urlinfo * uret)
00156         /*@globals internalState @*/
00157         /*@modifies *uret, internalState @*/;
00158 
00165 int urlGetFile(const char * url, /*@null@*/ const char * dest)
00166         /*@globals fileSystem, internalState @*/
00167         /*@modifies fileSystem, internalState @*/;
00168 
00169 #ifdef __cplusplus
00170 }
00171 #endif
00172 
00173 #endif  /* H_RPMURL */

Generated on Sun Oct 26 13:02:04 2003 for rpm by doxygen1.2.18