mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 19:41:16 +00:00
util: add helper API for getting URI parameters
Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
dee2218bc8
commit
fd2a9dda87
@ -3334,6 +3334,7 @@ virTypedParamsValidate;
|
|||||||
virURIFormat;
|
virURIFormat;
|
||||||
virURIFormatParams;
|
virURIFormatParams;
|
||||||
virURIFree;
|
virURIFree;
|
||||||
|
virURIGetParam;
|
||||||
virURIParse;
|
virURIParse;
|
||||||
virURIResolveAlias;
|
virURIResolveAlias;
|
||||||
|
|
||||||
|
@ -376,3 +376,19 @@ virURIResolveAlias(virConfPtr conf, const char *alias, char **uri)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char *
|
||||||
|
virURIGetParam(virURIPtr uri, const char *name)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for (i = 0; i < uri->paramsCount; i++) {
|
||||||
|
if (STREQ(uri->params[i].name, name))
|
||||||
|
return uri->params[i].value;
|
||||||
|
}
|
||||||
|
|
||||||
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
|
_("Missing URI parameter '%s'"), name);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
@ -62,4 +62,6 @@ void virURIFree(virURIPtr uri);
|
|||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virURI, virURIFree);
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virURI, virURIFree);
|
||||||
int virURIResolveAlias(virConfPtr conf, const char *alias, char **uri);
|
int virURIResolveAlias(virConfPtr conf, const char *alias, char **uri);
|
||||||
|
|
||||||
|
const char *virURIGetParam(virURIPtr uri, const char *name);
|
||||||
|
|
||||||
#define VIR_URI_SERVER(uri) ((uri) && (uri)->server ? (uri)->server : "localhost")
|
#define VIR_URI_SERVER(uri) ((uri) && (uri)->server ? (uri)->server : "localhost")
|
||||||
|
Loading…
Reference in New Issue
Block a user