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

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;
00025 
00029 struct urlinfo_s {
00030 /*@refs@*/ int nrefs;           
00031 /*@owned@*/ /*@null@*/
00032     const char * url;           
00033 /*@owned@*/ /*@null@*/
00034     const char * service;
00035 /*@owned@*/ /*@null@*/
00036     const char * user;
00037 /*@owned@*/ /*@null@*/
00038     const char * password;
00039 /*@owned@*/ /*@null@*/
00040     const char * host;
00041 /*@owned@*/ /*@null@*/
00042     const char * portstr;
00043 /*@owned@*/ /*@null@*/
00044     const char * proxyu;        
00045 /*@owned@*/ /*@null@*/
00046     const char * proxyh;        
00047     int proxyp;                 
00048     int port;
00049     int urltype;
00050     FD_t ctrl;                  
00051     FD_t data;                  
00052     int bufAlloced;             
00053 /*@owned@*/
00054     char * buf;                 
00055     int openError;              
00056     int httpVersion;
00057     int httpHasRange;
00058     int magic;
00059 };
00060 
00061 #ifdef __cplusplus
00062 extern "C" {
00063 #endif
00064 
00065 /*@unchecked@*/
00066 extern int _url_count;          
00068 /*@unchecked@*/
00069 /*@only@*/ /*@null@*/
00070 extern urlinfo * _url_cache;    
00072 /*@unchecked@*/
00073 extern int _url_iobuf_size;     
00074 #define RPMURL_IOBUF_SIZE       4096
00075 
00076 /*@unchecked@*/
00077 extern int _url_debug;          
00078 #define RPMURL_DEBUG_IO         0x40000000
00079 #define RPMURL_DEBUG_REFS       0x20000000
00080 
00081 
00087 /*@unused@*/ urlinfo    urlNew(const char * msg)        /*@*/;
00088 
00090 urlinfo XurlNew(const char * msg, const char * file, unsigned line)     /*@*/;
00091 #define urlNew(_msg) XurlNew(_msg, __FILE__, __LINE__)
00092 
00099 /*@unused@*/ urlinfo    urlLink(urlinfo u, const char * msg)
00100         /*@modifies u @*/;
00101 
00103 urlinfo XurlLink(urlinfo u, const char * msg, const char * file, unsigned line)
00104         /*@modifies u @*/;
00105 #define urlLink(_u, _msg) XurlLink(_u, _msg, __FILE__, __LINE__)
00106 
00113 /*@unused@*/ urlinfo    urlFree( /*@killref@*/ urlinfo u, const char * msg)
00114         /*@globals fileSystem, internalState @*/
00115         /*@modifies u, fileSystem, internalState @*/;
00116 
00118 urlinfo XurlFree( /*@killref@*/ urlinfo u, const char * msg,
00119                 const char * file, unsigned line)
00120         /*@globals fileSystem, internalState @*/
00121         /*@modifies u, fileSystem, internalState @*/;
00122 #define urlFree(_u, _msg) XurlFree(_u, _msg, __FILE__, __LINE__)
00123 
00127 void urlFreeCache(void)
00128         /*@globals _url_cache, _url_count, fileSystem, internalState @*/
00129         /*@modifies _url_cache, _url_count, fileSystem, internalState @*/;
00130 
00136 urltype urlIsURL(const char * url)
00137         /*@*/;
00138 
00145 /*@-incondefs@*/
00146 urltype urlPath(const char * url, /*@out@*/ const char ** pathp)
00147         /*@ensures maxSet(*pathp) == 0 /\ maxRead(*pathp) == 0 @*/
00148         /*@modifies *pathp @*/;
00149 /*@=incondefs@*/
00150 
00157 int urlSplit(const char * url, /*@out@*/ urlinfo * uret)
00158         /*@globals h_errno, internalState @*/
00159         /*@modifies *uret, internalState @*/;
00160 
00167 int urlGetFile(const char * url, /*@null@*/ const char * dest)
00168         /*@globals h_errno, fileSystem, internalState @*/
00169         /*@modifies fileSystem, internalState @*/;
00170 
00171 #ifdef __cplusplus
00172 }
00173 #endif
00174 
00175 #endif  /* H_RPMURL */

Generated on Mon Nov 1 21:54:21 2004 for rpm by  doxygen 1.3.9.1