downstream and upstream methods

Eddie Kohler eddietwo at cag.lcs.mit.edu
Tue Apr 27 19:37:21 EDT 1999


Router has new methods to allow you to find all the connections which lie
upstream or downstream of a given faction. All must be called at
initialize() time. (configure() time is too early; the methods will
fail and return -1.)

The simplest methods are:

   int Router::downstream_factions(Faction *f, Vector<Faction *> &v);
	Find all factions which lie downstream of `f' and append them to
	`v'.
	(A faction `f1' is downstream of `f' if a packet sent from `f'
	could pass by `f1'.)

   int Router::upstream_factions(Faction *, Vector<Faction *> &);
	Find all factions which lie upstream of `f' and append them to
	`v'.
	(A faction `f1' is upstream of `f' if a packet sent from `f1'
	could pass by `f'.)

In fact, you can ask for "all factions downstream of a given output port"
and "all factions upstream of a given input port":

   int Router::downstream_factions(Faction *, int outport, Vector<Faction *>&);
   int Router::upstream_factions(Faction *, int inport, Vector<Faction *>&);

And you can ask for "all input ports downstream of a given output port" and
"all output ports upstream of a given input port":

   typedef Faction::Connection Connection;
   int Router::downstream_inputs(Faction *, int outport, Vector<Connection>&);
   int Router::upstream_inputs(Faction *, int inport, Vector<Connection>&);

These methods use Faction's forward_flow and backward_flow methods, as well
as the router's list of connections, to analyze how packets flow through
the router.

They do not work correctly in the presence of compound factions.

love,
ed



More information about the click mailing list