Re: [ns] sending packets

2006-10-09 Thread Pedro Vale Estrela


Inside my recv() function I do like this without problems:


// clone the current packet and change some fields
Packet* new_p = clone_pkt(p);

hdr_ip*new_iph  = hdr_ip::access(new_p);

new_iph-daddr() = ...;
new_iph-saddr() = addr();

// change fields on the current packet
iph-daddr() = id2iaddr(th-b_id);
iph-saddr() = addr();


// send original packet somewhere
send(p, 0);

// send cloned packet elsewhere
send(new_p, 0);

...





 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
 Of Larry Brigman
 Sent: segunda-feira, 9 de Outubro de 2006 19:14
 To: ns-users@ISI.EDU
 Subject: [ns] sending packets
 
 
 I am working on a queuing model.  There are times that I need to
 send more than one packet in the recv function.
 
 Because of the way NS models things it looks like after a single send or
 target-recv(p,h) I cannot send again without an error.
 
 Is there a way to write a recv function that is allowed to send more than
 once?
 
 Also when I am rescheduling my class to deque packets, about the time I
 need to
 deque two or more packets NS detects that time has gone backwards!
 
 
 I am running this on FC4 using 2.29 version of NS.
 
 Thanks for any help provided.
 Larry





Re: [ns] sending packets

2006-10-09 Thread Larry Brigman

On 10/9/06, Pedro Vale Estrela [EMAIL PROTECTED] wrote:

 Inside my recv() function I do like this without problems:


 // clone the current packet and change some fields
 Packet* new_p = clone_pkt(p);

 hdr_ip*new_iph  = hdr_ip::access(new_p);

 new_iph-daddr() = ...;
 new_iph-saddr() = addr();

 // change fields on the current packet
 iph-daddr() = id2iaddr(th-b_id);
 iph-saddr() = addr();


 // send original packet somewhere
 send(p, 0);

 // send cloned packet elsewhere
 send(new_p, 0);

That doesn't seem to work for me when my class inherits from the queue class.

In my recv function I am doing:
while ((pkt = deque()) != NULL) {
send(pkt,0);
}

I get this error:
Scheduler: attempt to schedule an event with a NULL handler.  Don't DO that.

If I change it to use the handler that is inherited from the queue class as
while ((pkt = deque()) != NULL) {
send(pkt,qh_);
}

I get an error like:
Scheduler: Event UID not valid!


If I only do process one packet each time recv is called but always
schedule() with a small
delay, I get NS time backwards error.

I need to schedule every 5-10ms even if no packets are arriving as the
object may have
held packets because of the queuing functions.



Re: [ns] sending packets

2006-10-09 Thread Larry Brigman

No, I need to send different p during the same recv function.
(ie I need to deque multiple packets)

On 10/9/06, Raghu-kisore Neelisetti [EMAIL PROTECTED] wrote:
 Hi,
  Iam not sure If i understood you right. You cannot send the same 'p'
 over and over again (If this what u meant). The way to avoid the problem
 is
 target-recv(p,h)
 //Now make a copy of the p that you sent before and then
 target-recv(p,h)

 Iam sorry if i misunderstood you.
 raghu.


  Larry Brigman [EMAIL PROTECTED] 10/09/06 1:14 PM 
 I am working on a queuing model.  There are times that I need to
 send more than one packet in the recv function.

 Because of the way NS models things it looks like after a single send or
 target-recv(p,h) I cannot send again without an error.

 Is there a way to write a recv function that is allowed to send more
 than once?

 Also when I am rescheduling my class to deque packets, about the time I
 need to
 deque two or more packets NS detects that time has gone backwards!


 I am running this on FC4 using 2.29 version of NS.

 Thanks for any help provided.
 Larry