X-Git-Url: http://git.pjr.cc/?p=CBFWR.git;a=blobdiff_plain;f=bin%2Fcbfwrd.php;h=4abcbbde32e31c633cdd494b1093141c8d7e3be8;hp=6f49afe71fd80c3e90ff1763a2ab26f7c94ff29b;hb=c184472f1c4206a3bcd76ff8e9d27dc2eb1a4c4c;hpb=db4f63e0e2c434ded60cd1fd324be62a2aadcae1 diff --git a/bin/cbfwrd.php b/bin/cbfwrd.php index 6f49afe..4abcbbd 100644 --- a/bin/cbfwrd.php +++ b/bin/cbfwrd.php @@ -19,5 +19,60 @@ glcas_pluginLoader(); error_log("CBFWRD starting"); -$config = new Config(); +$comms = new Comms; + + +if(isset($argv[1])) { + // we get called here on boot. + if($argv[1] == "boot") { + $config = new Config(false); + $config->findHardware(); + $conf = $config->getConfig(); + $comms->putConfig($conf, 1); + exit(0); + } +} + +// now we got into daemon modes +$cont = true; + +// setup our sem/shm stuff + +// do the initial stuff +$config = new Config(true); +$config->loadConfigFile(); +$rawconf = $config->getConfig(); +$comms->putConfig($rawconf); +$config->applyConfig(); +$runconf["status"] = "nochange"; +$comms->putConfig($runconf, 2); +$res = $comms->getConfig(3); +if($res === false) { + $comms->putConfig($runconf, 3); +} + + +while($cont) { + $msg = $comms->waitForMessage(); + + //echo "Got message: $msg\n"; + if($msg == "quit") $cont = false; + else cbfwd_commandProcessor($msg); +} + + +function cbfwd_commandProcessor($command) +{ + global $config; + $cmds = explode(" ", $command); + $comms = new Comms; + + $comms->lockConfigs(); + switch($cmds[0]) { + case "applyclientconfig": + break; + + } + $comms->unlockConfigs(); +} ?> \ No newline at end of file