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     URL_IS_HTTPS        = 5,    
00020     URL_IS_HKP          = 6     
00021 } urltype;
00022 
00023 #define URLMAGIC        0xd00b1ed0
00024 #define URLSANE(u)      assert(u && u->magic == URLMAGIC)
00025 
00026 typedef /*@abstract@*/ /*@refcounted@*/ struct urlinfo_s * urlinfo;
00027 
00031 struct urlinfo_s {
00032 /*@refs@*/ int nrefs;           
00033 /*@owned@*/ /*@relnull@*/
00034     const char * url;           
00035 /*@owned@*/ /*@relnull@*/
00036     const char * scheme;        
00037 /*@owned@*/ /*@null@*/
00038     const char * user;          
00039 /*@owned@*/ /*@null@*/
00040     const char * password;      
00041 /*@owned@*/ /*@relnull@*/
00042     const char * host;          
00043 /*@owned@*/ /*@null@*/
00044     const char * portstr;       
00045 /*@owned@*/ /*@null@*/
00046     const char * proxyu;        
00047 /*@owned@*/ /*@null@*/
00048     const char * proxyh;        
00049     int proxyp;                 
00050     int port;                   
00051     int urltype;                
00052     FD_t ctrl;                  
00053     FD_t data;                  
00055 /*@relnull@*/
00056     void * capabilities;        
00057 /*@relnull@*/
00058     void * lockstore;           
00059 /*@relnull@*/
00060     void * sess;                
00061     off_t current;              
00062     off_t total;                
00063     int connstatus;             
00064 #ifdef  REFERENCE
00065 typedef enum {
00066     ne_conn_namelookup, /* lookup up hostname (info = hostname) */
00067     ne_conn_connecting, /* connecting to host (info = hostname) */
00068     ne_conn_connected,  /* connected to host (info = hostname) */
00069     ne_conn_secure      /* connection now secure (info = crypto level) */
00070 } ne_conn_status;
00071 #endif
00072 
00073     int bufAlloced;             
00074 /*@owned@*/
00075     char * buf;                 
00076     int openError;              
00077     int httpVersion;
00078     int httpHasRange;
00079     int magic;
00080 };
00081 
00082 #ifdef __cplusplus
00083 extern "C" {
00084 #endif
00085 
00086 /*@unchecked@*/
00087 extern int _url_count;          
00089 /*@unchecked@*/
00090 /*@only@*/ /*@null@*/
00091 extern urlinfo * _url_cache;    
00093 /*@unchecked@*/
00094 extern int _url_iobuf_size;     
00095 #define RPMURL_IOBUF_SIZE       4096
00096 
00097 /*@unchecked@*/
00098 extern int _url_debug;          
00099 #define RPMURL_DEBUG_IO         0x40000000
00100 #define RPMURL_DEBUG_REFS       0x20000000
00101 
00102 
00108 /*@unused@*/ urlinfo    urlNew(const char * msg)        /*@*/;
00109 
00111 urlinfo XurlNew(const char * msg, const char * file, unsigned line)     /*@*/;
00112 #define urlNew(_msg) XurlNew(_msg, __FILE__, __LINE__)
00113 
00120 /*@unused@*/ urlinfo    urlLink(urlinfo u, const char * msg)
00121         /*@modifies u @*/;
00122 
00124 urlinfo XurlLink(urlinfo u, const char * msg, const char * file, unsigned line)
00125         /*@modifies u @*/;
00126 #define urlLink(_u, _msg) XurlLink(_u, _msg, __FILE__, __LINE__)
00127 
00134 /*@unused@*/ urlinfo    urlFree( /*@killref@*/ urlinfo u, const char * msg)
00135         /*@globals fileSystem, internalState @*/
00136         /*@modifies u, fileSystem, internalState @*/;
00137 
00139 urlinfo XurlFree( /*@killref@*/ urlinfo u, const char * msg,
00140                 const char * file, unsigned line)
00141         /*@globals fileSystem, internalState @*/
00142         /*@modifies u, fileSystem, internalState @*/;
00143 #define urlFree(_u, _msg) XurlFree(_u, _msg, __FILE__, __LINE__)
00144 
00148 void urlFreeCache(void)
00149         /*@globals _url_cache, _url_count, fileSystem, internalState @*/
00150         /*@modifies _url_cache, _url_count, fileSystem, internalState @*/;
00151 
00157 urltype urlIsURL(const char * url)
00158         /*@*/;
00159 
00166 /*@-incondefs@*/
00167 urltype urlPath(const char * url, /*@out@*/ const char ** pathp)
00168         /*@ensures maxSet(*pathp) == 0 /\ maxRead(*pathp) == 0 @*/
00169         /*@modifies *pathp @*/;
00170 /*@=incondefs@*/
00171 
00178 int urlSplit(const char * url, /*@out@*/ urlinfo * uret)
00179         /*@globals h_errno, internalState @*/
00180         /*@modifies *uret, internalState @*/;
00181 
00188 int urlGetFile(const char * url, /*@null@*/ const char * dest)
00189         /*@globals h_errno, fileSystem, internalState @*/
00190         /*@modifies fileSystem, internalState @*/;
00191 
00192 #ifdef __cplusplus
00193 }
00194 #endif
00195 
00196 #endif  /* H_RPMURL */

Generated on Fri Oct 12 08:44:55 2007 for rpm by  doxygen 1.5.2