net.i2p.router.transport.udp
Class UDPPacket

java.lang.Object
  extended bynet.i2p.router.transport.udp.UDPPacket

public class UDPPacket
extends java.lang.Object

Basic delivery unit containing the datagram. This also maintains a cache of object instances to allow rapid reuse.


Field Summary
static byte DATA_FLAG_ECN
           
static byte DATA_FLAG_EXPLICIT_ACK
           
static byte DATA_FLAG_EXPLICIT_NACK
           
static byte DATA_FLAG_EXTENDED
           
static byte DATA_FLAG_NUMACKS
           
static byte DATA_FLAG_WANT_ACKS
           
static byte DATA_FLAG_WANT_REPLY
           
static int IV_SIZE
           
static int MAC_SIZE
           
static int PAYLOAD_TYPE_DATA
           
static int PAYLOAD_TYPE_RELAY_INTRO
           
static int PAYLOAD_TYPE_RELAY_REQUEST
           
static int PAYLOAD_TYPE_RELAY_RESPONSE
           
static int PAYLOAD_TYPE_SESSION_CONFIRMED
           
static int PAYLOAD_TYPE_SESSION_CREATED
           
static int PAYLOAD_TYPE_SESSION_REQUEST
           
 
Method Summary
static UDPPacket acquire(I2PAppContext ctx)
           
 void decrypt(SessionKey cipherKey)
          Decrypt this valid packet, overwriting the _data buffer's payload with the decrypted data (leaving the MAC and IV unaltered)
 long getExpiration()
           
 long getLifetime()
           
 java.net.DatagramPacket getPacket()
           
 short getPriority()
           
 void initialize(short priority, long expiration, java.net.InetAddress host, int port)
           
 void release()
           
 void resetBegin()
           
 java.lang.String toString()
           
 boolean validate(SessionKey macKey)
          Validate the packet against the MAC specified, returning true if the MAC matches, false otherwise.
 void writeData(byte[] src, int offset, int len)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

IV_SIZE

public static final int IV_SIZE
See Also:
Constant Field Values

MAC_SIZE

public static final int MAC_SIZE
See Also:
Constant Field Values

PAYLOAD_TYPE_SESSION_REQUEST

public static final int PAYLOAD_TYPE_SESSION_REQUEST
See Also:
Constant Field Values

PAYLOAD_TYPE_SESSION_CREATED

public static final int PAYLOAD_TYPE_SESSION_CREATED
See Also:
Constant Field Values

PAYLOAD_TYPE_SESSION_CONFIRMED

public static final int PAYLOAD_TYPE_SESSION_CONFIRMED
See Also:
Constant Field Values

PAYLOAD_TYPE_RELAY_REQUEST

public static final int PAYLOAD_TYPE_RELAY_REQUEST
See Also:
Constant Field Values

PAYLOAD_TYPE_RELAY_RESPONSE

public static final int PAYLOAD_TYPE_RELAY_RESPONSE
See Also:
Constant Field Values

PAYLOAD_TYPE_RELAY_INTRO

public static final int PAYLOAD_TYPE_RELAY_INTRO
See Also:
Constant Field Values

PAYLOAD_TYPE_DATA

public static final int PAYLOAD_TYPE_DATA
See Also:
Constant Field Values

DATA_FLAG_EXPLICIT_ACK

public static final byte DATA_FLAG_EXPLICIT_ACK
See Also:
Constant Field Values

DATA_FLAG_EXPLICIT_NACK

public static final byte DATA_FLAG_EXPLICIT_NACK
See Also:
Constant Field Values

DATA_FLAG_NUMACKS

public static final byte DATA_FLAG_NUMACKS
See Also:
Constant Field Values

DATA_FLAG_ECN

public static final byte DATA_FLAG_ECN
See Also:
Constant Field Values

DATA_FLAG_WANT_ACKS

public static final byte DATA_FLAG_WANT_ACKS
See Also:
Constant Field Values

DATA_FLAG_WANT_REPLY

public static final byte DATA_FLAG_WANT_REPLY
See Also:
Constant Field Values

DATA_FLAG_EXTENDED

public static final byte DATA_FLAG_EXTENDED
See Also:
Constant Field Values
Method Detail

initialize

public void initialize(short priority,
                       long expiration,
                       java.net.InetAddress host,
                       int port)

writeData

public void writeData(byte[] src,
                      int offset,
                      int len)

getPacket

public java.net.DatagramPacket getPacket()

getPriority

public short getPriority()

getExpiration

public long getExpiration()

getLifetime

public long getLifetime()

resetBegin

public void resetBegin()

validate

public boolean validate(SessionKey macKey)
Validate the packet against the MAC specified, returning true if the MAC matches, false otherwise.


decrypt

public void decrypt(SessionKey cipherKey)
Decrypt this valid packet, overwriting the _data buffer's payload with the decrypted data (leaving the MAC and IV unaltered)


toString

public java.lang.String toString()

acquire

public static UDPPacket acquire(I2PAppContext ctx)

release

public void release()