2 $CMD_ROOT_FS = realpath(dirname(__FILE__));
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");
23 $config = new Config();
27 if($argv[1] == "boot") {
28 // we get called here on boot.
29 $config->bootHardware();
34 // now we got into daemon modes
37 // setup our sem/shm stuff
39 // do the initial stuff
41 $config->loadConfig();
42 $rawconf = $config->getConfig();
43 $comms->putConfig($rawconf);
46 $msg = $comms->waitForMessage();
48 //echo "Got message: $msg\n";
49 if($msg == "quit") $cont = false;
50 else cbfwd_commandProcessor($msg);
54 function cbfwd_commandProcessor($command)
57 $cmds = explode(" ", $command);
60 $comms->lockConfigs();
65 // interface change requests
68 if($cmds[2] == "changename") {
69 $rawconf = $comms->getConfig();
70 if(isset($rawconf["interface"]["$int"]["name"])) $rawconf["interface"]["$int"]["name"] = $cmds[3];
71 $comms->putConfig($rawconf);
80 $rawconf = $comms->getConfig();
81 $rawconf["zone"][$zonename]["name"] = 1;
82 $comms->putConfig($rawconf);
87 $comms->unlockConfigs();