]> git.proxmox.com Git - mirror_qemu.git/blame - include/qemu/uri.h
util/uri: Remove unused functions uri_resolve() and uri_resolve_relative()
[mirror_qemu.git] / include / qemu / uri.h
CommitLineData
ca0defb9
PB
1/**
2 * Summary: library of generic URI related routines
3 * Description: library of generic URI related routines
4 * Implements RFC 2396
5 *
6 * Copyright (C) 1998-2003 Daniel Veillard. All Rights Reserved.
7 *
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:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
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.
24 *
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.
28 *
29 * Author: Daniel Veillard
30 **
31 * Copyright (C) 2007 Red Hat, Inc.
32 *
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.
37 *
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.
42 *
43 * You should have received a copy of the GNU Lesser General Public
0c201cc1 44 * License along with this library. If not, see <https://www.gnu.org/licenses/>.
ca0defb9
PB
45 *
46 * Authors:
47 * Richard W.M. Jones <rjones@redhat.com>
48 *
49 * Utility functions to help parse and assemble query strings.
50 */
51
52#ifndef QEMU_URI_H
53#define QEMU_URI_H
54
ca0defb9
PB
55/**
56 * URI:
57 *
58 * A parsed URI reference. This is a struct containing the various fields
59 * as described in RFC 2396 but separated for further processing.
60 */
61typedef struct URI {
48805df9
YF
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) */
ca0defb9
PB
72} URI;
73
74URI *uri_new(void);
ca0defb9
PB
75URI *uri_parse(const char *str);
76URI *uri_parse_raw(const char *str, int raw);
77int uri_parse_into(URI *uri, const char *str);
78char *uri_to_string(URI *uri);
79char *uri_string_escape(const char *str, const char *list);
ca0defb9
PB
80void uri_free(URI *uri);
81
82/* Single web service query parameter 'name=value'. */
83typedef struct QueryParam {
48805df9
YF
84 char *name; /* Name (unescaped). */
85 char *value; /* Value (unescaped). */
86 int ignore; /* Ignore this field in qparam_get_query */
ca0defb9
PB
87} QueryParam;
88
89/* Set of parameters. */
90typedef struct QueryParams {
48805df9
YF
91 int n; /* number of parameters used */
92 int alloc; /* allocated space */
93 QueryParam *p; /* array of parameters */
ca0defb9
PB
94} QueryParams;
95
f703f1ef
PMD
96QueryParams *query_params_new(int init_alloc);
97QueryParams *query_params_parse(const char *query);
98void query_params_free(QueryParams *ps);
ca0defb9 99
ca0defb9 100#endif /* QEMU_URI_H */