My initial thought in this regard, was to insert the Agent into Node N1's
entry, and then set the Agent's target_ to the Clasifier in Node N1.

Here's what I did in my Agent's command function:
--------------------------------------
int MyAgent::command(int argc, const char*const* argv) {
   Tcl& tcl = Tcl::instance(); // tcl instance
   if (argc == 3) {
      if (strcmp(argv[1], "set-target") == 0) {
         target_ = (NsObject*)(TclObject::lookup(argv[2]));
         printf("Setting MyAgent target_ to %s\n", argv[2]);
         if (target_ == NULL) {
            tcl.add_errorf("MyAgent target_ was NULL: %s", argv[2]);
            return TCL_ERROR;
         }
         return(TCL_OK);
      }
  } 
  return (Agent::command(argc, argv));
}
--------------------------------------

Then, in tcl I do something like this:
--------------------------------------
set n1_old_entry [$n1 entry] ;# points to classifier_
$n1 insert-entry [new RtModule] $my_agent
$my_agent set-target $n1_old_entry
--------------------------------------

However, when I attept to send a packet across N1, I get a Bus Error.
Any ideas?  Am I going about this all wrong?

Thanks in advance!

Brad

On 7/13/06 1:45 AM, "Brad Montgomery" <[EMAIL PROTECTED]> wrote:

> 
> All,
> 
> I would like to write an Agent that inspects all packets that pass through
> the node to which it is connected.  For example:
> 
> Given the topology,
> 
> N0 - N1 - N2 
> 
> An Agent attached to N1 would execute it's recv() function even if N2 was
> sending a packet to N0.  Is this possible? If so, any pointers to examples
> or descriptions would be greatly appreciated!
> 
> Also, as a new NS user, I'm still a little unsure of the exact "path through
> the ns code" that a packet takes on it's way from a sender to a destination.
> Is there a more succinct description of this process than what is in the ns
> documentation?
> 
> Thanks!
> 
> Brad
> 

Reply via email to