rpmurl.h File Reference
RPMIO.
`#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 | 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_s * | urlinfo

## 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 }
| 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 | 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 144 of file rpmurl.h.

#define RPMURL_DEBUG_REFS 0x20000000

Definition at line 145 of file rpmurl.h.

#define RPMURL_IOBUF_SIZE 4096

Definition at line 140 of file rpmurl.h.

#define RPMURL_SERVER_HASDAV (RPMURL_SERVER_HASDAVCLASS1|RPMURL_SERVER_HASDAVCLASS2|RPMURL_SERVER_HASDAVEXEC)

Definition at line 119 of file rpmurl.h.

#define RPMURL_SERVER_HASDAVCLASS1 ( 1 << 1)

Definition at line 113 of file rpmurl.h.

#define RPMURL_SERVER_HASDAVCLASS2 ( 1 << 2)

Definition at line 114 of file rpmurl.h.

#define RPMURL_SERVER_HASDAVEXEC ( 1 << 3)

Definition at line 115 of file rpmurl.h.

#define RPMURL_SERVER_HASRANGE ( 1 << 0)

Definition at line 112 of file rpmurl.h.

Referenced by checkResponse(), and XurlNew().

#define RPMURL_SERVER_OPTIONSDONE ( 1 << 8)

Definition at line 117 of file rpmurl.h.

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

Definition at line 185 of file rpmurl.h.

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

Definition at line 172 of file rpmurl.h.

#define URLMAGIC 0xd00b1ed0U

Definition at line 25 of file rpmurl.h.

Referenced by XurlNew().

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

Definition at line 161 of file rpmurl.h.

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

Definition at line 26 of file rpmurl.h.

Referenced by checkResponse(), ftpAbort(), ftpCheckResponse(), ftpCommand(), ftpFileDone(), ftpLogin(), ftpReq(), httpReq(), httpResp(), and urlFind().

## Typedef Documentation

typedef struct urlinfo_s* urlinfo

Definition at line 30 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://...

Definition at line 15 of file rpmurl.h.

## Function Documentation

urlinfo urlFree | ( | urlinfo | u,
|  | const char * | msg
| ) |  |

Dereference a URL control structure instance.

Parameters

  u | URL control structure
  msg | debugging identifier (unused)

Returns
  dereferenced instance (NULL if freed)

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

void urlFreeCache | ( | void |  | ) |

Free cached URL control structures.

Definition at line 183 of file url.c.

References _, _free(), _url_count, urlinfo_s::host, urlinfo_s::scheme, and urlFree().

Referenced by rpmioClean().

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

Copy data from URL to local file.

Parameters

  url | url string of source
  dest | file name of destination

Returns
  0 on success, otherwise FTPERR_* code

Definition at line 573 of file url.c.

References _free(), _url_debug, 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_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by prepFetch().

urltype urlIsURL | ( | const char * | url | ) |

Return type of URL.

Parameters

  url | url string

Returns
  type of url

Definition at line 377 of file url.c.

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

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

urlinfo urlLink | ( | urlinfo | u,
|  | const char * | msg
| ) |  |

Reference a URL control structure instance.

Parameters

  u | URL control structure
  msg | debugging identifier (unused)

Returns
  referenced instance

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

urlinfo urlNew | ( | const char * | msg | ) |

Create a URL control structure instance.

Parameters

  msg | debugging identifier (unused)

Returns
  new instance

Referenced by urlSplit().

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

Return path component of URL.

Parameters

  url | url string

Return values

  pathp | pointer to path component of url

Returns
  type of url

Definition at line 393 of file url.c.

References URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlIsURL().

Referenced by Access(), addFile(), arSetup(), Chdir(), Chmod(), Chown(), Chroot(), compareFileListRecs(), compressFilelist(), cpioStrCmp(), db3close(), db3open(), dncmp(), dnlInitIterator(), dodigest(), doFoo(), doIcon(), doPatch(), doSetupMacro(), doUntar(), Fchmod(), Fchown(), fsmMkdirs(), fsmStage(), Fstat(), ftpCmd(), ftpNLST(), fts_safe_changedir(), genCpioListAndHeader(), Glob(), Glob_pattern_p(), handlePreambleTag(), iosmMkdirs(), iosmStage(), iosmStrCmp(), Lchown(), Link(), Lstat(), main(), Mkdir(), Mkfifo(), Mknod(), Open(), Opendir(), parseForSimple(), populateInstallHeader(), processBinaryFile(), processMetadataFile(), processSourceFiles(), Readlink(), Realpath(), Rename(), repoMkdir(), repoRfileDigest(), Rmdir(), rpmdbRebuild(), rpmdbURIPath(), rpmdsNew(), rpmfcClassify(), rpmfcGenerateDepends(), rpmfiBuildFNames(), rpmfiFN(), rpmGenPath(), rpmGlob(), rpmioFileExists(), rpmMkdirPath(), rpmpsmStage(), rpmReadHeader(), rpmShowProgress(), rpmTempFile(), rpmtsRootDir(), 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

  url | url string

Return values

  uret | address of new control instance pointer

Returns
  0 on success, -1 on error

Definition at line 462 of file url.c.

References _, _free(), urlinfo_s::fragment, urlinfo_s::host, IPPORT_FTP, IPPORT_HTTP, IPPORT_HTTPS, 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, urlFind(), urlFree(), urlIsURL(), urlNew(), urlStrdup(), urlinfo_s::urltype, urlinfo_s::user, and xstrdup().

Referenced by avContextCreate(), httpOpen(), urlConnect(), and urlStrerror().

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

Todo:
  Remove debugging entry from the ABI.

Definition at line 157 of file url.c.

References urlinfo_s::allow, urlinfo_s::arg, urlinfo_s::buf, urlinfo_s::bufAlloced, urlinfo_s::ctrl, urlinfo_s::data, urlinfo_s::etag, urlinfo_s::httpVersion, urlinfo_s::location, urlinfo_s::magic, urlinfo_s::notify, urlinfo_s::port, urlinfo_s::proxyp, urlinfo_s::rop, rpmioLinkPoolItem(), RPMURL_SERVER_HASRANGE, urlinfo_s::sop, urlinfo_s::top, URL_IS_UNKNOWN, urlGetPool(), URLMAGIC, urlNotify, urlNotifyArg, urlinfo_s::urltype, and xcalloc().

## Variable Documentation

urlinfo* _url_cache

URL cache.

Definition at line 65 of file url.c.

int _url_count

No. of cached URL's.

Definition at line 138 of file url.c.

Referenced by urlFind(), and urlFreeCache().

int _url_debug

URL debugging?

Definition at line 54 of file url.c.

Referenced by urlGetFile(), and urlGetPool().

int _url_iobuf_size

Initial size of URL I/O buffer.

Definition at line 49 of file url.c.

Referenced by checkResponse(), and ftpNLST().

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

Definition at line 37 of file url.c.

Referenced by XurlNew().

void* urlNotifyArg

Definition at line 44 of file url.c.

Referenced by XurlNew().