Dear all, I am implementing a network coding protocol in ns2 currently. I created a Droptail queue for the outgoing packets (coded packets) in my source code. But I don't know how to forward the packets in this Droptail queue except the first one. ----------- whenever the routing agent receives a native packet ( non-coded packet) from upper layer, it deques a packet from the droptail queue and forwards it using the forward_data() function as show below:
- - - - - - - -- - -- - - - - - - - - - - - - - - - - - - - -- - - - forward_data(Packet* p) { struct hdr_cmn* ch = HDR_CMN(p); struct hdr_ip* ih = HDR_IP(p); ....... ....... ....... Scheduler::instance().schedule(target_, p, 0.0); } } ------------------------------------------------------------------------- So far as I know, when the MAC layer successfully transmitted a packet, it will call the tx_resume( ) function, which will call the *"callback_" handler* to tell the upper layer to transmit another data packet to MAC. This is defined in the following code: ------------------------------------------ void Mac802_11::tx_resume() { ...... ...... ...... ...... } else if(callback_) { Handler *h = callback_; callback_ = 0; h->handle((Event*) 0); } ...... } ------------------------------------------------ Also, according to a tutorial of 802.11MAC in NS2 on the internet, this *"callback_" handler* is a callback function of the upper level agent such as queue's resume function. Yet still, I don't understand how this "callback_" works exactly. And as for my case, what should I do so that I can continue to forward packets in the Droptail queue? I've been stuck on this for days, please help me. Any advice will be appreciate. Thanks in advance. Lishu