rpm  4.5
rpmurl.h
Go to the documentation of this file.
1 #ifndef H_RPMURL
2 #define H_RPMURL
3 
8 #include <assert.h>
9 
13 typedef enum urltype_e {
17  URL_IS_FTP = 3,
21 } urltype;
22 
23 #define URLMAGIC 0xd00b1ed0
24 #define URLSANE(u) assert(u && u->magic == URLMAGIC)
25 
26 typedef /*@abstract@*/ /*@refcounted@*/ struct urlinfo_s * urlinfo;
27 
31 struct urlinfo_s {
32 /*@refs@*/ int nrefs;
33 /*@owned@*/ /*@relnull@*/
34  const char * url;
35 /*@owned@*/ /*@relnull@*/
36  const char * scheme;
37 /*@owned@*/ /*@null@*/
38  const char * user;
39 /*@owned@*/ /*@null@*/
40  const char * password;
41 /*@owned@*/ /*@relnull@*/
42  const char * host;
43 /*@owned@*/ /*@null@*/
44  const char * portstr;
45 /*@owned@*/ /*@null@*/
46  const char * proxyu;
47 /*@owned@*/ /*@null@*/
48  const char * proxyh;
49  int proxyp;
50  int port;
51  int urltype;
52 /*@relnull@*/
54 /*@relnull@*/
57 #ifdef REFERENCE
58 typedef enum {
59  ne_conn_namelookup, /* lookup up hostname (info = hostname) */
60  ne_conn_connecting, /* connecting to host (info = hostname) */
61  ne_conn_connected, /* connected to host (info = hostname) */
62  ne_conn_secure /* connection now secure (info = crypto level) */
63 } ne_conn_status;
64 #endif
65 
66  int bufAlloced;
67 /*@owned@*/
68  char * buf;
69  int openError;
71  int allow;
72 #define RPMURL_SERVER_HASRANGE ( 1 << 0)
73 #define RPMURL_SERVER_HASDAVCLASS1 ( 1 << 1)
74 #define RPMURL_SERVER_HASDAVCLASS2 ( 1 << 2)
75 #define RPMURL_SERVER_HASDAVEXEC ( 1 << 3)
76 
77 #define RPMURL_SERVER_HASDAV (RPMURL_SERVER_HASDAVCLASS1|RPMURL_SERVER_HASDAVCLASS2|RPMURL_SERVER_HASDAVEXEC)
78  int magic;
79 };
80 
81 #ifdef __cplusplus
82 extern "C" {
83 #endif
84 
85 /*@unchecked@*/
86 extern int _url_count;
88 /*@unchecked@*/
89 /*@only@*/ /*@null@*/
90 extern urlinfo * _url_cache;
92 /*@unchecked@*/
93 extern int _url_iobuf_size;
94 #define RPMURL_IOBUF_SIZE 4096
95 
96 /*@unchecked@*/
97 extern int _url_debug;
98 #define RPMURL_DEBUG_IO 0x40000000
99 #define RPMURL_DEBUG_REFS 0x20000000
100 
101 
107 /*@unused@*/ urlinfo urlNew(const char * msg) /*@*/;
108 
110 urlinfo XurlNew(const char * msg, const char * file, unsigned line) /*@*/;
111 #define urlNew(_msg) XurlNew(_msg, __FILE__, __LINE__)
112 
119 /*@unused@*/ urlinfo urlLink(urlinfo u, const char * msg)
120  /*@modifies u @*/;
121 
123 urlinfo XurlLink(urlinfo u, const char * msg, const char * file, unsigned line)
124  /*@modifies u @*/;
125 #define urlLink(_u, _msg) XurlLink(_u, _msg, __FILE__, __LINE__)
126 
133 /*@unused@*/ urlinfo urlFree( /*@killref@*/ urlinfo u, const char * msg)
134  /*@globals fileSystem, internalState @*/
135  /*@modifies u, fileSystem, internalState @*/;
136 
138 urlinfo XurlFree( /*@killref@*/ urlinfo u, const char * msg,
139  const char * file, unsigned line)
140  /*@globals fileSystem, internalState @*/
141  /*@modifies u, fileSystem, internalState @*/;
142 #define urlFree(_u, _msg) XurlFree(_u, _msg, __FILE__, __LINE__)
143 
147 void urlFreeCache(void)
148  /*@globals _url_cache, _url_count, fileSystem, internalState @*/
149  /*@modifies _url_cache, _url_count, fileSystem, internalState @*/;
150 
156 urltype urlIsURL(const char * url)
157  /*@*/;
158 
165 /*@-incondefs@*/
166 urltype urlPath(const char * url, /*@out@*/ const char ** pathp)
167  /*@ensures maxSet(*pathp) == 0 /\ maxRead(*pathp) == 0 @*/
168  /*@modifies *pathp @*/;
169 /*@=incondefs@*/
170 
177 int urlSplit(const char * url, /*@out@*/ urlinfo * uret)
178  /*@globals h_errno, internalState @*/
179  /*@modifies *uret, internalState @*/;
180 
187 int urlGetFile(const char * url, /*@null@*/ const char * dest)
188  /*@globals h_errno, fileSystem, internalState @*/
189  /*@modifies fileSystem, internalState @*/;
190 
191 #ifdef __cplusplus
192 }
193 #endif
194 
195 #endif /* H_RPMURL */