Help needed. Problem using Notification Board in SCTP

228 views
Skip to first unread message

Ariff

unread,
Jul 7, 2011, 1:09:31 PM7/7/11
to omnetpp
Hello everyone.

I am very new to this group, and i am a total noob in OMNET++ and
inetmanet.


I tried to subscribe sctp to the notification board (NB). I wrote the
following codes in "SCTP.cc". I have also included the libraries that
I think is needed to subscribe to the NB. the following is part of the
codes:

=============THE CODES START===============================
#include "Radio80211aControlInfo_m.h"
#include "Ieee80211Frame_m.h"
#include "NotificationBoard.h"
#include "NotifierConsts.h"
#include "INotifiable.h"

void SCTP::initialize()
{
nextEphemeralPort = (uint16)(intrand(10000) + 30000);

//sctpEV3<<"SCTPMain initialize\n";

cModule *netw = simulation.getSystemModule();



//===CODES I ADDED START
NotificationBoard *nb = NotificationBoardAccess().get();
nb->subscribe(this, NF_LINK_FULL_PROMISCUOUS);
//===CODES I ADDED END



testing = netw->hasPar("testing") && netw-
>par("testing").boolValue();
if(testing) {
}
if (netw->hasPar("testTimeout"))
{
testTimeout = (simtime_t)netw->par("testTimeout");
}
numPacketsReceived = 0;
numPacketsDropped = 0;
sizeConnMap = 0;
if ((bool)par("udpEncapsEnabled"))
bindPortForUDP();
}

//===CODES I ADDED START
void SCTP::receiveChangeNotification(int category, const cPolymorphic
*details)
{
Enter_Method("SCTP");
printNotificationBanner(category, details);

if(category == NF_LINK_FULL_PROMISCUOUS)
{
cMessage* msg = check_and_cast<cMessage*>(details);
Radio80211aControlInfo *cinfo = dynamic_cast<Radio80211aControlInfo
*>(msg->getControlInfo());

double powrec = cinfo->getRecPow();
sctpEV3 << "Received Power (powrec) = " << powrec << endl;

Ieee80211DataOrMgmtFrame *frame =
dynamic_cast<Ieee80211DataOrMgmtFrame*>(msg);
if(frame)
sctpEV3<< "Received from: "<< frame->getTransmitterAddress() <<
endl;
}
}
//===CODES I ADDED

===========================THE CODES END=====================

but i got this error:

no matching function for call to 'NotificationBoard::subscribe(SCTP*
const, <anonymous enum>)' SCTP.cc /inetmanet/src/transport/sctp line
107 C/C++ Problem

Please help me. I don't know what the problem is, because i have
alrady included the NotificaitonBoard.h library.
Please anybody, teach me what the problem is.


regards,
ariff



Ariff

unread,
Jul 7, 2011, 9:27:42 PM7/7/11
to omnetpp
Hi,

Already got it. I forgot to put "public INotifiable" at the class in
SCTP.h file :

=============ORIGINAL CODE======================
class INET_API SCTP : public cSimpleModule
{
....
};

it should be as follows:
==============MODIFIED CODE====================
class INET_API SCTP : public cSimpleModule, public INotifiable
{
....
};

regards,
ariff
Reply all
Reply to author
Forward
0 new messages