client/scheduler: add support for "client brand"

Currently the server doesn't know about different client "brands",
e.g. HTC Power to Give, Charity Engine, GridRepublic, etc.,
so there's no way to collect statistics about them.

Changes:
- client: at startup, read a "client brand" string from client_brand.txt
    (i.e. branded clients will have to include this file in their installer)
    Report this string in scheduler requests.
- scheduler: parse this request element,
    and store it in host.serialnum as [BOINC|7.4.2|brand]
This commit is contained in:
David Anderson 2014-07-16 20:18:06 -07:00
parent 9904d7b920
commit 246f5a2d1e
7 changed files with 27 additions and 4 deletions

View File

@ -405,6 +405,13 @@ int CLIENT_STATE::init() {
msg_printf(NULL, MSG_INFO, "Running under account %s", pbuf);
#endif
FILE* f = fopen(CLIENT_BRAND_FILENAME, "r");
if (f) {
fgets(client_brand, sizeof(client_brand), f);
msg_printf(NULL, MSG_INFO, "Client brand: %s", client_brand);
fclose(f);
}
parse_account_files();
parse_statistics_files();

View File

@ -110,6 +110,9 @@ struct CLIENT_STATE {
double device_status_time;
char language[16]; // ISO language code reported by GUI
char client_brand[256];
// contents of client_brand.txt, e.g. "HTP Power to Give"
// reported to scheduler
VERSION_INFO core_client_version;
string statefile_platform_name;
int file_xfer_giveup_period;
@ -138,11 +141,11 @@ struct CLIENT_STATE {
// Determine when it is safe to leave the quit_client() handler
// and to finish cleaning up.
char detach_project_url[256];
// stores URL for -detach_project option
// stores URL for --detach_project option
char reset_project_url[256];
// stores URL for -reset_project option
// stores URL for --reset_project option
char update_prefs_url[256];
// stores URL for -update_prefs option
// stores URL for --update_prefs option
char main_host_venue[256];
// venue from project or AMS that gave us general prefs
char attach_project_url[256];

View File

@ -395,6 +395,10 @@ int CLIENT_STATE::make_scheduler_request(PROJECT* p) {
fclose(cof);
}
if (strlen(client_brand)) {
fprintf(f, " <client_brand>%s</client_brand>\n", client_brand);
}
fprintf(f, "</scheduler_request>\n");
fclose(f);

View File

@ -62,6 +62,7 @@ extern void send_log_after(const char* filename, double t, MIOFILE& mf);
#define CA_BUNDLE_FILENAME "ca-bundle.crt"
#define CERTIFICATE_DIRECTORY "certificates"
#define CLIENT_AUTH_FILENAME "client_auth.xml"
#define CLIENT_BRAND_FILENAME "client_brand.txt"
#define CLIENT_OPAQUE_FILENAME "client_opaque.txt"
#define CONFIG_FILE "cc_config.xml"
#define COPROC_INFO_FILENAME "coproc_info.xml"

View File

@ -347,6 +347,8 @@ struct HOST {
//
char p_features[1024];
char virtualbox_version[256];
char client_brand[256];
// as specific in client_brand.txt config file on client
bool p_vm_extensions_disabled;
int num_opencl_cpu_platforms;
OPENCL_CPU_PROP opencl_cpu_prop[MAX_OPENCL_CPU_PLATFORMS];

View File

@ -500,11 +500,16 @@ static int modify_host_struct(HOST& host) {
host.timezone = g_request->host.timezone;
strncpy(host.domain_name, g_request->host.domain_name, sizeof(host.domain_name));
char buf[1024], buf2[1024];
sprintf(buf, "[BOINC|%d.%d.%d]",
sprintf(buf, "[BOINC|%d.%d.%d",
g_request->core_client_major_version,
g_request->core_client_minor_version,
g_request->core_client_release
);
if (strlen(host.client_brand)) {
strcat(buf, "|");
strcat(buf, host.client_brand);
}
strcat(buf, "]");
g_request->coprocs.summary_string(buf2, sizeof(buf2));
strlcpy(host.serialnum, buf, sizeof(host.serialnum));
strlcat(host.serialnum, buf2, sizeof(host.serialnum));

View File

@ -1249,6 +1249,7 @@ int HOST::parse(XML_PARSER& xp) {
if (xp.parse_double("n_bwdown", n_bwdown)) continue;
if (xp.parse_str("p_features", p_features, sizeof(p_features))) continue;
if (xp.parse_str("virtualbox_version", virtualbox_version, sizeof(virtualbox_version))) continue;
if (xp.parse_str("client_brand", client_brand, sizeof(client_brand))) continue;
if (xp.parse_bool("p_vm_extensions_disabled", p_vm_extensions_disabled)) continue;
if (xp.match_tag("opencl_cpu_prop")) {
int retval = opencl_cpu_prop[num_opencl_cpu_platforms].parse(xp);