rpm  5.4.10
rpmurl.h
Go to the documentation of this file.
1 #ifndef H_RPMURL
2 #define H_RPMURL
3 
8 #include <assert.h>
9 #include <rpmio.h>
10 #include <rpmsw.h>
11 
15 typedef enum urltype_e {
19  URL_IS_FTP = 3,
22  URL_IS_HKP = 6,
24 } urltype;
25 #define URL_IS_GIT (urltype)16
26 #define URL_IS_SVN (urltype)17
27 #define URL_IS_SQLITE (urltype)32
28 #define URL_IS_MYSQL (urltype)33
29 #define URL_IS_POSTGRES (urltype)34
30 #define URL_IS_SQLSERVER (urltype)35
31 
32 #define URLMAGIC 0xd00b1ed0U
33 #define URLSANE(u) assert(u && u->magic == URLMAGIC)
34 
37 typedef /*@abstract@*/ /*@refcounted@*/ struct urlinfo_s * urlinfo;
38 
41 extern int (*urlNotify) (const urlinfo u, unsigned status)
42  /*@*/;
43 
46 /*@unchecked@*/ /*@null@*/ /*@shared@*/
47 extern void * urlNotifyArg;
48 
52 struct urlinfo_s {
53  struct rpmioItem_s _item;
54 /*@owned@*/ /*@relnull@*/
55  const char * url;
56 /*@owned@*/ /*@relnull@*/
57  const char * scheme;
58 /*@owned@*/ /*@null@*/
59  const char * user;
60 /*@owned@*/ /*@null@*/
61  const char * password;
62 /*@owned@*/ /*@relnull@*/
63  const char * host;
64 /*@owned@*/ /*@null@*/
65  const char * portstr;
66 /*@owned@*/ /*@null@*/
67  const char * query;
68 /*@owned@*/ /*@null@*/
69  const char * fragment;
70 /*@owned@*/ /*@null@*/
71  const char * proxyu;
72 /*@owned@*/ /*@null@*/
73  const char * proxyh;
74  int proxyp;
75  int port;
77 /*@relnull@*/
79 /*@relnull@*/
82 /*@relnull@*/
83  void * capabilities;
84 /*@relnull@*/
85  void * lockstore;
86 /*@relnull@*/
87  void * sess;
89 /*@null@*/
90  const char * location;
91 /*@null@*/
92  const char * etag;
93 /*@null@*/
94  int (*notify) (const urlinfo u, unsigned status);
95 /*@null@*/ /*@shared@*/
96  void * arg;
97  struct fdNotify_s {
98  unsigned status;
99 /*@null@*/
100  const char * hostname;
101 /*@null@*/
102  const char * address;
103  int64_t progress;
104  int64_t total;
105  } info;
106 /*@null@*/
108 /*@null@*/
110 /*@null@*/
114 /*@owned@*/
115  char * buf;
116  int openError;
118  int allow;
119 #define RPMURL_SERVER_HASRANGE ( 1 << 0)
120 #define RPMURL_SERVER_HASDAVCLASS1 ( 1 << 1)
121 #define RPMURL_SERVER_HASDAVCLASS2 ( 1 << 2)
122 #define RPMURL_SERVER_HASDAVEXEC ( 1 << 3)
123 
124 #define RPMURL_SERVER_OPTIONSDONE ( 1 << 8)
125 
126 #define RPMURL_SERVER_HASDAV (RPMURL_SERVER_HASDAVCLASS1|RPMURL_SERVER_HASDAVCLASS2|RPMURL_SERVER_HASDAVEXEC)
127  unsigned magic;
128 #if defined(__LCLINT__)
129 /*@refs@*/
130  int nrefs;
131 #endif
132 };
133 
134 #ifdef __cplusplus
135 extern "C" {
136 #endif
137 
138 /*@unchecked@*/
139 extern int _url_count;
141 /*@unchecked@*/
142 /*@only@*/ /*@null@*/
143 extern urlinfo * _url_cache;
145 /*@unchecked@*/
146 extern int _url_iobuf_size;
147 #define RPMURL_IOBUF_SIZE 4096
148 
149 /*@unchecked@*/
150 extern int _url_debug;
151 #define RPMURL_DEBUG_IO 0x40000000
152 #define RPMURL_DEBUG_REFS 0x20000000
153 
159 /*@unused@*/ /*@null@*/
160 urlinfo urlNew(const char * msg)
161  /*@*/;
162 
164 /*@null@*/
165 urlinfo XurlNew(const char * msg, const char * fn, unsigned ln)
166  /*@globals fileSystem @*/
167  /*@modifies fileSystem @*/;
168 #define urlNew(_msg) XurlNew(_msg, __FILE__, __LINE__)
169 
176 /*@unused@*/ /*@newref@*/
177 urlinfo urlLink(/*@returned@*/ urlinfo u, const char * msg)
178  /*@modifies u @*/;
179 #define urlLink(_u, _msg) \
180  (urlinfo) rpmioLinkPoolItem((rpmioItem)(_u), _msg, __FILE__, __LINE__)
181 
188 /*@unused@*/ /*@null@*/
189 urlinfo urlFree( /*@killref@*/ urlinfo u, const char * msg)
190  /*@globals fileSystem, internalState @*/
191  /*@modifies u, fileSystem, internalState @*/;
192 #define urlFree(_u, _msg) \
193  ((urlinfo)rpmioFreePoolItem((rpmioItem)(_u), _msg, __FILE__, __LINE__))
194 
198 void urlFreeCache(void)
199  /*@globals _url_cache, _url_count, fileSystem, internalState @*/
200  /*@modifies _url_cache, _url_count, fileSystem, internalState @*/;
201 
207 urltype urlIsURL(const char * url)
208  /*@*/;
209 urltype urlType(void * _u)
210  /*@*/;
211 
218 /*@-incondefs@*/
219 urltype urlPath(const char * url, /*@out@*/ const char ** pathp)
220  /*@modifies *pathp @*/;
221 /*@=incondefs@*/
222 
229 int urlSplit(const char * url, /*@out@*/ urlinfo * uret)
230  /*@globals h_errno, internalState @*/
231  /*@modifies *uret, internalState @*/;
232 
239 int urlGetFile(const char * url, /*@null@*/ const char * dest)
240  /*@globals h_errno, fileSystem, internalState @*/
241  /*@modifies fileSystem, internalState @*/;
242 
243 #ifdef __cplusplus
244 }
245 #endif
246 
247 #endif /* H_RPMURL */