All Packages This Package Class Hierarchy Class Search Index
java.lang.Object | +----edu.utah.janos.ants.ants.Capsule | +----edu.utah.janos.ants.ants.DataCapsule
Summary |
public class DataCapsule extends edu.utah.janos.ants.ants.Capsule { // Fields 6 private static final byte[] MID; private static final byte[] PID; public static final String VERSION; private ByteArray data; public short dpt; public short spt; // Constructors 2 public DataCapsule(); public DataCapsule(short, short, int, ByteArray); // Methods 8 public Xdr decode(); public Xdr encode(); public boolean evaluate(Node); public ByteArray getData(); public int length(); protected byte[] mid(); protected byte[] pid(); public void setData(ByteArray); }
Data capsule. Data capsules simply forward themselves to their destination. Each DataCapsule contains source and destination application ports (in addition to the source and destination node addresses kept by the superclass). Also, an arbitrary ByteArray payload is attached to the capsule.
XXX This doesn't need to be a builtin capsule type. Its convenient and all, but its not critical. Move it out to the apps/ directory. (Well, the fact that its builtin means the ID is fixed, so this is handy in a backwards-compatiblity way.)
Cross Reference |
Fields |
· VERSION | Summary | Top |
public static final String VERSION
WARNING: this is a builtin capsule, whose version number must be manually kept in synch with its functionality.
See Also: addCapsule
· MID | Summary | Top |
private static final byte[] MID
· PID | Summary | Top |
private static final byte[] PID
· spt | Summary | Top |
public short spt
Source application's port.
Not used by the DataCapsule, but its assumed that most users of this type will want to know where the capsule came from.
· dpt | Summary | Top |
public short dpt
Destination application's port.
· data | Summary | Top |
private ByteArray data
Data payload this capsule pulls through the network.
Constructors |
· DataCapsule | Summary | Top |
public DataCapsule()
· DataCapsule | Summary | Top |
public DataCapsule(short s, short d, int n, ByteArray p)
Construct a new DataCapsule.
Parameter Description s the source application's port d the destination application's port n the address of the destination node. p the payload.
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()
Return length of this data capsule.
- Overrides:
- length in class Capsule
See Also: Capsule.length
· encode | Summary | Top |
public Xdr encode()
- Overrides:
- encode in class Capsule
· decode | Summary | Top |
public Xdr decode()
- Overrides:
- decode in class Capsule
· getData | Summary | Top |
public ByteArray getData()
Get the payload associated with this DataCapsule.
· setData | Summary | Top |
public void setData(ByteArray data)
Set the payload associated with this DataCapsule.
· evaluate | Summary | Top |
public boolean evaluate(Node n)
Forwarding function for DataCapsules. Forwards the capsule to the appropriate application port if the capsule is on its destination node, otherwise forwards the capsule on to its destination node.
- Overrides:
- evaluate in class Capsule
All Packages This Package Class Hierarchy Class Search IndexFreshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7