本文整理汇总了PHP中XNODE_getpathbytarget函数的典型用法代码示例。如果您正苦于以下问题:PHP XNODE_getpathbytarget函数的具体用法?PHP XNODE_getpathbytarget怎么用?PHP XNODE_getpathbytarget使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了XNODE_getpathbytarget函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: netbios_setup
function netbios_setup($name)
{
$infp = XNODE_getpathbytarget("", "inf", "uid", $name, 0);
$stsp = XNODE_getpathbytarget("/runtime", "inf", "uid", $name, 0);
if ($infp == "" || $stsp == "") {
SHELL_info($_GLOBALS["START"], "infsvcs_setup: (" . $name . ") not exist.");
SHELL_info($_GLOBALS["STOP"], "infsvcs_setup: (" . $name . ") not exist.");
return;
}
$addrtype = query($stsp . "/inet/addrtype");
$ipaddr = query($stsp . "/inet/ipv4/ipaddr");
$devnam = query($stsp . "/devnam");
$hostname = query("device/hostname");
startcmd("hostname " . $hostname . "\n");
if ($ipaddr == "" || $devnam == "") {
return;
}
if ($addrtype == "ipv4" || $addrtype == "ipv6") {
//jef add + for support use shareport.local to access shareportmobile
$web_file_access = query("/webaccess/enable");
if ($web_file_access == 1) {
startcmd("netbios -i " . $devnam . " -r " . $hostname . " -r shareport.local -r shareport &\n");
startcmd("llmnresp -i " . $devnam . " -r " . $hostname . " -r shareport.local -r shareport &\n");
} else {
//jef add -
startcmd("netbios -i " . $devnam . " -r " . $hostname . " &\n");
startcmd("llmnresp -i " . $devnam . " -r " . $hostname . " &\n");
}
stopcmd("killall netbios");
stopcmd("killall llmnresp");
}
}
示例2: dhcps_setcfg
function dhcps_setcfg($prefix, $svc)
{
/* set dhcpX of inf */
$inf = cut($svc, 1, ".");
$svc = tolower(cut($svc, 0, "."));
$base = XNODE_getpathbytarget("", "inf", "uid", $inf, 0);
$dhcps_uid = query($prefix . "/inf/" . $svc);
set($base . "/" . $svc, $dhcps_uid);
/* copy the dhcp profile. */
$uid = INF_getinfinfo($inf, $svc);
$spath = XNODE_getpathbytarget($prefix . "/" . $svc, "entry", "uid", $dhcps_uid, 0);
$dhcps = XNODE_getpathbytarget("/" . $svc, "entry", "uid", $uid, 0);
if ($dhcps != "") {
if ($svc == "dhcps4") {
copy_dhcps4($spath, $dhcps);
} else {
if ($svc == "dhcps6") {
$_GLOBALS["SETCFG_DHCPS6_SRC_PATH"] = $spath;
$_GLOBALS["SETCFG_DHCPS6_DST_PATH"] = $dhcps;
$b = "/htdocs/phplib/setcfg/libs";
dophp("load", $b . "/dhcps6.php");
}
}
} else {
TRACE_error("SETCFG/DHCPS: no dhcps entry for [" . $uid . "] found!");
}
}
示例3: fatlady_phyinf
function fatlady_phyinf($prefix, $inf)
{
/* Check the interface setting */
if (query($prefix . "/inf/uid") != $inf) {
/* internet error, no i18n(). */
set_result("FAILED", $prefix . "/inf/uid", "INF UID mismatch");
return;
}
/* Check PHYINF */
$phy = query($prefix . "/inf/phyinf");
$phyp = XNODE_getpathbytarget($prefix, "phyinf", "uid", $phy, 0);
if ($phy == "" || $phyp == "") {
/* internet error, no i18n(). */
set_result("FAILED", $prefix . "/inf/phyinf", "Invalid phyinf");
return;
}
/* Check MACADDR */
$macaddr = query($phyp . "/macaddr");
if ($macaddr != "" && PHYINF_validmacaddr($macaddr) != "1") {
set_result("FAILED", $phyp . "/macaddr", i18n("Invalid MAC address"));
return;
}
$type = query($phyp . "/type");
if ($type == "eth") {
$media = query($phyp . "/media/linktype");
if ($media != "" && $media != "AUTO" && $media != "1000F" && $media != "1000H" && $media != "100F" && $media != "100H" && $media != "10F" && $media != "10H") {
set_result("FAILED", $phyp . "/media/linktype", i18n("Invalid media type"));
return;
}
}
/* We only validate the 'macaddr' & 'media' here,
* so be sure to save 'macaddr' & 'media' only at 'setcfg' */
set($prefix . "/valid", 1);
set_result("OK", "", "");
}
示例4: chkconn
function chkconn($inf)
{
$infp = XNODE_getpathbytarget("", "inf", "uid", $inf, 0);
$inet = query($infp . "/inet");
$inetp = XNODE_getpathbytarget("inet", "entry", "uid", $inet, 0);
$addrtype = query($inetp . "/addrtype");
if ($addrtype == "ppp4") {
$dialupmode = query($inetp . "/" . $addrtype . "/dialup/mode");
}
$active = query($infp . "/active");
$disable = query($infp . "/disable");
$backup = query($infp . "/backup");
$interval = query($infp . "/chkinterval");
if ($interval == "" || $interval < 15) {
$interval = 15;
}
if ($addrtype == "ipv4") {
$check = "yes";
} else {
if ($addrtype == "ppp4" && $dialupmode == "auto") {
$check = "yes";
} else {
$check = "no";
}
}
if ($active == 1 && $disable == 0 && $backup != "" && $check == "yes") {
fwrite(a, $_GLOBALS["START"], 'xmldbc -t chkconn.' . $inf . ':' . $interval . ':"sh /etc/scripts/backupconn.sh NULL ' . $inf . ' connected"\\n');
fwrite(a, $_GLOBALS["STOP"], 'killall chkconn\\n');
fwrite(a, $_GLOBALS["STOP"], 'xmldbc -k chkconn.' . $inf . '\\n');
}
}
示例5: start_proxyd
function start_proxyd()
{
echo "killall -9 proxyd\n";
$r_infp = XNODE_getpathbytarget("/runtime", "inf", "uid", "LAN-1", 0);
$lanif = query($r_infp . "/devnam");
if ($lanif == "") {
echo "echo Not found the name of LAN interface, set it as br0\n";
$lanif = "br0";
}
$proxyd_port = "5449";
$config_file = "/var/run/proxyd.conf";
fwrite("w", $config_file, "CONTROL\n{\n");
fwrite("a", $config_file, "\tTIMEOUT_CONNECT\t30\n");
fwrite("a", $config_file, "\tTIMEOUT_READ\t30\n");
fwrite("a", $config_file, "\tTIMEOUT_WRITE\t30\n");
fwrite("a", $config_file, "\tMAX_CLIENT\t32\n");
fwrite("a", $config_file, "}\n\n");
fwrite("a", $config_file, "HTTP\n{\n");
fwrite("a", $config_file, "\tINTERFACE\t" . $lanif . "\n");
fwrite("a", $config_file, "\tPORT\t" . $proxyd_port . "\n");
fwrite("a", $config_file, "\tALLOW_TYPE\t{ gif jpg css png }\n");
fwrite("a", $config_file, "\tERROR_PAGE\n\t{\n");
fwrite("a", $config_file, "\t\tdefault\t/htdocs/smart404/index.php\n");
fwrite("a", $config_file, "\t\t403\t/htdocs/smart404/index.php\n");
fwrite("a", $config_file, "\t\t404\t/none_exist_file\n");
fwrite("a", $config_file, "\t}\n}\n\n");
$config_url_file = "/var/run/proxyd_url.conf";
fwrite("w", $config_url_file, "0\n");
// Allow to access,
echo "proxyd -m 1.33.203.39 -f " . $config_file . " -u " . $config_url_file . " & > /dev/console\n";
echo "iptables -t nat -D PREROUTING -d 1.33.203.39 -p tcp --dport 80 -j REDIRECT --to-ports " . $proxyd_port . " 2>&-\n";
echo "iptables -t nat -I PREROUTING -d 1.33.203.39 -p tcp --dport 80 -j REDIRECT --to-ports " . $proxyd_port . "\n";
}
示例6: mk_neapscfg
function mk_neapscfg($name, $neaps_conf)
{
/* the interface status <runtime><inf> */
$stsp = XNODE_getpathbytarget("/runtime", "inf", "uid", $name, 0);
$addrtype = query($stsp . "/inet/addrtype");
if ($addrtype == "ipv4") {
$ipaddr = query($stsp . "/inet/ipv4/ipaddr");
} else {
$ipaddr = query($stsp . "/inet/ppp4/local");
}
$mask = query($stsp . "/inet/ipv4/mask");
$netmask = ipv4int2mask($mask);
$phyinf = query($stsp . "/phyinf");
/* the interface status <runtime><phyinf> */
$rphyinf = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $phyinf, 0);
$rmacaddr = query($rphyinf . "/macaddr");
$rname = query($rphyinf . "/name");
/* Get other info*/
$vender = "D-Link";
$model = query("/runtime/device/modelname");
$description = $vender . " " . $model . " Wireless Broadband Router";
$version = "v0.5.0";
fwrite("w", $neaps_conf, 'ipaddr=' . $ipaddr . '\\n' . 'netmask=' . $netmask . '\\n' . 'macaddr=' . $rmacaddr . '\\n' . 'vender=' . $vender . '\\n' . 'description=' . $description . '\\n' . 'model=' . $model . '\\n' . 'version=' . $version . '\\n');
return $rname;
}
示例7: sshdsetup
function sshdsetup($name)
{
/* Get the interface */
$stsp = XNODE_getpathbytarget("/runtime", "inf", "uid", $name, 0);
$infp = XNODE_getpathbytarget("", "inf", "uid", $name, 0);
if ($stsp == "" || $infp == "") {
SHELL_info($_GLOBALS["START"], "sshdsetup: (" . $name . ") no interface.");
SHELL_info($_GLOBALS["STOP"], "sshdsetup: (" . $name . ") no interface.");
return;
}
/* Is this interface active ? */
$active = query($infp . "/active");
$sshd = query($infp . "/sshd");
if ($active != "1" || $sshd == "") {
SHELL_info($_GLOBALS["START"], "sshdsetup: (" . $name . ") not active.");
SHELL_info($_GLOBALS["STOP"], "sshdsetup: (" . $name . ") not active.");
return;
}
/* Get the profile */
$sshdpro = XNODE_getpathbytarget("/sshd", "entry", "uid", $sshd, 0);
if ($sshdpro == "") {
SHELL_info($_GLOBALS["START"], "sshdsetup: (" . $name . ") no profile.");
SHELL_info($_GLOBALS["STOP"], "sshdsetup: (" . $name . ") no profile.");
return;
}
sshdstart($name, $sshdpro);
sshdstop($name, $sshdpro);
}
示例8: IP6TLAN_build_command
function IP6TLAN_build_command($name)
{
fwrite("w", $_GLOBALS["START"], "#!/bin/sh\n");
fwrite("a", $_GLOBALS["START"], "ip6tables -t filter -F FWD." . $name . "\n");
fwrite("a", $_GLOBALS["START"], "ip6tables -t filter -F INP." . $name . "\n");
$iptcmdFWD = "ip6tables -t filter -A FWD." . $name;
$iptcmdIN = "ip6tables -t filter -A INP." . $name;
$path = XNODE_getpathbytarget("", "inf", "uid", $name, 0);
if ($path != "") {
$fw = XNODE_get_var("FIREWALL6.USED");
$security = query("/device/simple_security");
if ($fw > 0) {
fwrite("a", $_GLOBALS["START"], $iptcmdFWD . " -j FIREWALL\n");
}
if ($security > 0) {
fwrite("a", $_GLOBALS["START"], $iptcmdFWD . " -j FWD.SMPSECURITY." . $name . "\n");
}
if ($fw > 0) {
fwrite("a", $_GLOBALS["START"], $iptcmdFWD . " -j FIREWALL_POLICY\n");
}
/* Outbound filter will be run faster to drop some packets. */
fwrite("a", $_GLOBALS["START"], $iptcmdFWD . " -j FWD.OBFILTER\n");
fwrite("a", $_GLOBALS["START"], $iptcmdIN . " -j INP.OBFILTER\n");
}
fwrite("a", $_GLOBALS["START"], "exit 0\n");
fwrite("w", $_GLOBALS["STOP"], "#!/bin/sh\n");
fwrite("a", $_GLOBALS["STOP"], "ip6tables -t filter -F FWD." . $name . "\n");
fwrite("a", $_GLOBALS["STOP"], "ip6tables -t filter -F INP." . $name . "\n");
fwrite("a", $_GLOBALS["STOP"], "exit 0\n");
}
示例9: init_update_status_for_station
function init_update_status_for_station($PHY_UID)
{
if (get_phyinf_freq($PHY_UID) == 5) {
$upwifistats_pidfile = "/var/run/upwifistats5g.pid";
$helper_script = "/etc/scripts/upwifistatshlper_A_band.sh";
} else {
$upwifistats_pidfile = "/var/run/upwifistats24g.pid";
$helper_script = "/etc/scripts/upwifistatshlper_G_band.sh";
}
$pid = fread("", $upwifistats_pidfile);
if ($pid != "") {
echo "kill " . $pid . "\n";
}
$upwifi_attr0 = "updatewifistats -s " . $helper_script . " -m bcm -i " . devname($PHY_UID) . " ";
$upwifi_attr1 = "-x ";
//for upwifistats argument (-x --> /phyinf:#)
$upwifi_attr2 = "-r ";
//for upwifistats argument (-r --> /runtime/phyinf:#)
$p = XNODE_getpathbytarget("", "phyinf", "uid", $PHY_UID, 0);
if ($p == "") {
return;
}
$r = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $PHY_UID, 0);
if ($r == "") {
return;
}
$upwifi_attr1 = $upwifi_attr1 . $p . " ";
$upwifi_attr2 = $upwifi_attr2 . $r . " ";
$cmd = $upwifi_attr0 . $upwifi_attr1 . $upwifi_attr2 . " &";
TRACE_error($cmd);
echo $cmd . "\n";
echo "echo \$! > " . $upwifistats_pidfile . "\n";
}
示例10: setup_mdns
function setup_mdns($uid, $port, $srvname, $srvcfg)
{
$dirty = 0;
$stsp = XNODE_getpathbytarget("/runtime/services/mdnsresponder", "server", "uid", $uid, 0);
if ($stsp == "") {
if ($port != "0") {
$dirty++;
$stsp = XNODE_getpathbytarget("/runtime/services/mdnsresponder", "server", "uid", $uid, 1);
set($stsp . "/srvname", $srvname);
set($stsp . "/port", $port);
set($stsp . "/srvcfg", $srvcfg);
}
} else {
if ($port == "0") {
$dirty++;
del($stsp);
} else {
if (query($stsp . "/srvname") != $srvname) {
$dirty++;
set($stsp . "/srvname", $srvname);
}
if (query($stsp . "/port") != $port) {
$dirty++;
set($stsp . "/port", $port);
}
if (query($stsp . "/srvcfg") != $srvcfg) {
$dirty++;
set($stsp . "/srvcfg", $srvcfg);
}
}
}
return $dirty;
}
示例11: INET_getinetinfo
function INET_getinetinfo($inet, $info)
{
$infp = XNODE_getpathbytarget("/inet", "entry", "uid", $inet, 0);
if ($infp != "") {
return query($infp . "/" . $info);
}
return "";
}
示例12: get_runtime_wifi_path
function get_runtime_wifi_path($uid)
{
$p = XNODE_getpathbytarget("", "phyinf", "wifi", $uid);
if ($p == "") {
return $p;
}
return XNODE_getpathbytarget("/runtime", "phyinf", "uid", query($p . "/uid"));
}
示例13: dhcpc6setup
function dhcpc6setup($inf)
{
$hlp = "/var/servd/" . $inf . "-dhcp6c.sh";
$pid = "/var/servd/" . $inf . "-dhcp6c.pid";
$cfg = "/var/servd/" . $inf . "-dhcp6c.cfg";
/* DHCP over PPP session ? */
//$previnf = XNODE_get_var($inf."_PREVINF");
//XNODE_del_var($inf."_PREVINF");
$infp = XNODE_getpathbytarget("", "inf", "uid", $inf, 0);
$previnf = query($infp . "/infprevious");
$phyinf = query($infp . "/phyinf");
$inet = query($infp . "/inet");
$inetp = XNODE_getpathbytarget("/inet", "entry", "uid", $inet, 0);
$devnam = PHYINF_getifname($phyinf);
/* dslite ? */
$nextinf = query($infp . "/infnext");
//if ($mode=="PPPDHCP" && $_GLOBALS["PREVINF"]!="")
//msg("mode is ".$mode.", previnf is ".$previnf);
startcmd('# dhcpc6setup(' . $inf . ',' . $inetp . ')');
startcmd("previnf is " . $previnf . ", nextinf is " . $nextinf);
//if ($mode=="PPPDHCP" && $previnf!="")
//{
// $pppdev = PHYINF_getruntimeifname($previnf);
// if ($pppdev=="") return error("no PPP device.");
//}
/* Gererate DHCP-IAID from 32-bit of mac address*/
$mac = PHYINF_getphymac($inf);
$mac1 = cut($mac, 3, ":");
$mac2 = cut($mac, 0, ":");
$mac3 = cut($mac, 1, ":");
$mac4 = cut($mac, 2, ":");
$iaidstr = $mac1 . $mac2 . $mac3 . $mac4;
$iaid = strtoul($iaidstr, 16);
/* Generate configuration file. */
$send = "\tinformation-only;\n";
$idas = "";
//if($mode=="PPPDHCP") $dname = $pppdev;
//else $dname = $devnam;
$dname = $devnam;
$nextinfp = XNODE_getpathbytarget("", "inf", "uid", $nextinf, 0);
$nextinet = query($nextinfp . "/inet");
$nextinetp = XNODE_getpathbytarget("inet", "entry", "uid", $nextinet, 0);
$nextmode = query($nextinetp . "/ipv4/ipv4in6/mode");
if ($nextinf != "" && $nextmode == "dslite") {
$rqstmsg = "\trequest aftr-server-domain-name;\n";
} else {
$rqstmsg = "";
}
fwrite(w, $cfg, "interface " . $dname . " {\n" . $send . $rqstmsg . "\tscript \"" . $hlp . "\";\n" . "};\n" . $idas);
/* generate callback script */
fwrite(w, $hlp, "#!/bin/sh\n" . "phpsh /etc/services/INET/inet6_dhcpc_helper.php" . " INF=" . $inf . " MODE=INFOONLY" . " DEVNAM=" . $dname . " GATEWAY=" . "" . " DHCPOPT=" . "" . ' "NAMESERVERS=$new_domain_name_servers"' . ' "NEW_ADDR=$new_addr"' . ' "NEW_PD_PREFIX=$new_pd_prefix"' . ' "NEW_PD_PLEN=$new_pd_plen"' . ' "DNS=' . "" . '"' . ' "NEW_AFTR_NAME=$new_aftr_name"' . ' "NTPSERVER=$new_ntp_servers"' . "\n");
/* Start DHCP client */
startcmd("chmod +x " . $hlp);
//if ($pppdev=="")
startcmd("dhcp6c -c " . $cfg . " -p " . $pid . " -t LL " . $devnam);
//else startcmd("dhcp6c -c ".$cfg." -p ".$pid." -t LL -o ".$devnam." ".$pppdev);
stopcmd("/etc/scripts/killpid.sh /var/servd/" . $inf . "-dhcp6c.pid");
}
示例14: getphyinf
function getphyinf($inf)
{
$infp = XNODE_getpathbytarget("", "inf", "uid", $inf, 0);
if ($infp == "") {
return "";
}
$phyinf = query($infp . "/phyinf");
return PHYINF_getifname($phyinf);
}
示例15: wanlinkstatus
function wanlinkstatus($inf)
{
$infp = XNODE_getpathbytarget("", "inf", "uid", $inf, 0);
$phyinf = query($infp . "/phyinf");
$phyinfp = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $phyinf, 0);
$linkstatus = query($phyinfp . "/linkstatus");
if ($linkstatus == "") {
return "down";
}
return $linkstatus;
}