rpm  5.2.1
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,
23 } urltype;
24 
25 #define URLMAGIC 0xd00b1ed0U
26 #define URLSANE(u) assert(u && u->magic == URLMAGIC)
27 
30 typedef /*@abstract@*/ /*@refcounted@*/ struct urlinfo_s * urlinfo;
31 
34 extern int (*urlNotify) (const urlinfo u, unsigned status)
35  /*@*/;
36 
39 /*@unchecked@*/ /*@null@*/ /*@shared@*/
40 extern void * urlNotifyArg;
41 
45 struct urlinfo_s {
46  struct rpmioItem_s _item;
47 /*@owned@*/ /*@relnull@*/
48  const char * url;
49 /*@owned@*/ /*@relnull@*/
50  const char * scheme;
51 /*@owned@*/ /*@null@*/
52  const char * user;
53 /*@owned@*/ /*@null@*/
54  const char * password;
55 /*@owned@*/ /*@relnull@*/
56  const char * host;
57 /*@owned@*/ /*@null@*/
58  const char * portstr;
59 /*@owned@*/ /*@null@*/
60  const char * query;
61 /*@owned@*/ /*@null@*/
62  const char * fragment;
63 /*@owned@*/ /*@null@*/
64  const char * proxyu;
65 /*@owned@*/ /*@null@*/
66  const char * proxyh;
67  int proxyp;
68  int port;
69  int urltype;
70 /*@relnull@*/
72 /*@relnull@*/
75 /*@relnull@*/
76  void * capabilities;
77 /*@relnull@*/
78  void * lockstore;
79 /*@relnull@*/
80  void * sess;
82 /*@null@*/
83  const char * location;
84 /*@null@*/
85  const char * etag;
86 /*@null@*/
87  int (*notify) (const urlinfo u, unsigned status);
88 /*@null@*/ /*@shared@*/
89  void * arg;
90  struct fdNotify_s {
91  unsigned status;
92 /*@null@*/
93  const char * hostname;
94 /*@null@*/
95  const char * address;
96  int64_t progress;
97  int64_t total;
98  } info;
99 /*@null@*/
101 /*@null@*/
103 /*@null@*/
107 /*@owned@*/
108  char * buf;
109  int openError;
111  int allow;
112 #define RPMURL_SERVER_HASRANGE ( 1 << 0)
113 #define RPMURL_SERVER_HASDAVCLASS1 ( 1 << 1)
114 #define RPMURL_SERVER_HASDAVCLASS2 ( 1 << 2)
115 #define RPMURL_SERVER_HASDAVEXEC ( 1 << 3)
116 
117 #define RPMURL_SERVER_OPTIONSDONE ( 1 << 8)
118 
119 #define RPMURL_SERVER_HASDAV (RPMURL_SERVER_HASDAVCLASS1|RPMURL_SERVER_HASDAVCLASS2|RPMURL_SERVER_HASDAVEXEC)
120  unsigned magic;
121 #if defined(__LCLINT__)
122 /*@refs@*/
123  int nrefs;
124 #endif
125 };
126 
127 #ifdef __cplusplus
128 extern "C" {
129 #endif
130 
131 /*@unchecked@*/
132 extern int _url_count;
134 /*@unchecked@*/
135 /*@only@*/ /*@null@*/
136 extern urlinfo * _url_cache;
138 /*@unchecked@*/
139 extern int _url_iobuf_size;
140 #define RPMURL_IOBUF_SIZE 4096
141 
142 /*@unchecked@*/
143 extern int _url_debug;
144 #define RPMURL_DEBUG_IO 0x40000000
145 #define RPMURL_DEBUG_REFS 0x20000000
146 
152 /*@unused@*/ /*@null@*/
153 urlinfo urlNew(const char * msg)
154  /*@*/;
155 
157 /*@null@*/
158 urlinfo XurlNew(const char * msg, const char * fn, unsigned ln)
159  /*@globals fileSystem @*/
160  /*@modifies fileSystem @*/;
161 #define urlNew(_msg) XurlNew(_msg, __FILE__, __LINE__)
162 
169 /*@unused@*/ /*@newref@*/
170 urlinfo urlLink(/*@returned@*/ urlinfo u, const char * msg)
171  /*@modifies u @*/;
172 #define urlLink(_u, _msg) \
173  (urlinfo) rpmioLinkPoolItem((rpmioItem)(_u), _msg, __FILE__, __LINE__)
174 
181 /*@unused@*/ /*@null@*/
182 urlinfo urlFree( /*@killref@*/ urlinfo u, const char * msg)
183  /*@globals fileSystem, internalState @*/
184  /*@modifies u, fileSystem, internalState @*/;
185 #define urlFree(_u, _msg) \
186  ((urlinfo)rpmioFreePoolItem((rpmioItem)(_u), _msg, __FILE__, __LINE__))
187 
191 void urlFreeCache(void)
192  /*@globals _url_cache, _url_count, fileSystem, internalState @*/
193  /*@modifies _url_cache, _url_count, fileSystem, internalState @*/;
194 
200 urltype urlIsURL(const char * url)
201  /*@*/;
202 
209 /*@-incondefs@*/
210 urltype urlPath(const char * url, /*@out@*/ const char ** pathp)
211  /*@modifies *pathp @*/;
212 /*@=incondefs@*/
213 
220 int urlSplit(const char * url, /*@out@*/ urlinfo * uret)
221  /*@globals h_errno, internalState @*/
222  /*@modifies *uret, internalState @*/;
223 
230 int urlGetFile(const char * url, /*@null@*/ const char * dest)
231  /*@globals h_errno, fileSystem, internalState @*/
232  /*@modifies fileSystem, internalState @*/;
233 
234 #ifdef __cplusplus
235 }
236 #endif
237 
238 #endif /* H_RPMURL */