diff options
Diffstat (limited to 'utils/nsurl/private.h')
-rw-r--r-- | utils/nsurl/private.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/utils/nsurl/private.h b/utils/nsurl/private.h index b8132c535..f8ba51f67 100644 --- a/utils/nsurl/private.h +++ b/utils/nsurl/private.h @@ -21,6 +21,7 @@ #include <libwapcaplet/libwapcaplet.h> +#include "utils/nsurl.h" #include "utils/utils.h" /** A type for URL schemes */ @@ -72,4 +73,71 @@ struct nsurl { char string[FLEX_ARRAY_LEN_DECL]; /* Full URL as a string */ }; + +/** Marker set, indicating positions of sections within a URL string */ +struct nsurl_component_lengths { + size_t scheme; + size_t username; + size_t password; + size_t host; + size_t port; + size_t path; + size_t query; + size_t fragment; +}; + + +/** Flags indicating which parts of a URL string are required for a nsurl */ +enum nsurl_string_flags { + NSURL_F_SCHEME = (1 << 0), + NSURL_F_SCHEME_PUNCTUATION = (1 << 1), + NSURL_F_AUTHORITY_PUNCTUATION = (1 << 2), + NSURL_F_USERNAME = (1 << 3), + NSURL_F_PASSWORD = (1 << 4), + NSURL_F_CREDENTIALS_PUNCTUATION = (1 << 5), + NSURL_F_HOST = (1 << 6), + NSURL_F_PORT = (1 << 7), + NSURL_F_AUTHORITY = (NSURL_F_USERNAME | + NSURL_F_PASSWORD | + NSURL_F_HOST | + NSURL_F_PORT), + NSURL_F_PATH = (1 << 8), + NSURL_F_QUERY = (1 << 9), + NSURL_F_FRAGMENT_PUNCTUATION = (1 << 10), + NSURL_F_FRAGMENT = (1 << 11) +}; + +/** + * Get nsurl string info; total length, component lengths, & components present + * + * \param url NetSurf URL components + * \param url_s Updated to contain the string + * \param l Individual component lengths + * \param flags String flags + */ +void nsurl__get_string(const struct nsurl_components *url, char *url_s, + struct nsurl_component_lengths *l, + enum nsurl_string_flags flags); + +/** + * Get nsurl string info; total length, component lengths, & components present + * + * \param url NetSurf URL components + * \param parts Which parts of the URL are required in the string + * \param url_l Updated to total string length + * \param lengths Updated with individual component lengths + * \param pflags Updated to contain relevant string flags + */ +void nsurl__get_string_data(const struct nsurl_components *url, + nsurl_component parts, size_t *url_l, + struct nsurl_component_lengths *lengths, + enum nsurl_string_flags *pflags); + +/** + * Calculate hash value + * + * \param url NetSurf URL object to set hash value for + */ +void nsurl__calc_hash(nsurl *url); + #endif |