I am creating my own protocol in ns. Let me explain what the problem
is. I have 4 nodes, 1,2,3 and 4. 1,2 and 3 are connected to 4 and the
send packets to 4. 4 must process the packet and send back the response
to the other 3 nodes. The problem is that 4 always sends the packet to 3
even if the source was 1 or 2.

   I have realised that "here_.addr_" when the packet is received is
always 3 (even if 1 or 2 sent the packet) but I do not why. I tried to
change src_.addr to 1 or 2 but then I got an error in execution
(something about the classifier has no slots). Any ideas on how to solve it?

  This is part of the tcl code:

#Setup RL Agent Flows
set rl0 [new Agent/RL_Agent]
$ns attach-agent $n5 $rl0

#Setup RL Main Agent
set rl1 [new Agent/RL_Agent]
$ns attach-agent $n6 $rl1
$ns connect $rl0 $rl1

# RL queue agent
set rl2 [new Agent/RL_Agent]
$ns attach-agent $n2 $rl2
$ns connect $rl2 $rl1

# RL congestion agent
set rl3 [new Agent/RL_Agent]
$ns attach-agent $n3 $rl3
$ns connect $rl3 $rl1




  This is part of the c++ code:

from the sent:
Packet* p = allocpkt();
      hdr_rl* rlh = hdr_rl::access(p);
      rlh->send_time() = Scheduler::instance().clock();
      rlh->payload() = action_;
      rlh->node_id() = here_.addr_;
      rlh->p_type() = t_act;
      cout << "packet: sent time: " << stime << " from: " << here_.addr_
<< " to: " << dst_.addr_ << " type: " << t_act << " value: " << action_
<< endl;
      // Send the packet
      send(p, 0);

from received:
// Access the  header for the received packet:
   hdr_rl* hdr = hdr_rl::access(pkt);
   double stime = hdr->send_time_;
   int ptype_ = hdr->p_type_;
   int nodeid_ = hdr->node_id_;
   cout << "packet: received time: " << stime << " from: " << nodeid_ <<
"," << dst_.addr_ << " type: " << ptype_ << " value: " << hdr->payload_
<< " msg: I' am: " << here_.addr_;

   Here the dst.addr is always 3 (nodeide_ is part of my packet and
there I can see the mismatch -mine is correct, 1, 2 or 3-)


Thanks,
-as

Reply via email to