summaryrefslogtreecommitdiff
path: root/url.h
blob: a6227cf14596016e19a3aa92e2e44da38ed42891 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef H_URL
#define H_URL

typedef enum {
    URL_IS_UNKNOWN	= 0,
    URL_IS_DASH		= 1,
    URL_IS_PATH		= 2,
    URL_IS_FTP		= 3,
    URL_IS_HTTP		= 4,
} urltype;

typedef struct urlinfo {
    const char *url;		/* copy of original url */
    const char *service;
    const char *user;
    const char *password;
    const char *host;
    const char *portstr;
    const char *path;
    const char *proxyu;		/* FTP: proxy user */
    const char *proxyh;		/* FTP/HTTP: proxy host */
    int proxyp;			/* FTP/HTTP: proxy port */
    int	port;
    int ftpControl;
    int ftpGetFileDoneNeeded;
    int openError;		/* Type of open failure */
} urlinfo;

#ifndef	IPPORT_HTTP
#define	IPPORT_HTTP	80
#endif

#ifdef __cplusplus
extern "C" {
#endif

urltype	urlIsURL(const char * url);
int 	urlSplit(const char *url, urlinfo **u);
urlinfo	*newUrlinfo(void);
void	freeUrlinfo(urlinfo *u);

FD_t	ufdOpen(const char * pathname, int flags, mode_t mode);
int	ufdClose(FD_t fd);
const char *urlStrerror(const char *url);

int	urlGetFile(const char * url, const char * dest);
void    urlInvalidateCache(const char * url);

#ifdef __cplusplus
}
#endif

#endif