2 * Summary: library of generic URI related routines
3 * Description: library of generic URI related routines
6 * Copyright (C) 1998-2003 Daniel Veillard. All Rights Reserved.
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
22 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 * Except as contained in this notice, the name of Daniel Veillard shall not
26 * be used in advertising or otherwise to promote the sale, use or other
27 * dealings in this Software without prior written authorization from him.
29 * Author: Daniel Veillard
31 * Copyright (C) 2007 Red Hat, Inc.
33 * This library is free software; you can redistribute it and/or
34 * modify it under the terms of the GNU Lesser General Public
35 * License as published by the Free Software Foundation; either
36 * version 2.1 of the License, or (at your option) any later version.
38 * This library is distributed in the hope that it will be useful,
39 * but WITHOUT ANY WARRANTY; without even the implied warranty of
40 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41 * Lesser General Public License for more details.
43 * You should have received a copy of the GNU Lesser General Public
44 * License along with this library. If not, see <https://www.gnu.org/licenses/>.
47 * Richard W.M. Jones <rjones@redhat.com>
49 * Utility functions to help parse and assemble query strings.
58 * A parsed URI reference. This is a struct containing the various fields
59 * as described in RFC 2396 but separated for further processing.
62 char *scheme
; /* the URI scheme */
63 char *opaque
; /* opaque part */
64 char *authority
; /* the authority part */
65 char *server
; /* the server part */
66 char *user
; /* the user part */
67 int port
; /* the port number */
68 char *path
; /* the path string */
69 char *fragment
; /* the fragment identifier */
70 int cleanup
; /* parsing potentially unclean URI */
71 char *query
; /* the query string (as it appears in the URI) */
75 URI
*uri_parse(const char *str
);
76 URI
*uri_parse_raw(const char *str
, int raw
);
77 int uri_parse_into(URI
*uri
, const char *str
);
78 char *uri_to_string(URI
*uri
);
79 char *uri_string_escape(const char *str
, const char *list
);
80 void uri_free(URI
*uri
);
82 /* Single web service query parameter 'name=value'. */
83 typedef struct QueryParam
{
84 char *name
; /* Name (unescaped). */
85 char *value
; /* Value (unescaped). */
86 int ignore
; /* Ignore this field in qparam_get_query */
89 /* Set of parameters. */
90 typedef struct QueryParams
{
91 int n
; /* number of parameters used */
92 int alloc
; /* allocated space */
93 QueryParam
*p
; /* array of parameters */
96 QueryParams
*query_params_new(int init_alloc
);
97 QueryParams
*query_params_parse(const char *query
);
98 void query_params_free(QueryParams
*ps
);
100 #endif /* QEMU_URI_H */