[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [ns] Packet Caching
HEllo,
HEre is the code. I don't have the complete code in the place i currently
am in. I am sending you the key lines.
void cache_packet(Packet *p)
{
Packet *pack = p->copy();
... obtain the seq no of packet
cache.insert(make_pair(seqno,pack));
/*
cache is a map class of the form
map<int,Packet *>
*/
my_ll->sendUp(p);
//here the original packet is sent up the link
//layer
//If i don't store the copy of the packet in the map class, the
//packet is successfully up the stack
//however, moment i store the copy in the map class,
//the original packet is not sent. I don't know what happens to
//it. I cannot explain the behavior. If i don't store it anywhere
// the whole purpose of caching is defeated
}
If u know of any other structure that can store the packets successfully,
kindly let me know.
Thanks
Aashish Patil
On Tue, 27 Nov 2001, Neundorf Alexander wrote:
>
>
> --
> Free Dmitry Sklyarov !
> http://www.freesklyarov.org
>
> > -----Original Message-----
> > From: aashishp [SMTP:[email protected]]
> > Sent: Tuesday, November 27, 2001 4:17 AM
> > To: [email protected]
> > Subject: [ns] Packet Caching
> >
> > Hello,
> >
> > I am trying to cache packets in intermediate nodes at the link layer.
> > However, I am having problems storing the packets in some structure.
> > Basically,
> >
> > I create a new copy using the Packet::copy() method.
> > I was storing these copies in a stl map class. However, moment I store
> > this copy, the original packet from which I made this copy is not
> > forwarded using the sendUp(Packet *) method of the link layer.If i don't
> > store then the packet is forwarded. Why should the copy affect the
> > behavior of the original packet?
> >
> > I tried to use an array of Packet* statically allocated. This is giving me
> > segmentation faults. Will dynamically creating an array affect the
> > way
> > Packet class is handled in ns.
> >
> > i.e. if I do
> > Packet *list = new Packet[num]
> >
> > I ask this because packets are already allocated and kept in ns. I will be
> > allocating more by this call
> >
> > Thanks
> >
> > Aashish Patil
> >
> >
> Please send some more of your code, otherwise we can't help.
>
> Bye
> Alex
>