All Packages This Package Class Hierarchy Class Search Index
java.lang.Object | +----edu.utah.janos.antsr.core.Entity | +----edu.utah.janos.antsr.core.Application | +----edu.utah.janos.antsr.route.DynamicRouteApp
Summary |
public class DynamicRouteApp extends edu.utah.janos.antsr.core.Application { // Fields 8 public static final int APP_PORT; private static final int MAXROUTESPERUPDATE; private static final String[] defaults; private final DynamicRouteEvents events; private boolean firstSend; private Node node; private boolean suppressTriggerEvents; private DynamicRouteTable table; // Constructors 1 public DynamicRouteApp(); // Methods 15 private void clearChangeFlags(); private void expireEntries(DynamicRouteEvent); private void gcEntries(DynamicRouteEvent); private void initApp(); private void initEvents(); boolean newRouteInfo(int, int, int, String, long); public void receive(Capsule); private String repairPhysAddr(String); void scheduleTrigger(long); private void sendRouteMessages(int); private void sendRouteWorker(DynamicRouteEntry, int); private void sendUpdate(DynamicRouteEntry, Vector); public void setArgs(KeyArgs) throws InvalidKeyArgsException; public void start(); void suppressTriggerEvents(boolean); }
The "app" that maintains a node's dynamic routing tables.
This is really just an app so it can justify sending capsules off without priming them off some other capsule. (All this code used to be part of DynamicRouteTable.)
Understands the default '-port' argument that all apps grok.
Fields |
· APP_PORT | Summary | Top |
public static final int APP_PORT
· defaults | Summary | Top |
private static final String[] defaults
· MAXROUTESPERUPDATE | Summary | Top |
private static final int MAXROUTESPERUPDATE
Maximum number of route updates to stuff into a single RouteUpdateCapsule. (Each update costs 5 bytes).
· table | Summary | Top |
private DynamicRouteTable table
The table this app is keeping up to date.
· node | Summary | Top |
private Node node
The node this table is maintained on.
· suppressTriggerEvents | Summary | Top |
private boolean suppressTriggerEvents
Used for suppressing triggered updates. Triggered updates are scheduled when the routing table is changed. Once a triggered update is scheduled, futher updates are suppressed until the trigger update is executed.
· events | Summary | Top |
private final DynamicRouteEvents events
The queue of timers and events that cause updates.
· firstSend | Summary | Top |
private boolean firstSend
Some extra things need to be sent out the first time to gauruntee that the routes are set up, so keep track of the first time.
Constructors |
· DynamicRouteApp | Summary | Top |
public DynamicRouteApp()
App constructors can't do anything useful. Ideally, I would like to set this.node and this.table, but I can't because the node hasn't been plugged into this app yet, and I need to node to get the table...
Methods |
· setArgs | Summary | Top |
public void setArgs(KeyArgs k) throws InvalidKeyArgsException
Parse command line arguments.
See the class description for a list of the arguments and their meaning.
- Overrides:
- setArgs in class Application
· initEvents | Summary | Top |
private void initEvents()
Initialize the event queue.
· initApp | Summary | Top |
private void initApp()
Do initialization of the App.
XXX one-time function.
· start | Summary | Top |
public void start()
The active route table logic.
Harmless if invoked on a static table.
- Overrides:
- start in class Application
· expireEntries | Summary | Top |
private void expireEntries(DynamicRouteEvent e)
Walks all routes and moves expired routes into the gcPool.
· gcEntries | Summary | Top |
private void gcEntries(DynamicRouteEvent e)
Delete all routes in the gcPool that have expired. Such routes are lost for all time.
· clearChangeFlags | Summary | Top |
private void clearChangeFlags()
Mark all routes as 'unchanged'.
· sendUpdate | Summary | Top |
private void sendUpdate(DynamicRouteEntry g, Vector r)
Send a route update to the given node.
XXX this is completely out of synch with the new world order.
· sendRouteWorker | Summary | Top |
private void sendRouteWorker(DynamicRouteEntry gatewayRoute, int cause)
Send a message to a host about a route. The given host should be a gateway host for this node.
· sendRouteMessages | Summary | Top |
private void sendRouteMessages(int cause)
Send a message to each gateway and to host which has a cost of "1" to reach. For each gateway send a long list of route entries.
XXX this is O(N * N) when N is the *number of routes*!
Parameter Description cause the reason this was invoked (Trigger or periodic).
· receive | Summary | Top |
public void receive(Capsule unknownCap)
Receive and process RouteUpdateCapsule. RouteUpdateCapsules contain zero or more route update records. Each "record" consists of a destination and a "distance" to that destination.
Parameter Description unknownCap the RouteUpdateCapsule.
- Overrides:
- receive in class Application
· repairPhysAddr | Summary | Top |
private String repairPhysAddr(String gwPhysAddr)
The physical address passed into newRouteInfo is in a different format than the route table expects it to be, so it need to be fixed.
Parameter Description gwPhyAddr The physical address in format proto;port:port:host
- Returns:
- The physical address in format host:port
· newRouteInfo | Summary | Top |
boolean newRouteInfo(int dest, int dist, int gw, String gwPhysAddr, long now)
Provide new information for a single route. If the info is useful, update the route table. It is the caller's responsibility to schedule a trigger update if there are changes to the route table.
Invoked by exclusivly by
RouteUpdateCapsule.evalutate
.
Parameter Description dest the active address of the destination to update a route to dist the distance to that node from the gateway gw the active address of the gateway (the "next hop" to dest) gwPhysAddr the physical address of the gateway now what time is it my dear?
- Returns:
- true if a change was made; false if not.
See Also: RouteUpdateCapsule
· suppressTriggerEvents | Summary | Top |
void suppressTriggerEvents(boolean doit)
Suppress scheduling of further trigger events. Or don't.
· scheduleTrigger | Summary | Top |
void scheduleTrigger(long when)
Schedule a trigger event for some time after 'when'. If triggers are surpressed (because one has already been scheduled but not executed) the request is dropped on the floor.
Invoked in here and by RouteUpdateCapsule.
All Packages This Package Class Hierarchy Class Search IndexFreshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7