2004-06-09 19:09:16 +00:00
|
|
|
<?php
|
2004-02-09 05:11:05 +00:00
|
|
|
require_once("docutil.php");
|
2005-04-18 04:32:22 +00:00
|
|
|
page_head("Controlling the core client via RPC");
|
2004-02-09 05:11:05 +00:00
|
|
|
echo "
|
|
|
|
<p>
|
2004-02-28 19:11:40 +00:00
|
|
|
The BOINC core client provides a set of RPCs
|
|
|
|
(remote procedure calls) for control and state interrogation.
|
2005-04-18 04:32:22 +00:00
|
|
|
This enables the development of GUI (graphical user interface)
|
2004-02-28 19:11:40 +00:00
|
|
|
programs separately from the core client.
|
2004-07-13 23:51:09 +00:00
|
|
|
<p>
|
2004-07-21 21:30:25 +00:00
|
|
|
BOINC provides a C++ interface to these RPCs.
|
|
|
|
The interface is based on the GUI_RPC class,
|
|
|
|
which provides the following functions
|
2004-09-27 04:26:51 +00:00
|
|
|
(the code is in <code>lib/gui_rpc_client.h</code>,
|
2005-04-18 04:32:22 +00:00
|
|
|
and the program <code>boinc_cmd.C</code> gives a usage example):
|
2004-02-09 05:11:05 +00:00
|
|
|
<p>
|
2004-02-28 19:11:40 +00:00
|
|
|
";
|
|
|
|
list_start();
|
2004-07-21 21:30:25 +00:00
|
|
|
list_heading("function ", "description");
|
2004-09-05 18:46:19 +00:00
|
|
|
list_item_func(
|
|
|
|
"init(char* host)",
|
|
|
|
"Establish RPC connection to the given host"
|
|
|
|
);
|
2005-03-08 00:23:58 +00:00
|
|
|
list_item_func(
|
|
|
|
"authorize(char* password)",
|
|
|
|
"Do authorization sequence with the peer, using given password"
|
|
|
|
);
|
2004-09-05 18:46:19 +00:00
|
|
|
list_item_func(
|
|
|
|
"get_state(CC_STATE&)",
|
2004-07-21 21:30:25 +00:00
|
|
|
"Get the core client's 'static' state,
|
|
|
|
i.e. its projects, apps, app_versions, workunits and results.
|
|
|
|
This call is relatively slow and should only
|
|
|
|
be done initially, and when needed later (see below).
|
|
|
|
"
|
2004-02-28 19:11:40 +00:00
|
|
|
);
|
2004-09-05 18:46:19 +00:00
|
|
|
list_item_func(
|
|
|
|
"get_results(RESULTS&)",
|
2004-07-21 21:30:25 +00:00
|
|
|
"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.
|
|
|
|
"
|
|
|
|
);
|
2004-09-05 18:46:19 +00:00
|
|
|
list_item_func(
|
|
|
|
"get_file_transfers(FILE_TRANSFERS&)",
|
2004-07-21 21:30:25 +00:00
|
|
|
"Get a list of file transfers in progress.
|
|
|
|
Each is linked by name to a project;
|
2004-09-27 04:26:51 +00:00
|
|
|
use CC_STATE::lookup_project() to find this project in the current state;
|
2004-07-21 21:30:25 +00:00
|
|
|
if it's not there, call get_state() again."
|
|
|
|
);
|
2006-06-27 21:46:50 +00:00
|
|
|
list_item_func(
|
|
|
|
"get_simple_gui_info(SIMPLE_GUI_INFO&)",
|
|
|
|
"Return the list of projects and of active results."
|
|
|
|
);
|
2004-09-05 18:46:19 +00:00
|
|
|
list_item_func(
|
|
|
|
"get_project_status(vector<PROJECT>&)",
|
|
|
|
"Get a list of projects, with only basic fields filled in."
|
2004-06-17 17:00:14 +00:00
|
|
|
);
|
2004-09-05 18:46:19 +00:00
|
|
|
list_item_func(
|
|
|
|
"get_disk_usage(vector<PROJECT>&)",
|
|
|
|
"Get a list of projects, with disk usage fields filled in."
|
|
|
|
);
|
|
|
|
list_item_func(
|
2004-07-21 21:30:25 +00:00
|
|
|
"show_graphics(char* result_name, bool full_screen)",
|
2004-02-28 19:11:40 +00:00
|
|
|
"Request that the application processing the given result
|
|
|
|
create a graphics window"
|
|
|
|
);
|
2004-09-05 18:46:19 +00:00
|
|
|
list_item_func(
|
2004-09-27 04:26:51 +00:00
|
|
|
"project_op(PROJECT&, char* op)",
|
|
|
|
"Perform a control operation on the given project.
|
|
|
|
<code>op</code> is one of
|
|
|
|
\"suspend\",
|
|
|
|
\"resume\",
|
|
|
|
\"reset\",
|
|
|
|
\"detach\", or
|
|
|
|
\"update\".
|
|
|
|
"
|
2004-02-28 19:11:40 +00:00
|
|
|
);
|
2004-09-05 18:46:19 +00:00
|
|
|
list_item_func(
|
2005-09-26 20:01:01 +00:00
|
|
|
"project_attach(
|
|
|
|
char* url,
|
|
|
|
char* account_id,
|
|
|
|
bool use_cached_credentials
|
|
|
|
)",
|
2005-09-22 08:55:03 +00:00
|
|
|
"Attach to the given project. Cached credentials are defined in the
|
|
|
|
<a href=client_startup.php>project_init.xml</a> file."
|
2004-02-28 19:11:40 +00:00
|
|
|
);
|
2004-09-05 18:46:19 +00:00
|
|
|
list_item_func(
|
|
|
|
"set_run_mode(int mode)",
|
|
|
|
"Set the run mode (never/auto/always)."
|
|
|
|
);
|
|
|
|
list_item_func(
|
2004-09-21 19:58:30 +00:00
|
|
|
"get_run_mode(int& mode)",
|
2004-09-05 18:46:19 +00:00
|
|
|
"Get the run mode (never/auto/always)."
|
2004-02-28 19:11:40 +00:00
|
|
|
);
|
2004-09-05 18:46:19 +00:00
|
|
|
list_item_func(
|
|
|
|
"set_network_mode(int mode)",
|
|
|
|
"Set the network mode (never/auto/always)."
|
|
|
|
);
|
|
|
|
list_item_func(
|
2004-07-21 21:30:25 +00:00
|
|
|
"run_benchmarks()",
|
2004-02-28 19:11:40 +00:00
|
|
|
"Run benchmarks"
|
|
|
|
);
|
2004-09-05 18:46:19 +00:00
|
|
|
list_item_func(
|
2004-07-21 21:30:25 +00:00
|
|
|
"set_proxy_settings(PROXY_INFO&)",
|
2004-02-28 19:11:40 +00:00
|
|
|
"Set proxy settings"
|
|
|
|
);
|
2004-09-27 04:26:51 +00:00
|
|
|
list_item_func(
|
|
|
|
"get_proxy_settings(PROXY_INFO&)",
|
|
|
|
"Get proxy settings"
|
|
|
|
);
|
2004-09-05 18:46:19 +00:00
|
|
|
list_item_func(
|
2005-01-10 20:46:33 +00:00
|
|
|
"get_messages(int seqno, MESSAGES&)",
|
|
|
|
"Returns a list of messages to be displayed to the user.
|
2004-09-05 18:46:19 +00:00
|
|
|
Each message has a sequence number (1, 2, ...),
|
2005-01-10 20:46:33 +00:00
|
|
|
a priority (1=informational, 2=error) and a timestamp.
|
|
|
|
The RPC requests the messages with sequence numbers greater than 'seqno',
|
|
|
|
in order of increasing sequence number."
|
2004-09-05 18:46:19 +00:00
|
|
|
);
|
|
|
|
list_item_func(
|
2004-09-27 04:26:51 +00:00
|
|
|
"file_transfer_op(FILE_TRANSFER&, char* op)",
|
|
|
|
"Perform a control operation on a file transfer.
|
|
|
|
<code>op</code> is one of
|
|
|
|
\"abort\" or
|
|
|
|
\"retry\".
|
|
|
|
"
|
|
|
|
);
|
|
|
|
list_item_func(
|
|
|
|
"result_op(FILE_TRANSFER&, char* op)",
|
|
|
|
"Perform a control operation on an active result.
|
|
|
|
<code>op</code> is one of
|
|
|
|
\"suspend\",
|
|
|
|
\"resume\", or
|
|
|
|
\"abort\".
|
|
|
|
"
|
2004-09-05 18:46:19 +00:00
|
|
|
);
|
2005-06-29 00:10:49 +00:00
|
|
|
list_item_func(
|
2005-09-26 20:01:01 +00:00
|
|
|
"acct_mgr_rpc(
|
|
|
|
const char* url,
|
|
|
|
const char* name,
|
|
|
|
const char* passwd,
|
|
|
|
bool use_cached_credentials
|
|
|
|
)",
|
2005-06-29 00:10:49 +00:00
|
|
|
"Do an <a href=acct_mgt.php>Account Manager RPC</a>
|
|
|
|
to the given URL, passing the given name/password.
|
2005-09-22 08:55:03 +00:00
|
|
|
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.
|
2005-06-29 00:10:49 +00:00
|
|
|
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."
|
|
|
|
);
|
2005-06-23 00:15:05 +00:00
|
|
|
list_item_func(
|
|
|
|
"network_query(int& network_wanted)",
|
|
|
|
"Returns a nonzero value in network_wanted if the core client
|
|
|
|
wants a network connection or is currently using one.
|
|
|
|
Wait to get a false twice (with a few seconds delay)
|
|
|
|
before closing a connection."
|
|
|
|
);
|
|
|
|
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."
|
|
|
|
);
|
2006-02-07 22:43:14 +00:00
|
|
|
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."
|
|
|
|
);
|
2004-02-28 19:11:40 +00:00
|
|
|
list_end();
|
|
|
|
echo "
|
2004-02-09 05:11:05 +00:00
|
|
|
<p>
|
2004-07-21 21:30:25 +00:00
|
|
|
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.
|
2005-04-11 19:29:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
<h2>Access control for GUI RPC</h2>
|
|
|
|
<p>
|
|
|
|
Since GUI RPCs can control the BOINC client
|
|
|
|
(e.g. attaching/detaching projects)
|
2005-10-15 05:08:59 +00:00
|
|
|
it is important to protect your BOINC client from unauthorized control.
|
2005-04-11 19:29:36 +00:00
|
|
|
There are two levels of protection:
|
|
|
|
<ul>
|
2005-10-15 05:08:59 +00:00
|
|
|
<li> You can associate a password with the client.
|
|
|
|
If a password is used,
|
2005-04-11 19:29:36 +00:00
|
|
|
GUI RPCs must be authenticated with this password.
|
|
|
|
<li> You can restrict RPCs to a limited set of hosts.
|
|
|
|
</ul>
|
2005-10-15 05:08:59 +00:00
|
|
|
A GUI RPC is handled only if it passes both levels of protection.
|
2005-04-11 19:29:36 +00:00
|
|
|
|
|
|
|
<h2>Password protection</h2>
|
|
|
|
<p>
|
|
|
|
If you place a password in a file <b>gui_rpc_auth.cfg</b>
|
|
|
|
in your BOINC directory,
|
|
|
|
GUI RPCs must be authenticated using the password.
|
2005-10-15 05:08:59 +00:00
|
|
|
<p>
|
|
|
|
If this file is not present, there is no password protection.
|
2005-04-11 19:29:36 +00:00
|
|
|
|
|
|
|
<h2>Remote host restriction</h2>
|
|
|
|
<p>
|
2005-10-15 05:08:59 +00:00
|
|
|
By default the core client accepts GUI RPCs only from the same host.
|
2005-04-11 19:29:36 +00:00
|
|
|
|
|
|
|
<p>
|
|
|
|
You can allow remote hosts to control a core client in two ways:
|
|
|
|
<ul>
|
|
|
|
<li> 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).
|
|
|
|
<li>
|
|
|
|
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.
|
|
|
|
</ul>
|
2004-02-09 05:11:05 +00:00
|
|
|
";
|
2005-04-11 19:29:36 +00:00
|
|
|
|
2004-02-09 05:11:05 +00:00
|
|
|
page_tail();
|
|
|
|
?>
|