Hi all

I am working with the IEEE 802.15.4 ns-2 implementation. I added a new packet 
type and I have problems when I try to send it.

I define the packet, which size of payload is 8 bytes (ch->size() = 8 + 
IP_HEADER_LEN). Then, I populate the HDR_CMN fields like this:
_______________________________________
struct hdr_cmn *ch = HDR_CMN(p);

ch->ptype() = PT_MYTYPE;
ch->size() = 8 + IP_HEADER_LEN 

ch->iface() = -2;
ch->error() = 0;
ch->prev_hop_ = address;//node's address
ch->next_hop_ = IP_BROADCAST;//It is a broadcast transmission 
ch->addr_type() =NS_AF_NONE;
ch->direction() = hdr_cmn::DOWN;
_______________________________________ 


and the HDR_fields:
_______________________________________ 

struct hdr_ip *ih = HDR_IP(p);
ih->saddr() = address;
ih->daddr() = IP_BROADCAST;
ih->sport() = RT_PORT;
ih->dport() = RT_PORT;
ih->ttl_ = 1;
_______________________________________ 

and I send it from the routing layer (AODV) with: 
_______________________________________ 

Scheduler::instance().schedule(target_, p, 0.0);

_______________________________________ 


This packet is transmitted periodically. Then, when I check the trace file, the 
simulator generates the following: The first time that the packet is 
transmitted, its size at the routing layer is 120 when it should be 8+20 = 28 
bytes:

...
s 400.000000000 _0_ RTR  --- 0 my_type 120 [0 0 0 0] ------- [0:255 -1:255 1 0] 

s 400.000345000 _0_ MAC  --- 0 my_type  127 [0 ffffffff 0 800] ------- [0:255 
-1:255 1 0] 

...

And the rest of messages have the correct size but they never go to the MAC 
layer but to the IFQ (and dropped). 

...
s 469.298724000 _0_ RTR  --- 0 my_type 28 [0 0 0 0] ------- [0:255 -1:255 1 0] 
D 469.298749000 _0_ IFQ  --- 0 my_type 28 [0 ffffffff 0 800] ------- [0:255 
-1:255 1 0]
...

I do not understant what I am doing wrong and why this is happening. If there 
are no ideas about the first problem (strange size of the packet), I would like 
to know  why a packet is sent to the IFQ.

I appreciate all the help possible.

Thanks in advance,
 
David

Reply via email to