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

- 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     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 allow;
    00079 #define RPMURL_SERVER_HASRANGE          ( 1 << 0)
    00080 #define RPMURL_SERVER_HASDAVCLASS1      ( 1 << 1)
    00081 #define RPMURL_SERVER_HASDAVCLASS2      ( 1 << 2)
    00082 #define RPMURL_SERVER_HASDAVEXEC        ( 1 << 3)
    00083
    00084 #define RPMURL_SERVER_HASDAV    (RPMURL_SERVER_HASDAVCLASS1|RPMURL_SERVER_HASDAVCLASS2|RPMURL_SERVER_HASDAVEXEC)
    00085     int magic;
    00086 };
    00087
    00088 #ifdef __cplusplus
    00089 extern "C" {
    00090 #endif
    00091
    00092 /*@unchecked@*/
    00093 extern int _url_count;
    00095 /*@unchecked@*/
    00096 /*@only@*/ /*@null@*/
    00097 extern urlinfo * _url_cache;
    00099 /*@unchecked@*/
    00100 extern int _url_iobuf_size;
    00101 #define RPMURL_IOBUF_SIZE       4096
    00102
    00103 /*@unchecked@*/
    00104 extern int _url_debug;
    00105 #define RPMURL_DEBUG_IO         0x40000000
    00106 #define RPMURL_DEBUG_REFS       0x20000000
    00107
    00108
    00114 /*@unused@*/ urlinfo    urlNew(const char * msg)        /*@*/;
    00115
    00117 urlinfo XurlNew(const char * msg, const char * file, unsigned line)     /*@*/;
    00118 #define urlNew(_msg) XurlNew(_msg, __FILE__, __LINE__)
    00119
    00126 /*@unused@*/ urlinfo    urlLink(urlinfo u, const char * msg)
    00127         /*@modifies u @*/;
    00128
    00130 urlinfo XurlLink(urlinfo u, const char * msg, const char * file, unsigned line)
    00131         /*@modifies u @*/;
    00132 #define urlLink(_u, _msg) XurlLink(_u, _msg, __FILE__, __LINE__)
    00133
    00140 /*@unused@*/ urlinfo    urlFree( /*@killref@*/ urlinfo u, const char * msg)
    00141         /*@globals fileSystem, internalState @*/
    00142         /*@modifies u, fileSystem, internalState @*/;
    00143
    00145 urlinfo XurlFree( /*@killref@*/ urlinfo u, const char * msg,
    00146                 const char * file, unsigned line)
    00147         /*@globals fileSystem, internalState @*/
    00148         /*@modifies u, fileSystem, internalState @*/;
    00149 #define urlFree(_u, _msg) XurlFree(_u, _msg, __FILE__, __LINE__)
    00150
    00154 void urlFreeCache(void)
    00155         /*@globals _url_cache, _url_count, fileSystem, internalState @*/
    00156         /*@modifies _url_cache, _url_count, fileSystem, internalState @*/;
    00157
    00163 urltype urlIsURL(const char * url)
    00164         /*@*/;
    00165
    00172 /*@-incondefs@*/
    00173 urltype urlPath(const char * url, /*@out@*/ const char ** pathp)
    00174         /*@ensures maxSet(*pathp) == 0 /\ maxRead(*pathp) == 0 @*/
    00175         /*@modifies *pathp @*/;
    00176 /*@=incondefs@*/
    00177
    00184 int urlSplit(const char * url, /*@out@*/ urlinfo * uret)
    00185         /*@globals h_errno, internalState @*/
    00186         /*@modifies *uret, internalState @*/;
    00187
    00194 int urlGetFile(const char * url, /*@null@*/ const char * dest)
    00195         /*@globals h_errno, fileSystem, internalState @*/
    00196         /*@modifies fileSystem, internalState @*/;
    00197
    00198 #ifdef __cplusplus
    00199 }
    00200 #endif
    00201
    00202 #endif  /* H_RPMURL */