diff options
author | Shav Kinderlehrer <[email protected]> | 2024-07-23 17:48:28 -0400 |
---|---|---|
committer | Shav Kinderlehrer <[email protected]> | 2024-07-23 17:48:28 -0400 |
commit | dc0f2ce9ba97ebb47e05b80a511da6eb29818b63 (patch) | |
tree | dc83035069f5a015047be1ca3da6f65781eb4695 /include/url.h | |
parent | f638f4bd1e3a03bc2bdd5f9dcd57d4830fd3c553 (diff) | |
download | molehole-ncurses.tar.gz molehole-ncurses.zip |
Merge old-moleholencurses
Diffstat (limited to 'include/url.h')
-rwxr-xr-x | include/url.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/include/url.h b/include/url.h new file mode 100755 index 0000000..c1278ee --- /dev/null +++ b/include/url.h @@ -0,0 +1,42 @@ +#ifndef _URL_H_ +#define _URL_H_ + +#define MAX_URL_LENGTH 2048 + +/** + * Molerat URL. + * + * Holds all relevant for molehole to make requests. + */ +struct url { + char *scheme; + char *host; + int port; + char *path; + char *query; + char *fragment; +}; + +/** + * Parses a `*s` into `*url` as a molerat URL. + */ +int parse_url(struct url *url, char *s); + +/** + * Deallocates `struct url *url`. + */ +void free_url(struct url *url); + +/** + * Initializes a `struct url*` with sensible defaults. + */ +struct url *init_url(void); + +/** + * Get's the strlen of a `struct url*` + */ +int len_url(struct url *url); + +/* Error codes */ +enum UrlError { INVALID_CHARACTER = -1, MISSING_HOST = -2, MISSING_PORT = -3 }; +#endif |