Tuesday, April 16, 2013

Error while adding new protocol in NS2 - 3

One more common error is as follows:

invalid command name "Agent/MyAgentOtcl"
    while executing
"Agent/MyAgentOtcl set seqNo_ $opt(seqNo)"



This is due to one of the below listed reason:

1. The spelling mistake in "Agent/MyAgentOtcl" of TCL script and .cc file. In .cc file code will be as follows:

MyAgentClass() : TclClass("Agent/MyAgentOtcl") {}
TclObject* create(int, const char*const*) {
return(new MyAgent());
}


2. Once protocol is added, then updating makefile is also important. In makefile give the path for creating object file. If path is not give, then TCL scripts cannot access the C++ codes.

3. After modifying the makefile and ./configure, sometimes makefile will not be having the path information. You may get ./configure as successfully completed but TCL scripts fails to access. So updating is also important.