mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-02 11:21:12 +00:00
1c61648961
ESX(i) uses UTF-8, but a Windows based GSX server writes Windows-1252 encoded VMX files. Add a test case to ensure that libxml2 provides Windows-1252 to UTF-8 conversion.
95 lines
3.1 KiB
C
95 lines
3.1 KiB
C
|
|
/*
|
|
* esx_util.h: utility functions for the VMware ESX driver
|
|
*
|
|
* 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
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*
|
|
*/
|
|
|
|
#ifndef __ESX_UTIL_H__
|
|
# define __ESX_UTIL_H__
|
|
|
|
# include <stdbool.h>
|
|
# include <libxml/uri.h>
|
|
|
|
# include "internal.h"
|
|
# include "conf.h"
|
|
|
|
typedef struct _esxUtil_ParsedUri esxUtil_ParsedUri;
|
|
|
|
struct _esxUtil_ParsedUri {
|
|
char *transport;
|
|
char *vCenter;
|
|
bool noVerify;
|
|
bool autoAnswer;
|
|
bool proxy;
|
|
int proxy_type;
|
|
char *proxy_hostname;
|
|
int proxy_port;
|
|
char *path_datacenter;
|
|
char *path_computeResource;
|
|
char *path_hostSystem;
|
|
};
|
|
|
|
int esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, xmlURIPtr uri);
|
|
|
|
void esxUtil_FreeParsedUri(esxUtil_ParsedUri **parsedUri);
|
|
|
|
int esxUtil_ParseVirtualMachineIDString(const char *id_string, int *id);
|
|
|
|
int esxUtil_ParseDatastorePath(const char *datastorePath, char **datastoreName,
|
|
char **directoryName, char **directoryAndFileName);
|
|
|
|
int esxUtil_ResolveHostname(const char *hostname,
|
|
char *ipAddress, size_t ipAddress_length);
|
|
|
|
int esxUtil_GetConfigString(virConfPtr conf, const char *name, char **string,
|
|
bool optional);
|
|
|
|
int esxUtil_GetConfigUUID(virConfPtr conf, const char *name,
|
|
unsigned char *uuid, bool optional);
|
|
|
|
int esxUtil_GetConfigLong(virConfPtr conf, const char *name, long long *number,
|
|
long long default_, bool optional);
|
|
|
|
int esxUtil_GetConfigBoolean(virConfPtr conf, const char *name, bool *boolean_,
|
|
bool default_, bool optional);
|
|
|
|
int esxUtil_ReformatUuid(const char *input, char *output);
|
|
|
|
char *esxUtil_EscapeHex(const char *string, char escape, const char *special);
|
|
|
|
# define esxUtil_EscapeHexPipe(_string) esxUtil_EscapeHex(_string, '|', "\"")
|
|
|
|
# define esxUtil_EscapeHexPercent(_string) esxUtil_EscapeHex(_string, '%', "/\\")
|
|
|
|
int esxUtil_UnescapeHex(char *string, char escape);
|
|
|
|
# define esxUtil_UnescapeHexPipe(_string) esxUtil_UnescapeHex(_string, '|')
|
|
|
|
# define esxUtil_UnescapeHexPercent(_string) esxUtil_UnescapeHex(_string, '%')
|
|
|
|
char *esxUtil_EscapeBase64(const char *string);
|
|
|
|
void esxUtil_ReplaceSpecialWindowsPathChars(char *string);
|
|
|
|
char *esxUtil_EscapeDatastoreItem(const char *string);
|
|
|
|
char *esxUtil_ConvertToUTF8(const char *encoding, const char *string);
|
|
|
|
#endif /* __ESX_UTIL_H__ */
|