ns2 script issue
Hello Guys,
While creating new protocol in ns2 i am getting the below error.Anyone knows the issue? ns: [code omitted because of length] : invalid command name "Agent/security" while executing "Agent/security set accessible_var_ true" |
Quote:
|
Hello,
I am trying to add new encryption / decryption function in ns2.I have tried all the steps to add the new protocol in ns2,but it didn't work so if anyone knows that steps than can you pls tell me from start.As i am new to ns2 i don't have that much idea of how to make new protocol or add new things in ns2. I am placing the code of my three files 1)security_packet.cc 2)security_packet.h 3)security.tcl security_packet.cc Code:
#include "security_packet.h" Code:
//----------------------------------- Code:
#Create a simulator object |
Any luck clearing the error??
Hi,
I got the same error while adding the protocol. Have you cleared the error? Can you tell me how you cleared the error |
Post #4, @Raaha Priya : Welcome to LQ.
You have two posts about "got the same error". Which protocol are you trying to add ? The above error "ns: [code omitted because of length]" .. happens when you add some surplus entries to e.g. tcl/lib/ns-default.tcl . Or : Another (conflicting) protocol was added to tcl/lib/{ files.tcl }, .. before the protocol that you are now trying to add. - |
I am trying to add a new security protocol in ns2.35 I followed the instructions given in this link "http://www.nsnam.com/2015/03/security-protocol-packet-in-ns2.html". But I ended with the following error
invalid command name "Agent/Security_packet" while executing "Agent/Security_packet instproc recv {from rtt mess originmess hash} { $self instvar node_ puts "node [$node_ id] received packet from \ ..." (file "security.tcl" line 51) Please help me with this The other protocol I tried to add was vanetrbc protocol. I ended up with a similar error for that too. I could not figure out the reason for the error as I am a beginner. Kindly help me with it. |
ns-2.35 + Security Protocol
Re #6.
Based on http://www.nsnam.com/2015/03/securit...et-in-ns2.html $ tar xvf ns-allinone-2.35_gcc482.tar.gz https://drive.google.com/file/d/0B7S...ew?usp=sharing $ cd ns-allinone-2.35/ $ patch -p0 < security_ns235.patch https://drive.google.com/file/d/0B7S...ew?usp=sharing $ ./install $ cd ns-2.35/ $ sudo make install $ cp ns ns235-security ( This is your backup ) $ sudo cp ns235-security /usr/local/bin/ Simulation : $ cd security/ $ ../ns security.tcl : Perfect. ( Or : $ ns235-security security.tcl ). * About "vanetrbc" : Is it this one ? http://gcorser.weebly.com/install-vanetrbc.html - |
Thanks for helping me out. I'll try the procedure for adding the security protocol and let you know if it works for me.
And regarding vanetrbc, yes I have used the link that you have provided for adding the protocol. While running the test tcl file (vntest.tcl) I got the following error invalid command name "Agent/VanetRBC" while executing "Agent/VanetRBC create _o2015 0" invoked from within "catch "$className create $o $args" msg" invoked from within "if [catch "$className create $o $args" msg] { if [string match "__FAILED_SHADOW_OBJECT_" $msg] { delete $o return "" } global errorInfo error "class $..." (procedure "new" line 3) invoked from within "new Agent/VanetRBC $i" ("for" body line 2) invoked from within "for {set i 0} {$i < $opt(nn)} {incr i} { set p($i) [new Agent/VanetRBC $i] $ns_ attach-agent $node($i) $p($i) # set the logtarget for ever..." (file "vanet.tcl" line 225) Thanks in advance |
ns-2.35 + vanetrbc
Re #8.
VanetRBC : Setup another ns-allinone-2.35 in a new directory, for testing vanetrbc. $ tar xvf ns-allinone-2.35_gcc482.tar.gz $ cd ns-allinone-2.35/ $ zcat vanetrbc_ns235.patch.gz | patch -p0 https://drive.google.com/file/d/0B7S...ew?usp=sharing $ ./install $ cd ns-2.35/ $ cp ns ns235-vanetrbc $ sudo cp ns235-vanetrbc /usr/local/bin/ Simulation : $ cd vanetrbc/ $ ns235-vanetrbc vntest-2015.tcl : Lots of activity in the Nam window. - |
Can we have two ns2 on the same os. Im using ubuntu 12.04. And i already have ns2.35 in the home directory. Now can i install ns2 in some other directory? Some of my friends used two versions of ns2 in the same os. But that din work properly and they had to change the os and start from the beginning.
|
Re #10.
I have about 150 times ns-allinone-2.xx in /home/knudfl/<dir>/. So I guess you can have 3 or 4 to test your projects. As you can see from the above posts, the executable 'ns' can have any name. 'ns' or 'ns-new-name' is hard coded to know the location of it`s libraries : ns-allinone-2.xx/{ lib/*, bin/tcsh8* }. And the same for 'nam' : cd nam-1.15/ && sudo make install ... Etc. etc. Never add ns, nam, etc. etc. to .bashrc . Not required. - |
Thanks for your guidance.
I have a doubt. I am trying to create a simulation environment where nodes will communicate using vanetrbc and security will be implemented using the security protocol. So a single tcl file will be using both the protocols. But how can I do so if I use different ns for different protocols?? |
Re #12.
Quote:
There may not be any problems using the two patches in the same ns2. 'security_ns235.patch' and 'vanetrbc_ns235.patch'. I will have a look at that .... later. - |
Thank you so much
Do you have any idea about TraNS?? |
I tested VANETRBC. It works fine. Thank you so much for the detailed procedure.
However when I tried to patch the security protocol, I ended up with error. The following is the error i got In file included from ./common/agent.h:41:0, from security/security.h:9, from security/security.cc:4: ./common/packet.h: In static member function ‘static void p_info::initName()’: ./common/packet.h:330:9: error: ‘PT_SECURITY_PACKET’ was not declared in this scope security/security.cc: In constructor ‘Security_packetAgent::Security_packetAgent()’: security/security.cc:25:54: error: ‘PT_SECURITY_PACKET’ was not declared in this scope security/security.cc: In member function ‘void Security_packetAgent::encryption(char*)’: security/security.cc:89:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] security/security.cc: In member function ‘void Security_packetAgent::decryption(char*)’: security/security.cc:99:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] security/security.cc: In member function ‘virtual void Security_packetAgent::recv(Packet*, Handler*)’: security/security.cc:142:16: warning: unused variable ‘ch’ [-Wunused-variable] make: *** [security/security.o] Error 1 Ns make failed! I tried this the other way too. I first patched the security file and then vanetrbc. I ended up with the same error and NS make failed. Quote:
|
All times are GMT -5. The time now is 01:39 AM. |