diff options
author | Ali Fardan <raiz@stellarbound.space> | 2020-11-18 10:55:20 +0300 |
---|---|---|
committer | Ali Fardan <raiz@stellarbound.space> | 2020-11-18 10:55:20 +0300 |
commit | 6f3d10a3ec09cc278041ced4d4e506cb89a7c69a (patch) | |
tree | 5b5c7db3104d805d71029534cffcfd5d9c2aca0b /yuri.h | |
download | libyuri-6f3d10a3ec09cc278041ced4d4e506cb89a7c69a.tar.gz |
initial commit; todo: thorough testing
Diffstat (limited to 'yuri.h')
-rw-r--r-- | yuri.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/yuri.h b/yuri.h new file mode 100644 index 0000000..1a3fa63 --- /dev/null +++ b/yuri.h @@ -0,0 +1,64 @@ +#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 *); +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); |