mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=3919
This commit is contained in:
parent
9b33d15117
commit
eaea3450dc
|
@ -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; i<active_tasks.active_tasks.size(); i++) {
|
||||
ACTIVE_TASK* atp = active_tasks.active_tasks[i];
|
||||
if (atp->wup->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) {
|
||||
|
|
|
@ -67,6 +67,35 @@ GUI_RPC_CONN::~GUI_RPC_CONN() {
|
|||
#endif
|
||||
}
|
||||
|
||||
static void handle_get_project_status(MIOFILE& fout) {
|
||||
unsigned int i;
|
||||
fout.printf("<projects>\n");
|
||||
for (i=0; i<gstate.projects.size(); i++) {
|
||||
PROJECT* p = gstate.projects[i];
|
||||
p->write_state(fout);
|
||||
}
|
||||
fout.printf("</projects>\n");
|
||||
}
|
||||
|
||||
static void handle_get_disk_usage(MIOFILE& fout) {
|
||||
unsigned int i;
|
||||
double size;
|
||||
|
||||
fout.printf("<projects>\n");
|
||||
for (i=0; i<gstate.projects.size(); i++) {
|
||||
PROJECT* p = gstate.projects[i];
|
||||
gstate.project_disk_usage(p, size);
|
||||
fout.printf(
|
||||
"<project>\n"
|
||||
" <master_url>%s</master_url>\n"
|
||||
" <disk_usage>%f</disk_usage>\n"
|
||||
"</project>\n",
|
||||
p->master_url, size
|
||||
);
|
||||
}
|
||||
fout.printf("</projects>\n");
|
||||
}
|
||||
|
||||
static PROJECT* get_project(char* buf, MIOFILE& fout) {
|
||||
string url;
|
||||
if (!parse_str(buf, "<project_url>", url)) {
|
||||
|
@ -281,6 +310,10 @@ int GUI_RPC_CONN::handle_rpc() {
|
|||
gstate.write_tasks_gui(mf);
|
||||
} else if (match_tag(request_msg, "<get_file_transfers>")) {
|
||||
gstate.write_file_transfers_gui(mf);
|
||||
} else if (match_tag(request_msg, "<get_project_status>")) {
|
||||
handle_get_project_status(mf);
|
||||
} else if (match_tag(request_msg, "<get_disk_usage>")) {
|
||||
handle_get_disk_usage(mf);
|
||||
} else if (match_tag(request_msg, "<result_show_graphics>")) {
|
||||
handle_result_show_graphics(request_msg, mf);
|
||||
} else if (match_tag(request_msg, "<project_reset>")) {
|
||||
|
@ -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;
|
||||
|
|
|
@ -30,7 +30,9 @@ static/dynamic linking
|
|||
|
||||
<h2>Cross-language issues</h2>
|
||||
<p>
|
||||
How to access BOINC API from C, FORTRAN?
|
||||
The BOINC API is implemented in C++.
|
||||
Information about using it from C and FORTRAN is
|
||||
<a href=fortran.php>here</a>.
|
||||
";
|
||||
page_tail();
|
||||
?>
|
||||
|
|
|
@ -35,6 +35,16 @@ This list is for people developing, debugging or porting the BOINC software.
|
|||
</dl>
|
||||
<h2>Getting source code</h2>
|
||||
<p>
|
||||
At any given point there are two different versions
|
||||
of the BOINC source code (maintained as separate CVS projects):
|
||||
<ul>
|
||||
<li> <b>boinc</b> is the development version.
|
||||
It may be unstable,
|
||||
and it may not be compatible with publicly-deployed BOINC projects.
|
||||
<li> <b>boinc_public</b> is the stable version.
|
||||
It generally is the version being used
|
||||
(on both client and server) by public BOINC projects.
|
||||
</ul>
|
||||
You can get the BOINC source code in several ways:
|
||||
<ul>
|
||||
<li>
|
||||
|
|
|
@ -27,6 +27,7 @@ htmlspecialchars("
|
|||
[ <one_result_per_user_per_wu/> ]
|
||||
[ <disable_account_creation/> ]
|
||||
[ <max_wus_to_send>10</max_wus_to_send ]
|
||||
[ <enforce_delay_bound/> ]
|
||||
<!-- optional; defaults as indicated: -->
|
||||
<project_dir>../</project_dir> <!-- relative to location of 'start' -->
|
||||
<bin_dir>bin</bin_dir> <!-- relative to project_dir -->
|
||||
|
@ -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 "
|
||||
<b>Tasks</b> are periodic, short-running jobs.
|
||||
|
|
|
@ -46,6 +46,7 @@ How to develop or port an application program for use with BOINC.
|
|||
<li><a href=fortran.php>FORTRAN applications</a>
|
||||
<li><a href=compound_app.php>Compound applications</a>
|
||||
<li><a href=trickle_api.php>Trickle messages</a>
|
||||
<li><a href=myers.txt>A cookbook</a> (courtesy Eric Myers from Vassar)
|
||||
</ul>
|
||||
|
||||
<font size=+1><b>
|
||||
|
|
117
doc/gui_rpc.php
117
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.
|
||||
<p>
|
||||
|
||||
BOINC provides a C++ interface to these RPCs.
|
||||
The interface is based on the GUI_RPC class,
|
||||
which provides the following functions
|
||||
(the program <code>gui_test.C</code> gives an example of their use):
|
||||
<p>
|
||||
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.
|
||||
<p>
|
||||
The current RPCs are available:
|
||||
";
|
||||
list_start();
|
||||
list_heading("Request message format", "Function");
|
||||
list_item(
|
||||
html_text("<get_state/>"),
|
||||
"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(
|
||||
"<get_messages>
|
||||
<nmessages>N</nmessages>
|
||||
<seqno>M</seqno>
|
||||
</get_messages>"),
|
||||
"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(
|
||||
"<msgs>
|
||||
<msg>
|
||||
<pri>x</pri>
|
||||
<seqno>x</seqno>
|
||||
<body>
|
||||
x
|
||||
</body>
|
||||
<time>x</time>
|
||||
</msg>
|
||||
...
|
||||
</msgs>")
|
||||
They are returned in order of decreasing sequence number."
|
||||
);
|
||||
|
||||
list_item(
|
||||
html_text(
|
||||
"<result_show_graphics>
|
||||
<project_url>X</project_url>
|
||||
<result_name>X</result_name>
|
||||
</result_show_graphics>
|
||||
"),
|
||||
"show_graphics(char* result_name, bool full_screen)",
|
||||
"Request that the application processing the given result
|
||||
create a graphics window"
|
||||
);
|
||||
list_item(
|
||||
html_text(
|
||||
"<project_reset>
|
||||
<project_url>X</project_url>
|
||||
</project_reset>"
|
||||
),
|
||||
"project_reset(char* url)",
|
||||
"Reset the given project"
|
||||
);
|
||||
list_item(
|
||||
html_text(
|
||||
"<project_update>
|
||||
<project_url>X</project_url>
|
||||
</project_update>"
|
||||
),
|
||||
"project_update(char* url)",
|
||||
"Update the given project"
|
||||
);
|
||||
list_item(
|
||||
html_text(
|
||||
"<project_detach>
|
||||
<project_url>X</project_url>
|
||||
</project_detach>"
|
||||
),
|
||||
"project_detach(char* url)",
|
||||
"Detach from the given project"
|
||||
);
|
||||
list_item(
|
||||
html_text(
|
||||
"<project_attach>
|
||||
<project_url>X</project_url>
|
||||
<authenticator>X</authenticator>
|
||||
</project_attach>"
|
||||
),
|
||||
"project_attach(char* url, char* account_id)",
|
||||
"Attach to the given project"
|
||||
);
|
||||
list_item(
|
||||
html_text("<run_benchmarks/>"),
|
||||
"run_benchmarks()",
|
||||
"Run benchmarks"
|
||||
);
|
||||
list_item(
|
||||
html_text(
|
||||
"<set_proxy_settings>
|
||||
<proxy_server_name>X</proxy_server_name>
|
||||
<proxy_server_port>X</proxy_server_port>
|
||||
</set_proxy_settings>"
|
||||
),
|
||||
"set_proxy_settings(PROXY_INFO&)",
|
||||
"Set proxy settings"
|
||||
);
|
||||
list_end();
|
||||
echo "
|
||||
<p>
|
||||
The BOINC source code distribution includes files
|
||||
<code>gui_rpc_client.C</code> and <code>gui_rpc_client.h</code>
|
||||
in the client directory.
|
||||
These define a class <code>GUI_RPC</code>
|
||||
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 <code>gui_test.C</code> 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();
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue