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

Re: [ns] Queue-monitoring Agent



    Hi,

    Actually, there are a couple of ways to do it. The "orthodox" way
would be to make the agent ask the queues about their size every time
some other event happens, or using a timer to wake up the agent etc. In
this way you don't need to modify the existing queue models, only the
agent.

    Another way would be to implement a queue with some kind of call
back function. In this case you write a function for the queue to check
it's length and if over the threshold, call some public (or if you make
queue a friend class to your agent whichever)  function of the agent.
With this approach, the queue must have a way to know which agent to
inform ( a pointer at initialization time or sth)

The last (that I can think of) and most "provocative" way ( in a
programming sense) is to derive a class both from Agent and from Queue,
overload "command" and "recv" to do both intended jobs, implement your
agent stuff there, then make it the queue of the link you are interested
in! (some compliers are not friently to classes with multiple occurance
of virtual base class. If yours is one of them, game over ;-)

Hope it helped,

--
Andreas Alexelis, Lab.1 ACR,
Advanced Telecommunications Research, Japan
E-mail: [email protected]