2 $CMD_ROOT_FS = realpath(dirname(__FILE__));
6 global $CMD_ROOT_FS, $AM_DAEMON, $MOCKUP;
8 // add libglcas as if it were a path in ../libglcas
9 if(file_exists("../libcbfwr")) {
10 $path = realpath($CMD_ROOT_FS."/../");
11 error_log("added cbfwr path as $path");
12 set_include_path(get_include_path().PATH_SEPARATOR.$path);
15 // include the based library
16 require_once("libcbfwr/lib.php");
20 error_log("CBFWRD starting");
26 // we get called here on boot.
27 if($argv[1] == "boot") {
28 $config = new Config(false);
29 $config->findHardware();
30 $conf = $config->getConfig();
31 $comms->putConfig($conf, 1);
36 // now we got into daemon modes
39 // setup our sem/shm stuff
41 // do the initial stuff
42 $config = new Config(true);
43 $config->loadConfigFile();
44 $rawconf = $config->getConfig();
45 $comms->putConfig($rawconf);
46 $config->applyConfig();
47 $runconf["status"] = "nochange";
48 $comms->putConfig($runconf, 2);
49 $res = $comms->getConfig(3);
51 $comms->putConfig($runconf, 3);
56 $msg = $comms->waitForMessage();
58 //echo "Got message: $msg\n";
59 if($msg == "quit") $cont = false;
60 else cbfwd_commandProcessor($msg);
64 function cbfwd_commandProcessor($command)
67 $cmds = explode(" ", $command);
70 $comms->lockConfigs();
72 case "applyclientconfig":
76 $comms->unlockConfigs();