LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 11-07-2014, 10:44 AM   #16
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

# 15 .

`ns-agent.tcl' :
No guaranty that is causes any changes,
you can try adding a new agent, like the AODV text (line 192) :
Agent/AODV set sport_ 0
Agent/AODV set dport_ 0


Quote:
made changes in common/packet.h, tcl/ns-default.tcl
Did you compile the edited ns-default.tcl into a new 'ns' ?
Also : Be sure you are using the right 'ns', like : $ cp ns ns-ping3
... And use that copy for the simulation : $ ns-ping3 ping-banerjee.tcl


`ns-lib.tcl' :
In ns-lib.tcl you can add the tcl configuration file :
source ns-ping.tcl


-

Last edited by knudfl; 11-07-2014 at 10:47 AM.
 
Old 11-10-2014, 06:28 AM   #17
banerjee
Member
 
Registered: Oct 2014
Posts: 32

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
dear knudfl,
I want to develop a multipath routing strategy for manet. i will split my message and put the slices on different paths from the source. where to start the from? how do i split a packet? how to maintain multiple paths? could you please help?
 
Old 11-10-2014, 06:43 AM   #18
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
← #17 .

Don't know. Sorry.

Multipath info ...
. http://code.google.com/p/multipath-d...ting-protocol/

Google .. ns2 Multipath Routing protocol ..

http://code.google.com/p/multipath-d...ting-protocol/
> http://code.google.com/p/multipath-d...downloads/list

http://wpage.unina.it/marcello.caleffi/ns2/mdart.html >>> ns234 >>>
wget http://wpage.unina.it/marcello.caleffi/ns2/mdart.diff

" aomdv-code-ns2 it s a multipath aodv protocol used in NS2.:
http://en.pudn.com/downloads201/sour...947190_en.html "

-
 
Old 11-18-2014, 12:10 PM   #19
banerjee
Member
 
Registered: Oct 2014
Posts: 32

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
invalid command name "Agent/MyPing"

following are the myping.h, myping.cc and myping.tcl files i have written. i have made changes in packet.h, ns-default.tcl, Makefile. still i am getting error----
invalid command name "Agent/MyPing"
while executing
"Agent/MyPing instproc recv {from rtt} {
$self instvar node_
puts "node [$node_ id] received ping answer from \
$from with round-trip-t..."
(file "myping.tcl" line 27)

could anyone please help me out. i cannot find a way out.

myping.h file
Code:
#ifndef ns_myping_h
#define ns_mying_h

#include "agent.h"
#include "tclcl.h"
#include "packet.h"
#include "address.h"
#include "ip.h"

struct hdr_myping{
	char ret;
	double send_time;
};

class MyPingAgent : public Agent{
	public:
	   MyPingAgent();
	   int command(int argc, const char*const* argv);
	   void recv(Packet*, Handler*);
	protected:
	   int off_myping_;
	   int off_ip_;
};

#endif





myping.cc file

Code:
#include "myping/myping.h"


static class MyPingHeaderClass : public PacketHeaderClass {
public:
   MyPingHeaderClass() : PacketHeaderClass("PacketHeader/MyPing",sizeof(hdr_myping)) {}

} class_mypinghdr;

static class MyPingClass : public TclClass{
public:
   MyPingClass() : TclClass("Agent/MyPing") {}
   TclObject* create(int, const char*const*) {
	return(new MyPingAgent());
} 

} class_myping;

MyPingAgent::MyPingAgent() : Agent(PT_MYPING)
{
  bind("packetSize_", &size_);
  bind("off_myping_", &off_myping_);
}

int MyPingAgent::command(int argc, const char*const* argv)
{
  if (argc == 2) {
    if (strcmp(argv[1], "send") == 0) {
      // Create a new packet
      Packet* pkt = allocpkt();
      // Access the Ping header for the new packet:
      hdr_myping* hdr = (hdr_myping*)pkt->access(off_myping_);
      //hdr_myping* hdr = hdr_myping::access(pkt);
      // Set the 'ret' field to 0, so the receiving node knows
      // that it has to generate an echo packet
      hdr->ret = 0;
      // Store the current time in the 'send_time' field
      hdr->send_time = Scheduler::instance().clock();
      // Send the packet
      send(pkt, 0);
      // return TCL_OK, so the calling function knows that the
      // command has been processed
      return (TCL_OK);
    }
  }
  // If the command hasn't been processed by PingAgent()::command,
  // call the command() function for the base class
  return (Agent::command(argc, argv));
}


void MyPingAgent::recv(Packet* pkt, Handler*)
{
  // Access the IP header for the received packet:
  off_ip_=hdr_ip::offset();
  hdr_ip* hdrip = (hdr_ip*)pkt->access(off_ip_);
  // Access the Ping header for the received packet:
  hdr_myping* hdr = (hdr_myping*)pkt->access(off_myping_);
  // Is the 'ret' field = 0 (i.e. the receiving node is being pinged)?
  if (hdr->ret == 0) {
    // Send an 'echo'. First save the old packet's send_time
    double stime = hdr->send_time;
    // Discard the packet
    Packet::free(pkt);
    // Create a new packet
    Packet* pktret = allocpkt();
    // Access the Ping header for the new packet:
    hdr_myping* hdrret = (hdr_myping*)pktret->access(off_myping_);
    // Set the 'ret' field to 1, so the receiver won't send another echo
    hdrret->ret = 1;
    // Set the send_time field to the correct value
    hdrret->send_time = stime;
    // Send the packet
    send(pktret, 0);
  } else {
    // A packet was received. Use tcl.eval to call the Tcl
    // interpreter with the ping results.
    // Note: In the Tcl code, a procedure 'Agent/Ping recv {from rtt}'
    // has to be defined which allows the user to react to the ping
    // result.
    char out[100];
    // Prepare the output to the Tcl interpreter. Calculate the round
    // trip time
    sprintf(out, "%s recv %d %3.1f", name(), 
            (hdrip->src_).addr_, 
	    (Scheduler::instance().clock()-hdr->send_time) * 1000);
    Tcl& tcl = Tcl::instance();
    tcl.eval(out);
    // Discard the packet
    Packet::free(pkt);
  }
}

myping.tcl file

Code:
#Create a simulator object
set ns [new Simulator]

#Open a trace file
set nf [open out.nam w]
$ns namtrace-all $nf

#Define a 'finish' procedure
proc finish {} {
        global ns nf
        $ns flush-trace
        close $nf
        exec nam out.nam &
        exit 0
}

#Create three nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]

#Connect the nodes with two links
$ns duplex-link $n0 $n1 1Mb 10ms DropTail
$ns duplex-link $n1 $n2 1Mb 10ms DropTail

#Define a 'recv' function for the class 'Agent/MyPing'
Agent/MyPing instproc recv {from rtt} {
	$self instvar node_
	puts "node [$node_ id] received ping answer from \
              $from with round-trip-time $rtt ms."
}

#Create two ping agents and attach them to the nodes n0 and n2
set p0 [new Agent/MyPing]
$ns attach-agent $n0 $p0

set p1 [new Agent/MyPing]
$ns attach-agent $n2 $p1

#Connect the two agents
$ns connect $p0 $p1

#Schedule events
$ns at 0.2 "$p0 send"
$ns at 0.4 "$p1 send"
$ns at 0.6 "$p0 send"
$ns at 0.6 "$p1 send"
$ns at 1.0 "finish"

#Run the simulation
$ns run

Last edited by banerjee; 11-19-2014 at 09:54 PM.
 
Old 11-18-2014, 10:20 PM   #20
banerjee
Member
 
Registered: Oct 2014
Posts: 32

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by knudfl View Post
# 15 .

`ns-agent.tcl' :

-
after i type make clean and make to compile my own file "myping/myping.cc", i get -> "make[1]: Nothing to be done for `all'"------is it any error?
 
Old 11-19-2014, 07:34 AM   #21
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
← #20 .
Quote:
Nothing to be done for `all'"
Means : Everything is OK.
Happens when you run 'make' for the second time.
I.e. the first 'make' is run by the './install' command.
* Besides that this "non issue" has been discussed before :
You will get 1,100,000,000 hits with Google, Nothing to be done for `all'"


← #19 .
Please edit post #19 to use 'code tags'
. http://www.linuxquestions.org/questi....php?do=bbcode
. http://www.linuxquestions.org/questi...gs-4175464257/
I.e. type [/code] at code end, and [code] at code start.
* And : You will have to replace the "code text" with the real code.

* Editing : The 'Edit' button.

-
 
Old 11-19-2014, 09:57 PM   #22
banerjee
Member
 
Registered: Oct 2014
Posts: 32

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by knudfl View Post
← #20 .


← #19 .
Please edit post #19 to use 'code tags'

-
i have edited #19. please check it and suggest solution....
 
Old 11-19-2014, 11:24 PM   #23
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
← #22 .

Your tcl file is OK.
Runs perfect with the stock ping in e.g. ns-2.34, ns-2.35,
when all Agent/MyPing was edited to Agent/Ping.

Please have a look at the default ns-2.xx/apps/{ ping.cc, ping.h }.

About `tcl/lib/{files.tcl} :
'Ping' is present in ns-default.tcl, ns-packet.tcl. Example, ns-2.34 :
Code:
ns-default.tcl:830:Agent/Ping set packetSize_ 64


ns-packet.tcl:155:      Ping    # Ping
ns-packet.tcl:267:#     { Ping off_ping_ }
* The numbers are the line numbers.

-
 
Old 11-19-2014, 11:38 PM   #24
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
Add #23 : "All Ping in ns-2.34".

$ cd ns-2.34
$ grep -Rn Ping *

The result is attached as all-ping_ns234.txt.gz.txt .
Omitted is : ping.h, ping.cc, tcl/test/, validate.out .

* Rename all-ping_ns234.txt.gz.txt to all-ping_ns234.txt.gz ,
then you can unpack the file.
-
Attached Files
File Type: txt all-ping_ns234.txt.gz.txt (2.7 KB, 15 views)
 
Old 11-20-2014, 01:18 AM   #25
banerjee
Member
 
Registered: Oct 2014
Posts: 32

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by knudfl View Post
← #22 .


when all Agent/MyPing was edited to Agent/Ping.

-

that's true. but if i write my own "ping" protocol as "MyPing" then the problem happens. this is i am doing for testing. i want to write my own algorithm in ns. so, i took the "Ping" as an example to see how the things are done. could you please suggest that what modification I need to make so that my "MyPing" protocol also works as "Ping"?
 
Old 11-23-2014, 02:33 AM   #26
banerjee
Member
 
Registered: Oct 2014
Posts: 32

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
when i run ./validate, i get the following error. there were multiple similar kind of errors indicated. what is the problm and how to solve this?
Quote:
global errorInfo
error "class $..."
(procedure "new" line 3)
invoked from within
"new Test/$test $topo"
(procedure "TestSuite" line 40)
(TestSuite runTest line 40)
invoked from within
"TestSuite runTest"
(file "test-suite-simple.tcl" line 1824)
Test output differs from reference output
Diagnose with: diff test-output-simple/tahoe1Bytes.test test-output-simple/tahoe1Bytes
Or see URL "http://www.isi.edu/nsnam/ns/ns-problems.html".
 
Old 11-23-2014, 06:06 AM   #27
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
← #26 .

A clean ns-2.xx will often fail some tests.
And : If it's a 64bits OS, some tests will always fail.

Editing C++ files, or adding a patch with a new protocol :
Some more, or many tests will / can fail at './validate'.

* Validate is not that important.
The protocols you want to use, are "always" OK.
I.e. I have never seen an added protocol fail,
even with a lot of failed tests.

*** Validate can be skipped, and/or errors can be ignored.

-
 
Old 11-23-2014, 12:37 PM   #28
banerjee
Member
 
Registered: Oct 2014
Posts: 32

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
i had to ./configure again...but after i do this get the following:
Code:
ln: failed to create symbolic link `ns': File exists
ln: failed to create symbolic link `nam': File exists
Please compile your xgraph separately.
ln: failed to create symbolic link `sgb2ns': File exists
ln: failed to create symbolic link `sgb2hierns': File exists
ln: failed to create symbolic link `sgb2comns': File exists
ln: failed to create symbolic link `itm': File exists
ln: failed to create symbolic link `sgb2alt': File exists
ln: failed to create symbolic link `edriver': File exists

Ns-allinone package has been installed successfully.
Here are the installation places:
tcl8.4.18:	/home/partha/program/ns-allinone-2.34/{bin,include,lib}
tk8.4.18:		/home/partha/program/ns-allinone-2.34/{bin,include,lib}
otcl:		/home/partha/program/ns-allinone-2.34/otcl-1.13
tclcl:		/home/partha/program/ns-allinone-2.34/tclcl-1.19
ns:		/home/partha/program/ns-allinone-2.34/ns-2.34/ns
nam:	/home/partha/program/ns-allinone-2.34/nam-1.14/nam
gt-itm:   /home/partha/program/ns-allinone-2.34/itm, edriver, sgb2alt, sgb2ns, sgb2comns, sgb2hierns

----------------------------------------------------------------------------------

Please put /home/partha/program/ns-allinone-2.34/bin:/home/partha/program/ns-allinone-2.34/tcl8.4.18/unix:/home/partha/program/ns-allinone-2.34/tk8.4.18/unix
into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.

IMPORTANT NOTICES:

(1) You MUST put /home/partha/program/ns-allinone-2.34/otcl-1.13, /home/partha/program/ns-allinone-2.34/lib, 
    into your LD_LIBRARY_PATH environment variable.
    If it complains about X libraries, add path to your X libraries 
    into LD_LIBRARY_PATH.
    If you are using csh, you can set it like:
		setenv LD_LIBRARY_PATH <paths>
    If you are using sh, you can set it like:
		export LD_LIBRARY_PATH=<paths>

(2) You MUST put /home/partha/program/ns-allinone-2.34/tcl8.4.18/library into your TCL_LIBRARY environmental
    variable. Otherwise ns/nam will complain during startup.


After these steps, you can now run the ns validation suite with
cd ns-2.34; ./validate

For trouble shooting, please first read ns problems page 
http://www.isi.edu/nsnam/ns/ns-problems.html. Also search the ns mailing list archive
for related posts.
what these mean?
 
Old 11-23-2014, 01:02 PM   #29
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
← #28 .
Quote:
what .. these mean ?
Nothing. Unless you are using a "University Computer",
and have no write permissions to /usr/.
* The executable 'ns' is hard coded to know the location of itīs libraries,
so at large the "year 1999 text" about *PATHīs makes little or no sense.

Assume a computer owned by you, and can do :
$ cd ns-2.34/
$ cp ns ns-backup ( Or any special name you want, e.g. ns-ping.)
$ sudo make install ('make install' will copy ns to /usr/local/bin/).
$ sudo cp ns-backup /usr/local/bin/

-
 
Old 11-24-2014, 03:31 AM   #30
banerjee
Member
 
Registered: Oct 2014
Posts: 32

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
I edited mkaefile, makefile.in and Makefile.vc and used ./configure. unfortunately i lost my ns file and copied it from /usr/local/bin. now, when i am using make i am getting the following error
Code:
In file included from mac/mac-802_11Ext.cc:66:0:
mac/mac-802_11Ext.h: In member function ‘u_int32_t PHY_MIBExt::getHdrLen11()’:
mac/mac-802_11Ext.h:175:19: error: expected primary-expression before ‘struct’
mac/mac-802_11Ext.h:175:41: error: ‘dh_body’ was not declared in this scope
mac/mac-802_11Ext.h:175:51: error: ‘offsetof’ was not declared in this scope
mac/mac-802_11Ext.h:177:3: warning: control reaches end of non-void function [-Wreturn-type]
make: *** [mac/mac-802_11Ext.o] Error 1
please help
 
  


Reply

Tags
network-coding-ns2, ns2



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
CentOS - Compile mutt error: configure: error: no curses library found SEI Linux - Newbie 2 01-28-2014 09:23 AM
configure error qt not found DeZern Linux - Software 2 05-15-2010 05:41 PM
Conmpile error wen compile php:configure: error: libpng.(a|so) not found tanveer Linux - Software 5 02-03-2009 06:13 AM
./configure fails with: libz... configure: error: not found. erpe Linux - Software 17 10-11-2006 05:56 PM
qt-mt not found error during configure Boomba Linux - Software 4 02-15-2005 04:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 01:46 PM.

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