Changes between Version 4 and Version 5 of GuiRpc
- Timestamp:
- Jun 30, 2007, 4:00:52 PM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GuiRpc
v4 v5 1 {{{ 2 #!comment I tried adding [[PageOutline]] too but it seemed too long, and breaking the page layout. 3 }}} 4 1 5 = Controlling the core client via RPC = 2 6 … … 7 11 8 12 To create an RPC connection, call 9 {{{ 10 init(char* host) 11 }}} 13 14 === `init(char* host)` === #function-init 15 12 16 Establish RPC connection to the given host 17 18 == Dealing with versions == 19 20 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: 21 22 * Create a GUI_RPC object and connect. Call exchange_versions() to get the client version. 23 * If exchange_versions() fails (it's not supported in pre-5.6 clients) do a get_state() RPC, and get the client version from CC_STATE::version_info. 24 * Use the client version number to decide what subsequent RPCs to make (version info is included in the RPC list below). 25 26 == Authorization == 27 28 GUI RPC authorization is described here. The RPC protocol allows the GUI program to authenticate itself using a password. 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. 29 30 === `authorize(char* password)` === #function-authorize 31 Do authorization sequence with the peer, using given password 32 33 == RPC list == 34 The following functions require authorization for remote clients, but not for local clients. Note: for core client versions 5.5.12 and earlier, all functions except get_state(), get_results(), get_screensaver_mode(), and set_screensaver_mode() require authorization. 13 35 14 36 {{{ 15 37 #!comment 16 It would be useful if we could link to individual RPCs. I'm not sure if that would need =headers= or there is another way to make anchors.38 A few function headers like set_screensaver_mode, project_attach and acct_mgr_rpc have the `monospaced` parts broken that way to allow word wrap. 17 39 }}} 18 40 19 == Dealing with versions == 20 21 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: 22 23 * Create a GUI_RPC object and connect. Call exchange_versions() to get the client version. 24 * If exchange_versions() fails (it's not supported in pre-5.6 clients) do a get_state() RPC, and get the client version from CC_STATE::version_info. 25 * Use the client version number to decide what subsequent RPCs to make (version info is included in the RPC list below). 26 27 == Authorization == 28 29 GUI RPC authorization is described here. The RPC protocol allows the GUI program to authenticate itself using a password. 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. 41 === `get_state(CC_STATE&)` === #function-get_state 42 43 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). 44 45 === `exchange_versions(VERSION_INFO&)` === #function-exchange_versions 46 47 Exchange version info with the core client. The core client's version info is returned. 48 49 === `get_cc_status(CC_STATUS&)` === #function-get_cc_status 30 50 {{{ 31 authorize(char* password)32 }}}33 34 Do authorization sequence with the peer, using given password35 36 == RPC list ==37 The following functions require authorization for remote clients, but not for local clients. Note: for core client versions 5.5.12 and earlier, all functions except get_state(), get_results(), get_screensaver_mode(), and set_screensaver_mode() require authorization.38 {{{39 get_state(CC_STATE&)40 }}}41 42 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).43 44 {{{45 exchange_versions(VERSION_INFO&)46 }}}47 48 Exchange version info with the core client. The core client's version info is returned.49 50 {{{51 get_cc_status(CC_STATUS&);52 51 struct CC_STATUS { 53 52 int network_status; … … 63 62 }; 64 63 }}} 65 66 64 67 65 Return a structure containing the network status, a flag if there was an account manager password error, and data about task and network suspension. 68 66 69 {{{ 70 get_results(RESULTS&) 71 }}} 67 === `get_results(RESULTS&)` === #function-get_results 72 68 73 69 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. 74 70 75 {{{ 76 get_screensaver_mode(int& status) 77 }}} 71 === `get_screensaver_mode(int& status)` === #function-get_screensaver_mode 78 72 79 73 Return screensaver mode (values listed in ss_logic.h) 80 74 81 {{{ 82 set_screensaver_mode( 83 bool enabled, double blank_time, DISPLAY_INFO& 84 ) 85 }}} 75 === `set_screensaver_mode``(bool enabled, ``double blank_time, ``DISPLAY_INFO&)` === #function-set_screensaver_mode 86 76 87 77 If enabled is true, the core client should try to get an application to provide screensaver graphics. Blank screen after blank_time seconds. 88 78 89 {{{ 90 get_file_transfers(FILE_TRANSFERS&) 91 }}} 79 === `get_file_transfers(FILE_TRANSFERS&)` === #function-get_file_transfers 92 80 93 81 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. 94 82 95 {{{ 96 get_simple_gui_info(SIMPLE_GUI_INFO&) 97 }}} 83 === `get_simple_gui_info(SIMPLE_GUI_INFO&)` === #function-get_simple_gui_info 98 84 99 85 Return the list of projects and of active results. 100 86 101 {{{ 102 get_project_status(vector<PROJECT>&) 103 }}} 87 === `get_project_status(vector<PROJECT>&)` === #function-get_project_status 104 88 105 89 Get a list of projects, with only basic fields filled in. 106 90 107 {{{ 108 get_disk_usage(vector<PROJECT>&) 109 }}} 91 === `get_disk_usage(vector<PROJECT>&)` === #function-get_disk_usage 110 92 111 93 Get a list of projects, with disk usage fields filled in. 112 94 113 {{{ 114 get_proxy_settings(PROXY_INFO&) 115 }}} 95 === `get_proxy_settings(PROXY_INFO&)` === #function-get_proxy_settings 116 96 117 97 Get proxy settings 118 98 119 {{{ 120 get_activity_state(ACTIVITY_STATE&) 121 }}} 99 === `get_activity_state(ACTIVITY_STATE&)` === #function-get_activity_state 122 100 123 101 Return bitmap of reasons why computation and network are suspended. Deprecated - for 5.5.13 and later, use cc_status() instead. In 5.5.10 and earlier, it returns bool (suspended) rather than bitmap. 124 102 125 {{{ 126 get_messages(int seqno, MESSAGES&) 127 }}} 103 === `get_messages(int seqno, MESSAGES&)` === #function-get_messages 128 104 129 105 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. The RPC requests the messages with sequence numbers greater than 'seqno', in order of increasing sequence number. 130 106 131 {{{ 132 get_host_info(HOST_INFO&) 133 }}} 107 === `get_host_info(HOST_INFO&)` === #function-get_host_info 134 108 135 109 Get information about host hardware and usage 136 110 137 {{{ 138 get_statistics(PROJECTS&) 139 }}} 111 === `get_statistics(PROJECTS&)` === #function-get_statistics 140 112 141 113 Get information about project credit history (the PROJECT::statistics field is populated) 142 114 143 {{{ 144 network_status(int&) 145 }}} 115 === `network_status(int&)` === #function-network_status 146 116 147 117 Find whether the core client has, needs, or is done with a physical network connection. Deprecated - for 5.5.13 and later, use cc_status() instead. 148 118 149 {{{ 150 get_newer_versions(std::string&) 151 }}} 119 === `get_newer_versions(std::string&)` === #function-get_newer_versions 152 120 153 121 Get a string describing newer versions of the core client, if any. … … 155 123 The following operations require authentication for both local and remote clients: 156 124 157 {{{ 158 show_graphics(char* result_name, bool full_screen) 159 }}} 125 === `show_graphics(char* result_name, bool full_screen)` === #function-show_graphics 160 126 161 127 Request that the application processing the given result create a graphics window 162 128 163 {{{ 164 project_op(PROJECT&, char* op) 165 }}} 129 === `project_op(PROJECT&, char* op)` === #function-project_op 166 130 167 131 Perform a control operation on the given project. op is one of "suspend", "resume", "reset", "detach", or "update". 168 132 169 {{{ 170 project_attach( 171 char* url, 172 char* account_id, 173 bool use_config_file 174 ) 175 }}} 133 === `project_attach(``char* url, ``char* account_id, ``bool use_config_file)` === #function-project_attach 176 134 177 135 Attach to the given project. If 'use_config_file' is true, use the project URL (and account key, if present) in the project_init.xml file. 178 136 179 {{{ 180 set_run_mode(int mode, double duration) 181 }}} 137 === `set_run_mode(int mode, double duration)` === #function-set_run_mode 182 138 183 139 Set the run mode (never/auto/always). If duration is zero, mode is permanent. Otherwise revert to last permanent mode after duration seconds elapse. 184 140 185 {{{ 186 set_network_mode(int mode, double duration) 187 }}} 141 === `set_network_mode(int mode, double duration)` === #function-set_network_mode 188 142 189 143 Set the network mode (never/auto/always). 190 144 191 {{{ 192 run_benchmarks() 193 }}} 145 === `run_benchmarks()` === #function-run_benchmarks 194 146 195 147 Run benchmarks 196 148 197 {{{ 198 set_proxy_settings(PROXY_INFO&) 199 }}} 149 === `set_proxy_settings(PROXY_INFO&)` === #function-set_proxy_settings 200 150 201 151 Set proxy settings 202 152 203 {{{ 204 network_available() 205 }}} 153 === `network_available()` === #function-network_available 206 154 207 155 Tells the core client that a network connection is available, and that it should do as much network activity as it can. 208 156 209 {{{ 210 file_transfer_op(FILE_TRANSFER&, char* op) 211 }}} 157 === `file_transfer_op(FILE_TRANSFER&, char* op)` === #function-file_transfer_op 212 158 213 159 Perform a control operation on a file transfer. op is one of "abort" or "retry". 214 160 215 {{{ 216 result_op(FILE_TRANSFER&, char* op) 217 }}} 161 === `result_op(FILE_TRANSFER&, char* op)` === #function-result_op 218 162 219 163 Perform a control operation on an active result. op is one of "suspend", "resume", or "abort". 220 164 221 {{{ 222 quit() 223 }}} 165 === `quit()` === #function-quit 224 166 225 167 Tell the core client to exit. 226 168 227 {{{ 228 acct_mgr_rpc( 229 const char* url, 230 const char* name, 231 const char* passwd, 232 bool use_cached_credentials 233 ) 234 }}} 169 === `acct_mgr_rpc(``const char* url, ``const char* name, ``const char* passwd, ``bool use_cached_credentials)` === #function-acct_mgr_rpc 235 170 236 171 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. 237 172 238 {{{ 239 acct_mgr_info(ACCT_MGR_INFO&) 240 }}} 173 === `acct_mgr_info(ACCT_MGR_INFO&)` === #function-acct_mgr_info 241 174 242 175 Return the URL/name of the current account manager (if any), and the user name and password. 243 176 244 {{{ 245 read_global_prefs_override() 246 }}} 177 === `read_global_prefs_override()` === #function-read_global_prefs_override 247 178 248 179 Tells the core client to reread the 'global_prefs_override.xml' file, modifying the global preferences according to its contents. 249 180 250 {{{ 251 get_global_prefs_override(std::string&) 252 }}} 181 === `get_global_prefs_override(std::string&)` === #function-get_global_prefs_override 253 182 254 183 Reads the contents of the global preferences override file into the given string. Return an error code if the file is not present. 255 184 256 {{{ 257 set_global_prefs_override(std::string&) 258 }}} 185 === `set_global_prefs_override(std::string&)` === #function-set_global_prefs_override 259 186 260 187 Write the given contents to the global preferences override file. If the argument is an empty string, delete the file. Otherwise the argument must be a valid <global_preferences> element. 261 188 262 {{{ 263 get_global_prefs_override_struct(GLOBAL_PREFS&) 264 }}} 189 === `get_global_prefs_override_struct(GLOBAL_PREFS&)` === #function-get_global_prefs_override_struct 265 190 266 191 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. 267 192 268 {{{ 269 set_global_prefs_override_struct(GLOBAL_PREFS&) 270 }}} 193 === `set_global_prefs_override_struct(GLOBAL_PREFS&)` === #function-set_global_prefs_override_struct 271 194 Convert the given structure to XML and write it to the global preferences override file. 272 195 273 {{{ 274 set_debts(std::vector<PROJECT>) 275 }}} 196 === `set_debts(std::vector<PROJECT>)` === #function-set_debts 276 197 Set the short- and long-term debts of the given projects 277 198 (only the master_url, short_term_debt, and long_term_debt fields 278 199 are used in the PROJECT structs). 200