Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

url.c File Reference

#include "system.h"
#include <netinet/in.h>
#include <rpmmacro.h>
#include <rpmmessages.h>
#include <rpmio_internal.h>
#include "debug.h"

Go to the source code of this file.

Data Structures

struct  urlstring

Defines

#define IPPORT_FTP   21
#define IPPORT_HTTP   80
#define URLDBG(_f, _m, _x)   if ((_url_debug | (_f)) & (_m)) fprintf _x
#define URLDBGIO(_f, _x)   URLDBG((_f), RPMURL_DEBUG_IO, _x)
#define URLDBGREFS(_f, _x)   URLDBG((_f), RPMURL_DEBUG_REFS, _x)

Functions

void * _free (const void *p)
 Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
urlinfo XurlLink (urlinfo u, const char *msg, const char *file, unsigned line)
urlinfo XurlNew (const char *msg, const char *file, unsigned line)
urlinfo XurlFree (urlinfo u, const char *msg, const char *file, unsigned line)
void urlFreeCache (void)
 Free cached URL control structures.
int urlStrcmp (const char *str1, const char *str2)
void urlFind (urlinfo *uret, int mustAsk)
urltype urlIsURL (const char *url)
 Return type of URL.
urltype urlPath (const char *url, const char **pathp)
 Return path component of URL.
int urlSplit (const char *url, urlinfo *uret)
 Parse URL string into a control structure.
int urlGetFile (const char *url, const char *dest)
 Copy data from URL to local file.

Variables

int _url_iobuf_size = RPMURL_IOBUF_SIZE
int _url_debug = 0
urlinfo_url_cache = NULL
int _url_count = 0
urlstring urlstrings []


Detailed Description

Definition in file url.c.


Define Documentation

#define IPPORT_FTP   21
 

Definition at line 19 of file url.c.

#define IPPORT_HTTP   80
 

Definition at line 22 of file url.c.

#define URLDBG _f,
_m,
_x   )     if ((_url_debug | (_f)) & (_m)) fprintf _x
 

Definition at line 35 of file url.c.

#define URLDBGIO _f,
_x   )     URLDBG((_f), RPMURL_DEBUG_IO, _x)
 

Definition at line 37 of file url.c.

#define URLDBGREFS _f,
_x   )     URLDBG((_f), RPMURL_DEBUG_REFS, _x)
 

Definition at line 38 of file url.c.

Referenced by XurlFree(), and XurlLink().


Function Documentation

void* _free const void *  p  )  [inline, static]
 

Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.

Parameters:
p memory to free
Return values:
NULL always

Definition at line 57 of file url.c.

void urlFind urlinfo uret,
int  mustAsk
[static]
 

Definition at line 191 of file url.c.

References _, _free(), _url_cache, _url_count, alloca(), urlinfo_s::host, urlinfo_s::password, urlinfo_s::portstr, urlinfo_s::proxyh, urlinfo_s::proxyp, urlinfo_s::proxyu, rpmExpand(), urlinfo_s::service, stpcpy(), urlFree, urlinfo, urlLink, URLSANE, urlStrcmp(), urlinfo_s::urltype, urlinfo_s::user, xmalloc(), xrealloc(), and xstrdup().

Referenced by urlSplit().

void urlFreeCache void   ) 
 

Free cached URL control structures.

Definition at line 158 of file url.c.

References _, _free(), _url_cache, _url_count, and urlFree.

Referenced by main().

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 506 of file url.c.

References _, Fclose(), FD_t, Ferror(), Fopen(), Fstrerror(), RPMMESS_DEBUG, rpmMessage, ufdGetFile(), Unlink(), URL_IS_DASH, URL_IS_FTP, URL_IS_HTTP, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by doUntar(), and rpmInstall().

urltype urlIsURL const char *  url  ) 
 

Return type of URL.

Parameters:
url url string
Returns:
type of url

Definition at line 348 of file url.c.

References urlstring::leadin, urlstring::ret, and urltype.

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

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 367 of file url.c.

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

Referenced by Access(), addFile(), buildForTarget(), Chdir(), db3close(), db3open(), doFoo(), domd5(), doPatch(), doScript(), doSetupMacro(), doUntar(), ftpCmd(), ftpNLST(), genCpioListAndHeader(), Glob(), Glob_pattern_p(), handlePreambleTag(), Link(), Lstat(), makeTempFile(), Mkdir(), Opendir(), parseSpec(), processBinaryFile(), processMetadataFile(), processSourceFiles(), Readlink(), Rename(), Rmdir(), rpmGenPath(), rpmGlob(), rpmGraph(), rpmInstall(), rpmioFileExists(), rpmMkdirPath(), rpmpsmStage(), Stat(), ufdOpen(), Unlink(), and urlGetFile().

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 409 of file url.c.

References _, _free(), urlinfo_s::host, urlinfo_s::password, urlinfo_s::port, urlinfo_s::portstr, RPMMESS_ERROR, rpmMessage, urlinfo_s::service, urlinfo_s::url, urlFind(), urlFree, urlinfo, urlIsURL(), urlNew, urlinfo_s::urltype, urlinfo_s::user, and xstrdup().

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

int urlStrcmp const char *  str1,
const char *  str2
[static]
 

Definition at line 178 of file url.c.

Referenced by urlFind().

urlinfo XurlFree urlinfo  u,
const char *  msg,
const char *  file,
unsigned  line
 

Todo:
Remove debugging entry from the ABI.

Definition at line 93 of file url.c.

References _, FDIO_s::_fdderef, FDIO_s::_fileno, _free(), urlinfo_s::buf, FDIO_s::close, urlinfo_s::ctrl, urlinfo_s::data, Fclose(), fdGetFp(), fdio, fdPush(), fpio, urlinfo_s::host, urlinfo_s::nrefs, urlinfo_s::password, urlinfo_s::portstr, urlinfo_s::proxyh, urlinfo_s::proxyu, urlinfo_s::service, urlinfo_s::url, URLDBGREFS, urlinfo, URLSANE, and urlinfo_s::user.

urlinfo XurlLink urlinfo  u,
const char *  msg,
const char *  file,
unsigned  line
 

Todo:
Remove debugging entry from the ABI.

Definition at line 63 of file url.c.

References urlinfo_s::nrefs, URLDBGREFS, urlinfo, and URLSANE.

Referenced by XurlNew().

urlinfo XurlNew const char *  msg,
const char *  file,
unsigned  line
 

Todo:
Remove debugging entry from the ABI.

Definition at line 73 of file url.c.

References urlinfo_s::ctrl, _FD_s::magic, _FD_s::nrefs, urlinfo_s::port, urlinfo_s::proxyp, urlinfo, urlinfo_s::urltype, xmalloc(), and XurlLink().


Variable Documentation

urlinfo* _url_cache = NULL
 

URL cache.

Definition at line 44 of file url.c.

Referenced by urlFind(), and urlFreeCache().

int _url_count = 0
 

No. of cached URL's.

Definition at line 49 of file url.c.

Referenced by urlFind(), and urlFreeCache().

int _url_debug = 0
 

URL debugging?

Definition at line 33 of file url.c.

int _url_iobuf_size = RPMURL_IOBUF_SIZE
 

Initial size of URL I/O buffer.

Definition at line 28 of file url.c.

struct urlstring urlstrings[] [static]
 


Generated on Sat Apr 9 12:20:16 2005 for rpm by  doxygen 1.3.9.1