rpm  5.4.15
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
rpmurl.h File Reference
#include <assert.h>
#include <rpmio.h>
#include <rpmsw.h>
Include dependency graph for rpmurl.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  urlinfo_s
 URL control structure. More...
 
struct  urlinfo_s::fdNotify_s
 

Macros

#define URL_IS_GIT   (urltype)16
 
#define URL_IS_SVN   (urltype)17
 
#define URL_IS_SQLITE   (urltype)32
 
#define URL_IS_MYSQL   (urltype)33
 
#define URL_IS_POSTGRES   (urltype)34
 
#define URL_IS_SQLSERVER   (urltype)35
 
#define URLMAGIC   0xd00b1ed0U
 
#define URLSANE(u)   assert(u && u->magic == URLMAGIC)
 
#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)
 
#define RPMURL_IOBUF_SIZE   4096
 
#define RPMURL_DEBUG_IO   0x40000000
 
#define RPMURL_DEBUG_REFS   0x20000000
 
#define urlNew(_msg)   XurlNew(_msg, __FILE__, __LINE__)
 
#define urlLink(_u, _msg)   (urlinfo) rpmioLinkPoolItem((rpmioItem)(_u), _msg, __FILE__, __LINE__)
 
#define urlFree(_u, _msg)   ((urlinfo)rpmioFreePoolItem((rpmioItem)(_u), _msg, __FILE__, __LINE__))
 

Typedefs

typedef enum urltype_e urltype
 Supported URL types. More...
 
typedef struct urlinfo_surlinfo
 

Enumerations

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, URL_IS_MONGO = 7
}
 Supported URL types. More...
 

Functions

urlinfo urlNew (const char *msg)
 Create a URL control structure instance. More...
 
urlinfo XurlNew (const char *msg, const char *fn, unsigned ln)
 
urlinfo urlLink (urlinfo u, const char *msg)
 Reference a URL control structure instance. More...
 
urlinfo urlFree (urlinfo u, const char *msg)
 Dereference a URL control structure instance. More...
 
void urlFreeCache (void)
 Free cached URL control structures. More...
 
urltype urlIsURL (const char *url)
 Return type of URL. More...
 
urltype urlType (void *_u)
 
urltype urlPath (const char *url, const char **pathp)
 Return path component of URL. More...
 
int urlSplit (const char *url, urlinfo *uret)
 Parse URL string into a control structure. More...
 
int urlGetFile (const char *url, const char *dest)
 Copy data from URL to local file. More...
 

Variables

int(* urlNotify )(const urlinfo u, unsigned status)
 
void * urlNotifyArg
 
int _url_count
 
urlinfo_url_cache
 
int _url_iobuf_size
 
int _url_debug
 

Macro Definition Documentation

#define RPMURL_DEBUG_IO   0x40000000

Definition at line 151 of file rpmurl.h.

#define RPMURL_DEBUG_REFS   0x20000000

Definition at line 152 of file rpmurl.h.

#define RPMURL_IOBUF_SIZE   4096

Definition at line 147 of file rpmurl.h.

Definition at line 126 of file rpmurl.h.

#define RPMURL_SERVER_HASDAVCLASS1   ( 1 << 1)

Definition at line 120 of file rpmurl.h.

#define RPMURL_SERVER_HASDAVCLASS2   ( 1 << 2)

Definition at line 121 of file rpmurl.h.

#define RPMURL_SERVER_HASDAVEXEC   ( 1 << 3)

Definition at line 122 of file rpmurl.h.

#define RPMURL_SERVER_HASRANGE   ( 1 << 0)

Definition at line 119 of file rpmurl.h.

Referenced by checkResponse(), and XurlNew().

#define RPMURL_SERVER_OPTIONSDONE   ( 1 << 8)

Definition at line 124 of file rpmurl.h.

#define URL_IS_GIT   (urltype)16

Definition at line 25 of file rpmurl.h.

#define URL_IS_MYSQL   (urltype)33

Definition at line 28 of file rpmurl.h.

Referenced by odbcConnect(), and odbcNew().

#define URL_IS_POSTGRES   (urltype)34

Definition at line 29 of file rpmurl.h.

Referenced by odbcConnect(), and odbcNew().

#define URL_IS_SQLITE   (urltype)32

Definition at line 27 of file rpmurl.h.

#define URL_IS_SQLSERVER   (urltype)35

Definition at line 30 of file rpmurl.h.

Referenced by odbcConnect(), and odbcNew().

#define URL_IS_SVN   (urltype)17

Definition at line 26 of file rpmurl.h.

#define urlFree (   _u,
  _msg 
)    ((urlinfo)rpmioFreePoolItem((rpmioItem)(_u), _msg, __FILE__, __LINE__))

Definition at line 192 of file rpmurl.h.

#define urlLink (   _u,
  _msg 
)    (urlinfo) rpmioLinkPoolItem((rpmioItem)(_u), _msg, __FILE__, __LINE__)

Definition at line 179 of file rpmurl.h.

#define URLMAGIC   0xd00b1ed0U

Definition at line 32 of file rpmurl.h.

Referenced by XurlNew().

#define urlNew (   _msg)    XurlNew(_msg, __FILE__, __LINE__)

Definition at line 168 of file rpmurl.h.

#define URLSANE (   u)    assert(u && u->magic == URLMAGIC)

Typedef Documentation

typedef struct urlinfo_s* urlinfo

Definition at line 37 of file rpmurl.h.

typedef enum urltype_e urltype

Supported URL types.

Enumeration Type Documentation

enum urltype_e

Supported URL types.

Enumerator
URL_IS_UNKNOWN 

unknown (aka a file)

URL_IS_DASH 

stdin/stdout

URL_IS_PATH 

file://...

URL_IS_FTP 

ftp://...

URL_IS_HTTP 

http://...

URL_IS_HTTPS 

https://...

URL_IS_HKP 

hkp://...

URL_IS_MONGO 

mongo://... and mongodb://...

Definition at line 15 of file rpmurl.h.

Function Documentation

urlinfo urlFree ( urlinfo  u,
const char *  msg 
)

Dereference a URL control structure instance.

Parameters
uURL control structure
msgdebugging identifier (unused)
Returns
dereferenced instance (NULL if freed)

Referenced by avxFini(), odbcFini(), ufdClose(), urlConnect(), urlFind(), urlFreeCache(), and urlSplit().

void urlFreeCache ( void  )

Free cached URL control structures.

Definition at line 202 of file url.c.

References _, _free(), _url_count, urlinfo_s::host, i, urlinfo_s::scheme, urlFree(), yarnPeekLock(), yarnPossess(), and yarnRelease().

Referenced by rpmioClean().

int urlGetFile ( const char *  url,
const char *  dest 
)

Copy data from URL to local file.

Parameters
urlurl string of source
destfile name of destination
Returns
0 on success, otherwise FTPERR_* code

Definition at line 598 of file url.c.

References _free(), D_, Fclose(), Ferror(), Fopen(), Fstrerror(), FTPERR_UNKNOWN, rpmExpand(), rpmExpandNumeric(), rpmlog(), RPMLOG_DEBUG, ufdGetFile(), Unlink(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_MONGO, URL_IS_PATH, URL_IS_UNKNOWN, urlPath(), and urlType().

Referenced by prepFetch().

urltype urlIsURL ( const char *  url)

Return type of URL.

Parameters
urlurl string
Returns
type of url

Definition at line 409 of file url.c.

References urlstring::leadin, urlstring::len, urlstring::ret, URL_IS_UNKNOWN, and urlstrings.

Referenced by Fopen(), Fts_open(), main(), urlSplit(), and urlStrerror().

urlinfo urlLink ( urlinfo  u,
const char *  msg 
)

Reference a URL control structure instance.

Parameters
uURL control structure
msgdebugging identifier (unused)
Returns
referenced instance

Referenced by ftpOpen(), httpOpen(), odbcNew(), rpmavxNew(), ufdGetUrlinfo(), urlConnect(), and urlFind().

urlinfo urlNew ( const char *  msg)

Create a URL control structure instance.

Parameters
msgdebugging identifier (unused)
Returns
new instance

Referenced by urlSplit().

urltype urlPath ( const char *  url,
const char **  pathp 
)

Return path component of URL.

Parameters
urlurl string
Return values
pathppointer to path component of url
Returns
type of url

Definition at line 430 of file url.c.

References urlstring::leadin, urlstring::len, urlstring::ret, URL_IS_UNKNOWN, and urlstrings.

Referenced by Access(), addFile(), arSetup(), Chdir(), Chflags(), Chmod(), Chown(), Chroot(), compareFileListRecs(), compressFilelist(), cpioStrCmp(), db3close(), db3open(), dncmp(), dnlInitIterator(), dodigest(), doFoo(), doIcon(), doPatch(), doSetupMacro(), doUntar(), Fadvise(), Fallocate(), Fchflags(), Fchmod(), Fchown(), fsmMkdirs(), fsmStage(), Fstat(), ftpCmd(), ftpNLST(), fts_safe_changedir(), genCpioListAndHeader(), Glob(), Glob_pattern_p(), handlePreambleTag(), iosmMkdirs(), iosmStage(), iosmStrCmp(), Lchflags(), Lchmod(), Lchown(), Link(), Lstat(), Lutimes(), main(), Mkdir(), Mkfifo(), Mknod(), odbcConnect(), odbcNew(), Open(), Opendir(), packagedDir(), parseForSimple(), populateInstallHeader(), processBinaryFile(), processMetadataFile(), processSourceFiles(), Readlink(), Realpath(), Rename(), Rmdir(), rpmalAllFileSatisfiesDepend(), rpmdbURIPath(), rpmdsNew(), rpmfcClassify(), rpmfcGenerateDepends(), rpmfiBuildFNames(), rpmfiFN(), rpmfiFNBF(), rpmGenPath(), rpmGlob(), rpmmgFile(), rpmMkdirPath(), rpmpsmStage(), rpmReadHeader(), rpmrepoInitPopt(), rpmrepoMkdir(), rpmrepoRfileDigest(), rpmShowProgress(), rpmTempFile(), rpmtsOpenSDB(), rpmtsRootDir(), Scandir(), sql_close(), sql_open(), Stat(), Symlink(), ufdOpen(), Unlink(), urlGetFile(), Utime(), Utimes(), writeFile(), and writeLinkedFile().

int urlSplit ( const char *  url,
urlinfo uret 
)

Parse URL string into a control structure.

Parameters
urlurl string
Return values
uretaddress of new control instance pointer
Returns
0 on success, -1 on error

Definition at line 476 of file url.c.

References _, _free(), urlinfo_s::fragment, urlinfo_s::host, IPPORT_FTP, IPPORT_HTTP, IPPORT_HTTPS, IPPORT_MONGO, IPPORT_PGPKEYSERVER, urlinfo_s::password, urlinfo_s::port, urlinfo_s::portstr, urlinfo_s::query, rpmlog(), RPMLOG_ERR, urlinfo_s::scheme, urlinfo_s::url, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_MONGO, urlFind(), urlFree(), urlIsURL(), urlNew(), urlStrdup(), urlinfo_s::user, urlinfo_s::ut, and xstrdup().

Referenced by httpOpen(), odbcConnect(), odbcNew(), rpmavxNew(), urlConnect(), and urlStrerror().

urltype urlType ( void *  _u)

Definition at line 424 of file url.c.

References URL_IS_UNKNOWN.

Referenced by ufdClose(), ufdSeek(), urlConnect(), and urlGetFile().

urlinfo XurlNew ( const char *  msg,
const char *  fn,
unsigned  ln 
)

Variable Documentation

urlinfo* _url_cache

URL cache.

Definition at line 82 of file url.c.

int _url_count

No. of cached URL's.

Definition at line 155 of file url.c.

Referenced by urlFind(), and urlFreeCache().

int _url_debug

URL debugging?

Definition at line 71 of file url.c.

int _url_iobuf_size

Initial size of URL I/O buffer.

Definition at line 66 of file url.c.

Referenced by checkResponse(), and ftpNLST().

int(* urlNotify)(const urlinfo u, unsigned status)

Definition at line 54 of file url.c.

Referenced by XurlNew().

void* urlNotifyArg

Definition at line 61 of file url.c.

Referenced by XurlNew().