VirtualBox

source: vbox/trunk/src/VBox/ExtPacks/VNC/VBoxVNCMain.cpp@ 48431

Last change on this file since 48431 was 43110, checked in by vboxsync, 12 years ago

standard license

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.7 KB
Line 
1/* $Id: VBoxVNCMain.cpp 43110 2012-08-30 14:32:29Z vboxsync $ */
2/** @file
3 * VNC main module.
4 */
5
6/*
7 * Copyright (C) 2010-2012 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18
19/*******************************************************************************
20* Header Files *
21*******************************************************************************/
22#include <VBox/ExtPack/ExtPack.h>
23
24#include <VBox/err.h>
25#include <VBox/version.h>
26#include <VBox/vmm/cfgm.h>
27#include <iprt/string.h>
28#include <iprt/param.h>
29#include <iprt/path.h>
30
31
32/*******************************************************************************
33* Global Variables *
34*******************************************************************************/
35/** Pointer to the extension pack helpers. */
36static PCVBOXEXTPACKHLP g_pHlp;
37
38
39// /**
40// * @interface_method_impl{VBOXEXTPACKREG,pfnInstalled}
41// */
42// static DECLCALLBACK(void) vboxVNCExtPack_Installed(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox);
43// /**
44// * @interface_method_impl{VBOXEXTPACKREG,pfnUninstall}
45// */
46// static DECLCALLBACK(int) vboxVNCExtPack_Uninstall(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox);
47//
48// /**
49// * @interface_method_impl{VBOXEXTPACKREG,pfnVirtualBoxReady}
50// */
51// static DECLCALLBACK(void) vboxVNCExtPack_VirtualBoxReady(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox);
52//
53// /**
54// * @interface_method_impl{VBOXEXTPACKREG,pfnUnload}
55// */
56// static DECLCALLBACK(void) vboxVNCExtPack_Unload(PCVBOXEXTPACKREG pThis);
57// /**
58// * @interface_method_impl{VBOXEXTPACKREG,pfnVMCreated}
59// */
60// static DECLCALLBACK(int) vboxVNCExtPack_VMCreated(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox, IMachine *pMachine);
61//
62// /**
63// * @interface_method_impl{VBOXEXTPACKREG,pfnVMConfigureVMM}
64// */
65// static DECLCALLBACK(int) vboxVNCExtPack_VMConfigureVMM(PCVBOXEXTPACKREG pThis, IConsole *pConsole, PVM pVM);
66//
67// /**
68// * @interface_method_impl{VBOXEXTPACKREG,pfnVMPowerOn}
69// */
70// static DECLCALLBACK(int) vboxVNCExtPack_VMPowerOn(PCVBOXEXTPACKREG pThis, IConsole *pConsole, PVM pVM);
71// /**
72// * @interface_method_impl{VBOXEXTPACKREG,pfnVMPowerOff}
73// */
74// static DECLCALLBACK(void) vboxVNCExtPack_VMPowerOff(PCVBOXEXTPACKREG pThis, IConsole *pConsole, PVM pVM);
75// /**
76// * @interface_method_impl{VBOXEXTPACKREG,pfnVMPowerOff}
77// */
78// static DECLCALLBACK(void) vboxVNCExtPack_QueryObject(PCVBOXEXTPACKREG pThis, PCRTUUID pObjectId);
79
80
81static const VBOXEXTPACKREG g_vboxVNCExtPackReg =
82{
83 VBOXEXTPACKREG_VERSION,
84 /* .pfnInstalled = */ NULL,
85 /* .pfnUninstall = */ NULL,
86 /* .pfnVirtualBoxReady =*/ NULL,
87 /* .pfnConsoleReady = */ NULL,
88 /* .pfnUnload = */ NULL,
89 /* .pfnVMCreated = */ NULL,
90 /* .pfnVMConfigureVMM = */ NULL,
91 /* .pfnVMPowerOn = */ NULL,
92 /* .pfnVMPowerOff = */ NULL,
93 /* .pfnQueryObject = */ NULL,
94 VBOXEXTPACKREG_VERSION
95};
96
97
98/** @callback_method_impl{FNVBOXEXTPACKREGISTER} */
99extern "C" DECLEXPORT(int) VBoxExtPackRegister(PCVBOXEXTPACKHLP pHlp, PCVBOXEXTPACKREG *ppReg, PRTERRINFO pErrInfo)
100{
101 /*
102 * Check the VirtualBox version.
103 */
104 if (!VBOXEXTPACK_IS_VER_COMPAT(pHlp->u32Version, VBOXEXTPACKHLP_VERSION))
105 return RTErrInfoSetF(pErrInfo, VERR_VERSION_MISMATCH,
106 "Helper version mismatch - expected %#x got %#x",
107 VBOXEXTPACKHLP_VERSION, pHlp->u32Version);
108 if ( VBOX_FULL_VERSION_GET_MAJOR(pHlp->uVBoxFullVersion) != VBOX_VERSION_MAJOR
109 || VBOX_FULL_VERSION_GET_MINOR(pHlp->uVBoxFullVersion) != VBOX_VERSION_MINOR)
110 return RTErrInfoSetF(pErrInfo, VERR_VERSION_MISMATCH,
111 "VirtualBox version mismatch - expected %u.%u got %u.%u",
112 VBOX_VERSION_MAJOR, VBOX_VERSION_MINOR,
113 VBOX_FULL_VERSION_GET_MAJOR(pHlp->uVBoxFullVersion),
114 VBOX_FULL_VERSION_GET_MINOR(pHlp->uVBoxFullVersion));
115
116 /*
117 * We're good, save input and return the registration structure.
118 */
119 g_pHlp = pHlp;
120 *ppReg = &g_vboxVNCExtPackReg;
121
122 return VINF_SUCCESS;
123}
124
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette