1 /* 2 * esx_util.h: utility functions for the VMware ESX driver 3 * 4 * Copyright (C) 2009 Matthias Bolte <matthias.bolte@googlemail.com> 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library. If not, see 18 * <http://www.gnu.org/licenses/>. 19 * 20 */ 21 22 #pragma once 23 24 #include "internal.h" 25 #include "viruri.h" 26 27 #define ESX_VI_CHECK_ARG_LIST(val) \ 28 do { \ 29 if (!val || *val) { \ 30 virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); \ 31 return -1; \ 32 } \ 33 } while (0) 34 35 typedef struct _esxUtil_ParsedUri esxUtil_ParsedUri; 36 37 struct _esxUtil_ParsedUri { 38 char *transport; 39 char *vCenter; 40 bool noVerify; 41 bool autoAnswer; 42 bool proxy; 43 int proxy_type; 44 char *proxy_hostname; 45 int proxy_port; 46 char *path; 47 }; 48 49 int esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURI *uri); 50 51 void esxUtil_FreeParsedUri(esxUtil_ParsedUri **parsedUri); 52 53 int esxUtil_ParseVirtualMachineIDString(const char *id_string, int *id); 54 55 int esxUtil_ParseDatastorePath(const char *datastorePath, char **datastoreName, 56 char **directoryName, char **directoryAndFileName); 57 58 int esxUtil_ResolveHostname(const char *hostname, char **ipAddress); 59 60 int esxUtil_ReformatUuid(const char *input, char *output); 61 62 char *esxUtil_EscapeBase64(const char *string); 63 64 void esxUtil_ReplaceSpecialWindowsPathChars(char *string); 65 66 char *esxUtil_EscapeDatastoreItem(const char *string); 67 68 char *esxUtil_EscapeForXml(const char *string); 69