6 * Uniform Resource Identifiers
12 /** A Uniform Resource Identifier
14 * Terminology for this data structure is as per uri(7), except that
15 * "path" is defined to include the leading '/' for an absolute path.
17 * Note that all fields within a URI are optional and may be NULL.
19 * Some examples are probably helpful:
21 * http://www.etherboot.org/wiki :
23 * scheme = "http", host = "www.etherboot.org", path = "/wiki"
27 * path = "/var/lib/tftpboot"
29 * mailto:bob@nowhere.com :
31 * scheme = "mailto", opaque = "bob@nowhere.com"
33 * ftp://joe:secret@insecure.org:8081/hidden/path/to?what=is#this
35 * scheme = "ftp", user = "joe", password = "secret",
36 * host = "insecure.org", port = "8081", path = "/hidden/path/to",
37 * query = "what=is", fragment = "this"
61 * URI is an absolute URI
64 * @ret is_absolute URI is absolute
66 * An absolute URI begins with a scheme, e.g. "http:" or "mailto:".
67 * Note that this is a separate concept from a URI with an absolute
70 static inline int uri_is_absolute ( struct uri *uri ) {
71 return ( uri->scheme != NULL );
75 * URI has an absolute path
78 * @ret has_absolute_path URI has an absolute path
80 * An absolute path begins with a '/'. Note that this is a separate
81 * concept from an absolute URI. Note also that a URI may not have a
84 static inline int uri_has_absolute_path ( struct uri *uri ) {
85 return ( uri->path && ( uri->path[0] == '/' ) );
89 * URI has a relative path
92 * @ret has_relative_path URI has a relative path
94 * An relative path begins with something other than a '/'. Note that
95 * this is a separate concept from a relative URI. Note also that a
96 * URI may not have a path at all.
98 static inline int uri_has_relative_path ( struct uri *uri ) {
99 return ( uri->path && ( uri->path[0] != '/' ) );
107 * Frees all the dynamically-allocated storage used by the URI
110 static inline void free_uri ( struct uri *uri ) {
114 extern struct uri * parse_uri ( const char *uri_string );
116 #endif /* _GPXE_URI_H */