url-parser.h (2718B)
1 /*_ 2 * Copyright (c) 2026 finwo 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a copy of 5 * this software and associated documentation files (the "Software"), to use, copy, 6 * modify, and distribute the Software, subject to the following conditions: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, this 9 * list of conditions, and the following disclaimer. 10 * 11 * 2. Redistributions in binary form, or any public offering of the Software 12 * (including hosted or managed services), must reproduce the above copyright 13 * notice, this list of conditions, and the following disclaimer in the 14 * documentation and/or other materials provided. 15 * 16 * 3. Any redistribution or public offering of the Software must clearly attribute 17 * the Software to the original copyright holder, reference this License, and 18 * include a link to the official project repository or website. 19 * 20 * 4. The Software may not be renamed, rebranded, or marketed in a manner that 21 * implies it is an independent or proprietary product. Derivative works must 22 * clearly state that they are based on the Software. 23 * 24 * 5. Modifications to copies of the Software must carry prominent notices stating 25 * that changes were made, the nature of the modifications, and the date of the 26 * modifications. 27 * 28 * Any violation of these conditions terminates the permissions granted herein. 29 * 30 * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 32 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT 33 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 34 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 35 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 36 */ 37 38 #ifndef _URL_PARSER_H 39 #define _URL_PARSER_H 40 41 /* 42 * URL storage 43 */ 44 struct parsed_url { 45 char *scheme; /* mandatory */ 46 char *host; /* mandatory */ 47 char *port; /* optional */ 48 char *path; /* optional */ 49 char *query; /* optional */ 50 char *fragment; /* optional */ 51 char *username; /* optional */ 52 char *password; /* optional */ 53 }; 54 55 #ifdef __cplusplus 56 extern "C" { 57 #endif 58 59 /* 60 * Declaration of function prototypes 61 */ 62 struct parsed_url *parse_url(const char *); 63 void parsed_url_free(struct parsed_url *); 64 const char *parse_url_last_error(void); 65 66 #ifdef __cplusplus 67 } 68 #endif 69 70 #endif /* _URL_PARSER_H */ 71 72 /* 73 * Local variables: 74 * tab-width: 4 75 * c-basic-offset: 4 76 * End: 77 * vim600: sw=4 ts=4 fdm=marker 78 * vim<600: sw=4 ts=4 79 */