1#ifndef URL_MATCH_H 2#include"string-list.h" 3 4struct url_info { 5/* normalized url on success, must be freed, otherwise NULL */ 6char*url; 7/* if !url, a brief reason for the failure, otherwise NULL */ 8const char*err; 9 10/* the rest of the fields are only set if url != NULL */ 11 12size_t url_len;/* total length of url (which is now normalized) */ 13size_t scheme_len;/* length of scheme name (excluding final :) */ 14size_t user_off;/* offset into url to start of user name (0 => none) */ 15size_t user_len;/* length of user name; if user_off != 0 but 16 user_len == 0, an empty user name was given */ 17size_t passwd_off;/* offset into url to start of passwd (0 => none) */ 18size_t passwd_len;/* length of passwd; if passwd_off != 0 but 19 passwd_len == 0, an empty passwd was given */ 20size_t host_off;/* offset into url to start of host name (0 => none) */ 21size_t host_len;/* length of host name; this INCLUDES any ':portnum'; 22 * file urls may have host_len == 0 */ 23size_t port_len;/* if a portnum is present (port_len != 0), it has 24 * this length (excluding the leading ':') at the 25 * end of the host name (always 0 for file urls) */ 26size_t path_off;/* offset into url to the start of the url path; 27 * this will always point to a '/' character 28 * after the url has been normalized */ 29size_t path_len;/* length of path portion excluding any trailing 30 * '?...' and '#...' portion; will always be >= 1 */ 31}; 32 33externchar*url_normalize(const char*,struct url_info *); 34externintmatch_urls(const struct url_info *url,const struct url_info *url_prefix,int*exactusermatch); 35 36struct urlmatch_item { 37size_t matched_len; 38char user_matched; 39}; 40 41struct urlmatch_config { 42struct string_list vars; 43struct url_info url; 44const char*section; 45const char*key; 46 47void*cb; 48int(*collect_fn)(const char*var,const char*value,void*cb); 49int(*cascade_fn)(const char*var,const char*value,void*cb); 50}; 51 52externinturlmatch_config_entry(const char*var,const char*value,void*cb); 53 54#endif/* URL_MATCH_H */