On Sat, Mar 9, 2013 at 11:33 AM, nwenwe htaywin <nwenwehtay...@gmail.com> wrote: Dear Sir, I still get error. I am not clear the last statement in your post.
now you are ready to call from protocol file (dsr , aodv) when you want to acess that access like that God::instance()->get_status(node_id); //any where in protocol file God::instance()->set_status(node_id , node_status); Does it mean I need to change aodv file (~ns/aodv.h / .cc)? But I can't add these statements. Here is the procedure I did as you said. 1. ~ns/common/mobilenode.h int Node_Status; inline int get_Node_Status() {return Node_Status;} //error occury but fix by changing void to int coz of returning status void set_Node_status(int status_id); 2. ~ns/common/mobilenode.cc void MobileNode::set_Node_Status(int status_id) { Node_Status=status_id; } 3. ~ns/mobile/god.cc int God::get_Node_Status1(int node_id) { return mb_node[node_id] -> get_Node_Status1(); } void God::set_Node_Status1(int node_id,int node_status) { mb_node[node_id] -> set_Node_Status1(node_status); } 4.~ns/mobile/god.h int get_Node_Status1(int node_id); void set_Node_Status1(int node_id, int node_status); But, After doing step4, I don't know how to change protocol file and how to use these node status in TCL file. I run "./configure and make " command after doing above 4 steps. I got the following error. linkstate/ls.h:137:20: note: declarations in dependent base ‘std::map<int, LsIdSeq, std::less<int>, std::allocator<std::pair<const int, LsIdSeq> > >’ are not found by unqualified lookup linkstate/ls.h:137:20: note: use ‘this->erase’ instead make: *** [linkstate/ls.o] Error 1 So, please kindly tell me the way to change protocol file and what code need to add in TCL file to call these node status. If possible, Please tell me in detail. I'm really afraid to use your previous time but I'm really stuck in these. I look forward hearing from you and any help will be highly appreciate. Thank you, Sir. there was one step i forgot that is you have to initialize that variable in mobilenode.cc Step 1 :~ns/common/mobilenode.h int Node_Status; //in private //in public part inline int get_Node_Status() {return Node_Status;} //error occury but fix by changing void to int coz of returning status void set_Node_status(int status_id); Step 1.1 ---> //under this function don't just copy and paste MobileNode::MobileNode(void) : pos_handle_(this) { ................. .... ... //under here :) Node_Status = 0 ; /mobilenode.cc } Step 2 ---- > is correct in step 3 .... you should call that function which have been created in the MobileNode.cc /.h so you are calling a wrong function . it should be "get_Node_Status();" not " get_Node_Status1();" int God::get_Node_Status1(int node_id) { return mb_node[node_id] -> get_Node_Status(); } void God::set_Node_Status1(int node_id,int node_status) { mb_node[node_id] -> set_Node_Status(node_status); } 4th step is correct ... Please don't run ./configure run only make //if make is success make install it will work . if everything is ohhhkkkk then go forward !!! Then we are coming back to how to use these in Protocol File ::: it's up to you where you are going to change the protocol file , if you doesn't know how to change the file so , it's your problem if you will write this you can access the mobile node's information God::instance()->get_Node_Status1(node_id); God::instance()->set_Node_Status1(node_id,node_status); // Remember here node_id should be in integer format not in "ID" format , in wireless all node's id is in "ID" format you have to convert it in to the int format like that nsaddr_t node_id = net_id.getNSAddr_t(); that above function will give you the current node in which you are and it's format is ID and you are converting it in to the int format . remember first from Protocol you can access the God file then god can access the mobile files, this is the hierarchy . -- Regards Arun Kumar Gupta +918000597109 m...@arungupta.co.in -- View this message in context: http://network-simulator-ns-2.7690.n7.nabble.com/ns-How-to-add-Some-information-in-Mobile-Node-tp26348p26378.html Sent from the ns-users mailing list archive at Nabble.com.