Advertisement
Guest User

Untitled

a guest
Jan 30th, 2013
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1.  
  2. root@bipul-Linux:/home/bipul/Desktop# nse Emulation1.tcl
  3. warning: no class variable Scheduler/RealTime::adjust_new_width_interval_
  4.  
  5. see tcl-object.tcl in tclcl for info about this warning.
  6.  
  7. warning: no class variable Scheduler/RealTime::min_bin_width_
  8.  
  9. TapAgent(_o40): linked sock 6 as READABLE
  10. TCPTapAgent(_o43): sent packet (sz: 40)
  11. TCPTapAgent(_o43): sent packet (sz: 40)
  12. TCPTapAgent(_o43): sent packet (sz: 40)
  13.  
  14.  
  15. bipul@bipul-Linux:~/Desktop$ cat out.tr
  16. + 0.010148 2 1 tcp 40 ------- 0 2.0 1.0 0 0
  17. - 0.010148 2 1 tcp 40 ------- 0 2.0 1.0 0 0
  18. r 0.011184 2 1 tcp 40 ------- 0 2.0 1.0 0 0
  19. + 3.010266 2 1 tcp 40 ------- 0 2.0 1.0 0 1
  20. - 3.010266 2 1 tcp 40 ------- 0 2.0 1.0 0 1
  21. r 3.011308 2 1 tcp 40 ------- 0 2.0 1.0 0 1
  22. + 9.010389 2 1 tcp 40 ------- 0 2.0 1.0 0 2
  23. - 9.010389 2 1 tcp 40 ------- 0 2.0 1.0 0 2
  24. r 9.011431 2 1 tcp 40 ------- 0 2.0 1.0 0 2
  25.  
  26. Below is my code. for nse
  27.  
  28. set ns [new Simulator]
  29. $ns use-scheduler RealTime
  30.  
  31. set f [open out.tr w]
  32. $ns trace-all $f
  33.  
  34. set entry_node [$ns node]
  35. set exit_node [$ns node]
  36. set tcp_node [$ns node]
  37.  
  38. $ns simplex-link $entry_node $tcp_node 10Mb 1ms DropTail
  39. $ns simplex-link $tcp_node $exit_node 10M 1ms DropTail
  40.  
  41. # Configure the entry node
  42. set tap1 [new Agent/TCPTap]; # Create the TCPTap Agent
  43. set bpf [new Network/Pcap/Live]; # Create the bpf
  44. set dev [$bpf open readonly eth0]
  45. $bpf filter "src 113.19.128.48 and src port 80 and dst 113.19.128.60 and dst port 16384"
  46. $tap1 network $bpf; # Connect bpf to TCPTap Agent
  47. $ns attach-agent $entry_node $tap1; # Attach TCPTap Agent to the node
  48.  
  49. # Configure the exit node
  50. set tap2 [new Agent/TCPTap]; # Create a TCPTap Agent
  51. set ipnet [new Network/IP]; # Create a Network agent
  52. $ipnet open writeonly
  53. $tap2 network $ipnet; # Connect network agent to tap agent
  54. $tap2 advertised-window 512
  55. $tap2 extipaddr "113.19.128.48"
  56. $tap2 extport 80
  57. $ns attach-agent $exit_node $tap2; # Attach agent to the node.
  58.  
  59. # Configure the TCP agent
  60. set tcp [new Agent/TCP/FullTcp]
  61. $ns attach-agent $tcp_node $tcp
  62.  
  63. # Connect the agents.
  64. $ns simplex-connect $tap1 $tcp
  65. $ns simplex-connect $tcp $tap2
  66.  
  67.  
  68. $ns at 0.01 "$tcp advance 1"
  69. $ns at 20.0 "finish"
  70.  
  71. proc finish {} {
  72. global ns f nf
  73. $ns flush-trace
  74. close $f
  75. exit 0
  76. }
  77.  
  78. $ns run
  79.  
  80.  
  81. I hope i will get the answer soon
  82.  
  83. Thank you.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement