2012-02-24 18:48:55 +00:00
|
|
|
/*
|
|
|
|
* viruri.h: internal definitions used for URI parsing.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 Red Hat, Inc.
|
|
|
|
*
|
2012-07-27 09:39:53 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2012-09-20 22:30:55 +00:00
|
|
|
* License along with this library. If not, see
|
2012-07-27 09:39:53 +00:00
|
|
|
* <http://www.gnu.org/licenses/>.
|
2012-02-24 18:48:55 +00:00
|
|
|
*/
|
|
|
|
|
2019-06-18 16:13:08 +00:00
|
|
|
#pragma once
|
2012-02-24 18:48:55 +00:00
|
|
|
|
2019-06-18 16:13:08 +00:00
|
|
|
#include <libxml/uri.h>
|
2012-02-24 18:48:55 +00:00
|
|
|
|
2019-06-18 16:13:08 +00:00
|
|
|
#include "internal.h"
|
|
|
|
#include "virconf.h"
|
2012-02-24 18:48:55 +00:00
|
|
|
|
2012-03-20 13:33:41 +00:00
|
|
|
typedef struct _virURI virURI;
|
|
|
|
typedef virURI *virURIPtr;
|
|
|
|
|
2012-03-20 13:59:32 +00:00
|
|
|
typedef struct _virURIParam virURIParam;
|
|
|
|
typedef virURIParam *virURIParamPtr;
|
|
|
|
|
|
|
|
struct _virURIParam {
|
|
|
|
char *name; /* Name (unescaped). */
|
|
|
|
char *value; /* Value (unescaped). */
|
|
|
|
bool ignore; /* Ignore this field in virURIFormatParams */
|
|
|
|
};
|
|
|
|
|
2012-03-20 13:33:41 +00:00
|
|
|
struct _virURI {
|
|
|
|
char *scheme; /* the URI scheme */
|
|
|
|
char *server; /* the server part */
|
|
|
|
char *user; /* the user part */
|
2017-07-20 10:42:53 +00:00
|
|
|
unsigned int port; /* the port number */
|
2012-03-20 13:33:41 +00:00
|
|
|
char *path; /* the path string */
|
|
|
|
char *query; /* the query string */
|
|
|
|
char *fragment; /* the fragment string */
|
2012-03-20 13:59:32 +00:00
|
|
|
|
|
|
|
size_t paramsCount;
|
|
|
|
size_t paramsAlloc;
|
|
|
|
virURIParamPtr params;
|
2012-03-20 13:33:41 +00:00
|
|
|
};
|
2012-02-24 18:48:55 +00:00
|
|
|
|
Centralize error reporting for URI parsing/formatting problems
Move error reporting out of the callers, into virURIParse
and virURIFormat, to get consistency.
* include/libvirt/virterror.h, src/util/virterror.c: Add VIR_FROM_URI
* src/util/viruri.c, src/util/viruri.h: Add error reporting
* src/esx/esx_driver.c, src/libvirt.c, src/libxl/libxl_driver.c,
src/lxc/lxc_driver.c, src/openvz/openvz_driver.c,
src/qemu/qemu_driver.c, src/qemu/qemu_migration.c,
src/remote/remote_driver.c, src/uml/uml_driver.c,
src/vbox/vbox_tmpl.c, src/vmx/vmx.c, src/xen/xen_driver.c,
src/xen/xend_internal.c, tests/viruritest.c: Remove error
reporting
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-03-20 12:16:54 +00:00
|
|
|
virURIPtr virURIParse(const char *uri)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
char *virURIFormat(virURIPtr uri)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
2012-02-24 18:48:55 +00:00
|
|
|
|
2012-03-20 13:59:32 +00:00
|
|
|
char *virURIFormatParams(virURIPtr uri);
|
|
|
|
|
2012-03-20 11:59:42 +00:00
|
|
|
void virURIFree(virURIPtr uri);
|
2019-10-15 12:47:50 +00:00
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virURI, virURIFree);
|
2015-11-06 09:44:53 +00:00
|
|
|
int virURIResolveAlias(virConfPtr conf, const char *alias, char **uri);
|
2012-03-20 11:59:42 +00:00
|
|
|
|
2019-06-18 16:13:08 +00:00
|
|
|
#define VIR_URI_SERVER(uri) ((uri) && (uri)->server ? (uri)->server : "localhost")
|