]> git.ozlabs.org Git - petitboot/blob - lib/url/url.h
lib/log: Always flush after writing logs
[petitboot] / lib / url / url.h
1 /*
2  *  Copyright (C) 2009 Sony Computer Entertainment Inc.
3  *  Copyright 2009 Sony Corp.
4  *
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; version 2 of the License.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #if !defined(_PB_URL_PARSER_H)
20 #define _PB_URL_PARSER_H
21
22 /**
23  * enum pb_url_scheme - Enumeration of the URL schemes we can handle.
24  */
25
26 enum pb_url_scheme {
27         pb_url_unknown = 0,
28         pb_url_file,
29         pb_url_ftp,
30         pb_url_http,
31         pb_url_https,
32         pb_url_nfs,
33         pb_url_sftp,
34         pb_url_tftp,
35 };
36
37 /**
38  * struct pb_url - Parsed URL info.
39  * @scheme: The enum pb_url_scheme for this URL.
40  * @full: The full URL = scheme://host:port/path.
41  * @host: The host part of URL.
42  * @port: The port part of URL.
43  * @path: The path part of URL.
44  * @dir: The dir part of path.
45  * @file: The file part of path.
46  *
47  * For info on URL syntax see:
48  *  http://www.ietf.org/rfc/rfc3986.txt
49  */
50
51 struct pb_url {
52         enum pb_url_scheme scheme;
53         char *full;
54         char *host;
55         char *port;
56         char *path;
57         char *dir;
58         char *file;
59 };
60
61 struct pb_url *pb_url_parse(void *ctx, const char *url_str);
62 struct pb_url *pb_url_join(void *ctx, const struct pb_url *url, const char *s);
63 char *pb_url_to_string(struct pb_url *url);
64
65 const char *pb_url_scheme_name(enum pb_url_scheme scheme);
66
67 #endif