[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] interaction between layers



Dear all,
I face the following problem:
I wrote a public function in DSRAgent  class (which is an NsObject's
heir) . this function is declared in dsragent.h as follow: "int
DsrForTcp(Packet *);"

I'd like call it from tcp.cc code, so I do:
"int xxx = ((DSRAgent*)target_)->DsrForTcp(p);".
It compiles properly, but at execution I have the error message:
"Segmentation fault (core dumped)". Under gdb debugger, I have the
following message when the previous line is executed: "Program received
signal SIGSEGV, Segmentation fault. 0xbea34 in TcpAgent::output
(this=0x6b1830, seqno=0, reason=0) at tcp.cc:521"

If I don't put "(DSRAgent*)",  there is a problem when compile since no
function "DsrForTcp()" is found in DSRAgent object.
I don't understand why it doesn't work. Is there any other mean to
perform comparable interactions between layers ?
I would appreciate some help.
Thanks by advance
Herve.