graphite_target_object(std::string alias, std::string path) : parent(alias, path) { set_property_bool("send perfdata", true); set_property_bool("send status", true); set_property_int("timeout", 30); set_property_string("perf path", "system.${hostname}.${check_alias}.${perf_alias}"); set_property_string("status path", "system.${hostname}.${check_alias}.status"); }
nsca_target_object(std::string alias, std::string path) : parent(alias, path) { set_property_int("timeout", 30); set_property_int("retries", 3); set_property_string("encryption", "ase"); set_property_int("payload length", 512); set_property_string("port", "5667"); set_property_int("time offset", 0); }
syslog_target_object(std::string alias, std::string path) : parent(alias, path) { set_property_int("timeout", 30); set_property_string("path", "/nsclient++"); set_property_string("severity", "error"); set_property_string("facility", "kernel"); set_property_string("tag syntax", "NSCA"); set_property_string("message syntax", "%message%"); set_property_string("ok severity", "informational"); set_property_string("warning severity", "warning"); set_property_string("critical severity", "critical"); set_property_string("unknown severity", "emergency"); }
void arduino_board_inst(void * dev, void * opaque) { mem_region * sysmem = get_sysmem(); Device * bootmem = create_device("boot", "memory-alias"); Device * rom = create_device("rom", "generic_rom"); Device * ram1 = create_device("ram1", "generic_ram"); Device * ram2 = create_device("ram2", "generic_ram"); Device * eef0 = create_device("eef0", "generic_ram"); Device * uart = create_device("uart", "arduinodue_uart"); Device * pmc = create_device("pmc", "arduinodue_pmc"); Device * uotghs = create_device("usb", "arduinodue_uotghs"); Device * log1 = create_device("log1", "c_logger"); Device * log2 = create_device("log2", "py_logger"); Device * log3 = create_device("log3", "rust_logger"); set_property_ptr(bootmem, "target", rom); set_property_int32(bootmem, "offset", 0); set_property_int32(bootmem, "size", 0xffff); set_property_string(rom, "file", get_property_string(dev, "kernel_file")); /* map device what where at how large */ map_device_to_memory(rom, sysmem, 0x80000, 0xf00000); map_device_to_memory(bootmem, sysmem, 0x0, 0xffff); map_device_to_memory(ram1, sysmem, 0x20000000, 0xFFFF); map_device_to_memory(ram2, sysmem, 0x20070000, 0x17FFF); map_device_to_memory(eef0, sysmem, 0x400E0A00, 0x400); map_device_to_memory(uart, sysmem, 0x400E0800, 0x200); map_device_to_memory(pmc, sysmem, 0x400E0600, 0x200); map_device_to_memory(uotghs, sysmem, 0x400AC800, 0x830); map_device_to_memory(log1, sysmem, 0x400E1000, 0x50); map_device_to_memory(log2, sysmem, 0x400E1200, 0x50); map_device_to_memory(log3, sysmem, 0x400E1400, 0x50); Device * processor = create_device("mcu", "cortex_m3"); Device * intctl = create_device("nvic", "armv7m_nvic"); set_property_ptr(intctl, "target", processor); set_property_int32(intctl, "num_irq", 64); /* Instantiate all created devices */ instantiate_devices(); }
/* set document.cookie to the cookies relevant to this url */ static void docCookie(jsobjtype d) { int cook_l; char *cook = initString(&cook_l); const char *url = cw->fileName; bool secure = false; const char *proto; char *s; if (url) { proto = getProtURL(url); if (proto && stringEqualCI(proto, "https")) secure = true; sendCookies(&cook, &cook_l, url, secure); if (memEqualCI(cook, "cookie: ", 8)) { /* should often happen */ strmove(cook, cook + 8); } if (s = strstr(cook, "\r\n")) *s = 0; } set_property_string(d, "cookie", cook); nzFree(cook); } /* docCookie */
smtp_target_object(std::string alias, std::string path) : parent(alias, path) { set_property_int("timeout", 30); set_property_string("sender", "nscp@localhost"); set_property_string("recipient", "nscp@localhost"); set_property_string("template", "Hello, this is %source% reporting %message%!"); }
collectd_target_object(std::string alias, std::string path) : parent(alias, path) { set_property_string("port", "25826"); set_property_string("host", "239.192.74.66"); }
static void rebuildSelector(struct htmlTag *sel, jsobjtype oa, int len2) { int i1, i2, len1; bool check2; char *s; const char *selname; bool changed = false; struct htmlTag *t; jsobjtype oo; /* option object */ len1 = cw->numTags; i1 = i2 = 0; selname = sel->name; if (!selname) selname = "?"; debugPrint(4, "testing selector %s %d %d", selname, len1, len2); sel->lic = (sel->multiple ? 0 : -1); while (i1 < len1 && i2 < len2) { /* there is more to both lists */ t = tagList[i1++]; if (t->action != TAGACT_OPTION) continue; if (t->controller != sel) continue; /* find the corresponding option object */ if ((oo = get_array_element_object(oa, i2)) == NULL) { /* Wow this shouldn't happen. */ /* Guess I'll just pretend the array stops here. */ len2 = i2; --i1; break; } t->jv = oo; /* should already equal oo */ t->rchecked = get_property_bool(oo, "defaultSelected"); check2 = get_property_bool(oo, "selected"); if (check2) { if (sel->multiple) ++sel->lic; else sel->lic = i2; } ++i2; if (t->checked != check2) changed = true; t->checked = check2; s = get_property_string(oo, "text"); if (s && !t->textval || !stringEqual(t->textval, s)) { nzFree(t->textval); t->textval = s; changed = true; } else nzFree(s); s = get_property_string(oo, "value"); if (s && !t->value || !stringEqual(t->value, s)) { nzFree(t->value); t->value = s; } else nzFree(s); } /* one list or the other or both has run to the end */ if (i2 == len2) { for (; i1 < len1; ++i1) { t = tagList[i1]; if (t->action != TAGACT_OPTION) continue; if (t->controller != sel) continue; /* option is gone in js, disconnect this option tag from its select */ t->jv = 0; t->controller = 0; t->action = TAGACT_NOP; changed = true; } } else if (i1 == len1) { for (; i2 < len2; ++i2) { if ((oo = get_array_element_object(oa, i2)) == NULL) break; t = newTag("option"); t->lic = i2; t->controller = sel; t->jv = oo; t->step = 2; // already decorated t->textval = get_property_string(oo, "text"); t->value = get_property_string(oo, "value"); t->checked = get_property_bool(oo, "selected"); if (t->checked) { if (sel->multiple) ++sel->lic; else sel->lic = i2; } t->rchecked = get_property_bool(oo, "defaultSelected"); changed = true; } } if (!changed) return; debugPrint(4, "selector %s has changed", selname); /* If js change the menu, it should have also changed select.value * according to the checked options, but did it? * Don't know, so I'm going to do it here. */ s = displayOptions(sel); if (!s) s = emptyString; set_property_string(sel->jv, "value", s); javaSetsTagVar(sel->jv, s); nzFree(s); if (!sel->multiple) set_property_number(sel->jv, "selectedIndex", sel->lic); } /* rebuildSelector */
/* After createJavaContext, set up the document object and other variables * and methods that are base for client side DOM. */ void setupJavaDom(void) { jsobjtype w = cw->winobj; // window object jsobjtype d = cw->docobj; // document object jsobjtype nav; // navigator object jsobjtype navpi; // navigator plugins jsobjtype navmt; // navigator mime types jsobjtype hist; // history object struct MIMETYPE *mt; struct utsname ubuf; int i; char save_c; static const char *languages[] = { 0, "english", "french", "portuguese", "polish", "german", "russian", }; extern const char *startWindowJS; /* self reference through several names */ set_property_object(w, "window", w); set_property_object(w, "self", w); set_property_object(w, "parent", w); set_property_object(w, "top", w); nav = instantiate(w, "navigator", 0); if (!nav) return; /* some of the navigator is in startwindow.js; the runtime properties are here. */ set_property_string(nav, "userLanguage", languages[eb_lang]); set_property_string(nav, "language", languages[eb_lang]); set_property_string(nav, "appVersion", version); set_property_string(nav, "vendorSub", version); set_property_string(nav, "userAgent", currentAgent); uname(&ubuf); set_property_string(nav, "oscpu", ubuf.sysname); set_property_string(nav, "platform", ubuf.machine); /* Build the array of mime types and plugins, * according to the entries in the config file. */ navpi = instantiate_array(nav, "plugins"); if (navpi == NULL) return; navmt = instantiate_array(nav, "mimeTypes"); if (navmt == NULL) return; mt = mimetypes; for (i = 0; i < maxMime; ++i, ++mt) { int len; /* po is the plugin object and mo is the mime object */ jsobjtype po = instantiate_array_element(navpi, i, 0); jsobjtype mo = instantiate_array_element(navmt, i, 0); if (po == NULL || mo == NULL) return; set_property_object(mo, "enabledPlugin", po); set_property_string(mo, "type", mt->type); set_property_object(navmt, mt->type, mo); set_property_string(mo, "description", mt->desc); set_property_string(mo, "suffixes", mt->suffix); /* I don't really have enough information from the config file to fill * in the attributes of the plugin object. * I'm just going to fake it. * Description will be the same as that of the mime type, * and the filename will be the program to run. * No idea if this is right or not. */ set_property_string(po, "description", mt->desc); set_property_string(po, "filename", mt->program); /* For the name, how about the program without its options? */ len = strcspn(mt->program, " \t"); save_c = mt->program[len]; mt->program[len] = 0; set_property_string(po, "name", mt->program); mt->program[len] = save_c; } hist = instantiate(w, "history", 0); if (hist == NULL) return; set_property_string(hist, "current", cw->fileName); /* Since there is no history in edbrowse, the rest is left to startwindow.js */ /* the js window/document setup script. * These are all the things that do not depend on the platform, * OS, configurations, etc. */ jsRunScript(w, startWindowJS, "StartWindow", 1); // Document properties that must be set after startwindow.js. // Most of these use the setters in the URL class. set_property_string(d, "referrer", cw->referrer); instantiate_url(d, "URL", cw->fileName); instantiate_url(d, "location", cw->fileName); instantiate_url(w, "location", cw->fileName); set_property_string(d, "domain", getHostURL(cw->fileName)); docCookie(d); } /* setupJavaDom */
/* pass, to the js process, the filename, * or the <base href=url>, for relative url resolution on innerHTML. * This has to be retained per edbrowse buffer. */ void set_basehref(const char *h) { if (!h) h = emptyString; set_property_string(cw->docobj, "base$href$", h); } /* set_basehref */
check_mk_target_object(std::string alias, std::string path) : parent(alias, path) { set_property_int("timeout", 30); set_property_int("retries", 3); set_property_string("port", "5667"); }