= GUI RPC Protocol =
The GUI RPC protocol lets GUIs like the BOINC Manager communicate with the core client.
Note that the RPC server is the core client, and the RPC client is a GUI or add-on communicating with it (such as BOINC Manager). This may seem confusing but this terminology will be used on the rest of the page.
== Basic Structure ==
The protocol is based on XML, and it's strictly request-reply. The client sends requests to the server, and waits for a reply; the server never sends anything without getting a request from the client first. Both requests and replies are terminated with the control character `0x03`.
Self-closing tags must not have a space before the slash, or current client and server will not parse it correctly. For example, send ``, not ``.
Requests are inside `` elements, and replies from the RPC server are inside `` elements (in both cases there is a `0x03` byte after the closing tag). The current RPC server implementation doesn't require the `` tag, which is handy for debugging (you can connect via [http://netcat.sourceforge.net netcat] and just type ``); however, clients must not rely on this, and must always send the `` root tag.
The current RPC server doesn't support pipelining of requests (pipelining means sending a batch of multiple requests without waiting for a reply, then getting all the replies together; this improves latency). For compatibility, pipelining must not be used.
To terminate the RPC session, just close the connection on the client side. Warning: some protocols have a specific "quit" command for this. The GUI RPC protocol has a `` command, but it has a completely different purpose: telling the core client to quit!
Every request has the following structure:
{{{
#!xml
\003
}}}
where `` is a placeholder for one of the actual requests that are listed [#RequestsandReplies later].
Self-closing tags could also be used for requests that do not require data to be passed to the client. Their structure is the following:
{{{
#!xml
\003
}}}
== Common replies ==
If a command requires [#Authentication authentication] but the client hasn't authenticated yet, the RPC server will reply
{{{
#!xml
\003
}}}
The client should be prepared to receive this in reply to any command.
Successful commands usually get the reply:
{{{
#!xml
\003
}}}
although individual commands, especially those that retrieve data, may return the requested information instead of ``.
If a command isn't successful, the reply is:
{{{
#!xml
human-readable error message\003
}}}
Clients should not try to parse the error message. The current gui_rpc_client.cpp library sometimes tries to parse errors, but this is very unreliable, since the message wording can change (and has changed) between RPC server versions. (Commit 63b49cd2 even changed "unrecognized op".)
== Authentication ==
The RPC protocol allows the RPC client to authenticate itself using a password. Most RPC operations can only be done by an authenticated client. Some can be done without authentication, but only by a client running on the same machine.
Authentication on the RPC protocol is password-based, and negotiated with a challenge-response system. To initiate the authentication process, send an `` command:
{{{
#!xml
\003
}}}
The response will be the authentication challenge:
{{{
#!xml
1198959933.057125\003
}}}
The value of `nonce` is to be used as a salt with the password. It is randomly generated for each request. To calculate the response, concatenate the nonce and the password (nonce first), then calculate the MD5 hash of the result, i.e: `md5(nonce+password)`. Finally, send an `` request with the calculated hash, in ''lowercase'' hexadecimal format.
{{{
#!xml
d41d8cd98f00b204e9800998ecf8427e\003
}}}
The reply will be either `` or ``.
If the client hasn't authenticated yet, and it is connecting remotely (ie. not via localhost), `` is the only command that can be sent, and all other commands will return ``.
== Common XML elements ==
There are some XML elements (like ``, ``, ``, and ``) that are common to many command replies. Such elements will be documented in this section.
The XML responses are relatively flat, and are parsed in one pass. The relationship between XML elements is determined by what was parsed before it, instead of based on the tree hierarchy like other XML formats do. For example, `` elements that come after a particular `` element are results that belong to that project. They won't be inside the `` element.
== Requests and Replies ==
These are the requests that can be issued to the client and the replies that are expected. The requests are placed between the opening and closing `` tags. The replies are described without the enclosing `` tags.
----
* Requests not requiring authentication
* [#exchange_versions exchange_versions]
* [#get_all_projects_list get_all_projects_list]
* [#get_cc_status get_cc_status]
* [#get_disk_usage get_disk_usage]
* [#get_daily_xfer_history get_daily_xfer_history]
* [#get_file_transfers get_file_transfers]
* [#get_host_info get_host_info]
* [#get_messages get_messages]
* [#get_message_count get_message_count]
* [#get_newer_version get_newer_version]
* [#get_notices_public get_notices_public]
* [#get_old_results get_old_results]
* [#get_project_status get_project_status]
* [#get_results get_results]
* [#get_screensaver_tasks get_screensaver_tasks]
* [#get_simple_gui_info get_simple_gui_info]
* [#get_state get_state]
* [#get_statistics get_statistics]
* Requests requiring authentication
* [#Filetransferoperations File transfer operations]
* [#abort_file_transfer abort_file_transfer]
* [#retry_file_transfer retry_file_transfer]
* [#Taskoperations Task operations]
* [#abort_result abort_result]
* [#suspend_result suspend_result]
* [#resume_result resume_result]
* [#Projectoperations Project operations]
* [#project_reset project_reset]
* [#project_detach project_detach]
* [#project_update project_update]
* [#project_suspend project_suspend]
* [#project_resume project_resume]
* [#project_nomorework project_nomorework]
* [#project_allowmorework project_allowmorework]
* [#project_detach_when_done project_detach_when_done]
* [#project_dont_detach_when_done project_dont_detach_when_done]
* [#project_attach project_attach]
* [#project_attach_poll project_attach_poll]
* [#get_project_init_status get_project_init_status]
* [#get_project_config get_project_config]
* [#get_project_config_poll get_project_config_poll]
* [#Accountoperations Account operations]
* [#create_account create_account]
* [#create_account_poll create_account_poll]
* [#lookup_account lookup_account]
* [#lookup_account_poll lookup_account_poll]
* [#Accountmanageroperations Account Manager operations]
* [#acct_mgr_info acct_mgr_info]
* [#acct_mgr_rpc acct_mgr_rpc]
* [#acct_mgr_rpc_poll acct_mgr_rpc_poll]
* [#Globalpreferencesoperations Global preferences operations]
* [#get_global_prefs_file get_global_prefs_file]
* [#get_global_prefs_override get_global_prefs_override]
* [#set_global_prefs_override set_global_prefs_override]
* [#read_global_prefs_override read_global_prefs_override]
* [#get_global_prefs_working get_global_prefs_working]
* [#Otheroperations Other operations]
* [#get_notices get_notices]
* [#set_host_info set_host_info]
* [#run_benchmarks run_benchmarks]
* [#get_proxy_settings get_proxy_settings]
* [#network_available network_available]
* [#quit quit]
* [#set_language set_language]
* [#set_network_mode set_network_mode]
* [#set_gpu_mode set_gpu_mode]
* [#set_run_mode set_run_mode]
* [#set_proxy_settings set_proxy_settings]
* [#get_cc_config get_cc_config]
* [#read_cc_config read_cc_config]
* [#set_cc_config set_cc_config]
* [#get_app_config get_app_config]
* [#set_app_config set_app_config]
* [#report_device_status report_device_status]
[[br]]
=== The following requests do not require local authorisation. ===
----
[[br]]
==== `exchange_versions` ====
Used to get the version of the running core client and send the version of the request's source.
Request:
{{{
#!xml
}}}
The sending of the source's version is optional and a simple:
{{{
#!xml
}}}
would suffice to get the version of the running core client.
Reply:
{{{
#!xml
}}}
[[br]]
==== `get_all_projects_list` ====
Used to get a list of all the projects as found in the all_projects_list.xml file.
Request:
{{{
#!xml
}}}
Reply:
{{{
#!xml
.
.
.
.
.
.
}}}
[[br]]
==== `get_cc_status` ====
Show CPU/GPU/network run modes and network connection status (version 6.12+)
Request:
{{{
#!xml
}}}
Reply:
{{{
#!xml
}}}
[[br]]
==== `get_disk_usage` ====
Show disk usage by project
Request:
{{{
#!xml
}}}
Reply:
{{{
#!xml
}}}
[[br]]
==== `get_daily_xfer_history` ====
Show network traffic history of the BOINC client. Read from daily_xfer_history.xml
Request:
{{{
#!xml
}}}
Reply:
{{{
#!xml
.
.
.
}}}
[[br]]
==== `get_file_transfers` ====
Show all current file transfers
Request:
{{{
#!xml
}}}
Reply:
{{{
#!xml
.
.
.
}}}
[[br]]
==== `get_host_info` ====
Get information about host hardware and usage
Request:
{{{
#!xml
}}}
Reply:
{{{
#!xml
}}}
[[br]]
==== `get_messages` ====
Show messages with sequence numbers beyond the given `seqno`
Request:
{{{
}}}
The `` tag is optional.
Reply:
{{{
#!xml
.
.
.
}}}
[[br]]
==== `get_message_count` ====
Show largest message seqno
Request:
{{{
#!xml
}}}
Reply:
{{{
#!xml
}}}
[[br]]
==== `get_newer_version` ====
Get newer version number, if any, and download url
Request:
{{{
#!xml
}}}
Reply:
{{{
#!xml
}}}
[[br]]
==== `get_notices_public` ====
Returns only non-private notices, doesn't require authentication
Request:
{{{
#!xml
}}}
Reply:
{{{
#!xml
.
.
.
}}}
[[br]]
==== `get_old_results` ====
Show old tasks
Request:
{{{
#!xml
}}}
Reply:
{{{
#!xml
.
.
.
}}}
[[br]]
==== `get_project_status` ====
Show status of all attached projects
Request:
{{{
#!xml
}}}
Reply:
{{{
#!xml
()
()
()
()
()
()
()
()
()
()
()
()
()
()
intel_gpu
.
.
.
.
.
.
.
.
.
}}}
[[br]]
==== `get_results` ====
Show tasks
Request:
{{{
#!xml
}}}
Reply:
{{{
#!xml
.
.
.
.
.
.
}}}
[[br]]
==== `get_screensaver_tasks` ====
Show suspend reason and active tasks
Request:
{{{
#!xml
}}}
Reply:
{{{
#!xml
.
.
.
}}}
[[br]]
==== `get_simple_gui_info` ====
Show status of projects and active tasks
Request:
{{{
#!xml
}}}
Reply:
{{{
#!xml
.
.
.
.
.
.
}}}
[[br]]
==== `get_state` ====
Get the entire state
Request:
{{{
#!xml
}}}
Reply:
{{{
#!xml
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
platform_name>
.
.
.
}}}
[[br]]
==== `get_statistics` ====
Get statistics for the projects the client is attached to
Request:
{{{
#!xml
}}}
Reply:
{{{
#!xml
.
.
.
.
.
.
}}}
[[br]]
----
=== The following requests require local authentication ===
In this section the replies fall in one of three categories. For requests that retrieve data the replies depend on the kind of data that is retrieved. For ''control of the client'' operations they are either:
{{{
#!xml
}}}
upon a successful request, or:
{{{
#!xml
human-readable error message
}}}
upon an unsuccessful request.
If the request retrieves data the reply will be documented.
Otherwise only requests will be documented.
See also ( [#Commonreplies Common Replies] )
[[br]]
=== File transfer operations ===
----
==== `abort_file_transfer` ====
Abort a pending file transfer
Request:
{{{
#!xml
}}}
[[br]]
==== `retry_file_transfer` ====
Retry a file transfer (Client will need temporary network access)
Request:
{{{
#!xml
}}}
[[br]]
=== Task operations ===
----
==== `abort_result` ====
Abort a task
Request:
{{{
#!xml
}}}
[[br]]
==== `suspend_result` ====
Suspend a running task (Note: Even if a task is already suspended the request will return success)
Request:
{{{
#!xml
}}}
[[br]]
==== `resume_result` ====
Resume a suspended task (Note: Even if a task is already running the request will return success)
Request:
{{{
#!xml
}}}
[[br]]
=== Project operations ===
----
[[br]]
==== `project_reset` ====
Reset a project (Client will need temporary network access)
Request:
{{{
#!xml
}}}
[[br]]
==== `project_detach` ====
Detach from a project
Request:
{{{
#!xml
}}}
[[br]]
==== `project_update` ====
Update a project (Client will need temporary network access)
Request:
{{{
#!xml
}}}
[[br]]
==== `project_suspend` ====
Suspend a project
Request:
{{{
#!xml
}}}
[[br]]
==== `project_resume` ====
Resume a project
Request:
{{{
#!xml
}}}
[[br]]
==== `project_nomorework` ====
Stop getting new tasks for a project
Request:
{{{
#!xml
}}}
[[br]]
==== `project_allowmorework` ====
Receive new tasks for a project. Reverse `project_nomorework`.
Request:
{{{
#!xml
}}}
[[br]]
==== `project_detach_when_done` ====
Detach from a project after all it's tasks are finished.
Request:
{{{
#!xml
}}}
[[br]]
==== `project_dont_detach_when_done` ====
Don't detach from a project after all it's tasks are finished. Reverse `project_detach_when_done`
Request:
{{{
#!xml
}}}
[[br]]
==== `project_attach` ====
Attach the client to a project. There are two kinds of requests. One using a project_init.xml file with all the necessary data and one not. (Client will need temporary network access)
Request using file:
{{{
#!xml
}}}
Request not using file:
{{{
#!xml
}}}
This request is asynchronous. This means that it will reply immediately with either `` or an error concerning missing or malformated input. Another kind of possible error is: `Already attached to project`.
**Note:** `` does not mean that the attachment was successful but that the request was made successfuly.
To see if the attachment was successful the request `` has to be made.
[[br]]
==== `project_attach_poll` ====
The aforementioned request. (Client will need temporary network access)
Request:
{{{
#!xml
}}}
Reply:
{{{
#!xml
[]
[ . ]
[ . ]
[ . ]
}}}
**Note:** A source of confusion could be the fact that the ``request will only return errors associated with the attachment process. If a user attaches to a non existing project or uses an invalid authenticator but the attachment per se has no errors the request will return with 0 exit code. In that case the client's messages will have to be checked.
[[br]]
==== `get_project_init_status` ====
Get the contents of the project_init.xml file if present
Request:
{{{
#!xml
}}}
Reply:
{{{
#!xml
}}}
[[br]]
==== `get_project_config` ====
Fetch the project configuration file from the specified url. Asynchronous request. (Client will need temporary network access)
Request:
{{{
#!xml
}}}
[[br]]
==== `get_project_config_poll` ====
The polling call for the previous request. Not a check for the successful fetching of the file but of the successful request. (Client will need temporary network access)
Request:
{{{
#!xml
}}}
Reply:
Successful request:
{{{
#!xml
[]
[ . ]
[ . ]
[ . ]
}}}
Unsuccessful request:
{{{
#!xml
}}}
[[br]]
=== Account operations (all require network access) === #Accountoperations
----
==== `create_account` ====
Create an account for a given project. Asynchronous call
Request:
{{{
#!xml
}}}
[[br]]
==== `create_account_poll` ====
The polling call for the previous request
Request:
{{{
#!xml
}}}
[[br]]
==== `lookup_account` ====
Look for an account in a given project. Asynchronous call.
Request:
{{{
#!xml
}}}
[[br]]
==== `lookup_account_poll` ====
The polling call for the previous request. This request is designed to be used within the context of a function (e.g. inside boinccmd's `--lookup_account`) and the results to be printed by an appropriate function (e.g. `ACCOUNT_OUT::print()`) so it will not be very useful as a standalone RPC call. To get the same functionality as the above command within the context of an RPC the [WebRpc lookup_account.php] script can be used.
Request:
{{{
#!xml
}}}
[[br]]
=== Account manager operations ===
----
==== `acct_mgr_info` ====
Retrieve account manager information
Request:
{{{
#!xml
}}}
Reply:
{{{
#!xml
()
()
()
}}}
[[br]]
==== `acct_mgr_rpc` ====
Make an rpc to an account manager. (Client will need temporary network access). It has three uses. Used by the `--join_acct_mgr` command of the [https://boinc.berkeley.edu/wiki/Boinccmd_tool boinccmd]) tool to join an account manager. Used by the same tool's `--quit_acct_mgr`command with null arguments to quit an account manager. And lastly used to trigger an RPC to the current account manager.
There are two requests depending on whether there is a file with the necessary data or not.
Using said file:
{{{
#!xml
}}}
Not using it:
{{{
#!xml
}}}
This request is asynchronous. It returns immediately with either ``or one of the following errors: `bad arg` or `unrecognized op: act_mgr_rpc`. To get the results of the request a call to `` has to be made.
[[br]]
==== `acct_mgr_rpc_poll` ====
The previously mentioned call. (Client will need temporary network access)
Request:
{{{
#!xml
}}}
Reply:
{{{
#!xml
[]
}}}
[[br]]
=== Global preferences operations ===
----
==== `get_global_prefs_file` ====
Get the contents of the `global_prefs.xml` file if present
Request:
{{{
#!xml
}}}
Reply:
{{{
#!xml
.
.
.
}}}
[[br]]
==== `get_global_prefs_override` ====
Get the contents of the `global_prefs_override.xml` file if present
Request:
{{{
#!xml
}}}
Reply:
{{{
#!xml
.
.
.
}}}
[[br]]
==== `set_global_prefs_override` ====
Write the `global_prefs_override.xml` file
Request:
{{{
#!xml
.
.
.
}}}
[[br]]
==== `read_global_prefs_override` ====
Read the `global_prefs_override.xml` file and set the preferences accordingly
Request:
{{{
#!xml
}}}
[[br]]
==== `get_global_prefs_working` ====
Get the currently used `global_prefs`
Request:
{{{
#!xml
}}}
Reply:
{{{
#!xml
.
.
.
}}}
[[br]]
=== Other operations ===
----
==== `get_notices` ====
Returns both private and non-private notices
Request:
{{{
#!xml
}}}
Reply:
{{{
#!xml
.
.
.
}}}
[[br]]
==== `set_host_info` ====
Set the `product_name` field of `host_info`
Request:
{{{
#!xml
}}}
[[br]]
==== `run_benchmarks` ====
Run benchmarks
Request:
{{{
#!xml
}}}
[[br]]
==== `get_proxy_settings` ====
Get the proxy settings
Request:
{{{
#!xml
}}}
Reply:
{{{
#!xml
[]
[]
[]
[]
[]
[]
}}}
[[br]]
==== `network_available` ====
Retry deferred network communication
Request:
{{{
#!xml
}}}
[[br]]
==== `quit` ====
Tell client to exit
Request:
{{{
#!xml
}}}
[[br]]
==== `set_language` ====
Set the language field in the client_state.xml file to append it in any subsequent GET calls to the original URL and translate notices
Request:
{{{
#!xml
}}}
[[br]]
==== `set_network_mode` ====
Set the network mode for given duration (in seconds)
Request:
{{{
#!xml
[]
[]
[]
[]
}}}
[[br]]
==== `set_gpu_mode` ====
Set GPU run mode for given duration (in seconds)
Request:
{{{
#!xml
[]
[]
[]
[]
}}}
[[br]]
==== `set_run_mode` ====
Set run mode for given duration (in seconds)
Request:
{{{
#!xml
[]
[]
[]
[]
}}}
[[br]]
==== `set_proxy_settings` ====
Set the proxy settings
Request:
{{{
#!xml
[]
[]
[]
}}}
[[br]]
==== `get_cc_config` ====
Get the contents of the cc_config.xml file if present
Request:
{{{
#!xml
}}}
Reply: The contents of the file.
[[br]]
==== `read_cc_config` ====
Read the `cc_config.xml` file and set the configuration accordingly. If no such file is present or it's contents are not formatted correctly the defaults are used.
Request:
{{{
#!xml
}}}
[[br]]
==== `set_cc_config` ====
Write a new cc_config.xml file
Request:
{{{
#!xml
.
.
.
}}}
[[br]]
==== `get_app_config` ====
Get the contents of the app_config.xml file if present
Request:
{{{
#!xml
}}}
Reply: The contents of the file.
[[br]]
==== `set_app_config` ====
Write a new app_config.xml file
Request:
{{{
#!xml
.
.
.
}}}
[[br]]
==== `report_device_status` ====
Used to report the status of an android device to the client. This is used to more easily access the status of the device. It essentially extracts the information using the, written in JAVA, Android GUI and using the RPC passes them to the client (a kind of bridge between Android's JAVA interface and the client's C++ one). It is therefore not of any use to be documented here.