summary refs log tree commit diff stats
path: root/yuri.h
blob: 3e33b43ceffad1a6ca137f8fafc32e526dfad090 (plain) (blame)
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
54
55
56
57
58
59
60
61
62
63
64
65
#define YURI_HOST_NAME     1
#define YURI_HOST_IP4      2
#define YURI_HOST_IP6      3
#define YURI_HOST_IPFUTURE 4

struct uri {
	char *scheme;
	struct {
		int type;
		char *user;
		char *host;
		int port;
	} authority;
	int npath;
	char **path;
	char *query;
	char *fragment;
};

/* yuri.c */
struct uri *uri_new(void);
int uri_set_scheme(struct uri *, const char *);
int uri_set_authority(struct uri *, int, const char *, const char *, int);
int uri_set_authority_type(struct uri *, int);
int uri_set_authority_user(struct uri *, const char *);
int uri_set_authority_host(struct uri *, const char *);
int uri_set_authority_port(struct uri *, int);
int uri_append_path(struct uri *, const char *);
int uri_set_query(struct uri *, const char *);
int uri_set_fragment(struct uri *, const char *);
void uri_unset_scheme(struct uri *);
void uri_unset_authority(struct uri *);
void uri_unset_authority_type(struct uri *);
void uri_unset_authority_user(struct uri *);
void uri_unset_authority_host(struct uri *);
void uri_unset_authority_port(struct uri *);
void uri_unset_path(struct uri *);
void uri_unset_query(struct uri *);
void uri_unset_fragment(struct uri *);
const char *uri_get_scheme(struct uri *);
int uri_get_authority_type(struct uri *);
const char *uri_get_authority_user(struct uri *);
const char *uri_get_authority_host(struct uri *);
int uri_get_authority_port(struct uri *);
const char **uri_get_path(struct uri *);
char *uri_string_path(struct uri *);
int uri_get_npath(struct uri *);
const char *uri_get_query(struct uri *);
const char *uri_get_fragment(struct uri *);
void uri_free(struct uri *);

/* decode.c */
struct uri *uri_decode(const char *);

/* encode.c */
char *uri_encode(struct uri *);

/* normalize.c */
int uri_normalize(struct uri *);

/* strlcat.c/strlcpy.c */
#undef strlcpy
#undef strlcat
size_t strlcpy(const char *, char *, size_t);
size_t strlcat(const char *, char *, size_t);