net.i2p.data.i2np
Class DeliveryInstructions

java.lang.Object
  extended by net.i2p.data.DataStructureImpl
      extended by net.i2p.data.i2np.DeliveryInstructions
All Implemented Interfaces:
Serializable, DataStructure

public class DeliveryInstructions
extends DataStructureImpl

Contains the delivery instructions for garlic cloves. Generic "delivery instructions" are used both in tunnel messages and in garlic cloves, with slight differences. However, the tunnel message generator TrivialPreprocessor and reader FragmentHandler do not use this class, the reading and writing is handled inline there.

Author:
jrandom
See Also:
Serialized Form

Field Summary
static int DELIVERY_MODE_DESTINATION
           
static int DELIVERY_MODE_LOCAL
           
static int DELIVERY_MODE_ROUTER
           
static int DELIVERY_MODE_TUNNEL
           
static DeliveryInstructions LOCAL
          Immutable local instructions, no options
 
Constructor Summary
DeliveryInstructions()
           
 
Method Summary
static DeliveryInstructions create(byte[] data, int offset)
          Returns immutable local instructions, or new
 boolean equals(Object obj)
           
 boolean getDelayRequested()
          Deprecated. unused
 long getDelaySeconds()
          Deprecated. unused
 int getDeliveryMode()
          default -1
 Hash getDestination()
          default null
 boolean getEncrypted()
          Deprecated. unused
 SessionKey getEncryptionKey()
          Deprecated. unused
 Hash getRouter()
          default null
 int getSize()
           
 TunnelId getTunnelId()
          default null
 int hashCode()
           
 int readBytes(byte[] data, int offset)
           
 void readBytes(InputStream in)
          Deprecated. unused
 void setDelayRequested(boolean req)
          Deprecated. unused
 void setDelaySeconds(long seconds)
          Deprecated. unused
 void setDeliveryMode(int mode)
           
 void setDestination(Hash dest)
          required for DESTINATION
 void setEncrypted(boolean encrypted)
          Deprecated. unused
 void setEncryptionKey(SessionKey key)
          Deprecated. unused
 void setRouter(Hash router)
          required for ROUTER or TUNNEL
 void setTunnelId(TunnelId id)
          required for TUNNEL
 String toString()
           
 int writeBytes(byte[] target, int offset)
           
 void writeBytes(OutputStream out)
          Deprecated. unused
 
Methods inherited from class net.i2p.data.DataStructureImpl
calculateHash, fromBase64, fromByteArray, read, toBase64, toByteArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DELIVERY_MODE_LOCAL

public static final int DELIVERY_MODE_LOCAL
See Also:
Constant Field Values

DELIVERY_MODE_DESTINATION

public static final int DELIVERY_MODE_DESTINATION
See Also:
Constant Field Values

DELIVERY_MODE_ROUTER

public static final int DELIVERY_MODE_ROUTER
See Also:
Constant Field Values

DELIVERY_MODE_TUNNEL

public static final int DELIVERY_MODE_TUNNEL
See Also:
Constant Field Values

LOCAL

public static final DeliveryInstructions LOCAL
Immutable local instructions, no options

Since:
0.9.9
Constructor Detail

DeliveryInstructions

public DeliveryInstructions()
Method Detail

create

public static DeliveryInstructions create(byte[] data,
                                          int offset)
                                   throws DataFormatException
Returns immutable local instructions, or new

Throws:
DataFormatException
Since:
0.9.20

getEncrypted

public boolean getEncrypted()
Deprecated. unused

For cloves only (not tunnels), default false, unused


setEncrypted

public void setEncrypted(boolean encrypted)
Deprecated. unused

For cloves only (not tunnels), default false, unused


getEncryptionKey

public SessionKey getEncryptionKey()
Deprecated. unused

For cloves only (not tunnels), default null, unused


setEncryptionKey

public void setEncryptionKey(SessionKey key)
Deprecated. unused

For cloves only (not tunnels), default null, unused


getDeliveryMode

public int getDeliveryMode()
default -1


setDeliveryMode

public void setDeliveryMode(int mode)
Parameters:
mode - 0-3

getDestination

public Hash getDestination()
default null


setDestination

public void setDestination(Hash dest)
required for DESTINATION


getRouter

public Hash getRouter()
default null


setRouter

public void setRouter(Hash router)
required for ROUTER or TUNNEL


getTunnelId

public TunnelId getTunnelId()
default null


setTunnelId

public void setTunnelId(TunnelId id)
required for TUNNEL


getDelayRequested

public boolean getDelayRequested()
Deprecated. unused

default false, unused


setDelayRequested

public void setDelayRequested(boolean req)
Deprecated. unused

default false, unused


getDelaySeconds

public long getDelaySeconds()
Deprecated. unused

default 0, unused


setDelaySeconds

public void setDelaySeconds(long seconds)
Deprecated. unused

default 0, unused


readBytes

public void readBytes(InputStream in)
               throws DataFormatException,
                      IOException
Deprecated. unused

Description copied from interface: DataStructure
Load up the current object with data from the given stream. Data loaded this way must match the I2P data structure specification. Warning - many classes will throw IllegalStateException if data is already set.

Parameters:
in - stream to read from
Throws:
DataFormatException - if the data is improperly formatted
IOException - if there was a problem reading the stream

readBytes

public int readBytes(byte[] data,
                     int offset)
              throws DataFormatException
Throws:
DataFormatException

writeBytes

public void writeBytes(OutputStream out)
                throws DataFormatException,
                       IOException
Deprecated. unused

Description copied from interface: DataStructure
Write out the data structure to the stream, using the format defined in the I2P data structure specification.

Parameters:
out - stream to write to
Throws:
DataFormatException - if the data was incomplete or not yet ready to be written
IOException - if there was a problem writing to the stream

writeBytes

public int writeBytes(byte[] target,
                      int offset)
Returns:
the number of bytes written to the target

getSize

public int getSize()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object