Re: [ns] Accessing object created in Tcl from C++

2006-08-21 Thread Prashant Batra

Hi Vijay,

The problem described by you seems to be something very specific to your 
codei mean to the modifications you have doneso it is really not 
possible for me to tell you anything straightforward on the matter.
I am sure if you take a deeper look into your code and try and 
understand what is it that a wireless node is expecting and I am not 
providing, you will definitely be able to work things out.

Sorry and All the Best.

 - Prashant

Vijay Ghorpade wrote:

  
 Hi Prashant,
   I have a problem with ns-2
 When i make some change in the node class and compile the code it 
 doesnot give any errors. The wired scripts also work.
 But when i try with wireless scripts it gives either segmentation 
 fault or event UID not found error.
 Why it is so. Can you help me out

 Vijay


 On Fri, 18 Aug 2006 Prashant Batra wrote :
 
 Hi Shafiq,
 
 To access a variable declared in your TCL script, you can use the 
 following
 method :-
 
 Tcl tcl = Tcl::instance();
 tcl.lookup(char* s);
 
 The 'lookup()' function of Tcl class takes a pointer to the name of the
 variable in the TCL script and returns you a TclObject class object,
 which you can further typecast into your specific object type and use.
 
   - Prashant
 
 
 
 Shafiq Hashmi wrote:
   Hello all,
  
   Is it possible to access an object of Agent/RCAgent, created in 
 Tcl, from another C++ class.
  
   Can anybody tell me ?
  
   Thanx
   Shafiq
  
  
 



 http://adworks.rediff.com/cgi-bin/AdWorks/sigclick.cgi/www.rediff.com/signature-home.htm/[EMAIL
  PROTECTED] 



Re: [ns] help: ns-eurane install worng

2006-08-18 Thread Prashant Batra

Hi,

To get it working, you should enter into the NS Directory and then fire 
the same command i.e. patch -p1  Path to your Diff File

- Prashant

袁旭 wrote:
 

  
  

 I installed the ns-allinone-2.28 in linux of ubuntu6.06
 and do this command:patch -p1  ns-eurane-111.diff 
 system tell:
 can't find file to patch at input line 4 
 Perhaps you used the wrong -p or --strip option? 
 The text leading up to this was: 
 -- 
 |diff -b -B -u -I '$Id.*$' -I '$Header.*$' --new-file --recursive 
 ns-2.28-orig/common/packet.h ns-2.28-eu111/common/packet.h 
 |--- ns-2.28-orig/common/packet.h   2005-01-19 19:23:18.0 +0100 
 |+++ ns-2.28-eu111/common/packet.h  2005-10-28 14:06:41.0 +0200 
 -- 
 File to patch: 

  



Re: [ns] Accessing object created in Tcl from C++

2006-08-18 Thread Prashant Batra

Hi Shafiq,

To access a variable declared in your TCL script, you can use the following 
method :-

Tcl tcl = Tcl::instance();
tcl.lookup(char* s);

The 'lookup()' function of Tcl class takes a pointer to the name of the 
variable in the TCL script and returns you a TclObject class object, 
which you can further typecast into your specific object type and use.

 - Prashant



Shafiq Hashmi wrote:
 Hello all,

 Is it possible to access an object of Agent/RCAgent, created in Tcl, from 
 another C++ class.

 Can anybody tell me ?

 Thanx
 Shafiq

   



Re: [ns] Problem with .o files

2006-08-09 Thread Prashant Batra

Hi,

Your observations are expected!! The only thing that's going wrong in 
your case is that you do './configure' over and over again !! When you 
run './configure', it regenerates a new Makefile, which overwrites the 
Makefile that you modified. Thus, your changes vanish. So, after you 
modify the Makefile, please do not run the 'configure' file again. Just 
do 'make' and 'make install'

Regards,
Prashant Batra



Aleksandar Smolovic wrote:
 Hi all,

 I have file.cc and file.h and I put that in for example ~/tcp/file.cc and 
 ~/tcp/file.h.

 Now I make neccesary modifications and among other things in OBJ_CC section 
 on Makefile I have put this
 .
 tcp/file.o \
 ..

 When I do ./configure and make and make install I do not have file.o 
 under path where I put file.cc and file.h.

 In futher, I open Makefile after congifure,make and make install procedure 
 and there is no line I put - the line I mentioned above tcp/file.o \

 How can disapear a coplete line from Makefile ?

 Am I missing something here?

 When I try to start ns on prompt I have something like this:

 machine:/mypath/# ns
 ns:
 [code omitted because of length]
 : invalid command name Agent/TCP/WestwoodNR
 while executing
 Agent/TCP/WestwoodNR set current_bwe_ 0
 machine:/mypath/# ns


 Thank you.

   



Re: [ns] installation problems with otcl-1.11

2006-08-09 Thread Prashant Batra

Hi,

Well you have to do what the message says. Clearly, your X11 Header 
Files are missing. You will have to pick up your FC5 CD/DVD, and install 
the Header Files. If you run the Package Installer or Update Manager, 
you will have to go into the Development / Library section of packages, 
find X11 related packages / headers and install them. Once the headers 
are installed, the installation should (hopefully) run smoothly  !!

Good Luck !!

Regards,
Prashant Batra

jaime venzala wrote:
 I working with fedora core5 and i tried to install ns-allinone-2.29.3.
 Everythings was ok untill otcl-1.11 was installing and i saw the next
 messages:

 checking for X11 header files
 can't find X includes
 otcl-1.11 configuration failed! Exiting ...

 Is there any solution?



   



Re: [ns] OTCL-Linkage

2006-08-09 Thread Prashant Batra

Hi Jana,

Interesting Problem !! But, unfortunately I am also new to NS-2, so I 
can't answer your question in the way you expected, but I can propose an 
alternate solution, purely on the C++ platform.

If you need just one instance of the ContextAgent object, you can create 
a Global variable or a member variable in AODV class, where you can 
register your pointer to the newly created ContextAgent Object. Now, in 
your AODV code when you need to access the member variables of the 
ContextAgent object, you simply dereference this pointer and access the 
variables. Obviously, you can acess them, as AODV has been declared as a 
Friend Class.

Alternately, if you need more than one instances of the ContextAgent 
class, you can create a Global or a member variable in AODV class, of 
the type HashTable or something simmilar, in which you can register an 
identifier and the pointer to the ContextAgent object, everytime you 
create it. Whenever you need to access the variables of the ContextAgent 
class, you will also have to pass along this identifier, so as to access 
the appropriate object. This identifier could be the node name or 
anything you please.

This could be a way out of your situation, even though it will be much 
better and smarter, if you are able to find the way of accessing objects 
created in your TCL script, in the C++ code !!

Hope this helps.

Regards,
Prashant Batra

Jana Henniger wrote:
 I’m new to ns-2 and C++ and need help concerning OTCL-Linkage.
 I’ve created a new class ContextAgent which has AODV as friendclass. 
 ContextAgent has two public variables that are bound to OTCL using the 
 bind()-function (as it is used in the Example ex-linkage.cc from the tutorial 
 “ns by example”). That works, as far as I could see.

 My problem is, how can I call on the variables from the AODV-function 
 sendRequest()?
 Since the ContextAgent is created in the simulation script, I don’t know the 
 name of it to assign it to an object of the type ContextAgent.

 I send parts of my source code for better understanding. Please help!!

 *

 class ContextAgent : public Agent{

 friend class AODV;

 public:
   ContextAgent();
   int rq_context;
   int rt_context;
 }

 //LinkObject
 static class ContextAgentClass : public TclClass {
 public:
   ContextAgentClass() : TclClass(Agent/Context){}
   TclObject* create(int, const char*const*) {
   return (new ContextAgent());
   }
 } class_context_agent;

 //Constructor
 ContextAgent::ContextAgent() : Agent(PT_AODV) {
   bind(rq_cxt_otcl, rq_context);
   bind(rt_cxt_otcl, rt_context);
 };

 *

 class AODV: public Agent {
  ...
 private:
   ContextAgent  *ContextAgentObject;
  ...
 };

 **

 // call in AODV-function
 void
 AODV::sendRequest(nsaddr_t dst) {
  ...
   ContextAgentObject = ;
   rq-rq_cxt = ContextAgentObject-rq_context;
  ...
 }

 **

 # tcl-code
  ...
   set context1 [new Agent/Context]
 $ns_ attach-agent $node_(1) $context1
 $context1 set rq_cxt_otcl 0   
 $context1 set rt_cxt_otcl 5   
  ...