void AppUtil_SendGuestCaps(const GuestCapabilities *caps, // IN: array of capabilities size_t numCaps, // IN: number of capabilities Bool enabled) // IN: capabilities status { char *capsStr = NULL; char *capsTemp = NULL; size_t capIdx; ASSERT(caps); ASSERT(numCaps > 0); capsStr = strdup(GUEST_CAP_FEATURES); for (capIdx = 0; capIdx < numCaps; capIdx++) { if (!capsStr) { Debug("%s: Not enough memory to create capabilities string\n", __FUNCTION__); return; } capsTemp = Str_Asprintf(NULL, "%s %d=%d", capsStr, caps[capIdx], (int)enabled); free(capsStr); capsStr = capsTemp; } if (!RpcOut_sendOne(NULL, NULL, capsStr)) { Debug("%s: could not set capabilities: older vmx?\n", __FUNCTION__); } free(capsStr); }
void RpcVMX_ReportDriverVersion(const char *drivername, const char *versionString) { char setVersionCmd[128]; Str_Sprintf(setVersionCmd, sizeof(setVersionCmd), "info-set guestinfo.driver.%s.version %s", drivername, versionString); RpcOut_sendOne(NULL, NULL, setVersionCmd); RpcVMX_Log("Driver=%s, Version=%s", drivername, versionString); }
char * RpcVMX_ConfigGetString(const char *defval, const char *var) { char *value; if (!RpcOut_sendOne(&value, NULL, "info-get guestinfo.%s", var)) { /* Get rid of the old value first. */ free(value); value = NULL; if (defval) { /* * We have to dup the default, because of our contract: values we * return must always be freed by the caller. */ value = strdup(defval); } } return value; }