Hello!
Seems to me that at the time when you try to access thisaodv->energy,
thisaodv is null. Trying to dereference a null pointer would give you a
Segfault for sure.
Have you tried to test whether thisaodv is null before doing
thisaodv->energy=thisaodv->energy-1;
?
Is thisaodv ever set correctly?
Good luck,
Martina
etudiante usthb schrieb:
> Hello.
>
> I’m trying to modify the routing protocol AODV. For this cause, I add a
> member variable “energy” in the AODV class (aodv.h ) and modify it in
> aodv.cc file.
> I want to recover this member variable of the class AODV which represents
> this value of energy "energy" and to use it in MAC_802-11.cc file and to
> decrease it in the method recvDATA but I had a bug :"Segmentation fault" at
> the execution of the programme!!. (I want to reach the same variable
> “energy” and to modify the same value in memory).
> Veiled how I recovered this variable:
> In file mac_802-11.h I added:
> #include "aodv/aodv.h"
> ............
> class Mac802_11 : public Mac {
> ...........
> friend class aodv;
> public:
> ................
> AODV *thisaodv;
> ...............
> }
>
> In file mac_802-11.cc I added:
> void Mac802_11::recvDATA(Packet *p)
> {
> .............
> thisaodv->energy=thisaodv->energy-1;
> ..............
> }
>
> Where is the problem please. If it is possible, can you propose me other
> solutions.
>
> Thank you in advance
>
> _________________________________________________________________
> Personnalisez votre Messenger avec Live.com
> http://www.windowslive.fr/livecom/