boinc/samples/vboxwrapper/vbox_vboxmanage.h

92 lines
2.9 KiB
C
Raw Normal View History

// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2010-2012 University of California
//
// BOINC 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 3 of the License, or (at your option) any later version.
//
// BOINC 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 BOINC. If not, see <http://www.gnu.org/licenses/>.
// Provide cross-platform interfaces for making changes to VirtualBox
#ifndef _VBOX_VBOXMANAGE_H_
#define _VBOX_VBOXMANAGE_H_
namespace vboxmanage {
class VBOX_VM : public VBOX_BASE {
public:
VBOX_VM();
~VBOX_VM();
int initialize();
int create_vm();
int register_vm();
int deregister_vm(bool delete_media);
int deregister_stale_vm();
void poll(bool log_state = true);
int start();
int stop();
int poweroff();
int pause();
int resume();
int create_snapshot(double elapsed_time);
int cleanup_snapshots(bool delete_active);
int restore_snapshot();
void dump_hypervisor_status_reports();
int is_registered();
bool is_system_ready(std::string& message);
bool is_disk_image_registered();
bool is_extpack_installed();
static bool is_virtualbox_installed();
int get_install_directory(std::string& dir);
int get_version_information(std::string& version);
int get_guest_additions(std::string& dir);
int get_default_network_interface(std::string& iface);
int get_vm_network_bytes_sent(double& sent);
int get_vm_network_bytes_received(double& received);
int get_vm_process_id();
int get_vm_exit_code(unsigned long& exit_code);
double get_vm_cpu_time();
int set_network_access(bool enabled);
int set_cpu_usage(int percentage);
int set_network_usage(int kilobytes);
void lower_vm_process_priority();
void reset_vm_process_priority();
int launch_vboxsvc();
int launch_vboxvm();
int vbm_popen(
std::string& command, std::string& output, const char* item, bool log_error = true, bool retry_failures = true, unsigned int timeout = 45, bool log_trace = true
);
int vbm_popen_raw(
std::string& command, std::string& output, unsigned int timeout
);
void vbm_replay(
std::string& command
);
void vbm_trace(
std::string& command, std::string& ouput, int retval
);
};
};
#endif