[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Classifier in an agent for simple link selection



Daniel Friedman <[email protected]> writes:

> My ns version is 2.1b4a.
> 
> Pretend I have a star topology of nodes, and from the central node I
> must send a packet to one of the leaf (non-central) nodes over the link
> from the central node to that leaf node.  The decision of which leaf
> node should get the packet is made by an agent ("CentralAgent") I've
> built  for the central node.  I think I need to incorporate somehow a
> classifier in my CentralAgent.  Looking at errmodel.{h,cc} and
> mac.{h,cc}, it appears I need a line something like this:
> 
> class CentralAgent: public Agent {
> 	// ...
> 	Classifier *classifier_;
> 	// ...
> };
> 
> ===> Q1) I don't see, though, where/how this classifier is/should be
>          actually created.  (or is my approach incorrect?)

If you don't want to use the ns default routing, your approach is
fine.  You can either create it in C++ (in CentralAgent's constructor,
or just declare it as "Classifier classifier_")  or you can create and
populate it in TCL and then provide a command to lookup and assign
this pointer, just like it's done in errmodel.

> 
> Once I understand the answer to Q1, I think that I can use the
> install{<index> <object>} instproc-like within my Tcl script to populate
> the slot table with the object names of the links to the leaf nodes,
> sort of like this:
> 
>   for {set i 0} {$i < $leaf_count} {incr i} {
>     $centralnode install $i [$ns link $centralnode $leaf($i)]
>   }
> 
> ... after I've extended CentralAgent::command() to forward this
> 'install' command to the central agent's classifier_.
> 
> ===> Q2) Does this sound right?  Am I going about this correctly?

I think this should work.  Probably you'll need to install
a head-of-link instead of a link:
	$centralnode install $i [[$ns link $centralnode $leaf($i)] head]


  -Yuri