diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2013-03-05 15:28:14 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2013-04-15 15:42:26 +0800 |
commit | 16ebe978aeced862dd877cfee81ac7604902fd55 (patch) | |
tree | c73db6d36b3a8785f6a47c4544419b9341cd5ea2 /lib/url/url.h | |
parent | 9a960821e54b0794b1c519b493294b7222dd98d4 (diff) | |
download | petitboot-16ebe978aeced862dd877cfee81ac7604902fd55.zip petitboot-16ebe978aeced862dd877cfee81ac7604902fd55.tar.gz |
lib/url: Move URL-handling code to lib
We'll need to use the URL handling code in the server, so move it to the
lib/ directory.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'lib/url/url.h')
-rw-r--r-- | lib/url/url.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/lib/url/url.h b/lib/url/url.h new file mode 100644 index 0000000..3cb7cd8 --- /dev/null +++ b/lib/url/url.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2009 Sony Computer Entertainment Inc. + * Copyright 2009 Sony Corp. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#if !defined(_PB_URL_PARSER_H) +#define _PB_URL_PARSER_H + +/** + * enum pb_url_scheme - Enumeration of the URL schemes we can handle. + */ + +enum pb_url_scheme { + pb_url_unknown = 0, + pb_url_file, + pb_url_ftp, + pb_url_http, + pb_url_https, + pb_url_nfs, + pb_url_sftp, + pb_url_tftp, +}; + +/** + * struct pb_url - Parsed URL info. + * @scheme: The enum pb_url_scheme for this URL. + * @full: The full URL = scheme://host:port/path. + * @host: The host part of URL. + * @port: The port part of URL. + * @path: The path part of URL. + * @dir: The dir part of path. + * @file: The file part of path. + * + * For info on URL syntax see: + * http://www.ietf.org/rfc/rfc3986.txt + */ + +struct pb_url { + enum pb_url_scheme scheme; + char *full; + char *host; + char *port; + char *path; + char *dir; + char *file; +}; + +struct pb_url *pb_url_parse(void *ctx, const char *url_str); + +const char *pb_url_scheme_name(enum pb_url_scheme scheme); + +#endif |