*** empty log message ***

svn path=/trunk/boinc/; revision=3633
This commit is contained in:
David Anderson 2004-06-17 17:00:14 +00:00
parent db7d4f7993
commit f6e4923ed3
11 changed files with 115 additions and 49 deletions

View File

@ -13836,3 +13836,21 @@ David 16 June 2004
Rom June 16 2004
- Tag for 3.10 release, all platforms
boinc_core_release_3_10
David 17 June 2004
- Change the way we get local host's domain name on UNIX:
instead of gethostbyname()
(which has nightmarish linkage problems that no one quite understands)
use "ping", which we assume exists on all UNIX systems,
and parse its output
- Allow Python scripts to access remote databases
(courtesy of Carl C.)
client/
gui_rpc_server.C
hostinfo_network.C,h
hostinfo_unix.C
win/
hostinfo_win.cpp
py/Boinc/
database.py

View File

@ -199,7 +199,7 @@ void handle_get_messages(char* buf, MIOFILE& fout) {
iter++, j++
) {
MESSAGE_DESC* mdp = *iter;
if (seqno && mdp->seqno < seqno) break;
if (mdp->seqno <= seqno) break;
fout.printf(
"<msg>\n"
" <pri>%d</pri>\n"

View File

@ -44,53 +44,75 @@
#include "util.h"
#include "parse.h"
#include "file_names.h"
#include "client_msgs.h"
#include "error_numbers.h"
#include "hostinfo.h"
// Returns the domain of the local host
// get domain name and IP address of this host
//
int get_local_domain_name(char* p, int len) {
int get_local_network_info(
char* domain_name, int domlen, char* ip_addr, int iplen
) {
#ifdef _WIN32
char buf[256];
if (gethostname(buf, 256)) return ERR_GETHOSTBYNAME;
struct hostent* he = gethostbyname(buf);
if (!he) return ERR_GETHOSTBYNAME;
safe_strncpy(p, he->h_name, len);
return 0;
}
safe_strncpy(domain_name, he->h_name, domlen);
// Get the IP address of the local host
//
static int get_local_ip_addr(struct in_addr& addr) {
#if HAVE_NETDB_H || _WIN32
char buf[256];
if (gethostname(buf, 256)) {
msg_printf(NULL, MSG_ERROR, "get_local_ip_addr(): gethostname failed\n");
return ERR_GETHOSTNAME;
}
struct in_addr addr;
struct hostent* he = gethostbyname(buf);
if (!he || !he->h_addr_list[0]) {
msg_printf(NULL, MSG_ERROR, "get_local_ip_addr(): gethostbyname failed\n");
return ERR_GETHOSTBYNAME;
}
memcpy(&addr, he->h_addr_list[0], sizeof(addr));
strcpy(ip_addr, "");
safe_strncpy(ip_addr, inet_ntoa(addr), iplen);
return 0;
#else
// gethostbyname() is a linkage nightmare on UNIX systems (go figure)
// so use a kludge instead: run ping and parse the output
// should be "PING domainname (ipaddr) ..."
//
char hostname[256];
char buf[256];
int retval;
if (gethostname(hostname, 256)) return ERR_GETHOSTBYNAME;
sprintf(buf, "ping -c 1 %s > %s", hostname, TEMP_FILE_NAME);
retval = system(buf);
if (retval) return retval;
FILE* f = fopen(TEMP_FILE_NAME, "r");
if (!f) return ERR_FOPEN;
fgets(buf, 256, f);
fclose(f);
char *p, *q;
p = strchr(buf, ' ');
if (!p) return ERR_NULL;
p++;
q = strchr(p, ' ');
if (!q) return ERR_NULL;
*q = 0;
safe_strncpy(domain_name, p, domlen);
q++;
p = strchr(q, '(');
if (!p) return ERR_NULL;
p++;
q = strchr(p, ')');
if (!q) return ERR_NULL;
*q = 0;
safe_strncpy(ip_addr, p, iplen);
return 0;
#elif
GET IP ADDR NOT IMPLEMENTED
#endif
}
// Get the IP address as a string
//
int get_local_ip_addr_str(char* p, int len) {
int retval;
struct in_addr addr;
strcpy(p, "");
retval = get_local_ip_addr(addr);
if (retval) return retval;
safe_strncpy(p, inet_ntoa(addr), len);
return 0;
}

View File

@ -1,4 +1 @@
extern int get_local_domain_name(char* p, int len);
extern int get_local_ip_addr_str(char* p, int len);
extern int get_local_ip_addr(int& p);
extern int get_local_network_info(char* dom, int ,char* ip, int iplen);

View File

@ -374,8 +374,10 @@ int HOST_INFO::get_host_info() {
#endif
#endif
get_local_domain_name(domain_name, sizeof(domain_name));
get_local_ip_addr_str(ip_addr, sizeof(ip_addr));
get_local_network_info(
domain_name, sizeof(domain_name), ip_addr, sizeof(ip_addr)
);
timezone = get_timezone();
#ifdef HAVE_SYS_UTSNAME_H
struct utsname u;

View File

@ -318,8 +318,9 @@ int HOST_INFO::get_host_info() {
WSAStartup(wVersionRequested, &wsdata);
// Get host name/ip info
get_local_domain_name(domain_name, sizeof(domain_name));
get_local_ip_addr_str(ip_addr, sizeof(ip_addr));
get_local_network_info(
domain_name, sizeof(domain_name), ip_addr, sizeof(ip_addr)
);
// Close the WinSock dll
WSACleanup();

View File

@ -89,8 +89,6 @@ list_item("error_mask",
list_end();
echo "
</ul>
Workunit invariants:
<ul>
<li> eventually either canonical_resultid or error_mask is set

View File

@ -33,7 +33,9 @@ list_item("-reset_project URL",
);
list_item("-update_prefs URL",
"Contact a project's server to obtain new preferences."
"Contact a project's server to obtain new preferences.
This will also report completed results
and get new work if needed."
);
list_item("-run_cpu_benchmarks",

View File

@ -2,8 +2,6 @@
require_once("docutil.php");
page_head("Framework for separate GUIs");
echo "
<b>NOTE: the following is under development,
and is currently available only with Unix core clients.</b>
<p>
The BOINC core client provides a set of RPCs
(remote procedure calls) for control and state interrogation.
@ -13,8 +11,9 @@ This will make it easier to develop new GUIs,
and will eliminate security issues related
to having GUI code in the core client.
<p>
GUI programs connect to the core client by opening a TCP socket at port XXX.
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:
";
@ -25,6 +24,33 @@ list_item(
"Get the state of the core client.
The reply message has the same format as the client_state.xml file."
);
list_item(
html_text(
"<get_messages>
<nmessages>N</nmessages>
<seqno>M</seqno>
</get_messages>"),
"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>")
);
list_item(
html_text(
"<result_show_graphics>
@ -84,10 +110,6 @@ list_item(
list_end();
echo "
<p>
Eventually we will add RPCs allowing the GUI to control
the core client (e.g. to suspend and resume it,
to attach or detach projects, etc.
<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.

View File

@ -8,8 +8,8 @@ list_start();
list_item("Chinese",
"<a href=http://www.equn.com/boinchina>www.equn.com/boinchina</a>"
);
list_item("Estonian",
"<a href=http://boinc.tmac.pri.ee>boinc.tmac.pri.ee</a>"
list_item("Czech",
"<a href=http://www.boinc.cz/>www.boinc.cz</a>"
);
list_item("Danish",
"<a href=http://setiboinc.dk>setiboinc.dk</a>
@ -19,6 +19,9 @@ list_item("Danish",
list_item("Dutch",
"<a href=http://www.seti-nl.org/content.php?c=boinc_berkeley_main>www.seti-nl.org</a>"
);
list_item("Estonian",
"<a href=http://boinc.tmac.pri.ee>boinc.tmac.pri.ee</a>"
);
list_item("Finnish",
"<a href=http://www.universe-examiners.org/boinc_faq.php>Universe Examiners</a>"
);
@ -38,9 +41,9 @@ list_item("Japanese",
list_item("Russian",
"<a href=http://www.boinc.narod.ru>www.boinc.narod.ru</a>"
);
list_item("Serbian",
"<a href=http://www.boincatserbia.co.sr/>BOINC@Serbia</a>"
);
//list_item("Serbian",
// "<a href=http://www.boincatserbia.co.sr/>BOINC@Serbia</a>"
//);
list_item("Spanish",
"<a href=http://members.lycos.co.uk/boincspain/>BOINC España</a>"
);

View File

@ -227,6 +227,7 @@ def connect(config = None, nodb = False):
else:
db = config.db_name
do_connect(db=db,
host=config.__dict__.get('db_host',''),
user=config.__dict__.get('db_user',''),
passwd=config.__dict__.get('db_passwd', ''))
return 1