Class UDPPacketReader

java.lang.Object
net.i2p.router.transport.udp.UDPPacketReader

class UDPPacketReader extends Object
To read a packet, initialize this reader with the data and fetch out the appropriate fields. If the interesting bits are in message specific elements, grab the appropriate subreader. Many of the methods here and in the subclasses will throw AIOOBE on malformed packets, that should be caught also.
  • Constructor Details

    • UDPPacketReader

      public UDPPacketReader(I2PAppContext ctx)
      Parameters:
      ctx - unused
  • Method Details

    • initialize

      public void initialize(UDPPacket packet)
    • readPayloadType

      public int readPayloadType()
      what type of payload is in here?
    • isRekeyingIncluded

      public boolean isRekeyingIncluded()
      Does this packet include rekeying data in the header? Unused, should always be false.
    • isExtendedOptionsIncluded

      public boolean isExtendedOptionsIncluded()
      Does this packet include extended options in the header?
    • readTimestamp

      public long readTimestamp()
      Returns:
      seconds
    • readKeyingMaterial

      @Deprecated public byte[] readKeyingMaterial()
      Deprecated.
      unused
      Returns rekeying data (64 bytes), or null if none. Unused, should always return null.
    • readExtendedOptions

      public byte[] readExtendedOptions()
      Returns extended option data, 0-255 bytes, or null if none. Returned array does NOT include the length byte.
      Returns:
      extended options or null if none is included
      Since:
      0.9.24
    • getSessionRequestReader

      public UDPPacketReader.SessionRequestReader getSessionRequestReader()
    • getSessionCreatedReader

      public UDPPacketReader.SessionCreatedReader getSessionCreatedReader()
    • getSessionConfirmedReader

      public UDPPacketReader.SessionConfirmedReader getSessionConfirmedReader()
    • getDataReader

      public UDPPacketReader.DataReader getDataReader()
    • getPeerTestReader

      public UDPPacketReader.PeerTestReader getPeerTestReader()
    • getRelayRequestReader

      public UDPPacketReader.RelayRequestReader getRelayRequestReader()
    • getRelayIntroReader

      public UDPPacketReader.RelayIntroReader getRelayIntroReader()
    • getRelayResponseReader

      public UDPPacketReader.RelayResponseReader getRelayResponseReader()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toRawString

      public void toRawString(StringBuilder buf)