- vboxwrapper: add <pf_host_port> element to config file.

Specifies host port # for port forwarding.
    If absent or zero, assign a port.


svn path=/trunk/boinc/; revision=25030
This commit is contained in:
David Anderson 2012-01-11 23:21:17 +00:00
parent 521b9fdce3
commit 125ad03a54
6 changed files with 21 additions and 11 deletions

View File

@ -366,3 +366,13 @@ Charlie 11 Jan 2012
clientgui/
BOINCClientManager.cpp
David 11 Jan 2012
- vboxwrapper: add <pf_host_port> element to config file.
Specifies host port # for port forwarding.
If absent or zero, assign a port.
samples/vboxwrapper
vbox.cpp,h
floppyio.cpp,h
vboxwrapper.cpp

View File

@ -77,8 +77,7 @@ FloppyIO::FloppyIO(const char * filename, int flags) {
// Prepare open flags and create file stream
ios_base::openmode fOpenFlags = fstream::in | fstream::out;
if ((flags & F_NOCREATE) == 0) fOpenFlags |= fstream::trunc;
fstream *fIO = new fstream( );
this->fIO = fIO;
this->fIO = new fstream( );
// Enable exceptions on fIO if told so
if ((flags & F_EXCEPTIONS) != 0) {
@ -201,7 +200,6 @@ int FloppyIO::send(string strData) {
// Initialize variables
int szData = (int)strData.length();
int szPad = 0;
int bytesSent = szData;
// Copy the first szInput bytes
@ -260,7 +258,6 @@ string FloppyIO::receive() {
//
int FloppyIO::receive(string * ansBuffer) {
char * dataToReceive = new char[this->szInput];
int dataLength = this->szInput;
// Check for ready state
if (!this->ready()) return this->setError(-4, "Stream is not ready!");

View File

@ -173,9 +173,9 @@ public:
// Change the message and return my instance
// (Used for singleton format)
FloppyIOException * set(int code, std::string message) {
this->code = code;
this->message = message;
FloppyIOException * set(int _code, std::string _message) {
this->code = _code;
this->message = _message;
return this;
}

View File

@ -841,12 +841,14 @@ int VBOX_VM::register_vm() {
set_network_access(true);
}
// If a project wants to open up a firewall port through the VirtualBox virtual
// If the app wants to open up a port through the VirtualBox virtual
// network firewall/nat do that here.
//
if (pf_guest_port) {
retval = get_port_forwarding_port();
if (retval) return retval;
if (!pf_host_port) {
retval = get_port_forwarding_port();
if (retval) return retval;
}
retval = register_vm_firewall_rules();
if (retval) return retval;
}

View File

@ -68,7 +68,7 @@ struct VBOX_VM {
bool enable_network;
// the following for optional port forwarding
int pf_host_port;
// dynamically assigned
// specified in config file
int pf_guest_port;
// specified in config file

View File

@ -110,6 +110,7 @@ int parse_job_file(VBOX_VM& vm) {
else if (xp.parse_bool("enable_shared_directory", vm.enable_shared_directory)) continue;
else if (xp.parse_bool("enable_floppyio", vm.enable_floppyio)) continue;
else if (xp.parse_int("pf_guest_port", vm.pf_guest_port)) continue;
else if (xp.parse_int("pf_host_port", vm.pf_host_port)) continue;
fprintf(stderr, "%s parse_job_file(): unexpected tag %s\n",
boinc_msg_prefix(buf, sizeof(buf)), xp.parsed_tag
);