[Click] Help with Click HashMap
Swati Sinha Deb
Swati.Deb at bristol.ac.uk
Tue Apr 4 10:35:55 EDT 2006
Hi,
I am trying to implement HashMap of click. The key is of unsigned. I have
used user annotation to set the key and the value in the hashMap is of
WriatablePacket*. The problem is that I am not able to retrieve the packet
in my callback function. It seems that packets are getting destroyed.
Can you please have a look at my sample code. Any advice would be highly
appreciated. Thanks.
typedef HashMap <unsigned, WritablePacket *> PktMap;
Inline Packet * PktHandler::smaction (Packet *p_in)
{
WritablePacket *p = p_in->uniqueify();
//set the USER ANNO at 0 byte
p->set_user_anno_u(0, counter);
uint32_t _pktid = p->user_anno_u(0);
_pkt_map.insert(_pktid, p);
.....................
return p;
}
void PktHandler::callback(uint32_t pktid_, int token_)
{
WritablePacket *p = _pkt_map.find(pktid_);
//here I am not able to read the packet p.
.....................
}
regards,
Swati
More information about the click
mailing list