LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking > Linux - Wireless Networking
User Name
Password
Linux - Wireless Networking This forum is for the discussion of wireless networking in Linux.

Notices


Reply
  Search this Thread
Old 01-30-2015, 07:30 AM   #1
hamdan
LQ Newbie
 
Registered: Nov 2014
Posts: 19

Rep: Reputation: Disabled
cross-layering not working in ns2.34


i was referring to this link for cross-layer technique.
http://wmnatupdiliman.blogspot.in/20...l#comment-form

but in here, step b,which i included here, is not clear.
Quote:
Add the following code in the command () function in aodv.cc

int
OLSR:: command (int argc, const char * const * argv) {
. . .
. . .
else if (argc == 3) {
...
...
else if (strcmp (argv [1], "access-phy") == 0) {
netif_ = (Phy *) TclObject:: lookup (argv[2]);
if (netif_ == 0) {
fprintf (stderr, "Agent: %s lookup %s failed. \n", argv[1], argv[2]);
return TCL_ERROR;
} else {
double x, y, z;
((MobileNode*) netif_->node())->getLoc(&x, &y, &z);
printf ("This node's location: %f %f \n", x, y);
return TCL_OK;
}
}
}
. . .
. . .
}
the owner of the post seems not to reply back any comments!!
i tried to copy paste the given code in command() of aodv.cc as below:
Code:
int
AODV::command(int argc, const char*const* argv) {
  int
OLSR:: command (int argc, const char * const * argv) {
 
  if(argc == 2) {
  Tcl& tcl = Tcl::instance();
    
    if(strncasecmp(argv[1], "id", 2) == 0) {
      tcl.resultf("%d", index);
      return TCL_OK;
    }
    
    if(strncasecmp(argv[1], "start", 2) == 0) {
      btimer.handle((Event*) 0);

#ifndef AODV_LINK_LAYER_DETECTION
      htimer.handle((Event*) 0);
      ntimer.handle((Event*) 0);
#endif // LINK LAYER DETECTION

      rtimer.handle((Event*) 0);
      return TCL_OK;
     }               
  }
  else if(argc == 3) {
    if(strcmp(argv[1], "index") == 0) {
      index = atoi(argv[2]);
      return TCL_OK;
    }

else if (strcmp (argv [1], "access-phy") == 0) {
netif_ = (Phy *) TclObject:: lookup (argv[2]);
if (netif_ == 0) {
fprintf (stderr, "Agent: %s lookup %s failed. \n", argv[1], argv[2]);
return TCL_ERROR;
} else {
double x, y, z;
((MobileNode*) netif_->node())->getLoc(&x, &y, &z);
printf ("This node's location: %f %f \n", x, y);
return TCL_OK;
}
}
} 
    else if(strcmp(argv[1], "log-target") == 0 || strcmp(argv[1], "tracetarget") == 0) {
      logtarget = (Trace*) TclObject::lookup(argv[2]);
      if(logtarget == 0)
	return TCL_ERROR;
      return TCL_OK;
    }
    else if(strcmp(argv[1], "drop-target") == 0) {
    int stat = rqueue.command(argc,argv);
      if (stat != TCL_OK) return stat;
      return Agent::command(argc, argv);
    }
    else if(strcmp(argv[1], "if-queue") == 0) {
    ifqueue = (PriQueue*) TclObject::lookup(argv[2]);
      
      if(ifqueue == 0)
	return TCL_ERROR;
      return TCL_OK;
    }
    else if (strcmp(argv[1], "port-dmux") == 0) {
    	dmux_ = (PortClassifier *)TclObject::lookup(argv[2]);
	if (dmux_ == 0) {
		fprintf (stderr, "%s: %s lookup of %s failed\n", __FILE__,
		argv[1], argv[2]);
		return TCL_ERROR;
	}
	return TCL_OK;
    }
  }
  return Agent::command(argc, argv);
}
but this returns to following error during ./install
Code:
aodv/aodv.cc:80: error: ‘OLSR’ has not been declared
aodv/aodv.cc:80: error: a function-definition is not allowed here before ‘{’ token
aodv/aodv.cc:1409: error: expected ‘}’ at end of input
aodv/aodv.cc:1409: warning: no return statement in function returning non-void
make: *** [aodv/aodv.o] Error 1
Ns make failed!

so please help me out with this.
thanks in advance

Last edited by hamdan; 02-04-2015 at 03:55 AM.
 
Old 02-04-2015, 03:47 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
First : You will have to edit the three blocks of code / error ouput :
To use CODE tags. That's the # button in the 'Advanced Editor'.
* Editing : The 'Edit' button → → `Go Advanced´.
. http://www.linuxquestions.org/questi....php?do=bbcode
. http://www.linuxquestions.org/questi...gs-4175464257/
Please replace the text with the real code.


Cross-layering : If you want to use the protocol layer / the mac layer,
i.e. OLSR / the mac layer, make sure you have a functional OLSR.
I.e., i.e. the command 'ns-olsr ddebbie90-scenario.tcl' must function OK.

And the changes in the protocol layer : Not AODV, then not aodv.cc .
But probably OLSR.cc .

-
 
Old 02-04-2015, 04:48 AM   #3
hamdan
LQ Newbie
 
Registered: Nov 2014
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Cross-layering : If you want to use the protocol layer / the mac layer,
i.e. OLSR / the mac layer, make sure you have a functional OLSR.
I.e., i.e. the command 'ns-olsr ddebbie90-scenario.tcl' must function OK.
well i am sure i built the OLSR correctly using the following code.
Code:
$ cd ns-allinone-2.34/ns-2.34/
$ tar xvf um-olsr-1.0.tgz
$ ln -s um-olsr olsr
$ patch -p1 < olsr/um-olsr_ns-2.34_v1.0.patch
$ cd ../
$ ./install
but the command 'ns-olsr ddebbie90-scenario.tcl' returns me following error:
Code:
[root@localhost ns-2.34]# ns-olsr ddebbie90-scenario.tcl
bash: ns-olsr: command not found
please suggest me what is missing.
 
Old 02-04-2015, 04:56 AM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
→ ref. post #3.

$ cd ns-2.34/
$ cp ns ns-olsr
# cp ns-olsr /usr/local/bin/

-
 
Old 02-04-2015, 05:26 AM   #5
hamdan
LQ Newbie
 
Registered: Nov 2014
Posts: 19

Original Poster
Rep: Reputation: Disabled
ref.post #4

ya that helped.thanks.
but still my problem is not solved.

i am trying to include OLSR class inside AODV class as a step for the cross layering.
refer:http://wmnatupdiliman.blogspot.in/20...mation-in.html

i am pretty sure i did the part a) (as mentioned in the blog) correctly, the part b) portion,when followed got me following error:
Code:
aodv/aodv.cc: In member function ‘virtual int AODV::command(int, const char* const*)’:
aodv/aodv.cc:80: error: ‘OLSR’ has not been declared
aodv/aodv.cc:80: error: a function-definition is not allowed here before ‘{’ token
aodv/aodv.cc:1409: error: expected ‘}’ at end of input
aodv/aodv.cc:1409: warning: no return statement in function returning non-void
make: *** [aodv/aodv.o] Error 1
Ns make failed!
still is says OLSR has not been declared.i dont get why!!
please help.
 
Old 02-04-2015, 05:32 AM   #6
hamdan
LQ Newbie
 
Registered: Nov 2014
Posts: 19

Original Poster
Rep: Reputation: Disabled
ref.post #2
Quote:
And the changes in the protocol layer : Not AODV, then not aodv.cc .
But probably OLSR.cc .
well i am trying to access physical layer(OLSR) from network layer(AODV).thus changing OLSR.cc will not get me results because i am runnig tcl scripts of aodv.so, i think change should be in the aodv.cc itself.
 
Old 02-04-2015, 05:34 AM   #7
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
← ref. post #5.

http://wmnatupdiliman.blogspot.in/20...mation-in.html
.. is about adding cross-layer to the used protocol.
In the wmnatupdiliman example, the protocol is AODV.
Your example protocol is not AODV, but OLSR.

You cannot use aodv.cc for an "OLSR change".

Suggest : Restore aodv.cc, and make your edits in the OLSR file(s).


-
 
Old 02-04-2015, 05:56 AM   #8
hamdan
LQ Newbie
 
Registered: Nov 2014
Posts: 19

Original Poster
Rep: Reputation: Disabled
ref.post #7
sir,i am not entirely sure if i understood you. but i want my example to be aodv itself and not olsr.even the blog says olsr is used as an example(line 3).
because, after i get this right,i will run a tcl scripts for aodv and compare the energy throughput of this cross-layer AODV with original AODV.
so, please suggest me likewise.
 
  


Reply

Tags
ns2, olsr



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cross-layering in Ns2.34 hamdan Linux - Wireless Networking 4 01-22-2015 12:03 PM
LXer: Defining OpenStack: Layering DefCore LXer Syndicated Linux News 0 11-09-2014 05:50 PM
Cross synchronization NTP not working Vikonder Linux - Newbie 1 11-16-2011 01:18 PM
FC4: Gnome 2.12.3 Window List layering issue JRR883 Linux - Software 4 02-10-2006 08:39 PM
Wine: Layering applications Diminished7th Linux - Software 1 12-14-2005 08:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking > Linux - Wireless Networking

All times are GMT -5. The time now is 03:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration