- API/client/manager:

allow applications to supply a "web graphics URL",
    in which case the manager's "Show Graphics" button
    opens a browser at that URL.
    This typically would used for applications that
    implement a web server that serves pages showing
    job information in HTML.
- vboxwrapper: if <pf_guest_port> is specified in the config file,
    set up port forwarding to that port
    and use the above API call with URL "http://localhost:port"


svn path=/trunk/boinc/; revision=24898
This commit is contained in:
David Anderson 2011-12-26 03:10:42 +00:00
parent 2e09c7d9a1
commit 17e2cedefe
5 changed files with 58 additions and 27 deletions

View File

@ -1449,3 +1449,10 @@ double boinc_get_fraction_done() {
double boinc_elapsed_time() { double boinc_elapsed_time() {
return running_interrupt_count*TIMER_PERIOD; return running_interrupt_count*TIMER_PERIOD;
} }
void boinc_web_graphics_url(char* url) {
char buf[256];
if (standalone) return;
sprintf(buf, "<web_graphics_url>%s</web_graphics_url>", url);
app_client_shm->shm->graphics_reply.send_msg(buf);
}

View File

@ -117,6 +117,7 @@ extern double boinc_get_fraction_done();
extern void boinc_register_timer_callback(FUNC_PTR); extern void boinc_register_timer_callback(FUNC_PTR);
extern double boinc_worker_thread_cpu_time(); extern double boinc_worker_thread_cpu_time();
extern int boinc_init_parallel(); extern int boinc_init_parallel();
extern void boinc_web_graphics_url(char*);
#ifdef __APPLE__ #ifdef __APPLE__
extern int setMacPList(void); extern int setMacPList(void);

View File

@ -9480,3 +9480,22 @@ Rom 25 Dec 2011
samples/vboxwrapper/ samples/vboxwrapper/
vbox.cpp vbox.cpp
vboxwrapper.cpp vboxwrapper.cpp
David 26 Dec 2011
- API/client/manager:
allow applications to supply a "web graphics URL",
in which case the manager's "Show Graphics" button
opens a browser at that URL.
This typically would used for applications that
implement a web server that serves pages showing
job information in HTML.
- vboxwrapper: if <pf_guest_port> is specified in the config file,
set up port forwarding to that port
and use the above API call with URL "http://localhost:port"
samples/
vboxwrapper/
vbox.cpp
vboxwrapper.cpp
api/
boinc_api.cpp,h

View File

@ -838,33 +838,6 @@ int VBOX_VM::register_vm_firewall_rules() {
retval = vbm_popen(command, output, "add updated port forwarding rule"); retval = vbm_popen(command, output, "add updated port forwarding rule");
if(retval) return retval; if(retval) return retval;
fprintf(
stderr,
"%s VM communication is allowed on port '%d'.\n",
boinc_msg_prefix(buf, sizeof(buf)), pf_host_port
);
// Write firewall rule to disk
//
MIOFILE mf;
FILE* f = boinc_fopen(PORTFORWARD_FILENAME, "w");
mf.init_file(f);
mf.printf(
"<vbox_firewall>\n"
" <rule>\n"
" <name>vboxwrapper</name>\n"
" <host_port>%d</host_port>\n"
" <guest_port>%d</guest_port>\n"
" </rule>\n"
"</vbox_firewall>\n",
pf_host_port,
pf_guest_port
);
fclose(f);
return 0; return 0;
} }

View File

@ -337,6 +337,37 @@ int main(int argc, char** argv) {
set_floppy_image(aid, vm); set_floppy_image(aid, vm);
set_throttles(aid, vm); set_throttles(aid, vm);
// write port-forwarding info if relevant
//
if (vm.pf_guest_port && vm.pf_host_port) {
fprintf(
stderr,
"%s port forwarding enabled on port '%d'.\n",
boinc_msg_prefix(buf, sizeof(buf)), vm.pf_host_port
);
// Write info to disk
//
MIOFILE mf;
FILE* f = boinc_fopen(PORTFORWARD_FILENAME, "w");
mf.init_file(f);
mf.printf(
"<port_forwarding>\n"
" <rule>\n"
" <host_port>%d</host_port>\n"
" <guest_port>%d</guest_port>\n"
" </rule>\n"
"</port_forwarding>\n",
vm.pf_host_port,
vm.pf_guest_port
);
fclose(f);
sprintf(buf, "http://localhost:%d", vm.pf_host_port);
boinc_web_graphics_url(buf);
}
while (1) { while (1) {
// Discover the VM's current state // Discover the VM's current state
vm.poll(); vm.poll();