config modifications and such
[CBFWR.git] / bin / cbfwrd.php
index b8360e5..4a9f5a5 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 $CMD_ROOT_FS = realpath(dirname(__FILE__));
 $AM_DAEMON = true;
+$MOCKUP = true;
 
-global $CMD_ROOT_FS;
-global $AM_DAEMON;
+global $CMD_ROOT_FS, $AM_DAEMON, $MOCKUP;
 
 // add libglcas as if it were a path in ../libglcas
 if(file_exists("../libcbfwr")) {
@@ -19,14 +19,16 @@ glcas_pluginLoader();
 
 error_log("CBFWRD starting");
 
+$comms = new Comms;
 
-$config = new Config();
-global $config;
 
 if(isset($argv[1])) {
+       // we get called here on boot.
        if($argv[1] == "boot") {
-               // we get called here on boot.
-               $config->bootHardware();
+               $config = new Config(false);
+               $config->findHardware();
+               $conf = $config->getConfig();
+               $comms->putConfig($conf, 1);
                exit(0);
        }
 }
@@ -37,10 +39,18 @@ $cont = true;
 // setup our sem/shm stuff
 
 // do the initial stuff
-$comms = new Comms;
-$config->loadConfig();
+$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();
@@ -59,30 +69,9 @@ function cbfwd_commandProcessor($command)
        
        $comms->lockConfigs();
        switch($cmds[0]) {
-               case "goodone":
-                       break;
-                       
-               // interface change requests
-               case "interface":
-                       $int = $cmds[1];
-                       if($cmds[2] == "changename") {
-                               $rawconf = $comms->getConfig();
-                               if(isset($rawconf["interface"]["$int"]["name"])) $rawconf["interface"]["$int"]["name"] = $cmds[3];
-                               $comms->putConfig($rawconf);
-                       }
+               case "applyclientconfig":
                        break;
                        
-               case "zone":
-                       $cmd = $cmds[1];
-                       switch($cmd) {
-                               case "add":
-                                       $zonename = $cmds[2];
-                                       $rawconf = $comms->getConfig();
-                                       $rawconf["zone"][$zonename]["name"] = 1;
-                                       $comms->putConfig($rawconf);
-                                       break;
-                                       
-                       }
        }
        $comms->unlockConfigs();
 }