PDA

View Full Version : سوال: خطای cbrp/ntable.h:93:30: error: expected ‘)’ before ‘*’ token



armangara
چهارشنبه 13 دی 1391, 09:03 صبح
سلام
برنامه زیر خطاهای عجیب و غریب می دهد. چندین کلاس هست که همه شان مشکل دارند اما برای نمونه یک کلاس را گذاشتم و خطایی رو که میدهد هم در پایین گذاشتم. ممنون میشم راهنماییم کنید.

/* ntable.h -*- c++ -*-
NeighborTable is maintained by each node.
*/
#ifndef ntable_h_
#define ntable_h_

#include "config.h"
#include "scheduler.h"
#include "queue.h"
#include "cbrpagent.h"

#define BIG 250

#define MAX_NODE_NUM 150

#define CBRP_BROADCAST_JITTER 0.15
#define CBRP_STARTUP_JITTER 0.1

#define CLUSTER_UNDECIDED 0
#define CLUSTER_MEMBER 1
#define CLUSTER_HEAD 2

#define LINK_BIDIRECTIONAL 3
#define LINK_TO 4 //from me TO the other
#define LINK_FROM 5 // to me FROM the other

#define TIMEOUT_INTEVAL 3.0
#define BROADCAST_INTEVAL 2.0

typedef unsigned int uint;

/* NOTE: we depend on bzero setting the booleans to ``false''
but if false != 0, so many things are screwed up, I don't
know what to say... */

class NeighborTablePeriodicHandler;
class NeighborTableTimeoutHandler;
class NeighborTableCFormationHandler;

class ntable_ent {
public:
ntable_ent() { bzero(this, sizeof(struct ntable_ent));}
nsaddr_t neighbor; //target node
uint neighbor_status; //whether neighbor is a cluster member,
//head or undecided
uint link_status; // whether the link with this neighbor is
// bidirectional or unidirectional link
double RxPr_new; // Last signal sample
double RxPr_old; // previous signal sample
double M_rel; //relative mobility
double neighbor_M_rel_aggregate; // neighbor node's aggregated mobility

double last_update; //last update time for this entry
Packet* n_pkt;
Event* timeout_event; //time out event sent out
ntable_ent *next; //pointer to the next entry
};

class nexthop_ent {
public:
nexthop_ent() { bzero(this,sizeof(struct nexthop_ent)); }
nsaddr_t next_node;
Event* timeout_event;
nexthop_ent *next;
};

class adjtable_ent {
public:
adjtable_ent() { bzero(this, sizeof(struct adjtable_ent));}
nsaddr_t neighbor_cluster; //the neighboring cluster head
nexthop_ent *next_hop; //the next hop node in order to reach neighbor_cluster
adjtable_ent *next; //pointer to the next adjtable_ent
};

class nextnode {
public:
nextnode() {bzero(this,sizeof(struct nextnode));}
nsaddr_t the_node;
nsaddr_t dest_status;
double last_updated;
};

class NeighborTable {

friend class NeighborTablePeriodicHandler; //The handler function inside is invoked periodically to send out BROADCAST messages
friend class NeighborTableTimeoutHandler; // The handler function inside is invoked to remove outdated neighbortable entry
friend class NeighborTableCFormationHandler; // The handler function is invoked to perform cluster formation algorithm.
friend class NeighborTableCContentionHandler; // The handler function is invoked to resolve cluster head contention

friend class CBRP_Agent;
public:

NeighborTable(CBRP_Agent *a_);

void AddUpdateEntry(ntable_ent *ent);
int DeleteEntry(nsaddr_t dest);
ntable_ent *GetEntry(nsaddr_t dest);
bool isNeighbor(nsaddr_t addr);

/* we chose a lazy way to implement the two-hop-topology database
it's implemented using an array whose index X is the node X one
can reach in two hop s and the element kept at the index would
contain info. on the 1-hop-neighbor in order to reach X This is
not a good solution for large sized network, nevertheless it's
simple to keep and fast to check The function AddUpdateQuickAdj(..)
is for updating this array.
-Jinyang */
void AddUpdateQuickAdj(nsaddr_t dest, uint dest_status, nsaddr_t next_node);
nsaddr_t GetQuickNextNode(nsaddr_t dest);
bool existsLink(nsaddr_t from, nsaddr_t to);
/*This member function calculates the aggregated relative mobility*/
void Update_My_M_rel_aggregate();

/* we kept two cluster adjacency tables, one(primary) is for keeping info. abt two-hop away neighbor clusters
the other one (!primary) is for keeping info. abt 3-hop away neighboring clusters */
void AddUpdateAdj(nsaddr_t dest, nsaddr_t next_hop, int primary);
void DeleteAdjEntry(nsaddr_t dest,int primary);
adjtable_ent *GetAdjEntry(nsaddr_t dest_cluster, int primary);

int RemainingLoop();
void InitLoop();
ntable_ent *NextLoop();

Packet *getUpdatePacket();
Packet *getBroadcastPacket();
void processUpdate(Packet *);
void startUp();

#ifdef CBRP_DEBUG
char *printNeighbors();
char *printHELLOpkt(Packet *p);
char *PrintTwoHopNeighbors();
#endif

uint no_of_clusterheads;
uint my_status; //whether I am undecided, cluster head or member only
// double My_M_rel_aggregate; //My aggregated relative mobility
uint my_size;
uint adjtable_size;

Event *periodic_event;
Event *c_form_event;
Event *c_contention_event;

NeighborTablePeriodicHandler *periodic_handler;
NeighborTableTimeoutHandler *timeout_handler;
NeighborTableCFormationHandler *c_formation_handler;
NeighborTableCContentionHandler *c_contention_handler;

protected:
void lostClusterHeads();
nextnode *adjtable;
adjtable_ent *adjtable_1;
adjtable_ent *adjtable_2;

private:
CBRP_Agent *a;
ntable_ent *head;
ntable_ent *prev;
ntable_ent *now;

int in_contention;
int maxelts;
int ctr;
double *last_update; // a supplementary table used to updating the main one
double My_M_rel_aggregate; //The node's aggregated mobility
double mob_threshold; //Threshold value for head decisioning
};


class NeighborTablePeriodicHandler : public Handler {

public:
NeighborTablePeriodicHandler(CBRP_Agent *a_, NeighborTable *t_);

virtual void handle(Event *e);

private:
NeighborTable *t;
CBRP_Agent *a;
Event *periodic_event_;
};

class NeighborTableTimeoutHandler : public Handler {

public:
NeighborTableTimeoutHandler(CBRP_Agent *a_, NeighborTable *t_);
virtual void handle(Event *e);
int checkAdjTimeout(Event *e, int primary);
private:
NeighborTable *t;
CBRP_Agent *a;
};

class NeighborTableCFormationHandler : public Handler {

public:
NeighborTableCFormationHandler(CBRP_Agent *a_, NeighborTable *t_);
virtual void handle(Event *e);

private:
NeighborTable *t;
CBRP_Agent *a;

};
class NeighborTableCContentionHandler: public Handler {
public:
NeighborTableCContentionHandler(CBRP_Agent *a_, NeighborTable *t_);
virtual void handle(Event *e);

private:
NeighborTable *t;
CBRP_Agent *a;
};
#endif
خطا:

cbrp/ntable.h:93:30: error: expected ‘)’ before ‘*’ token
cbrp/ntable.h:148:5: error: ‘NeighborTableCContentionHandler’ does not name a type
cbrp/ntable.h:157:5: error: ‘CBRP_Agent’ does not name a type
cbrp/ntable.h:174:45: error: expected ‘)’ before ‘*’ token
cbrp/ntable.h:180:5: error: ‘CBRP_Agent’ does not name a type
cbrp/ntable.h:187:44: error: expected ‘)’ before ‘*’ token
cbrp/ntable.h:192:5: error: ‘CBRP_Agent’ does not name a type
cbrp/ntable.h:198:47: error: expected ‘)’ before ‘*’ token
cbrp/ntable.h:203:5: error: ‘CBRP_Agent’ does not name a type
cbrp/ntable.h:208:48: error: expected ‘)’ before ‘*’ token
cbrp/ntable.h:213:5: error: ‘CBRP_Agent’ does not name a type
cbrp/cbrpagent.cc: In constructor ‘CBRP_Agent::CBRP_Agent()’:
cbrp/cbrpagent.cc:296:34: error: no matching function for call to ‘NeighborTable::NeighborTable(CBRP_Agent* const)’
cbrp/cbrpagent.cc:296:34: note: candidates are:
cbrp/ntable.h:83:7: note: NeighborTable::NeighborTable()
cbrp/ntable.h:83:7: note: candidate expects 0 arguments, 1 provided
cbrp/ntable.h:83:7: note: NeighborTable::NeighborTable(const NeighborTable&)
cbrp/ntable.h:83:7: note: no known conversion for argument 1 from ‘CBRP_Agent* const’ to ‘const NeighborTable&’
cbrp/cbrpagent.cc: In member function ‘virtual int CBRP_Agent::command(int, const char* const*)’:
cbrp/cbrpagent.cc:371:36: error: ‘class Address’ has no member named ‘str2int’
cbrp/cbrpagent.cc: In member function ‘void CBRP_Agent::handlePktWithoutSR(CBRP_Packet&, bool)’:
cbrp/cbrpagent.cc:654:13: warning: unused variable ‘cbrph’ [-Wunused-variable]
cbrp/cbrpagent.cc: In member function ‘int CBRP_Agent::handleRREP(CBRP_Packet&)’:
cbrp/cbrpagent.cc:876:25: error: ‘CBRP_XmitFailureCallback’ was not declared in this scope
cbrp/cbrpagent.cc: In member function ‘int CBRP_Agent::UnicastRREQ(CBRP_Packet&, nsaddr_t)’:
cbrp/cbrpagent.cc:1376:25: error: ‘CBRP_XmitFailureCallback’ was not declared in this scope
cbrp/cbrpagent.cc: In member function ‘void CBRP_Agent::sendOutPacketWithRoute(CBRP_Packet&, bool, Time)’:
cbrp/cbrpagent.cc:1573:25: error: ‘CBRP_XmitFailureCallback’ was not declared in this scope
make: *** [cbrp/cbrpagent.o] Error 1