The BOINC core client provides a set of RPCs (remote procedure calls) for control and state interrogation. This enables the development of GUI (graphical user interface) programs separately from the core client. These RPCs send XML request and reply messages over a TCP connection. The XML formats are not documented, but can be deduced from the source code.
BOINC provides a C++ interface to these RPCs,
consisting of the GUI_RPC
class.
The interface is in lib/gui_rpc_client.h
,
and the program boinc_cmd.C
gives a usage example).
All member functions return an integer error code.
To create an RPC connection, call
";
list_start();
list_item_func(
"init(char* host)",
"Establish RPC connection to the given host"
);
list_end();
echo "
The GUI RPC protocol changes over time. If you're writing a GUI program that needs to communicate with older versions of the BOINC core client, here's what to do:
The RPC protocol allows the GUI program to authenticate itself using a password; this is described below. Some of the RPC operations can be done without authentication; others can be done without authentication, but only by a GUI program running on the same machine. "; list_start(); list_item_func( "authorize(char* password)", "Do authorization sequence with the peer, using given password" ); list_end(); echo "
op
is one of
\"suspend\",
\"resume\",
\"reset\",
\"detach\", or
\"update\".
"
);
list_item_func(
"project_attach(
char* url,
char* account_id,
bool use_cached_credentials
)",
"Attach to the given project. Cached credentials are defined in the
project_init.xml file."
);
list_item_func(
"set_run_mode(int mode, double duration)",
"Set the run mode (never/auto/always).
If duration is zero, mode is permanent.
Otherwise revert to last permanent mode
after duration seconds elapse."
);
list_item_func(
"set_network_mode(int mode, double duration)",
"Set the network mode (never/auto/always)."
);
list_item_func(
"run_benchmarks()",
"Run benchmarks"
);
list_item_func(
"set_proxy_settings(PROXY_INFO&)",
"Set proxy settings"
);
list_item_func(
"network_available()",
"Tells the core client that a network connection is available,
and that it should do as much network activity as it can."
);
list_item_func(
"file_transfer_op(FILE_TRANSFER&, char* op)",
"Perform a control operation on a file transfer.
op
is one of
\"abort\" or
\"retry\".
"
);
list_item_func(
"result_op(FILE_TRANSFER&, char* op)",
"Perform a control operation on an active result.
op
is one of
\"suspend\",
\"resume\", or
\"abort\".
"
);
list_item_func(
"quit()",
"Tell the core client to exit."
);
list_item_func(
"acct_mgr_rpc(
const char* url,
const char* name,
const char* passwd,
bool use_cached_credentials
)",
"Do an Account Manager RPC
to the given URL, passing the given name/password.
If use_cached_credentials is true, then the existing url, username,
and password are used and the core client updates the project
information from the account manager.
If the RPC is successful, save the account info on disk
(it can be retrieved later using acct_mgr_info(), see below).
If URL is the empty string, remove account manager info from disk.
"
);
list_item_func(
"acct_mgr_info(ACCT_MGR_INFO&)",
"Return the URL/name of the current account manager (if any),
and the user name and password."
);
list_item_func(
"read_global_prefs_override()",
"Tells the core client to reread the 'global_prefs_override.xml' file,
modifying the global preferences according to its contents."
);
list_item_func(
"get_global_prefs_override(std::string&)",
"Reads the contents of the
global preferences override file
into the given string.
Return an error code if the file is not present."
);
list_item_func(
"set_global_prefs_override(std::string&)",
"Write the given contents to the
global preferences override file.
If the argment is an empty string, delete the file.
Otherwise the argument must be a valid
<global_preferences> element."
);
list_item_func(
"get_global_prefs_override_struct(GLOBAL_PREFS&)",
"Return the contents of the
global preferences override file,
parsed into a structure.
Default values are zero.
Returns an error code if the file is not present."
);
list_item_func(
"set_global_prefs_override_struct(GLOBAL_PREFS&)",
"Convert the given structure to XML and write it to the
global preferences override file."
);
list_end();
echo "
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.
Since GUI RPCs can control the BOINC client (e.g. attaching/detaching projects) it is important to protect your BOINC client from unauthorized control. There are two levels of 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.
If this file is not present, there is no password protection.
By default the core client accepts GUI RPCs only from the same host.
You can allow remote hosts to control a core client in two ways: