[ns] broadcast works! but can't trace when SENDING!

kenneth at daimi kenneth at daimi.au.dk
Thu Feb 19 10:24:06 PST 2004


Ok, this one is new.

Finally I got broadcast to work thanks to Jeff Boleng posting:
http://mailman.isi.edu/pipermail/ns-users/2000-June/009635.html

So I can know send and receive packets using broadcast.
The problem is that I CAN'T see the packets send by the agent (AGT) in the trace file.
What I can see is the packets send and received by the MAC, and only see the packets received by the AGT. I repeat, I can't see the packets send by AGT.

As a said I made the necesary changes proposed by Jeff Boleng.

Somebody have the solution to my problem?

Regards, Kenneth

THIS IS THE C++ CODE THAT SEND THE PACKET.

      Packet* pkt = allocpkt(); 
      hdr_cmn* cmnhdr = hdr_cmn::access(pkt);
      hdr_ip* iphdr = hdr_ip::access(pkt);
      hdr_ping* hdr = hdr_ping::access(pkt);
      iphdr->daddr() = IP_BROADCAST;
      iphdr->dport() = 5555;
      iphdr->ttl() = 1;
      hdr->ret = 0;
      hdr->send_time = Scheduler::instance().clock();
      Scheduler::instance().schedule(ll, pkt, 0.0);

THIS IS THE TCL CODE


# ======================================================================
# Define options
# ======================================================================

set val(chan)       Channel/WirelessChannel
set val(prop)       Propagation/FreeSpace
set val(netif)      Phy/WirelessPhy

set val(mac)        Mac/802_11

set val(ifq)        Queue/DropTail/PriQueue
set val(ll)         LL
set val(ant)        Antenna/OmniAntenna
set val(x)              670   ;# X dimension of the topography
set val(y)              670   ;# Y dimension of the topography
set val(ifqlen)         50            ;# max packet in ifq
set val(seed)           0.0

set val(adhocRouting)   FLOODING
# when set to flooding, only one node is accounted for....

set val(nn)             2           ;# how many nodes are simulated
set val(stop)           200.0           ;# simulation time

# =====================================================================
# Main Program
# ======================================================================
set ns_        [new Simulator]

set topo    [new Topography]
set tracefd    [open flood.tr w]
$ns_ trace-all $tracefd

set namtrace [open flood.nam w]
$ns_ namtrace-all-wireless $namtrace $val(x) $val(y)
$topo load_flatgrid $val(x) $val(y)
set god_ [create-god $val(nn)]
set chan_1_ [new $val(chan)]

#global node setting
$ns_ node-config -adhocRouting $val(adhocRouting) \
                  -llType $val(ll) \
                  -macType $val(mac) \
                  -ifqType $val(ifq) \
                  -ifqLen $val(ifqlen) \
                  -antType $val(ant) \
                  -propType $val(prop) \
                  -phyType $val(netif) \
          -topoInstance $topo \
          -agentTrace ON \
                  -routerTrace OFF \
                  -macTrace ON \
          -mobilityTrace OFF \
          -channel $chan_1_

for {set i 0} {$i < $val(nn) } {incr i} {
     set node_($i) [$ns_ node $i]
     $node_($i) random-motion 0        ;# disable random motion
}

$node_(0) set Z_ 0.000000000000
$node_(0) set Y_ 0.00
$node_(0) set X_ 0.00

$node_(1) set Z_ 0.000000000000
$node_(1) set Y_ 0.0
$node_(1) set X_ 10.0

set g_(0) [new Agent/MyPing]
set g_(1) [new Agent/MyPing]

$node_(0) attach $g_(0) 5555
$node_(1) attach $g_(1) 5555

set all(0) [$node_(0) set ll_(0)]
set all(1) [$node_(1) set ll_(0)]

$ns_ at 0.0 "$g_(0) set-ll $all(0)"
$ns_ at 0.0 "$g_(1) set-ll $all(1)"


$ns_ at 1.0 "$g_(0) send"

for {set i 0} {$i < $val(nn) } {incr i} {
     $ns_ at $val(stop).0 "$node_($i) reset";
}

$ns_ at  $val(stop).0002 "puts \"NS EXITING...\" ; $ns_ halt"
$ns_ run


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gamma.isi.edu/pipermail/ns-users/attachments/20040219/eaffcfcf/attachment.html


More information about the Ns-users mailing list