[ns] SIP in Wired-cum-Wireless and MobileIP Simulations
Bo Peng
eenbp at leeds.ac.uk
Thu Apr 20 10:04:56 PDT 2006
Dear All,
I am trying to simulate SIP protocol in a Wired-cum-Wireless and MobileIP
network. After compiled the SIP patch successfully in ns-2.27, I have tried
a simple wired network example and it worked. However, when I introduce some
wireless nodes running SIP on it and connected via a base station with wired
network in the simulation. I got errors like:
"(null) - invalid packet type (SIP)"
I did not meet this error in wired network, so I think maybe because of
wireless nodes in this simulation or some undefined class in some part of
this simulation. I have no idea which part of the script lead to this error.
What do you guys think of this invalid packet type problem? Can you suggest
me where I should go to check and fix this problem in NS-2?
My script is like follows:
#
# This software was developed at the National Institute of Standards and
# Technology by employees of the Federal Goverment in the course of their
# official duties. This software is an experimental objects. NIST assumes
# no responsibility whatsoever for its use by other parties, and makes no
# guarantees, expressed or implied, about its quality, reliability, or any
# other characteristic. We would appreicate acknowledgement if the software
# is used.
# This software can be redistributed and/or modified freely. We respect
# that any derivative works bear some notice that they are derived from it,
# any any modified versions bear some notice that they have been modified.
# Jin-Woo Jung, jjw at korea.ac.kr
#initilizations
# ======================================================================
# Define options
# ======================================================================
set opt(chan) Channel/WirelessChannel ;# channel type
set opt(prop) Propagation/TwoRayGround ;# radio-propagation
model
set opt(netif) Phy/WirelessPhy ;# network interface type
set opt(mac) Mac/802_11 ;# MAC type
set opt(ifq) Queue/DropTail/PriQueue ;# interface queue type
set opt(ll) LL ;# link layer type
set opt(ant) Antenna/OmniAntenna ;# antenna model
set opt(ifqlen) 50 ;# max packet in ifq
set opt(nn) 1 ;# number of mobilenodes
set opt(adhocRouting) DSDV ;# routing protocol
set opt(cp) "" ;# connection pattern
file
set opt(sc)
"/home/iplot/ns-allinone-2.27/ns-2.27/tcl/mobility/scene/scen-3-test" ;#
node movement file.
set opt(x) 670 ;# x coordinate of topology
set opt(y) 670 ;# y coordinate of topology
set opt(seed) 0.0 ;# seed for random number
gen.
set opt(stop) 10 ;# time to stop simulation
set num_wired_nodes 4
set num_bs_nodes 1
#
============================================================================
# check for boundary parameters and random seed
if { $opt(x) == 0 || $opt(y) == 0 } {
puts "No X-Y boundary values given for wireless topology\n"
}
if {$opt(seed) > 0} {
puts "Seeding Random number generator with $opt(seed)\n"
ns-random $opt(seed)
}
set ns [new Simulator]
# set up for hierarchical routing
$ns node-config -addressType hierarchical
AddrParams set domain_num_ 3 ;# number of domains
lappend cluster_num 3 1 1 ;# number of clusters in each domain
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel 1 1 1 1 2 ;# number of nodes in each
cluster
AddrParams set nodes_num_ $eilastlevel ;# of each domain
set tf [open out_sip_test.tr w]
$ns trace-all $tf
#Open the nam trace file
#set nf [open out.nam w]
#$ns namtrace-all-wireless $nf $opt(x) $opt(y)
# Create topography object
set topo [new Topography]
# define topology
$topo load_flatgrid $opt(x) $opt(y)
# create God
create-god [expr $opt(nn) + $num_bs_nodes]
#create wired nodes
set temp {0.0.0 0.1.0 0.2.0 1.0.0} ;# hierarchical addresses for
wired domain
for {set i 0} {$i < $num_wired_nodes} {incr i} {
set W($i) [$ns node [lindex $temp $i]]
}
# configure for base-station node
$ns node-config -adhocRouting $opt(adhocRouting) \
-llType $opt(ll) \
-macType $opt(mac) \
-ifqType $opt(ifq) \
-ifqLen $opt(ifqlen) \
-antType $opt(ant) \
-propType $opt(prop) \
-phyType $opt(netif) \
-channelType $opt(chan) \
-topoInstance $topo \
-wiredRouting ON \
-agentTrace ON \
-routerTrace OFF \
-macTrace OFF
#create base-station node
set temp {2.0.0 2.0.1} ;# hier address to be used for wireless
;# domain
set BS(0) [$ns node [lindex $temp 0]]
$BS(0) random-motion 0 ;# disable random motion
#provide some co-ord (fixed) to base station node
$BS(0) set X_ 1.0
$BS(0) set Y_ 2.0
$BS(0) set Z_ 0.0
# create mobilenodes in the same domain as BS(0)
# note the position and movement of mobilenodes is as defined
# in $opt(sc)
#configure for mobilenodes
$ns node-config -wiredRouting OFF
for {set j 0} {$j < $opt(nn)} {incr j} {
set node_($j) [ $ns node [lindex $temp \
[expr $j+1]] ]
$node_($j) base-station [AddrParams addr2id \
[$BS(0) node-addr]]
}
#create links between wired and BS nodes
$ns duplex-link $W(0) $W(1) 5Mb 2ms DropTail
$ns duplex-link $W(2) $W(1) 5Mb 2ms DropTail
$ns duplex-link $W(1) $BS(0) 5Mb 2ms DropTail
$ns duplex-link $W(3) $BS(0) 5Mb 2ms DropTail
$ns duplex-link-op $W(0) $W(1) orient down
$ns duplex-link-op $W(1) $BS(0) orient left-down
set serverid [$W(2) id]
set serverid1 [$W(3) id]
set dnsid [$W(1) id]
set serverid [$W(2) id]
set serverid1 [$W(3) id]
set dnsid [$W(1) id]
# agents
set sipA [new Agent/SIP jwjung www.nist.gov]
$sipA set packetSize_ 1000
$sipA set print_ 0 ;# if set 1 , display message flow on screen
$sipA set Server_ $serverid
$sipA set Lifetime_ 120
$sipA set Mode_ 1
$ns attach-agent $node_(0) $sipA
set sipB [new Agent/SIP bykim www.nist.gov]
$sipB set packetSize_ 1000
$sipB set print_ 0
$sipB set Server_ $serverid
$sipB set Mode_ 1
$sipB set Lifetime_ 120
$ns attach-agent $W(0) $sipB
set dnsServer [new Agent/DNSAgent]
$dnsServer set print_ 0
$ns attach-agent $W(1) $dnsServer
set sipC [new Agent/SIPRedirect www.nist.gov]
$sipC set packetSize_ 1000
$sipC set print_ 1
$ns attach-agent $W(2) $sipC
set sipD [new Agent/SIPRedirect www.antd.gov]
$sipD set packetSize_ 1000
$sipD set print_ 1
$ns attach-agent $W(3) $sipD
#$ns connect $sipA $sipB
#Setup a RTP traffic over SIP connection
set st [new Application/SIPTraffic]
$st attach-agent $sipA
#$cbr set type_ CBR
$st set packetSize_ 500
$st set rate_ 1mb
$st set random_ false
#finish procedure
proc finish {} {
global ns tf #nf
$ns flush-trace
close $tf
#close $nf
puts "Running NS-simulation"
# exec nam out_sip_test.nam &
#exec nam out.nam &
exit 0
}
$ns at 1.0 "$sipA register $serverid" ;# register its location
with proxy or redirect server
$ns at 1.2 "$sipB register $serverid1" ;# register its location
with protyx or redirect server
$ns at 1.4 "$sipC register $dnsid"
$ns at 1.4 "$sipD register $dnsid"
$ns at 2.0 "$st start bykim www.nist.gov"
$ns at 4.0 "$st send"
$ns at 8.0 "$st stop"
$ns at 10.0 "finish"
$ns run
Many thanks,
Bo Peng
--------------------------------------
Bo Peng
Institute of Integrated Information Systems
School of Electronic and Electrical Engineering
University of Leeds
Leeds, LS2 9JT, UK
E-mail:eenbp at leeds.ac.uk
--------------------------------------
More information about the Ns-users
mailing list