rpmurl.h
Go to the documentation of this file.
#ifndef H_RPMURL
#define H_RPMURL
#include <assert.h>
#include <rpmio.h>
#include <rpmsw.h>
typedef enum urltype_e {
URL_IS_UNKNOWN = 0,
URL_IS_DASH = 1,
URL_IS_PATH = 2,
URL_IS_FTP = 3,
URL_IS_HTTP = 4,
URL_IS_HTTPS = 5,
URL_IS_HKP = 6
} urltype;
#define URLMAGIC 0xd00b1ed0U
#define URLSANE(u) assert(u && u->magic == URLMAGIC)
typedef /*@abstract@*/ /*@refcounted@*/ struct urlinfo_s * urlinfo;
extern int (*urlNotify) (const urlinfo u, unsigned status)
/*@*/;
/*@unchecked@*/ /*@null@*/ /*@shared@*/
extern void * urlNotifyArg;
struct urlinfo_s {
struct rpmioItem_s _item;
/*@owned@*/ /*@relnull@*/
const char * url;
/*@owned@*/ /*@relnull@*/
const char * scheme;
/*@owned@*/ /*@null@*/
const char * user;
/*@owned@*/ /*@null@*/
const char * password;
/*@owned@*/ /*@relnull@*/
const char * host;
/*@owned@*/ /*@null@*/
const char * portstr;
/*@owned@*/ /*@null@*/
const char * query;
/*@owned@*/ /*@null@*/
const char * fragment;
/*@owned@*/ /*@null@*/
const char * proxyu;
/*@owned@*/ /*@null@*/
const char * proxyh;
int proxyp;
int port;
int urltype;
/*@relnull@*/
FD_t ctrl;
/*@relnull@*/
FD_t data;
/*@relnull@*/
void * capabilities;
/*@relnull@*/
void * lockstore;
/*@relnull@*/
void * sess;
/*@null@*/
const char * location;
/*@null@*/
const char * etag;
/*@null@*/
int (*notify) (const urlinfo u, unsigned status);
/*@null@*/ /*@shared@*/
void * arg;
struct fdNotify_s {
unsigned status;
/*@null@*/
const char * hostname;
/*@null@*/
const char * address;
int64_t progress;
int64_t total;
} info;
/*@null@*/
rpmop rop;
/*@null@*/
rpmop sop;
/*@null@*/
rpmop top;
int bufAlloced;
/*@owned@*/
char * buf;
int openError;
int httpVersion;
int allow;
#define RPMURL_SERVER_HASRANGE ( 1 << 0)
#define RPMURL_SERVER_HASDAVCLASS1 ( 1 << 1)
#define RPMURL_SERVER_HASDAVCLASS2 ( 1 << 2)
#define RPMURL_SERVER_HASDAVEXEC ( 1 << 3)
#define RPMURL_SERVER_OPTIONSDONE ( 1 << 8)
#define RPMURL_SERVER_HASDAV (RPMURL_SERVER_HASDAVCLASS1|RPMURL_SERVER_HASDAVCLASS2|RPMURL_SERVER_HASDAVEXEC)
unsigned magic;
#if defined(__LCLINT__)
/*@refs@*/
int nrefs;
#endif
};
#ifdef __cplusplus
extern "C" {
#endif
/*@unchecked@*/
extern int _url_count;
/*@unchecked@*/
/*@only@*/ /*@null@*/
extern urlinfo * _url_cache;
/*@unchecked@*/
extern int _url_iobuf_size;
#define RPMURL_IOBUF_SIZE 4096
/*@unchecked@*/
extern int _url_debug;
#define RPMURL_DEBUG_IO 0x40000000
#define RPMURL_DEBUG_REFS 0x20000000
/*@unused@*/ /*@null@*/
urlinfo urlNew(const char * msg)
/*@*/;
/*@null@*/
urlinfo XurlNew(const char * msg, const char * fn, unsigned ln)
/*@globals fileSystem @*/
/*@modifies fileSystem @*/;
#define urlNew(_msg) XurlNew(_msg, __FILE__, __LINE__)
/*@unused@*/ /*@newref@*/
urlinfo urlLink(/*@returned@*/ urlinfo u, const char * msg)
/*@modifies u @*/;
#define urlLink(_u, _msg) \
(urlinfo) rpmioLinkPoolItem((rpmioItem)(_u), _msg, __FILE__, __LINE__)
/*@unused@*/ /*@null@*/
urlinfo urlFree( /*@killref@*/ urlinfo u, const char * msg)
/*@globals fileSystem, internalState @*/
/*@modifies u, fileSystem, internalState @*/;
#define urlFree(_u, _msg) \
((urlinfo)rpmioFreePoolItem((rpmioItem)(_u), _msg, __FILE__, __LINE__))
void urlFreeCache(void)
/*@globals _url_cache, _url_count, fileSystem, internalState @*/
/*@modifies _url_cache, _url_count, fileSystem, internalState @*/;
urltype urlIsURL(const char * url)
/*@*/;
/*@-incondefs@*/
urltype urlPath(const char * url, /*@out@*/ const char ** pathp)
/*@modifies *pathp @*/;
/*@=incondefs@*/
int urlSplit(const char * url, /*@out@*/ urlinfo * uret)
/*@globals h_errno, internalState @*/
/*@modifies *uret, internalState @*/;
int urlGetFile(const char * url, /*@null@*/ const char * dest)
/*@globals h_errno, fileSystem, internalState @*/
/*@modifies fileSystem, internalState @*/;
#ifdef __cplusplus
}
#endif
#endif /* H_RPMURL */