Controlling the BOINC Daemon via RPC
From Unofficial BOINC Wiki
Contents |
[edit] General
The BOINC Client Software provides a set of Remote Procedure Calls (RPCs) for control and state interrogation. This enables the development of Graphical User Interface (GUI) programs separately from the BOINC Daemon.
The BOINC Client Software provides a C++ interface to these RPCs. The interface is based on the GUI_RPC class, which provides the following functions (the code is in lib/gui_rpc_client.h, and the program boinc_cmd.C gives a usage example):
| function | description |
|---|---|
| init(char* host) | Establish RPC connection to the given Host |
| authorize(char* password) | Do authorization sequence with the peer, using given password |
| get_state(CC_STATE&) | Get the BOINC Daemon's 'static' state, i.e. its projects, apps, app_versions, Work Units and Results. This call is relatively slow and should only be done initially, and when needed later (see below). |
| get_results(RESULTS&) | Get a list of results. Those that are in progress will have information such as CPU Time and fraction done. Each Result includes a name; use CC_STATE::lookup_result() to find this Result in the current static state; if it's not there, call get_state() again. |
| get_file_transfers(FILE_TRANSFERS&) | Get a list of file transfers in progress. Each is linked by name to a project; use CC_STATE::lookup_project() to find this project in the current state; if it's not there, call get_state() again. |
| get_project_status(vector<PROJECT>&) | Get a list of projects, with only basic fields filled in. |
| get_disk_usage(vector<PROJECT>&) | Get a list of projects, with disk usage fields filled in. |
| show_graphics(char* result_name, bool full_screen) | Request that the application processing the given result create a graphics window |
| project_op(PROJECT&, char* op) | Perform a control operation on the given Project.
|
| project_attach(char* url, char* account_id) | Attach to the given project |
| set_run_mode(int mode) | Set the run mode (never/auto/always). |
| get_run_mode(int& mode) | Get the run mode (never/auto/always). |
| set_network_mode(int mode) | Set the network mode (never/auto/always). |
| run_benchmarks() | Run benchmarks |
| set_proxy_settings(PROXY_INFO&) | Set proxy settings |
| get_proxy_settings(PROXY_INFO&) | Get proxy settings |
| get_messages(int seqno, MESSAGES&) | Returns a list of messages to be displayed to the user.
Each message has a sequence number (1, 2, ...), a priority (1=informational, 2=error) and a timestamp. |
| file_transfer_op(FILE_TRANSFER&, char* op) | Perform a control operation on a file transfer.
|
| result_op(FILE_TRANSFER&, char* op) | Perform a control operation on an active result.
|
The RPC mechanism uses XML requests and replies. It should be easy fairly easy to generate client interfaces in languages other than C++. GUI programs connect to the core client by opening a TCP socket at port 31416. They can then do repeated RPCs over this connection. Each reply message ends with the character '\003'.
[edit] Access Control for GUI RPC
Since GUI RPCs can control the BOINC Client Software (e.g. attaching/detaching projects), it is important to protect your BOINC client from unauthorized control. There are two levels of protection:
- You can associate a password with the client; GUI RPCs must be authenticated with this password, if set.
- You can restrict RPCs to a limited set of Hosts.
[edit] Password Protection
If you place a password in a file gui_rpc_auth.cfg in your BOINC directory, GUI RPCs must be authenticated using the password.
[edit] Remote Host Restriction
By default the BOINC Daemon accepts GUI RPCs only from the same Host.
You can allow remote hosts to control the BOINC Client Software in two ways:
If you run the client with the -allow_remote_gui_rpc command line option, it will accept connections from any host. This is not recommended unless the host is behind a firewall that blocks the GUI RPC port (1043). You can create a file remote_hosts.cfg in your BOINC Directory containing a list of allowed DNS host names or IP addresses (one per line). Those hosts will be able to connect. The remote_hosts.cfg file can have comment lines that start with either a # or a ; character as well.
[edit] Also See
[edit] UCB Source
[edit] Copyright ©
- 2005 University of California
- 2005 Paul D. Buck
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.

