libvirt/src/vbox/vbox_uniformed_api.h

597 lines
29 KiB
C
Raw Normal View History

/*
* Copyright 2014, Taowei Luo (uaedante@gmail.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, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef VBOX_UNIFORMED_API_H
# define VBOX_UNIFORMED_API_H
# include "internal.h"
/* This file may be used in three place. That is vbox_tmpl.c,
* vbox_common.c and vbox_driver.c. The vboxUniformedAPI and some
* types used for vboxUniformedAPI is defined here.
*
* The vbox_tmpl.c is the only place where the driver knows the inside
* architecture of those vbox structs(vboxObj, vboxSession,
* pFuncs, vboxCallback and vboxQueue). The file should be included
* after the currect vbox_CAPI_v*.h, then we can use the vbox structs
* in vboxGlobalData. The vbox_tmpl.c should implement functions
* defined in vboxUniformedAPI.
*
* In vbox_driver.c, it is used to define the struct vboxUniformedAPI.
* The vbox_driver.c collects vboxUniformedAPI for all versions.
* Then vboxRegister calls the vboxRegisterUniformedAPI to register.
* Note: In vbox_driver.c, the vbox structs in vboxGlobalData is
* defined by vbox_CAPI_v2.2.h.
*
* The vbox_common.c, it is used to generate common codes for all vbox
* versions. Bacause the same member varible's offset in a vbox struct
* may change between different vbox versions. The vbox_common.c
* shouldn't directly use struct's member varibles defined in
* vbox_CAPI_v*.h. To make things safety, we include the
* vbox_common.h in vbox_common.c. In this case, we treat structs
* defined by vbox as a void*. The common codes don't concern about
* the inside of this structs(actually, we can't, in the common level).
* With the help of vboxUniformed API, we call VirtualBox's API and
* implement the vbox driver in a high level.
*
* In conclusion:
* * In vbox_tmpl.c, this file is included after vbox_CAPI_v*.h
* * In vbox_driver.c, this file is included after vbox_glue.h
* * In vbox_common.c, this file is included after vbox_common.h
*
*/
/* Extracted define from vbox_tmpl.c */
# ifdef WIN32
struct _vboxIID_v2_x_WIN32 {
/* IID is represented by a GUID value. */
GUID value;
};
# endif /* !WIN32 */
struct _vboxIID_v2_x {
/* IID is represented by a pointer to a nsID. */
nsID *value;
/* backing is used in cases where we need to create or copy an IID.
* We cannot allocate memory that can be freed by ComUnallocMem.
* Therefore, we use this stack allocated nsID instead. */
nsID backing;
};
struct _vboxIID_v3_x {
/* IID is represented by a UTF-16 encoded UUID in string form. */
PRUnichar *value;
/* owner indicates if we own the value and need to free it. */
bool owner;
};
typedef union {
# ifdef WIN32
struct _vboxIID_v2_x_WIN32 vboxIID_v2_x_WIN32;
# endif /* !WIN32 */
struct _vboxIID_v2_x vboxIID_v2_x;
struct _vboxIID_v3_x vboxIID_v3_x;
} vboxIIDUnion;
typedef union {
nsresult uResultCode;
PRInt32 resultCode;
} resultCodeUnion;
typedef struct {
virMutex lock;
unsigned long version;
virCapsPtr caps;
virDomainXMLOptionPtr xmlopt;
IVirtualBox *vboxObj;
ISession *vboxSession;
/** Our version specific API table pointer. */
PCVBOXXPCOM pFuncs;
/* The next is used for domainEvent */
# if defined(VBOX_API_VERSION) && VBOX_API_VERSION > 2002000 && VBOX_API_VERSION < 4000000
/* Async event handling */
virObjectEventStatePtr domainEvents;
int fdWatch;
IVirtualBoxCallback *vboxCallback;
nsIEventQueue *vboxQueue;
int volatile vboxCallBackRefCount;
/* pointer back to the connection */
virConnectPtr conn;
# else /* VBOX_API_VERSION <= 2002000 || VBOX_API_VERSION >= 4000000 || VBOX_API_VERSION undefined */
virObjectEventStatePtr domainEvents;
int fdWatch;
void *vboxCallback;
void *vboxQueue;
int volatile vboxCallBackRefCount;
virConnectPtr conn;
# endif /* VBOX_API_VERSION <= 2002000 || VBOX_API_VERSION >= 4000000 || VBOX_API_VERSION undefined */
} vboxGlobalData;
/* vboxUniformedAPI gives vbox_common.c a uniformed layer to see
* vbox API.
*/
/* Functions for pFuncs */
typedef struct {
int (*Initialize)(vboxGlobalData *data);
void (*Uninitialize)(vboxGlobalData *data);
void (*ComUnallocMem)(PCVBOXXPCOM pFuncs, void *pv);
void (*Utf16Free)(PCVBOXXPCOM pFuncs, PRUnichar *pwszString);
void (*Utf8Free)(PCVBOXXPCOM pFuncs, char *pszString);
int (*Utf16ToUtf8)(PCVBOXXPCOM pFuncs, const PRUnichar *pwszString, char **ppszString);
int (*Utf8ToUtf16)(PCVBOXXPCOM pFuncs, const char *pszString, PRUnichar **ppwszString);
} vboxUniformedPFN;
/* Functions for vboxIID */
typedef struct {
void (*vboxIIDInitialize)(vboxIIDUnion *iidu);
void (*vboxIIDUnalloc)(vboxGlobalData *data, vboxIIDUnion *iidu);
void (*vboxIIDToUUID)(vboxGlobalData *data, vboxIIDUnion *iidu, unsigned char *uuid);
void (*vboxIIDFromUUID)(vboxGlobalData *data, vboxIIDUnion *iidu, const unsigned char *uuid);
bool (*vboxIIDIsEqual)(vboxGlobalData *data, vboxIIDUnion *iidu1, vboxIIDUnion *iidu2);
void (*vboxIIDFromArrayItem)(vboxGlobalData *data, vboxIIDUnion *iidu, vboxArray *array, int idx);
void (*vboxIIDToUtf8)(vboxGlobalData *data, vboxIIDUnion *iidu, char **utf8);
void (*DEBUGIID)(const char *msg, vboxIIDUnion *iidu);
} vboxUniformedIID;
2014-08-11 10:06:14 +00:00
/* Functions for vboxArray */
typedef struct {
nsresult (*vboxArrayGet)(vboxArray *array, void *self, void *getter);
nsresult (*vboxArrayGetWithIIDArg)(vboxArray *array, void *self, void *getter, vboxIIDUnion *iidu);
2014-08-11 10:06:14 +00:00
void (*vboxArrayRelease)(vboxArray *array);
/* Generate function pointers for vboxArrayGet */
void* (*handleGetMachines)(IVirtualBox *vboxObj);
2014-08-11 10:06:42 +00:00
void* (*handleUSBGetDeviceFilters)(IUSBCommon *USBCommon);
void* (*handleMachineGetMediumAttachments)(IMachine *machine);
void* (*handleMachineGetSharedFolders)(IMachine *machine);
void* (*handleSnapshotGetChildren)(ISnapshot *snapshot);
void* (*handleMediumGetChildren)(IMedium *medium);
void* (*handleMediumGetSnapshotIds)(IMedium *medium);
2014-08-11 10:06:14 +00:00
} vboxUniformedArray;
/* Functions for nsISupports */
typedef struct {
nsresult (*Release)(nsISupports *nsi);
nsresult (*AddRef)(nsISupports *nsi);
} vboxUniformednsISupports;
/* Functions for IVirtualBox */
typedef struct {
nsresult (*GetVersion)(IVirtualBox *vboxObj, PRUnichar **versionUtf16);
nsresult (*GetMachine)(IVirtualBox *vboxObj, vboxIIDUnion *iidu, IMachine **machine);
nsresult (*OpenMachine)(IVirtualBox *vboxObj, PRUnichar *settingsFile, IMachine **machine);
2014-08-11 10:06:12 +00:00
nsresult (*GetSystemProperties)(IVirtualBox *vboxObj, ISystemProperties **systemProperties);
2014-08-11 10:06:19 +00:00
nsresult (*CreateMachine)(vboxGlobalData *data, virDomainDefPtr def, IMachine **machine, char *uuidstr);
nsresult (*CreateHardDiskMedium)(IVirtualBox *vboxObj, PRUnichar *format, PRUnichar *location, IMedium **medium);
2014-08-11 10:06:19 +00:00
nsresult (*RegisterMachine)(IVirtualBox *vboxObj, IMachine *machine);
nsresult (*FindMedium)(IVirtualBox *vboxObj, PRUnichar *location, PRUint32 deviceType, PRUint32 accessMode, IMedium **medium);
nsresult (*OpenMedium)(IVirtualBox *vboxObj, PRUnichar *location, PRUint32 deviceType, PRUint32 accessMode, IMedium **medium);
} vboxUniformedIVirtualBox;
2014-08-11 10:06:14 +00:00
/* Functions for IMachine */
typedef struct {
2014-08-11 10:06:19 +00:00
nsresult (*AddStorageController)(IMachine *machine, PRUnichar *name,
PRUint32 connectionType, IStorageController **controller);
2014-08-11 10:06:42 +00:00
nsresult (*GetStorageControllerByName)(IMachine *machine, PRUnichar *name,
IStorageController **storageController);
2014-08-11 10:06:19 +00:00
nsresult (*AttachDevice)(IMachine *machine, PRUnichar *name,
PRInt32 controllerPort, PRInt32 device,
PRUint32 type, IMedium *medium);
nsresult (*CreateSharedFolder)(IMachine *machine, PRUnichar *name,
PRUnichar *hostPath, PRBool writable,
PRBool automount);
2014-08-11 10:06:50 +00:00
nsresult (*RemoveSharedFolder)(IMachine *machine, PRUnichar *name);
nsresult (*LaunchVMProcess)(vboxGlobalData *data, IMachine *machine,
vboxIIDUnion *iidu,
PRUnichar *sessionType, PRUnichar *env,
IProgress **progress);
nsresult (*Unregister)(IMachine *machine, PRUint32 cleanupMode,
PRUint32 *aMediaSize, IMedium ***aMedia);
nsresult (*FindSnapshot)(IMachine *machine, vboxIIDUnion *iidu, ISnapshot **snapshot);
2014-08-11 10:06:14 +00:00
nsresult (*GetAccessible)(IMachine *machine, PRBool *isAccessible);
nsresult (*GetState)(IMachine *machine, PRUint32 *state);
2014-08-11 10:06:16 +00:00
nsresult (*GetName)(IMachine *machine, PRUnichar **name);
nsresult (*GetId)(IMachine *machine, vboxIIDUnion *iidu);
2014-08-11 10:06:19 +00:00
nsresult (*GetBIOSSettings)(IMachine *machine, IBIOSSettings **bios);
nsresult (*GetAudioAdapter)(IMachine *machine, IAudioAdapter **audioAdapter);
nsresult (*GetNetworkAdapter)(IMachine *machine, PRUint32 slot, INetworkAdapter **adapter);
nsresult (*GetChipsetType)(IMachine *machine, PRUint32 *chipsetType);
nsresult (*GetSerialPort)(IMachine *machine, PRUint32 slot, ISerialPort **port);
nsresult (*GetParallelPort)(IMachine *machine, PRUint32 slot, IParallelPort **port);
nsresult (*GetVRDxServer)(IMachine *machine, IVRDxServer **VRDxServer);
nsresult (*GetUSBCommon)(IMachine *machine, IUSBCommon **USBCommon);
nsresult (*GetCurrentSnapshot)(IMachine *machine, ISnapshot **currentSnapshot);
nsresult (*GetSettingsFilePath)(IMachine *machine, PRUnichar **settingsFilePath);
2014-08-11 10:06:36 +00:00
nsresult (*GetCPUCount)(IMachine *machine, PRUint32 *CPUCount);
2014-08-11 10:06:19 +00:00
nsresult (*SetCPUCount)(IMachine *machine, PRUint32 CPUCount);
2014-08-11 10:06:36 +00:00
nsresult (*GetMemorySize)(IMachine *machine, PRUint32 *memorySize);
2014-08-11 10:06:19 +00:00
nsresult (*SetMemorySize)(IMachine *machine, PRUint32 memorySize);
2014-08-11 10:06:42 +00:00
nsresult (*GetCPUProperty)(IMachine *machine, PRUint32 property, PRBool *value);
2014-08-11 10:06:19 +00:00
nsresult (*SetCPUProperty)(IMachine *machine, PRUint32 property, PRBool value);
2014-08-11 10:06:42 +00:00
nsresult (*GetBootOrder)(IMachine *machine, PRUint32 position, PRUint32 *device);
2014-08-11 10:06:19 +00:00
nsresult (*SetBootOrder)(IMachine *machine, PRUint32 position, PRUint32 device);
2014-08-11 10:06:42 +00:00
nsresult (*GetVRAMSize)(IMachine *machine, PRUint32 *VRAMSize);
2014-08-11 10:06:19 +00:00
nsresult (*SetVRAMSize)(IMachine *machine, PRUint32 VRAMSize);
2014-08-11 10:06:42 +00:00
nsresult (*GetMonitorCount)(IMachine *machine, PRUint32 *monitorCount);
2014-08-11 10:06:19 +00:00
nsresult (*SetMonitorCount)(IMachine *machine, PRUint32 monitorCount);
2014-08-11 10:06:42 +00:00
nsresult (*GetAccelerate3DEnabled)(IMachine *machine, PRBool *accelerate3DEnabled);
2014-08-11 10:06:19 +00:00
nsresult (*SetAccelerate3DEnabled)(IMachine *machine, PRBool accelerate3DEnabled);
2014-08-11 10:06:42 +00:00
nsresult (*GetAccelerate2DVideoEnabled)(IMachine *machine, PRBool *accelerate2DVideoEnabled);
2014-08-11 10:06:19 +00:00
nsresult (*SetAccelerate2DVideoEnabled)(IMachine *machine, PRBool accelerate2DVideoEnabled);
nsresult (*GetExtraData)(IMachine *machine, PRUnichar *key, PRUnichar **value);
2014-08-11 10:06:19 +00:00
nsresult (*SetExtraData)(IMachine *machine, PRUnichar *key, PRUnichar *value);
nsresult (*GetSnapshotCount)(IMachine *machine, PRUint32 *snapshotCount);
2014-08-11 10:06:18 +00:00
nsresult (*SaveSettings)(IMachine *machine);
2014-08-11 10:06:14 +00:00
} vboxUniformedIMachine;
/* Functions for ISession */
typedef struct {
2014-08-11 10:06:18 +00:00
nsresult (*Open)(vboxGlobalData *data, vboxIIDUnion *iidu, IMachine *machine);
nsresult (*OpenExisting)(vboxGlobalData *data, vboxIIDUnion *iidu, IMachine *machine);
nsresult (*GetConsole)(ISession *session, IConsole **console);
2014-08-11 10:06:18 +00:00
nsresult (*GetMachine)(ISession *session, IMachine **machine);
nsresult (*Close)(ISession *session);
} vboxUniformedISession;
/* Functions for IConsole */
typedef struct {
nsresult (*SaveState)(IConsole *console, IProgress **progress);
2014-08-11 10:06:27 +00:00
nsresult (*Pause)(IConsole *console);
2014-08-11 10:06:28 +00:00
nsresult (*Resume)(IConsole *console);
2014-08-11 10:06:29 +00:00
nsresult (*PowerButton)(IConsole *console);
2014-08-11 10:06:32 +00:00
nsresult (*PowerDown)(IConsole *console);
2014-08-11 10:06:31 +00:00
nsresult (*Reset)(IConsole *console);
nsresult (*TakeSnapshot)(IConsole *console, PRUnichar *name,
PRUnichar *description, IProgress **progress);
} vboxUniformedIConsole;
/* Functions for IProgress */
typedef struct {
nsresult (*WaitForCompletion)(IProgress *progress, PRInt32 timeout);
nsresult (*GetResultCode)(IProgress *progress, resultCodeUnion *resultCode);
nsresult (*GetCompleted)(IProgress *progress, PRBool *completed);
} vboxUniformedIProgress;
2014-08-11 10:06:12 +00:00
/* Functions for ISystemProperties */
typedef struct {
nsresult (*GetMaxGuestCPUCount)(ISystemProperties *systemProperties, PRUint32 *maxCPUCount);
2014-08-11 10:06:19 +00:00
nsresult (*GetMaxBootPosition)(ISystemProperties *systemProperties, PRUint32 *maxBootPosition);
nsresult (*GetMaxNetworkAdapters)(ISystemProperties *systemProperties, PRUint32 chipset,
PRUint32 *maxNetworkAdapters);
nsresult (*GetSerialPortCount)(ISystemProperties *systemProperties, PRUint32 *SerialPortCount);
nsresult (*GetParallelPortCount)(ISystemProperties *systemProperties, PRUint32 *ParallelPortCount);
nsresult (*GetMaxPortCountForStorageBus)(ISystemProperties *systemProperties, PRUint32 bus,
PRUint32 *maxPortCount);
nsresult (*GetMaxDevicesPerPortForStorageBus)(ISystemProperties *systemProperties,
PRUint32 bus, PRUint32 *maxDevicesPerPort);
2014-08-11 10:06:36 +00:00
nsresult (*GetMaxGuestRAM)(ISystemProperties *systemProperties, PRUint32 *maxGuestRAM);
2014-08-11 10:06:12 +00:00
} vboxUniformedISystemProperties;
2014-08-11 10:06:19 +00:00
/* Functions for IBIOSSettings */
typedef struct {
2014-08-11 10:06:42 +00:00
nsresult (*GetACPIEnabled)(IBIOSSettings *bios, PRBool *ACPIEnabled);
2014-08-11 10:06:19 +00:00
nsresult (*SetACPIEnabled)(IBIOSSettings *bios, PRBool ACPIEnabled);
2014-08-11 10:06:42 +00:00
nsresult (*GetIOAPICEnabled)(IBIOSSettings *bios, PRBool *IOAPICEnabled);
2014-08-11 10:06:19 +00:00
nsresult (*SetIOAPICEnabled)(IBIOSSettings *bios, PRBool IOAPICEnabled);
} vboxUniformedIBIOSSettings;
/* Functions for IAudioAdapter */
typedef struct {
2014-08-11 10:06:42 +00:00
nsresult (*GetEnabled)(IAudioAdapter *audioAdapter, PRBool *enabled);
2014-08-11 10:06:19 +00:00
nsresult (*SetEnabled)(IAudioAdapter *audioAdapter, PRBool enabled);
2014-08-11 10:06:42 +00:00
nsresult (*GetAudioController)(IAudioAdapter *audioAdapter, PRUint32 *audioController);
2014-08-11 10:06:19 +00:00
nsresult (*SetAudioController)(IAudioAdapter *audioAdapter, PRUint32 audioController);
} vboxUniformedIAudioAdapter;
/* Functions for INetworkAdapter */
typedef struct {
2014-08-11 10:06:42 +00:00
nsresult (*GetAttachmentType)(INetworkAdapter *adapter, PRUint32 *attachmentType);
nsresult (*GetEnabled)(INetworkAdapter *adapter, PRBool *enabled);
2014-08-11 10:06:19 +00:00
nsresult (*SetEnabled)(INetworkAdapter *adapter, PRBool enabled);
2014-08-11 10:06:42 +00:00
nsresult (*GetAdapterType)(INetworkAdapter *adapter, PRUint32 *adapterType);
2014-08-11 10:06:19 +00:00
nsresult (*SetAdapterType)(INetworkAdapter *adapter, PRUint32 adapterType);
2014-08-11 10:06:42 +00:00
nsresult (*GetBridgedInterface)(INetworkAdapter *adapter, PRUnichar **bridgedInterface);
2014-08-11 10:06:19 +00:00
nsresult (*SetBridgedInterface)(INetworkAdapter *adapter, PRUnichar *bridgedInterface);
2014-08-11 10:06:42 +00:00
nsresult (*GetInternalNetwork)(INetworkAdapter *adapter, PRUnichar **internalNetwork);
2014-08-11 10:06:19 +00:00
nsresult (*SetInternalNetwork)(INetworkAdapter *adapter, PRUnichar *internalNetwork);
2014-08-11 10:06:42 +00:00
nsresult (*GetHostOnlyInterface)(INetworkAdapter *adapter, PRUnichar **hostOnlyInterface);
2014-08-11 10:06:19 +00:00
nsresult (*SetHostOnlyInterface)(INetworkAdapter *adapter, PRUnichar *hostOnlyInterface);
2014-08-11 10:06:42 +00:00
nsresult (*GetMACAddress)(INetworkAdapter *adapter, PRUnichar **MACAddress);
2014-08-11 10:06:19 +00:00
nsresult (*SetMACAddress)(INetworkAdapter *adapter, PRUnichar *MACAddress);
nsresult (*AttachToBridgedInterface)(INetworkAdapter *adapter);
nsresult (*AttachToInternalNetwork)(INetworkAdapter *adapter);
nsresult (*AttachToHostOnlyInterface)(INetworkAdapter *adapter);
nsresult (*AttachToNAT)(INetworkAdapter *adapter);
} vboxUniformedINetworkAdapter;
/* Functions for ISerialPort */
typedef struct {
2014-08-11 10:06:42 +00:00
nsresult (*GetEnabled)(ISerialPort *port, PRBool *enabled);
2014-08-11 10:06:19 +00:00
nsresult (*SetEnabled)(ISerialPort *port, PRBool enabled);
2014-08-11 10:06:42 +00:00
nsresult (*GetPath)(ISerialPort *port, PRUnichar **path);
2014-08-11 10:06:19 +00:00
nsresult (*SetPath)(ISerialPort *port, PRUnichar *path);
2014-08-11 10:06:42 +00:00
nsresult (*GetIRQ)(ISerialPort *port, PRUint32 *IRQ);
2014-08-11 10:06:19 +00:00
nsresult (*SetIRQ)(ISerialPort *port, PRUint32 IRQ);
2014-08-11 10:06:42 +00:00
nsresult (*GetIOBase)(ISerialPort *port, PRUint32 *IOBase);
2014-08-11 10:06:19 +00:00
nsresult (*SetIOBase)(ISerialPort *port, PRUint32 IOBase);
2014-08-11 10:06:42 +00:00
nsresult (*GetHostMode)(ISerialPort *port, PRUint32 *hostMode);
2014-08-11 10:06:19 +00:00
nsresult (*SetHostMode)(ISerialPort *port, PRUint32 hostMode);
} vboxUniformedISerialPort;
/* Functions for IParallelPort */
typedef struct {
2014-08-11 10:06:42 +00:00
nsresult (*GetEnabled)(IParallelPort *port, PRBool *enabled);
2014-08-11 10:06:19 +00:00
nsresult (*SetEnabled)(IParallelPort *port, PRBool enabled);
2014-08-11 10:06:42 +00:00
nsresult (*GetPath)(IParallelPort *port, PRUnichar **path);
2014-08-11 10:06:19 +00:00
nsresult (*SetPath)(IParallelPort *port, PRUnichar *path);
2014-08-11 10:06:42 +00:00
nsresult (*GetIRQ)(IParallelPort *port, PRUint32 *IRQ);
2014-08-11 10:06:19 +00:00
nsresult (*SetIRQ)(IParallelPort *port, PRUint32 IRQ);
2014-08-11 10:06:42 +00:00
nsresult (*GetIOBase)(IParallelPort *port, PRUint32 *IOBase);
2014-08-11 10:06:19 +00:00
nsresult (*SetIOBase)(IParallelPort *port, PRUint32 IOBase);
} vboxUniformedIParallelPort;
/* Functions for IVRDPServer and IVRDEServer */
typedef struct {
2014-08-11 10:06:42 +00:00
nsresult (*GetEnabled)(IVRDxServer *VRDxServer, PRBool *enabled);
2014-08-11 10:06:19 +00:00
nsresult (*SetEnabled)(IVRDxServer *VRDxServer, PRBool enabled);
2014-08-11 10:06:42 +00:00
nsresult (*GetPorts)(vboxGlobalData *data, IVRDxServer *VRDxServer,
virDomainGraphicsDefPtr graphics);
2014-08-11 10:06:19 +00:00
nsresult (*SetPorts)(vboxGlobalData *data, IVRDxServer *VRDxServer,
virDomainGraphicsDefPtr graphics);
2014-08-11 10:06:42 +00:00
nsresult (*GetReuseSingleConnection)(IVRDxServer *VRDxServer, PRBool *enabled);
2014-08-11 10:06:19 +00:00
nsresult (*SetReuseSingleConnection)(IVRDxServer *VRDxServer, PRBool enabled);
2014-08-11 10:06:42 +00:00
nsresult (*GetAllowMultiConnection)(IVRDxServer *VRDxServer, PRBool *enabled);
2014-08-11 10:06:19 +00:00
nsresult (*SetAllowMultiConnection)(IVRDxServer *VRDxServer, PRBool enabled);
2014-08-11 10:06:42 +00:00
nsresult (*GetNetAddress)(vboxGlobalData *data, IVRDxServer *VRDxServer,
PRUnichar **netAddress);
2014-08-11 10:06:19 +00:00
nsresult (*SetNetAddress)(vboxGlobalData *data, IVRDxServer *VRDxServer,
PRUnichar *netAddress);
} vboxUniformedIVRDxServer;
/* Common Functions for IUSBController and IUSBDeviceFilters */
typedef struct {
nsresult (*Enable)(IUSBCommon *USBCommon);
2014-08-11 10:06:42 +00:00
nsresult (*GetEnabled)(IUSBCommon *USBCommon, PRBool *enabled);
2014-08-11 10:06:19 +00:00
nsresult (*CreateDeviceFilter)(IUSBCommon *USBCommon, PRUnichar *name,
IUSBDeviceFilter **filter);
nsresult (*InsertDeviceFilter)(IUSBCommon *USBCommon, PRUint32 position,
IUSBDeviceFilter *filter);
} vboxUniformedIUSBCommon;
typedef struct {
2014-08-11 10:06:42 +00:00
nsresult (*GetProductId)(IUSBDeviceFilter *USBDeviceFilter, PRUnichar **productId);
2014-08-11 10:06:19 +00:00
nsresult (*SetProductId)(IUSBDeviceFilter *USBDeviceFilter, PRUnichar *productId);
2014-08-11 10:06:42 +00:00
nsresult (*GetActive)(IUSBDeviceFilter *USBDeviceFilter, PRBool *active);
2014-08-11 10:06:19 +00:00
nsresult (*SetActive)(IUSBDeviceFilter *USBDeviceFilter, PRBool active);
2014-08-11 10:06:42 +00:00
nsresult (*GetVendorId)(IUSBDeviceFilter *USBDeviceFilter, PRUnichar **vendorId);
2014-08-11 10:06:19 +00:00
nsresult (*SetVendorId)(IUSBDeviceFilter *USBDeviceFilter, PRUnichar *vendorId);
} vboxUniformedIUSBDeviceFilter;
/* Functions for IMedium */
typedef struct {
nsresult (*GetId)(IMedium *medium, vboxIIDUnion *iidu);
2014-08-11 10:06:42 +00:00
nsresult (*GetLocation)(IMedium *medium, PRUnichar **location);
nsresult (*GetReadOnly)(IMedium *medium, PRBool *readOnly);
nsresult (*GetParent)(IMedium *medium, IMedium **parent);
nsresult (*GetChildren)(IMedium *medium, PRUint32 *childrenSize, IMedium ***children);
nsresult (*GetFormat)(IMedium *medium, PRUnichar **format);
nsresult (*DeleteStorage)(IMedium *medium, IProgress **progress);
2014-08-11 10:06:19 +00:00
nsresult (*Release)(IMedium *medium);
nsresult (*Close)(IMedium *medium);
2014-08-11 10:06:19 +00:00
nsresult (*SetType)(IMedium *medium, PRUint32 type);
nsresult (*CreateDiffStorage)(IMedium *medium, IMedium *target, PRUint32 variantSize,
PRUint32 *variant, IProgress **progress);
2014-08-11 10:06:19 +00:00
} vboxUniformedIMedium;
2014-08-11 10:06:42 +00:00
/* Functions for IMediumAttachment */
typedef struct {
nsresult (*GetMedium)(IMediumAttachment *mediumAttachment, IMedium **medium);
nsresult (*GetController)(IMediumAttachment *mediumAttachment, PRUnichar **controller);
nsresult (*GetType)(IMediumAttachment *mediumAttachment, PRUint32 *type);
nsresult (*GetPort)(IMediumAttachment *mediumAttachment, PRInt32 *port);
nsresult (*GetDevice)(IMediumAttachment *mediumAttachment, PRInt32 *device);
} vboxUniformedIMediumAttachment;
/* Functions for IStorageController */
typedef struct {
nsresult (*GetBus)(IStorageController *storageController, PRUint32 *bus);
} vboxUniformedIStorageController;
/* Functions for ISharedFolder */
typedef struct {
nsresult (*GetHostPath)(ISharedFolder *sharedFolder, PRUnichar **hostPath);
nsresult (*GetName)(ISharedFolder *sharedFolder, PRUnichar **name);
nsresult (*GetWritable)(ISharedFolder *sharedFolder, PRBool *writable);
} vboxUniformedISharedFolder;
/* Functions for ISnapshot */
typedef struct {
nsresult (*GetName)(ISnapshot *snapshot, PRUnichar **name);
nsresult (*GetId)(ISnapshot *snapshot, vboxIIDUnion *iidu);
nsresult (*GetMachine)(ISnapshot *snapshot, IMachine **machine);
nsresult (*GetDescription)(ISnapshot *snapshot, PRUnichar **description);
nsresult (*GetTimeStamp)(ISnapshot *snapshot, PRInt64 *timeStamp);
nsresult (*GetParent)(ISnapshot *snapshot, ISnapshot **parent);
nsresult (*GetOnline)(ISnapshot *snapshot, PRBool *online);
} vboxUniformedISnapshot;
2014-08-11 10:06:14 +00:00
typedef struct {
bool (*Online)(PRUint32 state);
bool (*Inactive)(PRUint32 state);
bool (*NotStart)(PRUint32 state);
2014-08-11 10:06:27 +00:00
bool (*Running)(PRUint32 state);
2014-08-11 10:06:28 +00:00
bool (*Paused)(PRUint32 state);
2014-08-11 10:06:29 +00:00
bool (*PoweredOff)(PRUint32 state);
2014-08-11 10:06:14 +00:00
} uniformedMachineStateChecker;
typedef struct {
/* vbox API version */
uint32_t APIVersion;
uint32_t XPCOMCVersion;
/* vbox APIs */
int (*initializeDomainEvent)(vboxGlobalData *data);
void (*registerGlobalData)(vboxGlobalData *data);
2014-08-11 10:06:18 +00:00
void (*detachDevices)(vboxGlobalData *data, IMachine *machine, PRUnichar *hddcnameUtf16);
nsresult (*unregisterMachine)(vboxGlobalData *data, vboxIIDUnion *iidu, IMachine **machine);
void (*deleteConfig)(IMachine *machine);
2014-08-11 10:06:19 +00:00
void (*vboxAttachDrivesOld)(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine);
2014-08-11 10:06:36 +00:00
virDomainState (*vboxConvertState)(PRUint32 state);
2014-08-11 10:06:42 +00:00
void (*dumpIDEHDDsOld)(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine);
void (*dumpDVD)(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine);
2014-08-11 10:06:47 +00:00
int (*attachDVD)(vboxGlobalData *data, IMachine *machine, const char *src);
2014-08-11 10:06:50 +00:00
int (*detachDVD)(IMachine *machine);
2014-08-11 10:06:42 +00:00
void (*dumpFloppy)(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine);
2014-08-11 10:06:47 +00:00
int (*attachFloppy)(vboxGlobalData *data, IMachine *machine, const char *src);
2014-08-11 10:06:50 +00:00
int (*detachFloppy)(IMachine *machine);
vboxUniformedPFN UPFN;
vboxUniformedIID UIID;
2014-08-11 10:06:14 +00:00
vboxUniformedArray UArray;
vboxUniformednsISupports nsUISupports;
vboxUniformedIVirtualBox UIVirtualBox;
2014-08-11 10:06:14 +00:00
vboxUniformedIMachine UIMachine;
vboxUniformedISession UISession;
vboxUniformedIConsole UIConsole;
vboxUniformedIProgress UIProgress;
2014-08-11 10:06:12 +00:00
vboxUniformedISystemProperties UISystemProperties;
2014-08-11 10:06:19 +00:00
vboxUniformedIBIOSSettings UIBIOSSettings;
vboxUniformedIAudioAdapter UIAudioAdapter;
vboxUniformedINetworkAdapter UINetworkAdapter;
vboxUniformedISerialPort UISerialPort;
vboxUniformedIParallelPort UIParallelPort;
vboxUniformedIVRDxServer UIVRDxServer;
vboxUniformedIUSBCommon UIUSBCommon;
vboxUniformedIUSBDeviceFilter UIUSBDeviceFilter;
vboxUniformedIMedium UIMedium;
2014-08-11 10:06:42 +00:00
vboxUniformedIMediumAttachment UIMediumAttachment;
vboxUniformedIStorageController UIStorageController;
vboxUniformedISharedFolder UISharedFolder;
vboxUniformedISnapshot UISnapshot;
2014-08-11 10:06:14 +00:00
uniformedMachineStateChecker machineStateChecker;
/* vbox API features */
bool domainEventCallbacks;
bool hasStaticGlobalData;
bool getMachineForSession;
2014-08-11 10:06:18 +00:00
bool detachDevicesExplicitly;
2014-08-11 10:06:19 +00:00
bool chipsetType;
bool accelerate2DVideo;
bool vboxAttachDrivesUseOld;
2014-08-11 10:06:42 +00:00
bool oldMediumInterface;
bool vboxSnapshotRedefine;
} vboxUniformedAPI;
/* libvirt API
* These API would be removed after we generate the
* vboxDriver in common code.
*/
virDrvOpenStatus vboxConnectOpen(virConnectPtr conn,
virConnectAuthPtr auth,
unsigned int flags);
2014-08-11 10:06:05 +00:00
int vboxConnectClose(virConnectPtr conn);
int vboxDomainSave(virDomainPtr dom, const char *path);
2014-08-11 10:06:07 +00:00
int vboxConnectGetVersion(virConnectPtr conn, unsigned long *version);
2014-08-11 10:06:08 +00:00
char *vboxConnectGetHostname(virConnectPtr conn);
2014-08-11 10:06:09 +00:00
int vboxConnectIsSecure(virConnectPtr conn);
2014-08-11 10:06:10 +00:00
int vboxConnectIsEncrypted(virConnectPtr conn);
2014-08-11 10:06:11 +00:00
int vboxConnectIsAlive(virConnectPtr conn);
2014-08-11 10:06:12 +00:00
int vboxConnectGetMaxVcpus(virConnectPtr conn, const char *type);
char *vboxConnectGetCapabilities(virConnectPtr conn);
2014-08-11 10:06:14 +00:00
int vboxConnectListDomains(virConnectPtr conn, int *ids, int nids);
2014-08-11 10:06:15 +00:00
int vboxConnectNumOfDomains(virConnectPtr conn);
2014-08-11 10:06:16 +00:00
virDomainPtr vboxDomainLookupByID(virConnectPtr conn, int id);
2014-08-11 10:06:17 +00:00
virDomainPtr vboxDomainLookupByUUID(virConnectPtr conn,
const unsigned char *uuid);
2014-08-11 10:06:23 +00:00
virDomainPtr
vboxDomainLookupByName(virConnectPtr conn, const char *name);
2014-08-11 10:06:19 +00:00
virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml);
2014-08-11 10:06:18 +00:00
int vboxDomainUndefineFlags(virDomainPtr dom, unsigned int flags);
2014-08-11 10:06:46 +00:00
int vboxDomainUndefine(virDomainPtr dom);
int vboxDomainCreateWithFlags(virDomainPtr dom, unsigned int flags);
2014-08-11 10:06:21 +00:00
int vboxDomainCreate(virDomainPtr dom);
2014-08-11 10:06:22 +00:00
virDomainPtr vboxDomainCreateXML(virConnectPtr conn, const char *xml,
unsigned int flags);
2014-08-11 10:06:24 +00:00
int vboxDomainIsActive(virDomainPtr dom);
2014-08-11 10:06:25 +00:00
int vboxDomainIsPersistent(virDomainPtr dom);
2014-08-11 10:06:26 +00:00
int vboxDomainIsUpdated(virDomainPtr dom);
2014-08-11 10:06:27 +00:00
int vboxDomainSuspend(virDomainPtr dom);
2014-08-11 10:06:28 +00:00
int vboxDomainResume(virDomainPtr dom);
2014-08-11 10:06:29 +00:00
int vboxDomainShutdownFlags(virDomainPtr dom, unsigned int flags);
2014-08-11 10:06:30 +00:00
int vboxDomainShutdown(virDomainPtr dom);
2014-08-11 10:06:31 +00:00
int vboxDomainReboot(virDomainPtr dom, unsigned int flags);
2014-08-11 10:06:32 +00:00
int vboxDomainDestroyFlags(virDomainPtr dom, unsigned int flags);
2014-08-11 10:06:33 +00:00
int vboxDomainDestroy(virDomainPtr dom);
2014-08-11 10:06:34 +00:00
char *vboxDomainGetOSType(virDomainPtr dom);
2014-08-11 10:06:35 +00:00
int vboxDomainSetMemory(virDomainPtr dom, unsigned long memory);
2014-08-11 10:06:36 +00:00
int vboxDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info);
2014-08-11 10:06:37 +00:00
int vboxDomainGetState(virDomainPtr dom, int *state,
int *reason, unsigned int flags);
2014-08-11 10:06:38 +00:00
int vboxDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
unsigned int flags);
2014-08-11 10:06:39 +00:00
int vboxDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus);
2014-08-11 10:06:40 +00:00
int vboxDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags);
2014-08-11 10:06:41 +00:00
int vboxDomainGetMaxVcpus(virDomainPtr dom);
2014-08-11 10:06:43 +00:00
char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags);
int vboxConnectListDefinedDomains(virConnectPtr conn,
char ** const names, int maxnames);
int vboxConnectNumOfDefinedDomains(virConnectPtr conn);
2014-08-11 10:06:47 +00:00
int vboxDomainAttachDevice(virDomainPtr dom, const char *xml);
int vboxDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
unsigned int flags);
int vboxDomainUpdateDeviceFlags(virDomainPtr dom, const char *xml,
unsigned int flags);
2014-08-11 10:06:50 +00:00
int vboxDomainDetachDevice(virDomainPtr dom, const char *xml);
int vboxDomainDetachDeviceFlags(virDomainPtr dom, const char *xml,
unsigned int flags);
virDomainSnapshotPtr
vboxDomainSnapshotCreateXML(virDomainPtr dom,
const char *xmlDesc,
unsigned int flags);
char *vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
unsigned int flags);
2014-08-11 10:06:55 +00:00
int vboxDomainSnapshotNum(virDomainPtr dom, unsigned int flags);
int vboxDomainSnapshotListNames(virDomainPtr dom, char **names,
int nameslen, unsigned int flags);
/* Version specified functions for installing uniformed API */
void vbox22InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
void vbox30InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
void vbox31InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
void vbox32InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
void vbox40InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
void vbox41InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
void vbox42InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
void vbox42_20InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
void vbox43InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
void vbox43_4InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
#endif /* VBOX_UNIFORMED_API_H */