2 * Copyright (C) 2009 Sony Computer Entertainment Inc.
3 * Copyright 2009 Sony Corp.
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.
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.
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
19 #if !defined(_PB_URL_PARSER_H)
20 #define _PB_URL_PARSER_H
22 #include <arpa/inet.h>
26 * enum pb_url_scheme - Enumeration of the URL schemes we can handle.
41 * struct pb_url - Parsed URL info.
42 * @scheme: The enum pb_url_scheme for this URL.
43 * @full: The full URL = scheme://host:port/path.
44 * @host: The host part of URL.
45 * @port: The port part of URL.
46 * @path: The path part of URL.
47 * @dir: The dir part of path.
48 * @file: The file part of path.
50 * For info on URL syntax see:
51 * http://www.ietf.org/rfc/rfc3986.txt
55 enum pb_url_scheme scheme;
64 bool is_url(const char *str);
65 int addr_scheme(const char *address);
66 struct pb_url *pb_url_parse(void *ctx, const char *url_str);
67 struct pb_url *pb_url_copy(void *ctx, const struct pb_url *url);
68 struct pb_url *pb_url_join(void *ctx, const struct pb_url *url, const char *s);
69 char *pb_url_to_string(struct pb_url *url);
71 const char *pb_url_scheme_name(enum pb_url_scheme scheme);