diff --git a/client/cs_prefs.C b/client/cs_prefs.C index 69189e0cdc..47c282efed 100644 --- a/client/cs_prefs.C +++ b/client/cs_prefs.C @@ -72,14 +72,22 @@ int CLIENT_STATE::allowed_disk_usage(double& size) { } int CLIENT_STATE::project_disk_usage(PROJECT* p, double& size) { - char buf[256],buf2[256]; + char buf[256]; + unsigned int i; + double s; - // TODO: replace the following with a function + get_project_dir(p, buf); + dir_size(buf, size); - escape_project_url(p->master_url, buf); - sprintf(buf2, "%s%s%s", PROJECTS_DIR, PATH_SEPARATOR, buf); + for (i=0; iwup->project != p) continue; + get_slot_dir(atp->slot, buf); + dir_size(buf, s); + size += s; + } - return dir_size(buf2, size); + return 0; } int CLIENT_STATE::total_disk_usage(double& size) { diff --git a/client/gui_rpc_server.C b/client/gui_rpc_server.C index 61d1613820..f7e89835b8 100644 --- a/client/gui_rpc_server.C +++ b/client/gui_rpc_server.C @@ -67,6 +67,35 @@ GUI_RPC_CONN::~GUI_RPC_CONN() { #endif } +static void handle_get_project_status(MIOFILE& fout) { + unsigned int i; + fout.printf("\n"); + for (i=0; iwrite_state(fout); + } + fout.printf("\n"); +} + +static void handle_get_disk_usage(MIOFILE& fout) { + unsigned int i; + double size; + + fout.printf("\n"); + for (i=0; i\n" + " %s\n" + " %f\n" + "\n", + p->master_url, size + ); + } + fout.printf("\n"); +} + static PROJECT* get_project(char* buf, MIOFILE& fout) { string url; if (!parse_str(buf, "", url)) { @@ -281,6 +310,10 @@ int GUI_RPC_CONN::handle_rpc() { gstate.write_tasks_gui(mf); } else if (match_tag(request_msg, "")) { gstate.write_file_transfers_gui(mf); + } else if (match_tag(request_msg, "")) { + handle_get_project_status(mf); + } else if (match_tag(request_msg, "")) { + handle_get_disk_usage(mf); } else if (match_tag(request_msg, "")) { handle_result_show_graphics(request_msg, mf); } else if (match_tag(request_msg, "")) { @@ -365,8 +398,7 @@ int GUI_RPC_CONN_SET::init() { lsock = socket(AF_INET, SOCK_STREAM, 0); if (lsock < 0) { msg_printf(NULL, MSG_ERROR, - "GUI RPC failed to initialize socket (retval = '%d')\n", - lsock + "GUI RPC failed to create socket: %d\n", lsock ); return ERR_SOCKET; } @@ -380,17 +412,12 @@ int GUI_RPC_CONN_SET::init() { retval = bind(lsock, (const sockaddr*)(&addr), sizeof(addr)); if (retval) { - msg_printf(NULL, MSG_ERROR, - "GUI RPC bind failed (retval = '%d')\n", retval - ); + msg_printf(NULL, MSG_ERROR, "GUI RPC bind failed: %d\n", retval); return ERR_BIND; } retval = listen(lsock, 999); if (retval) { - msg_printf(NULL, MSG_ERROR, - "GUI RPC listen failed (retval = '%d')\n", - retval - ); + msg_printf(NULL, MSG_ERROR, "GUI RPC listen failed: %d\n", retval); return ERR_LISTEN; } return 0; diff --git a/doc/app_dev.php b/doc/app_dev.php index c5279c2b30..720445ba85 100644 --- a/doc/app_dev.php +++ b/doc/app_dev.php @@ -30,7 +30,9 @@ static/dynamic linking

Cross-language issues

-How to access BOINC API from C, FORTRAN? +The BOINC API is implemented in C++. +Information about using it from C and FORTRAN is +here. "; page_tail(); ?> diff --git a/doc/community.php b/doc/community.php index 7c4d7757ec..cc2709291a 100644 --- a/doc/community.php +++ b/doc/community.php @@ -35,6 +35,16 @@ This list is for people developing, debugging or porting the BOINC software.

Getting source code

+At any given point there are two different versions +of the BOINC source code (maintained as separate CVS projects): +

    +
  • boinc is the development version. +It may be unstable, +and it may not be compatible with publicly-deployed BOINC projects. +
  • boinc_public is the stable version. +It generally is the version being used +(on both client and server) by public BOINC projects. +
You can get the BOINC source code in several ways:
  • diff --git a/doc/configuration.php b/doc/configuration.php index 653110f0c0..80950da93c 100644 --- a/doc/configuration.php +++ b/doc/configuration.php @@ -27,6 +27,7 @@ htmlspecialchars(" [ ] [ ] [ 10 ] ../ bin @@ -71,6 +72,8 @@ list_item("cgi_url", "URL of scheduling server"); list_item("one_result_per_user_per_wu", "If present, send at most one result of a given workunit to a given user"); list_item("disable_account_creation", "If present, disallow account creation"); list_item("max_wus_to_send", "Maximum results sent per scheduler RPC"); +list_item("enforce_delay_bound", "Don't send results to hosts + too slow to complete them within delay bound"); list_end(); echo " Tasks are periodic, short-running jobs. diff --git a/doc/create_project.php b/doc/create_project.php index 3c808546ed..731b02eaac 100644 --- a/doc/create_project.php +++ b/doc/create_project.php @@ -46,6 +46,7 @@ How to develop or port an application program for use with BOINC.
  • FORTRAN applications
  • Compound applications
  • Trickle messages +
  • A cookbook (courtesy Eric Myers from Vassar)
diff --git a/doc/gui_rpc.php b/doc/gui_rpc.php index 2e2460f0c0..d997f1d39e 100644 --- a/doc/gui_rpc.php +++ b/doc/gui_rpc.php @@ -11,116 +11,89 @@ This will make it easier to develop new GUIs, and will eliminate security issues related to having GUI code in the core client.

- +BOINC provides a C++ interface to these RPCs. +The interface is based on the GUI_RPC class, +which provides the following functions +(the program gui_test.C gives an example of their use):

-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. -

-The current RPCs are available: "; list_start(); -list_heading("Request message format", "Function"); -list_item( - html_text(""), - "Get the state of the core client. - The reply message has a list of - projects,apps, app +list_heading("function ", "description"); +list_item("init(char* host)", "Establish RPC connection to the given host"); +list_item("get_state(CC_STATE&)", + "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). + " ); +list_item("get_results(RESULTS&)", + "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. + " +); +list_item("get_file_transfers(FILE_TRANSFERS&)", + "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 state; + if it's not there, call get_state() again." +); + list_item( - html_text( -" - N - M -"), + "get_messages(int nmessages, int seqno, vector<MESSAGE_DESC>&)", "Returns a list of (user-level) messages. Each message has a sequence number (1, 2, ...), a priority (1=informational, 2=error) and a timestamp. The RPC requests the N most recent messages with sequence numbers greater than M. - They are returned in order of decreasing sequence number. - The reply has the form ".html_text( -" - - x - x - - x - - - - ... -") + They are returned in order of decreasing sequence number." ); list_item( - html_text( - " - X - X - - "), + "show_graphics(char* result_name, bool full_screen)", "Request that the application processing the given result create a graphics window" ); list_item( - html_text( - " - X -" - ), + "project_reset(char* url)", "Reset the given project" ); list_item( - html_text( - " - X -" - ), + "project_update(char* url)", "Update the given project" ); list_item( - html_text( - " - X -" - ), + "project_detach(char* url)", "Detach from the given project" ); list_item( - html_text( - " - X - X -" - ), + "project_attach(char* url, char* account_id)", "Attach to the given project" ); list_item( - html_text(""), + "run_benchmarks()", "Run benchmarks" ); list_item( - html_text( - " - X - X -" - ), + "set_proxy_settings(PROXY_INFO&)", "Set proxy settings" ); list_end(); echo "

-The BOINC source code distribution includes files -gui_rpc_client.C and gui_rpc_client.h -in the client directory. -These define a class GUI_RPC -that manages the establishment of the RPC pipe, -and that parses the returned XML into a data structure -from which the GUI can be generated. -The project gui_test.C shows how to use this mechanism. +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. "; page_tail(); ?>