net.i2p.router.transport.udp
Class PacketBuilder

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

public class PacketBuilder
extends java.lang.Object

Big ol' class to do all our packet formatting. The UDPPackets generated are fully authenticated, encrypted, and configured for delivery to the peer.


Constructor Summary
PacketBuilder(I2PAppContext ctx)
           
 
Method Summary
 UDPPacket buildACK(PeerState peer, java.util.List ackedMessageIds)
           
 UDPPacket buildPacket(OutboundMessageState state, int fragment, PeerState peer)
           
 UDPPacket buildSessionConfirmedPacket(OutboundEstablishState state, int fragmentNum, int numFragments, byte[] identity)
          Build a new SessionConfirmed packet for the given peer
 UDPPacket[] buildSessionConfirmedPackets(OutboundEstablishState state, RouterIdentity ourIdentity)
          Build a new series of SessionConfirmed packets for the given peer, encrypting it as necessary.
 UDPPacket buildSessionCreatedPacket(InboundEstablishState state, int externalPort, SessionKey ourIntroKey)
          Build a new SessionCreated packet for the given peer, encrypting it as necessary.
 UDPPacket buildSessionRequestPacket(OutboundEstablishState state)
          Build a new SessionRequest packet for the given peer, encrypting it as necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PacketBuilder

public PacketBuilder(I2PAppContext ctx)
Method Detail

buildPacket

public UDPPacket buildPacket(OutboundMessageState state,
                             int fragment,
                             PeerState peer)

buildACK

public UDPPacket buildACK(PeerState peer,
                          java.util.List ackedMessageIds)

buildSessionCreatedPacket

public UDPPacket buildSessionCreatedPacket(InboundEstablishState state,
                                           int externalPort,
                                           SessionKey ourIntroKey)
Build a new SessionCreated packet for the given peer, encrypting it as necessary.

Returns:
ready to send packet, or null if there was a problem

buildSessionRequestPacket

public UDPPacket buildSessionRequestPacket(OutboundEstablishState state)
Build a new SessionRequest packet for the given peer, encrypting it as necessary.

Returns:
ready to send packet, or null if there was a problem

buildSessionConfirmedPackets

public UDPPacket[] buildSessionConfirmedPackets(OutboundEstablishState state,
                                                RouterIdentity ourIdentity)
Build a new series of SessionConfirmed packets for the given peer, encrypting it as necessary.

Returns:
ready to send packets, or null if there was a problem

buildSessionConfirmedPacket

public UDPPacket buildSessionConfirmedPacket(OutboundEstablishState state,
                                             int fragmentNum,
                                             int numFragments,
                                             byte[] identity)
Build a new SessionConfirmed packet for the given peer

Returns:
ready to send packets, or null if there was a problem