- All Known Implementing Classes:
PeerState2, PeerStateDestroyed
interface SSU2Sender
Basic interface over top of PeerState2 and PeerStateDestroyed, so we can pass them both to PacketBuilder2 to send packets.
Method Summary
All MethodsModifier and TypeMethodDescriptionvoidfragmentsSent(long pktNum, int length, List<PacketBuilder2.Fragment> fragments) Records that a set of fragments was sent.Bitfield of acked messages.bytegetFlags()Flags byte.intgetMTU()Maximum transmission unit.longNext packet number to use.Bitfield of received messages.Remote host ID.Remote IP address.intRemote port.Cipher to use when sending.longConnection ID to use when sending.byte[]Header encryption key 1.byte[]Header encryption key 2.booleanisIPv6()Whether the remote is IPv6.voidsetDestroyReason(int reason) Reason the connection was destroyed.
Method Details
getRemoteHostId
isIPv6
boolean isIPv6()Whether the remote is IPv6.- Returns:
- true for IPv6
getRemoteIPAddress
getRemotePort
int getRemotePort()Remote port.- Returns:
- the port in the 1-65535 range
getMTU
int getMTU()Maximum transmission unit.- Returns:
- the largest payload size to build packets to, between
PeerState2.MIN_MTUandPeerState2.MAX_MTU
getNextPacketNumber
Next packet number to use.- Returns:
- next packet number
- Throws:
IOException- if the peer is already dead and cannot send
getSendConnID
long getSendConnID()Connection ID to use when sending.- Returns:
- send connection ID
getSendCipher
CipherState getSendCipher()Cipher to use when sending.- Returns:
- the cipher state; the caller must sync on it while encrypting
getSendHeaderEncryptKey1
byte[] getSendHeaderEncryptKey1()Header encryption key 1.- Returns:
- send header encrypt key 1
getSendHeaderEncryptKey2
byte[] getSendHeaderEncryptKey2()Header encryption key 2.- Returns:
- send header encrypt key 2
setDestroyReason
void setDestroyReason(int reason) Reason the connection was destroyed.- Parameters:
reason- theSSU2Utiltermination code, echoed to the peer in a SessionDestroy and ignored once destroyed
getReceivedMessages
getAckedMessages
fragmentsSent
Records that a set of fragments was sent.- Parameters:
pktNum- the packet number the fragments were sent underlength- the total payload length those fragments add up tofragments- fragment list
getFlags
byte getFlags()Flags byte.- Returns:
- flags byte