[ns] Packet Ack

2006-01-25 Thread Andrea Occari

Hi,

which fields are accessible in the Ack package?

how to enter in the header?
..
hrd_XXX *ack = hdr_XXX::access(p) it is corrected?  (where XXX are the
name of the header)

thanks, Andrea


Re: [ns] Agent::recv method not reached

2006-01-25 Thread Hailun Tan

There is no mistake actually...Just NS2 did not exactly follow the OSI
modelSome short cut to solve this problem: try to change the port
number of the packet into 255 when it was originated from the
source...Then the recv() can be invoked when the packet reaches the
destination!!!But in order for the upper layer to receive the packet, you
have to change the port number back to its original value and send it to
upper layer once recv() is called in destination.Hope it helps!!



 I am a novice to the internals of ns-2. I would appreciate it if you can
 tell me where the mistake it. Looking at the structural diagram did not
 give me any answers w/ respect to multiple interfaces!
 Thanks,
 Sita



 I am not sure if you are talking about this problem on routing
 agent...If
 yes, it is normal since if you checked the structurural diagram of a
 mobile node in NS2, you can find out that once the packet reaches the
 destination, the address classifier and port classifier will forward it
 in
 different way and the recv() in routing agent does not get invoked at
 all...The solution also lies in that structural diagram!!!Think about
 the
 condition on which address classifier and port classfier will make
 different selection!!

 Hailun Tan

 Hi There,
 Thank you again for the reply. This is not my work, I am trying to use
 something from NRL for my WSN work. Basically they have multiple
 interfaces to a node. One channel carries just sensing info and another
 channel is used for routing to sink. They want the sensing info to come
 to
 the agent, so that it can send info about it to the sink on the other
 channel. That is why they have the up-target statement in the tcl code.
 By
 doing this, I was hoping the recv will come to the agent and it can
 handle
 it, but it does not. So I am not sure if the problem is in the
 interface
 implementation or somewhere else. Please share your thoughts.
 Regards,
 Sita


 Hi again,

 Yes I understand a little more of what you are trying to accomplish,
 but
 i
 still have some questions; Are you modifying an existing routing
 protocol
 in ns2? Do packets get forwarded correctly from source to destination
 according to your Mac level trace? If the packets don't get forwarded
 there is as you say something wrong with the link layer's connection
 to
 the network layer (Your Router-module). When I designed my routing
 protocol I started out with AODV and modified it. Also there are some
 pictures of the architecture of the ns2 layers on the Internet that
 may
 help you. And finally, you say that you changed some thing in the Link
 layer's up target so your routing module will be the receiver of
 packets,
 I'm not sure if you need to do that, if I remember correctly a
 classifier
 gets the packet from the link layer and the classifier decides if the
 packet shall be sent to the routing module for processing (forwarding)
 or
 if the packet shall be sent to agent level (when the pac
 ket have reached it's destination).

 Regards Micke

 - Originalmeddelande -
 Från: Sita S. Krishnakumar [EMAIL PROTECTED]
 Datum: Tisdag, Januari 24, 2006 16:58
 Ämne: Re: [ns] Agent::recv method not reached

 Mikael,
 Thanks for your reply. I have more information that may shed more
 light on
 the problem.
 I basically have a new agent designed. In my code, I specify that
 the link
 layer's 'up-target' is my agent node so that it can come to my
 recv() for
 processing. But looks like that is not working fine.
 The MAC layer receives the packet but the agent does not. That is
 why I
 see it in the MAC trace but not in the agent trace. Even if it
 does not
 come to  my recv(), it should go to the agent's recv() - but it
 does not
 go there either. So I am not sure where it goes altogether. Also I
 am not
 sure what the 'add-ll' does when an agent is created. I am trying
 to add
 someone else's work. I am not sure why they didn't have an add-ll
 statement.
 This is work from NRL and they say it works in 2.27, I am trying
 to get it
 to work in 2.29
 Thanks,
 Sita


  Hi,
 
  I had a similar problem, but I?m not sure if I understand
 exactly what you
  mean.
  If you are sending one packet from source to destination
 over some
  number of intermediate nodes, you will only see the packet at
 agent level,
  if you have that trace level turned on in ns2 and you will only
 see it at
  the source and destination node. If you want to do something
 with your
  routing protocol when a data packet has been received at the
 destination you have to understand that ns2's layers don't
 exactly work as the OSI
  reference model. When a data packet reaches it's destination a
 classifier sends it to the agent layer, so you will never see
 this packet at the
  router layer(Network layer). If I remember correctly this has
 some thing
  to do with the mobile node class. I know for a fact that the AODVUU
  implementation uses a newer class where packets are received and
 sent bottom up through all layers. So you could 

[ns] Please Help : Multicast cache-miss: can't read protocols

2006-01-25 Thread mmulibra

This is a repost message :

Hi All,

I would like to simulate a simple multicast of 5 nodes, where there are 2
groups and 2 sources and 2 nodes leaving and joining different groups.
However I got this error :

ns: _o15 new-group 0 -2147483648 -1 cache-miss: can't read protocols_(-1):
no such variable
while executing
$protocols_($iface) upcall $code $source $group $iface
(procedure _o16 line 9)
(mrtObject upcall line 9)
invoked from within
$mrtObject_ upcall $code $src $group $iface
(procedure _o10 line 3)
(Node new-group line 3)
invoked from within
$node_ new-group $src $group $iface $code
(procedure _o15 line 3)
(Classifier/Multicast new-group line 3)
invoked from within
_o15 new-group 0 -2147483648 -1 cache-miss

Hopefully someone can give me a hint
Thanks for your kind attention



Here is my tcl script:
-

set ns [new Simulator -multicast on]

# Dense Mode Multicast Protocol
set mproto DM
set mrthandle [$ns mrtproto $mproto {}]

# allocate a multicast address;
set group0 [Node allocaddr]
set group1 [Node allocaddr]

# Open nam tracefile
set nf [open prob1.nam w]

# Open tracefile
set nt [open trace.tr w]

$ns namtrace-all $nf
$ns trace-all $nt

$ns color 1 red
# the nam colors for the prune packets
$ns color 30 purple
# the nam colors for the graft packets
$ns color 31 green

#Define a 'finish' procedure
proc finish {} {
global ns nf nt
$ns flush-trace
close $nf
close $nt
puts running nam...
exec nam -a prob1.nam 
exit 0
}

# create 5 nodes
puts create 5 nodes now.

set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
set n5 [$ns node]

puts create connections now.

# Create connection
$ns duplex-link $n1 $n2 1Mb 5ms DropTail
$ns duplex-link $n2 $n3 1Mb 5ms DropTail
$ns duplex-link $n3 $n4 1Mb 5ms DropTail
$ns duplex-link $n2 $n4 1Mb 5ms DropTail
$ns duplex-link $n2 $n5 1Mb 5ms DropTail

# Node orientation
$ns duplex-link-op $n1 $n2 orient right
$ns duplex-link-op $n2 $n3 orient right
$ns duplex-link-op $n3 $n4 orient right
$ns duplex-link-op $n2 $n4 orient down
$ns duplex-link-op $n2 $n5 orient up

puts Create agents and attach to appropriate nodes...

# Create agents and attach to appropriate nodes
set udp0 [new Agent/UDP]
$ns attach-agent $n1 $udp0
$udp0 set dst_addr_ $group0
$udp0 set dst_port_ 0
set cbr0 [new Application/Traffic/CBR]
$cbr0 attach-agent $udp0

set udp1 [new Agent/UDP]
$ns attach-agent $n3 $udp1
$udp1 set dst_addr_ $group1
$udp1 set dst_port_ 1
set cbr1 [new Application/Traffic/CBR]
$cbr1 attach-agent $udp1

puts schedule transmitting packets...
# create receiver agents
set rcvr0 [new Agent/LossMonitor]
set rcvr1 [new Agent/LossMonitor]

$ns attach-agent $n4 $rcvr0
$ns attach-agent $n5 $rcvr1

# joining and leaving the group;
$ns at 0.10 $n4 join-group $rcvr0 $group0
$ns at 0.12 $n5 join-group $rcvr1 $group0
$ns at 0.50 $n4 leave-group $rcvr0 $group0
$ns at 0.60 $n4 join-group $rcvr0 $group1

$ns at 0.05 $cbr0 start
$ns at 0.05 $cbr1 start
$ns at 0.80 finish
$ns run