2009-07-23 22:21:08 +02:00
|
|
|
/*
|
2010-03-02 22:19:24 +01:00
|
|
|
* esx_util.h: utility functions for the VMware ESX driver
|
2009-07-23 22:21:08 +02:00
|
|
|
*
|
|
|
|
* Copyright (C) 2009 Matthias Bolte <matthias.bolte@googlemail.com>
|
|
|
|
*
|
|
|
|
* 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 16:30:55 -06:00
|
|
|
* License along with this library. If not, see
|
2012-07-21 18:06:23 +08:00
|
|
|
* <http://www.gnu.org/licenses/>.
|
2009-07-23 22:21:08 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-06-07 15:20:24 -05:00
|
|
|
#pragma once
|
2009-07-23 22:21:08 +02:00
|
|
|
|
2019-06-07 15:20:24 -05:00
|
|
|
#include "internal.h"
|
|
|
|
#include "viruri.h"
|
2009-07-23 22:21:08 +02:00
|
|
|
|
2019-06-07 15:20:24 -05:00
|
|
|
#define ESX_VI_CHECK_ARG_LIST(val) \
|
2018-07-03 23:31:22 -03:00
|
|
|
do { \
|
|
|
|
if (!val || *val) { \
|
|
|
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); \
|
|
|
|
return -1; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
2010-07-30 22:08:35 +02:00
|
|
|
typedef struct _esxUtil_ParsedUri esxUtil_ParsedUri;
|
2010-06-03 20:04:15 +02:00
|
|
|
|
2010-07-30 22:08:35 +02:00
|
|
|
struct _esxUtil_ParsedUri {
|
2010-06-03 20:04:15 +02:00
|
|
|
char *transport;
|
|
|
|
char *vCenter;
|
|
|
|
bool noVerify;
|
|
|
|
bool autoAnswer;
|
2010-06-03 23:09:12 +02:00
|
|
|
bool proxy;
|
|
|
|
int proxy_type;
|
|
|
|
char *proxy_hostname;
|
|
|
|
int proxy_port;
|
2011-11-01 17:12:37 +01:00
|
|
|
char *path;
|
2010-06-03 20:04:15 +02:00
|
|
|
};
|
|
|
|
|
2021-03-11 08:16:13 +01:00
|
|
|
int esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURI *uri);
|
2010-06-03 20:04:15 +02:00
|
|
|
|
2010-07-30 22:08:35 +02:00
|
|
|
void esxUtil_FreeParsedUri(esxUtil_ParsedUri **parsedUri);
|
2009-07-23 22:21:08 +02:00
|
|
|
|
|
|
|
int esxUtil_ParseVirtualMachineIDString(const char *id_string, int *id);
|
|
|
|
|
2010-08-01 19:53:00 +02:00
|
|
|
int esxUtil_ParseDatastorePath(const char *datastorePath, char **datastoreName,
|
2010-08-25 11:44:57 +02:00
|
|
|
char **directoryName, char **directoryAndFileName);
|
2009-09-23 14:52:36 +02:00
|
|
|
|
2020-10-05 13:34:25 +02:00
|
|
|
int esxUtil_ResolveHostname(const char *hostname, char **ipAddress);
|
2009-07-23 22:21:08 +02:00
|
|
|
|
2010-08-29 19:33:49 +02:00
|
|
|
int esxUtil_ReformatUuid(const char *input, char *output);
|
|
|
|
|
2010-10-12 19:37:39 +02:00
|
|
|
char *esxUtil_EscapeBase64(const char *string);
|
|
|
|
|
|
|
|
void esxUtil_ReplaceSpecialWindowsPathChars(char *string);
|
|
|
|
|
|
|
|
char *esxUtil_EscapeDatastoreItem(const char *string);
|
|
|
|
|
2011-03-03 22:11:24 +01:00
|
|
|
char *esxUtil_EscapeForXml(const char *string);
|