Phone app and iotcloud addition into the fourth benchmark and a few minor stuff
[iot2.git] / iotjava / iotruntime / master / RouterConfig.java
index 8e23ce1fec62960015799baff0cac1e2a6c181a2..760f3d25dc63d53a18bb5928f0f365941874c975 100644 (file)
@@ -62,7 +62,7 @@ public final class RouterConfig {
         * getPrintWriter() gets the right PrintWriter object to print policies to the right file
         *
         * @param   strConfigHost String hostname to be configured
-        * @return  void
+        * @return  PrintWriter
         */
        private PrintWriter getPrintWriter(String strConfigHost) {
 
@@ -159,6 +159,17 @@ public final class RouterConfig {
                }
        }
 
+       /**
+        * getAddressListObject() method returns the map from this class
+        * <p>
+        * This method is useful for MAC policy class so that it doesn't have
+        * to query the router again
+        */
+       public Map<String, String> getAddressListObject() {
+
+               return mapMACtoIPAdd;
+       }
+
        /**
         * getAddressList() method gets list of IP addresses
         * <p>
@@ -618,6 +629,9 @@ public final class RouterConfig {
                PrintWriter pwConfig = getPrintWriter(strConfigHost);
                // Configure NAT
                pwConfig.println("-t nat -A POSTROUTING -o eth0 -j MASQUERADE");
+               // Add the following 2 lines
+               pwConfig.println("-A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT");
+               pwConfig.println("-A FORWARD -i wlan0 -o eth0 -j ACCEPT");
        }
 
        /**