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     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 /*@relnull@*/
00053     FD_t ctrl;                  
00054 /*@relnull@*/
00055     FD_t data;                  
00057 #ifdef  REFERENCE
00058 typedef enum {
00059     ne_conn_namelookup, /* lookup up hostname (info = hostname) */
00060     ne_conn_connecting, /* connecting to host (info = hostname) */
00061     ne_conn_connected,  /* connected to host (info = hostname) */
00062     ne_conn_secure      /* connection now secure (info = crypto level) */
00063 } ne_conn_status;
00064 #endif
00065 
00066     int bufAlloced;             
00067 /*@owned@*/
00068     char * buf;                 
00069     int openError;              
00070     int httpVersion;
00071     int allow;
00072 #define RPMURL_SERVER_HASRANGE          ( 1 << 0)
00073 #define RPMURL_SERVER_HASDAVCLASS1      ( 1 << 1)
00074 #define RPMURL_SERVER_HASDAVCLASS2      ( 1 << 2)
00075 #define RPMURL_SERVER_HASDAVEXEC        ( 1 << 3)
00076 
00077 #define RPMURL_SERVER_HASDAV    (RPMURL_SERVER_HASDAVCLASS1|RPMURL_SERVER_HASDAVCLASS2|RPMURL_SERVER_HASDAVEXEC)
00078     int magic;
00079 };
00080 
00081 #ifdef __cplusplus
00082 extern "C" {
00083 #endif
00084 
00085 /*@unchecked@*/
00086 extern int _url_count;          
00088 /*@unchecked@*/
00089 /*@only@*/ /*@null@*/
00090 extern urlinfo * _url_cache;    
00092 /*@unchecked@*/
00093 extern int _url_iobuf_size;     
00094 #define RPMURL_IOBUF_SIZE       4096
00095 
00096 /*@unchecked@*/
00097 extern int _url_debug;          
00098 #define RPMURL_DEBUG_IO         0x40000000
00099 #define RPMURL_DEBUG_REFS       0x20000000
00100 
00101 
00107 /*@unused@*/ urlinfo    urlNew(const char * msg)        /*@*/;
00108 
00110 urlinfo XurlNew(const char * msg, const char * file, unsigned line)     /*@*/;
00111 #define urlNew(_msg) XurlNew(_msg, __FILE__, __LINE__)
00112 
00119 /*@unused@*/ urlinfo    urlLink(urlinfo u, const char * msg)
00120         /*@modifies u @*/;
00121 
00123 urlinfo XurlLink(urlinfo u, const char * msg, const char * file, unsigned line)
00124         /*@modifies u @*/;
00125 #define urlLink(_u, _msg) XurlLink(_u, _msg, __FILE__, __LINE__)
00126 
00133 /*@unused@*/ urlinfo    urlFree( /*@killref@*/ urlinfo u, const char * msg)
00134         /*@globals fileSystem, internalState @*/
00135         /*@modifies u, fileSystem, internalState @*/;
00136 
00138 urlinfo XurlFree( /*@killref@*/ urlinfo u, const char * msg,
00139                 const char * file, unsigned line)
00140         /*@globals fileSystem, internalState @*/
00141         /*@modifies u, fileSystem, internalState @*/;
00142 #define urlFree(_u, _msg) XurlFree(_u, _msg, __FILE__, __LINE__)
00143 
00147 void urlFreeCache(void)
00148         /*@globals _url_cache, _url_count, fileSystem, internalState @*/
00149         /*@modifies _url_cache, _url_count, fileSystem, internalState @*/;
00150 
00156 urltype urlIsURL(const char * url)
00157         /*@*/;
00158 
00165 /*@-incondefs@*/
00166 urltype urlPath(const char * url, /*@out@*/ const char ** pathp)
00167         /*@ensures maxSet(*pathp) == 0 /\ maxRead(*pathp) == 0 @*/
00168         /*@modifies *pathp @*/;
00169 /*@=incondefs@*/
00170 
00177 int urlSplit(const char * url, /*@out@*/ urlinfo * uret)
00178         /*@globals h_errno, internalState @*/
00179         /*@modifies *uret, internalState @*/;
00180 
00187 int urlGetFile(const char * url, /*@null@*/ const char * dest)
00188         /*@globals h_errno, fileSystem, internalState @*/
00189         /*@modifies fileSystem, internalState @*/;
00190 
00191 #ifdef __cplusplus
00192 }
00193 #endif
00194 
00195 #endif  /* H_RPMURL */

Generated on Sun Aug 18 10:48:53 2013 for rpm by  doxygen 1.4.4