Browse Source

Merge branch 'master' of erinn.io:netsim

Erinn 8 years ago
parent
commit
d1f784d6af

+ 10 - 1
js/devicescripts.js

@@ -13,6 +13,15 @@ var deviceScripts = {
 		onPacketReceived: function (device, packet) {
 			//.
 		}
-	}
+	},
+
+    ping: {
+		onPacketReceived: function(device, packet) {
+                    //if(packet.tranport.proto == "icmp"){
+                        //doPacketAnimation(device.id, device.ports[0], 
+		}
+    }
+
+        
 }
 

+ 8 - 13
levels/01 Basics/level02.html

@@ -7,21 +7,16 @@
  information contained in this header: <strong>srcip</strong> (the source of the packet) and <strong>dstip</strong>
  (the destination of the packet).
  
+<h3>Level Objectives</h3>
  <p>To pass this level, you will need to send a packet from Alice to Bob. To do this:
  
  <ul>
- 	<li>open the Timeline Editor 
-	<li>open <strong>Basics &rarr; Level 2</strong> by going to <strong>File &rarr; Change level</strong>
-	<li>add a new packet by selecting the Add Packet option from the File menu (or by pressing <strong>Ctrl+N</strong>)
-	<li>we need to send this packet <strong>from</strong> Alice, so make sure she is selected in the From: dropdown
-	<li>you need to set the <strong>srcip</strong> and <strong>dstip</strong> headers in the network layer<br>
-	    <em>hint: restart and pause the simulator to click on packets and see what their headers look like</em>
-	<li>save your new packet by selecting the Save option from the dropdown menu (or by pressing <strong>Ctrl+S</strong>)
-</ul>
-
-<p>Now that you have saved a packet to the timeline, go back to the Simulator and press <span class="button">reload</span>. 
-When the timer in the corner hits the "At:" value of your packet, it will be sent!</p>
+	<li>Click the + button and add a new packet
+	<li>We need to send this packet <strong>from</strong> Alice, so make sure she is selected in the From: dropdown menu.
+	<li>You need to set the <strong>srcip</strong> and <strong>dstip</strong> headers in the network layer.<br>
+            <em>hint: restart and pause the simulator to click on packets to see what the srcip and dstip header values are set to.</em></li>
+        <li>Save your new packet by pressing <strong>Add</strong> button</li>
+        <li>Restart the simulation and click the send arrow beside the newly added packet to see it in action!</li>
 
-<h3>Level Objectives</h3>
+</ul>
 
-<ul><li>Send a packet from Alice to Bob</li></ul>

+ 3 - 3
levels/01 Basics/level02.json

@@ -32,7 +32,7 @@
 		},
 		{
 			type:"packet",
-			at:1500,
+			at:2000,
 			from:"Bob",
 			payload:{
 				network:{srcip:"Bob",dstip:"Alice"}
@@ -40,7 +40,7 @@
 		},
 		{
 			type:"packet",
-			at:2500,
+			at:4000,
 			from:"Bob",
 			payload:{
 				network:{srcip:"Bob",dstip:"Alice"}
@@ -52,7 +52,7 @@
 			type:"packet",
 			device:"Bob",
 			payload:{
-				network:{dstip:"Bob"}
+				network:{srcip:"Alice", dstip:"Bob"}
 			}
 		}
 	],

+ 3 - 8
levels/01 Basics/level03.html

@@ -5,18 +5,13 @@ information about how to respond.
 
 <p>Pause the simulation to view the packet sent from Alice's computer to Google. There is a new header under the
 <strong>transport layer</strong>. The header, <strong>proto</strong> defines the <strong>protocol</strong> that will
-be run on this layer. The protocol listed is <strong>ICMP</strong>, which refers to a <strong>ping</strong>. When a
+be run on this layer. The protocol listed is <strong>ICMP</strong>, which is used to <strong>ping</strong> computers. When a
 computer receives a packet with an ICMP echo request (ping) they respond by sending back a packet with an ICMP echo
-(pong). Resume the simulation and notice the packet sent from Google to Alice's computer.
+(pong). Resume the simulation and notice the response packet sent from Google to Alice's computer.
 
-<p>To complete this level, you must send 4 more ICMP echo requests (pings) from Alice to Google. Proceed as before,
-by adding a new packet in the Timeline Editor. Remember to add the new <strong>transport layer</strong> header.
-
-<p><em><strong>Hint:</strong> use the 'repeat' feature in the Editor to send the same packet many times!
 
 <h3>Level Objectives</h3>
 
 <ul>
-	<li>remember to go to the <strong>next level</strong> in the timeline editor</li>
-	<li>send 4 more ping requests to Google</li>
+    <li>To complete this level, you must send 4 more ICMP echo requests from Alice to Google. Proceed as before, by clicking the + to add new packets. Remember to fill in the new <strong>transport layer</strong> header proto header field.</li>
 </ul>

+ 11 - 12
levels/01 Basics/level03.json

@@ -2,7 +2,6 @@
 	devices:[
 		{
 			id:"Alice",
-			type:"NullComputer",
 			ports:1,
 			x:0.25,
 			y:0.5,
@@ -11,10 +10,11 @@
 		},
 		{
 			id:"Google",
-			type:"NullComputer",
 			ports:1,
 			x:0.75,
-			y:0.5
+			y:0.5,
+			image:"iphone-1",
+			script: deviceScripts.ping
 		}
 	],
 	links:[
@@ -26,23 +26,22 @@
 	timeline:[
 		{
 			type:"packet",
-			at:100,
+			at:500,
 			from:"Alice",
 			payload:{
-				network:{dstip:"Google"},
+				network:{srcip:"Alice", dstip:"Google"},
 				transport:{proto:"ICMP"}
 			}
 		}
 	],
-	triggers:{
-		t0:{
+	triggers:[
+                {
 			type:"packet",
 			device:"Alice",
 			payload:{
 				network:{srcip:"Google", dstip:"Alice"}
-			},
-			times:5
-		}
-	},
-	nextLevel:"01 Basics/level04.json"
+			}
+                }
+        ],
+	nextLevel:4
 }