All Packages  This Package  Class Hierarchy  Class Search  Index

Class edu.utah.janos.antsr.route.DynamicRouteCapsule
java.lang.Object
   |
   +----edu.utah.janos.antsr.core.Capsule
           |
           +----edu.utah.janos.antsr.route.DynamicRouteCapsule

  Summary

public class  DynamicRouteCapsule
     extends edu.utah.janos.antsr.core.Capsule
{
          // Fields 6
     private static final byte[] MID;
     private static final byte[] PID;
     String addressSpec;
     int nroutes;
     String protocolSpec;
     ByteArray routes;

          // Constructors 2
     public DynamicRouteCapsule();
     public DynamicRouteCapsule(int, String, String, Vector);

          // Methods 7
     public Xdr decode();
     public Xdr encode();
     public boolean evaluate(Node);
     public int length();
     protected byte[] mid();
     protected byte[] pid();
     public String toString();
}

Route update capsule.

Used to be a built-in capsule type. Now it is not.

XXX fix the PACKAGE-accessible fields. (Need to be accessible in DynamicRouteApp.)

Author:
Janos Ministry of Development , David Wetherall




  Fields

· MID

Summary  |  Top

   private static final byte[] MID


· PID

Summary  |  Top
   private static final byte[] PID


· protocolSpec

Summary  |  Top
   String protocolSpec

Physical address of the node this DynamicRouteCapsule originated at.

As a String because only the Core is allowed to parse these things. XXX not very safe for pushing thorugh the network, now is it?


· addressSpec

Summary  |  Top
   String addressSpec


· nroutes

Summary  |  Top
   int nroutes

Number of route updates this capsule contains. Controls the size of the routes array.

XXX this need not be encoded/decoded. It can be inferred from the size of the byte array (which is already encoded for us by the Xdr routines).


· routes

Summary  |  Top
   ByteArray routes

The route updates. Each update consists of:

 logical destination (INT)
 cost (byte)
 


  Constructors

· DynamicRouteCapsule

Summary  |  Top

   public DynamicRouteCapsule() 

Construct an empty DynamicRouteCapsule. This is only invoked when a node receives a DynamicRouteCapsule.



· DynamicRouteCapsule

Summary  |  Top
   public DynamicRouteCapsule(int activeDest, 
                              String protocolSpec, 
                              String addressSpec, 
                              Vector routeVec) 

Create a DynamicRouteCapsule to send to a remote host. This capsule will be sent to the activeDest host.

It contains the *physical address* of the host that sends it. (Because, hey, that's what routing does.)

Lastly, it will contain a suite of DynamicRouteEntries for the destination host to store in its RouteTable.

Parameter Description
activeDest the destination for this capsule. Must be 1 hop away.
srcPhysAddr the physical address of the the sender. As a string.
routeVec a list of updated route entries for the remote node



  Methods

· mid

Summary  |  Top
   protected byte[] mid() 
Overrides:
mid in class Capsule


· pid

Summary  |  Top
   protected byte[] pid() 
Overrides:
pid in class Capsule


· length

Summary  |  Top
   public int length() 

The length of this capsule. Adds the length of the physAddr string, 4 bytes for the nroutes word, and zero or more bytes for the routes array.

Overrides:
length in class Capsule


· encode

Summary  |  Top
   public Xdr encode() 
Overrides:
encode in class Capsule


· decode

Summary  |  Top
   public Xdr decode() 
Overrides:
decode in class Capsule


· evaluate

Summary  |  Top
   public boolean evaluate(Node node) 

When an update capsule arrives at its destination Node, it gets delivered to the app that maintains the routing table.

Overrides:
evaluate in class Capsule


· toString

Summary  |  Top
   public String toString() 
Overrides:
toString in class Capsule


All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7