= 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 ​[netcat](http://netcat.sourceforge.net) 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 [later](#requests-and-replies) 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. (r15942 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 * [File transfer operations](#file-transfer-operations) * [abort_file_transfer](#abort_file_transfer) * [retry_file_transfer](#retry_file_transfer) * [Task operations](#task-operations) * [abort_result](#abort_result) * [suspend_result](#suspend_result) * [resume_result](#resume_result) * [Project operations](#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) * [Account operations](#account-operations) * [create_account](#create_account) * [create_account_poll](#create_account_poll) * [lookup_account](#lookup_account) * [lookup_account_poll](#lookup_account_poll) * [Account Manager operations](#account-manager-operations) * [acct_mgr_info](#acct_mgr_info) * [acct_mgr_rpc](#acct_mgr_rpc) * [acct_mgr\_rpc_poll](#acct_mgr_rpc_poll) * [Global preferences operations](#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) * [Other operations](#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)   === The following requests do not require local authorisation. === ---   ==== `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 }}}   ==== `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 . . . . . . }}}   ==== `get_cc_status` ==== Show CPU/GPU/network run modes and network connection status (version 6.12+) Request: {{{ #!xml }}} Reply: {{{ #!xml }}}   ==== `get_disk_usage` ==== Show disk usage by project Request: {{{ #!xml }}} Reply: {{{ #!xml }}}   ==== `get_daily_xfer_history` ==== Show network traffic history of the BOINC client. Read from daily_xfer\_history.xml Request: {{{ #!xml }}} Reply: {{{ #!xml . . . }}}   ==== `get_file_transfers` ==== Show all current file transfers Request: {{{ #!xml }}} Reply: {{{ #!xml . . . }}}   ==== `get_host_info` ==== Get information about host hardware and usage Request: {{{ #!xml }}} Reply: {{{ #!xml }}}   ==== `get_messages` ==== Show messages with sequence numbers beyond the given `seqno` Request: }}}`XML }}}` The `` tag is optional. Reply: {{{ #!xml . . . }}}   ==== `get_message_count` ==== Show largest message seqno Request: {{{ #!xml }}} Reply: {{{ #!xml }}}   ==== `get_newer_version` ==== Get newer version number, if any, and download url Request: {{{ #!xml }}} Reply: {{{ #!xml }}}   ==== `get_notices_public` ==== Returns only non-private notices, doesn't require authentication Request: {{{ #!xml }}} Reply: {{{ #!xml . . . }}}   ==== `get_old_results` ==== Show old tasks Request: {{{ #!xml }}} Reply: {{{ #!xml . . . }}}   ==== `get_project_status` ==== Show status of all attached projects Request: {{{ #!xml }}} Reply: {{{ #!xml () () () () () () () () () () () () () () intel_gpu . . . . . . . . . }}}   ==== `get_results` ==== Show tasks Request: {{{ #!xml }}} Reply: {{{ #!xml . . . . . . }}}   ==== `get_screensaver_tasks` ==== Show suspend reason and active tasks Request: {{{ #!xml }}} Reply: {{{ #!xml . . . }}}   ==== `get_simple_gui_info` ==== Show status of projects and active tasks Request: {{{ #!xml }}} Reply: {{{ #!xml . . . . . . }}}   ==== `get_state` ==== Get the entire state Request: {{{ #!xml }}} Reply: {{{ #!xml . . . . . . . . . . . . . . . platform_name> . . . }}}   ==== `get_statistics` ==== Get statistics for the projects the client is attached to Request: {{{ #!xml }}} Reply: {{{ #!xml . . . . . . }}}   --- === 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 ( [Common Replies](#common-replies) )   === File transfer operations === --- ==== `abort_file_transfer` ==== Abort a pending file transfer Request: {{{ #!xml }}}   ==== `retry_file_transfer` ==== Retry a file transfer (Client will need temporary network access) Request: {{{ #!xml }}}   === Task operations === --- ==== `abort_result` ==== Abort a task Request: {{{ #!xml }}}   ==== `suspend_result` ==== Suspend a running task (Note: Even if a task is already suspended the request will return success) Request: {{{ #!xml }}}   ==== `resume_result` ==== Resume a suspended task (Note: Even if a task is already running the request will return success) Request: {{{ #!xml }}}   === Project operations === ---   ==== `project_reset` ==== Reset a project (Client will need temporary network access) Request: {{{ #!xml }}}   ==== `project_detach` ==== Detach from a project Request: {{{ #!xml }}}   ==== `project_update` ==== Update a project (Client will need temporary network access) Request: {{{ #!xml }}}   ==== `project_suspend` ==== Suspend a project Request: {{{ #!xml }}}   ==== `project_resume` ==== Resume a project Request: {{{ #!xml }}}   ==== `project_nomorework` ==== Stop getting new tasks for a project Request: {{{ #!xml }}}   ==== `project_allowmorework` ==== Receive new tasks for a project. Reverse `project_nomorework`. Request: {{{ #!xml }}}   ==== `project_detach_when_done` ==== Detach from a project after all it's tasks are finished. Request: {{{ #!xml }}}   ==== `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 }}}   ==== `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.   ==== `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.   ==== `get_project_init_status` ==== Get the contents of the project_init.xml file if present Request: {{{ #!xml }}} Reply: {{{ #!xml }}}   ==== `get_project_config` ==== Fetch the project configuration file from the specified url. Asynchronous request. (Client will need temporary network access) Request: {{{ #!xml }}}   ==== `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 }}}   === Account operations (all require network access) === --- ==== `create_account` ==== Create an account for a given project. Asynchronous call Request: {{{ #!xml }}}   ==== `create_account_poll` ==== The polling call for the previous request Request: {{{ #!xml }}}   ==== `lookup_account` ==== Look for an account in a given project. Asynchronous call. Request: {{{ #!xml }}}   ==== `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 [lookup_account.php](https://boinc.berkeley.edu/trac/wiki/WebRpc) script can be used. Request: {{{ #!xml }}}   === Account manager operations === --- ==== `acct_mgr_info` ==== Retrieve account manager information Request: {{{ #!xml }}} Reply: {{{ #!xml () () () }}}   ==== `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 [boinccmd](http://boinc.berkeley.edu/wiki/Boinccmd_tool) 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.   ==== `acct_mgr_rpc_poll` ==== The previously mentioned call. (Client will need temporary network access) Request: {{{ #!xml }}} Reply: {{{ #!xml [] }}}   === Global preferences operations === --- ==== `get_global_prefs_file` ==== Get the contents of the `global_prefs.xml` file if present Request: {{{ #!xml }}} Reply: {{{ #!xml . . . }}}   ==== `get_global_prefs_override` ==== Get the contents of the `global_prefs_override.xml` file if present Request: {{{ #!xml }}} Reply: {{{ #!xml . . . }}}   ==== `set_global_prefs_override` ==== Write the `global_prefs_override.xml` file Request: {{{ #!xml . . . }}}   ==== `read_global_prefs_override` ==== Read the `global_prefs_override.xml` file and set the preferences accordingly Request: {{{ #!xml }}}   ==== `get_global_prefs_working` ==== Get the currently used `global_prefs` Request: {{{ #!xml }}} Reply: {{{ #!xml . . . }}}   === Other operations === --- ==== `get_notices` ==== Returns both private and non-private notices Request: {{{ #!xml }}} Reply: {{{ #!xml . . . }}}   ==== `set_host_info` ==== Set the `product_name` field of `host_info` Request: {{{ #!xml }}}   ==== `run_benchmarks` ==== Run benchmarks Request: {{{ #!xml }}}   ==== `get_proxy_settings` ==== Get the proxy settings Request: {{{ #!xml }}} Reply: {{{ #!xml [] [] [] [] [] [] }}}   ==== `network_available` ==== Retry deferred network communication Request: {{{ #!xml }}}   ==== `quit` ==== Tell client to exit Request: {{{ #!xml }}}   ==== `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 }}}   ==== `set_network_mode` ==== Set the network mode for given duration (in seconds) Request: {{{ #!xml [] [] [] [] }}}   ==== `set_gpu_mode` ==== Set GPU run mode for given duration (in seconds) Request: {{{ #!xml [] [] [] [] }}}   ==== `set_run_mode` ==== Set run mode for given duration (in seconds) Request: {{{ #!xml [] [] [] [] }}}   ==== `set_proxy_settings` ==== Set the proxy settings Request: {{{ #!xml [] [] [] }}}   ==== `get_cc_config` ==== Get the contents of the cc_config.xml file if present Request: {{{ #!xml }}} Reply: The contents of the file.   ==== `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 }}}   ==== `set_cc_config` ==== Write a new cc_config.xml file Request: {{{ #!xml . . . }}}   ==== `get_app_config` ==== Get the contents of the app_config.xml file if present Request: {{{ #!xml }}} Reply: The contents of the file.   ==== `set_app_config` ==== Write a new app_config.xml file Request: {{{ #!xml . . . }}}   ==== `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.