Hi,
I don't think you want to classify packets in mac layer. Instead, you want
your packets to be submitted to aodv. Thus, in aodv.cc, you need to identify
your packets in AODV::recv(Packet *p). In fact, as you know, all packets first
arrive at such a recv function in any layer. So if you want to do anything
about your packets, it should be in this function.
Then how to identify your packets
you need to register your packet header in common/packet.h
then you can set hdr_cmn and use it to identify your packets and do something.
hdr_cmn *ch = HDR_CMN(p)
when you send a packet, set the packet type as yours,
when you recv it in aodv
if(ch->ptype() == PT_YOUR_TYPE) {
recvMYPACKT(p); //change to execute your code instead of recvAODV(p)
return;
}
Detailed how to register your header can be referred to
Implementing a New Manet Unicast Routing Protocol in NS2
see the "needed changes" part.
BTW, how to suppress duplicate packets I have sent. I do not want to read
aodv code if you already know.
Best,
Pei
Mubashir Rehmani <[EMAIL PROTECTED]> wrote:
Hello Daniel
I hope that you are fine. I need your help to resolve my problem in ns2.
Basically i am using AODV.cc and as you know that AODV has many types of
packets like HELLO, RREQ etc. I have declared my own packet header in AODV.cc
and i used it for unicasting. Now the problem is that when i send my own packet
from source to destination in AODV.cc then first this packet is received in MAC
802.11.cc file in the recv_timer() function and then in this recv_timer()
function all the packets are classified. For instance if the packet is Control
like RTS/CTS/ACK then recv_timer() call functions like recvRTS() etc etc. and
if the packet is data packet, as Hello or my own packet then it just check
whether it is data packet or not and just call the recvDATA() packet in
mac-802.11.cc and then this function send packet to upword layer to recv()
function that is present in AODV.cc file. Then further action is taken place
and packets are being dropped there.
Now my problem is that when i send my own packet from particular source to
destination then at the mac layer all the nodes that are in the communication
range will listen this packet and discard them at the mac layer (control
packets) but if the packet is data packet, in the mac layer it will not
classify the data packet, instead it will just check whether it is a data
packet or not and then forward it to upper layer.
What i want to do is that at the mac layer, in the recv_timer() function, the
mac layer should classify the data packet and if it found that at the mac layer
that this is a data packet and of type HELLO or RREQ then discard them or if it
is my own data packet type then forward it to upper layer.
I hope you understand my question.
Thanks in advance.
Regards
--
Mubashir Husain Rehmani
Mobile : 00 33 (0)6 32 00 89 35
__________________________________________________
赶快注册雅虎超大容量免费邮箱?
http://cn.mail.yahoo.com