1 /* 2 * url.h 3 */ 4 5 #ifndef CORE_PXE_URL_H 6 #define CORE_PXE_URL_H 7 8 #include <stddef.h> 9 #include <stdint.h> 10 11 enum url_type { 12 URL_NORMAL, /* It is a full URL */ 13 URL_OLD_TFTP, /* It's a ::-style TFTP path */ 14 URL_SUFFIX /* Prepend the pathname prefix */ 15 }; 16 17 struct url_info { 18 char *scheme; 19 char *user; 20 char *passwd; 21 char *host; 22 uint32_t ip; /* Placeholder field not set by parse_url() */ 23 unsigned int port; 24 char *path; /* Includes query */ 25 enum url_type type; 26 }; 27 28 enum url_type url_type(const char *url); 29 void parse_url(struct url_info *ui, char *url); 30 size_t url_escape_unsafe(char *output, const char *input, size_t bufsize); 31 char *url_unescape(char *buffer, char terminator); 32 33 #endif /* CORE_PXE_URL_H */ 34