|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.router.transport.udp.PeerState
public class PeerState
Contain all of the state about a UDP connection to a peer.
Field Summary | |
---|---|
(package private) static int |
IP_HEADER_SIZE
|
(package private) static long |
RETRANSMISSION_PERIOD_WIDTH
how many packets will be considered within the retransmission rate calculation |
(package private) static int |
UDP_HEADER_SIZE
|
Constructor Summary | |
---|---|
PeerState(RouterContext ctx,
UDPTransport transport)
|
Method Summary | |
---|---|
void |
acked(ACKBitfield bitfield)
|
int |
acked(long messageId)
|
int |
add(OutboundMessageState state)
|
void |
adjustClockSkew(short skew)
how far off is the remote peer from our clock, in seconds? |
OutboundMessageState |
allocateSend()
Pick a message we want to send and allocate it out of our window |
boolean |
allocateSendingBytes(int size,
boolean isForACK)
|
boolean |
allocateSendingBytes(int size,
boolean isForACK,
int messagePushCount)
|
boolean |
allocateSendingBytes(int size,
int messagePushCount)
Decrement the remaining bytes in the current period's window, returning true if the full size can be decremented, false if it cannot. |
void |
dataReceived()
|
void |
dropOutbound()
drop all outbound messages |
void |
ECNReceived()
we received a backoff request, so cut our send window |
int |
expireInboundMessages()
Expire partially received inbound messages, returning how many are still pending. |
(package private) void |
fetchPartialACKs(java.util.List rv)
|
int |
finishMessages()
Expire / complete any outbound messages |
short |
getClockSkew()
how far off is the remote peer from our clock, in seconds? |
int |
getConcurrentSends()
|
int |
getConcurrentSendWindow()
|
int |
getConsecutiveFailedSends()
how many seconds have we sent packets without any ACKs received? |
int |
getConsecutiveSendRejections()
|
SessionKey |
getCurrentCipherKey()
The AES key used to encrypt/decrypt packets, set only after the connection is established. |
java.util.List |
getCurrentFullACKs()
Grab a list of message ids (Long) that we want to send to the remote peer, regardless of the packet size, but don't remove it from our "want to send" list. |
SessionKey |
getCurrentMACKey()
The AES key used to verify packets, set only after the connection is established. |
long |
getCurrentReceiveSecond()
what is the current receive second, for congestion control? |
boolean |
getCurrentSecondECNReceived()
have we received a packet with the ECN bit set in the current second? |
long |
getInactivityTime()
|
java.util.Map |
getInboundMessages()
Fetch the internal id (Long) to InboundMessageState for incomplete inbound messages. |
long |
getKeyEstablishedTime()
when were the current cipher and MAC keys established/rekeyed? |
long |
getLastACKSend()
when did we last send an ACK to the peer? |
long |
getLastReceiveTime()
when did we last receive a packet from them? |
long |
getLastSendFullyTime()
when did we last send them a message that was ACKed? |
long |
getLastSendTime()
when did we last send them a packet? |
long |
getMessagesReceived()
|
long |
getMessagesSent()
|
int |
getMTU()
what is the largest packet we can send to the peer? |
long |
getMTUDecreases()
|
long |
getMTUIncreases()
|
long |
getMTULastChecked()
when did we last check the MTU? |
SessionKey |
getNextCipherKey()
The pending AES key for encrypting/decrypting packets if we are rekeying the connection, or null if we are not in the process of rekeying. |
int |
getNextDelay()
return how long to wait before sending, or -1 if we have nothing to send |
byte[] |
getNextKeyingMaterial()
The keying material used for the rekeying, or null if we are not in the process of rekeying. |
SessionKey |
getNextMACKey()
The pending AES key for verifying packets if we are rekeying the connection, or null if we are not in the process of rekeying. |
int |
getOutboundMessageCount()
|
long |
getPacketRetransmissionRate()
avg number of packets retransmitted for every 100 packets |
int |
getPacketsPeriodRetransmitted()
|
long |
getPacketsPeriodTransmitted()
|
long |
getPacketsReceived()
|
long |
getPacketsReceivedDuplicate()
|
long |
getPacketsRetransmitted()
|
long |
getPacketsTransmitted()
|
int |
getReceiveACKBps()
|
int |
getReceiveBps()
|
int |
getReceiveMTU()
estimate how large the other side is sending packets |
boolean |
getRekeyBeganLocally()
true if we began the current rekeying, false otherwise |
RemoteHostId |
getRemoteHostId()
|
byte[] |
getRemoteIP()
what IP is the peer sending and receiving packets on? |
java.net.InetAddress |
getRemoteIPAddress()
|
Hash |
getRemotePeer()
The peer are we talking to. |
int |
getRemotePort()
what port is the peer sending and receiving packets on? |
boolean |
getRemoteRequiresIntroduction()
if we need to contact them, do we need to talk to an introducer? |
boolean |
getRemoteWantsPreviousACKs()
have all of the packets received in the current second requested that the previous second's ACKs be sent? |
int |
getRTO()
how soon should we retransmit an unacked packet? |
int |
getRTT()
how long does it usually take to get a message ACKed? |
long |
getRTTDeviation()
how skewed are the measured RTTs? |
int |
getSendACKBps()
how fast we are sending *ack* packets |
int |
getSendBps()
return the smoothed send transfer rate |
int |
getSendWindowBytes()
how many bytes should we send to the peer in a second |
int |
getSendWindowBytesRemaining()
how many bytes can we send to the peer in the current second |
int |
getSlowStartThreshold()
|
long |
getTheyRelayToUsAs()
If they have offered to serve as an introducer to us, this is the tag we can use to publish that fact. |
long |
getWantedACKSendSince()
|
long |
getWeRelayToThemAs()
if we are serving as an introducer to them, this is the the tag that they can publish that, when presented to us, will cause us to send a relay introduction to the current peer |
int |
incrementConsecutiveFailedSends()
|
void |
loadFrom(PeerState oldPeer)
Transfer the basic activity/state from the old peer to the current peer |
void |
messageACKed(int bytesACKed,
long lifetime,
int numSends)
we sent a message which was ACKed containing the given # of bytes |
void |
messageFullyReceived(java.lang.Long messageId,
int bytes)
we received the message specified completely |
void |
messageFullyReceived(java.lang.Long messageId,
int bytes,
boolean isForACK)
|
void |
messagePartiallyReceived()
|
void |
messageRetransmitted(int packets)
we are resending a packet, so lets jack up the rto |
void |
packetReceived(int size)
|
void |
packetsTransmitted(int packets)
|
void |
remoteDoesNotWantPreviousACKs()
have all of the packets received in the current second requested that the previous second's ACKs be sent? |
void |
removeACKMessage(java.lang.Long messageId)
|
java.util.List |
retrieveACKBitfields()
grab a list of ACKBitfield instances, some of which may fully ACK a message while others may only partially ACK a message. |
java.util.List |
retrieveACKBitfields(boolean alwaysIncludeRetransmissions)
|
void |
setCurrentCipherKey(SessionKey key)
The AES key used to encrypt/decrypt packets, set only after the connection is established. |
void |
setCurrentMACKey(SessionKey key)
The AES key used to verify packets, set only after the connection is established. |
void |
setCurrentReceiveSecond(long sec)
what is the current receive second, for congestion control? |
void |
setKeyEstablishedTime(long when)
when were the current cipher and MAC keys established/rekeyed? |
void |
setLastACKSend(long when)
|
void |
setLastReceiveTime(long when)
when did we last receive a packet from them? |
void |
setLastSendTime(long when)
when did we last send them a packet? |
void |
setMTU(int mtu)
what is the largest packet we can send to the peer? |
void |
setNextCipherKey(SessionKey key)
The pending AES key for encrypting/decrypting packets if we are rekeying the connection, or null if we are not in the process of rekeying. |
void |
setNextKeyingMaterial(byte[] data)
The keying material used for the rekeying, or null if we are not in the process of rekeying. |
void |
setNextMACKey(SessionKey key)
The pending AES key for verifying packets if we are rekeying the connection, or null if we are not in the process of rekeying. |
void |
setRekeyBeganLocally(boolean local)
true if we began the current rekeying, false otherwise |
void |
setRemoteAddress(byte[] ip,
int port)
what IP+port is the peer sending and receiving packets on? |
void |
setRemotePeer(Hash peer)
The peer are we talking to. |
void |
setRemoteRequiresIntroduction(boolean required)
if we need to contact them, do we need to talk to an introducer? |
void |
setTheyRelayToUsAs(long tag)
If they have offered to serve as an introducer to us, this is the tag we can use to publish that fact. |
void |
setWeRelayToThemAs(long tag)
if we are serving as an introducer to them, this is the the tag that they can publish that, when presented to us, will cause us to send a relay introduction to the current peer |
java.lang.String |
toString()
|
boolean |
unsentACKThresholdReached()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
static final long RETRANSMISSION_PERIOD_WIDTH
static final int UDP_HEADER_SIZE
static final int IP_HEADER_SIZE
Constructor Detail |
---|
public PeerState(RouterContext ctx, UDPTransport transport)
Method Detail |
---|
public Hash getRemotePeer()
public SessionKey getCurrentMACKey()
public SessionKey getCurrentCipherKey()
public SessionKey getNextMACKey()
public SessionKey getNextCipherKey()
public byte[] getNextKeyingMaterial()
public boolean getRekeyBeganLocally()
public long getKeyEstablishedTime()
public short getClockSkew()
public long getCurrentReceiveSecond()
public long getLastSendTime()
public long getLastSendFullyTime()
public long getLastReceiveTime()
public int getConsecutiveFailedSends()
public boolean getCurrentSecondECNReceived()
public boolean getRemoteWantsPreviousACKs()
public int getSendWindowBytes()
public int getSendWindowBytesRemaining()
public byte[] getRemoteIP()
public java.net.InetAddress getRemoteIPAddress()
public int getRemotePort()
public boolean getRemoteRequiresIntroduction()
public long getWeRelayToThemAs()
public long getTheyRelayToUsAs()
public int getMTU()
public int getReceiveMTU()
public long getMTULastChecked()
public long getMTUIncreases()
public long getMTUDecreases()
public void setRemotePeer(Hash peer)
public void setCurrentMACKey(SessionKey key)
public void setCurrentCipherKey(SessionKey key)
public void setNextMACKey(SessionKey key)
public void setNextCipherKey(SessionKey key)
public void setNextKeyingMaterial(byte[] data)
public void setRekeyBeganLocally(boolean local)
public void setKeyEstablishedTime(long when)
public void adjustClockSkew(short skew)
public void setCurrentReceiveSecond(long sec)
public void setLastSendTime(long when)
public void setLastReceiveTime(long when)
public int getSendBps()
public int getReceiveBps()
public int incrementConsecutiveFailedSends()
public long getInactivityTime()
public int getSendACKBps()
public int getReceiveACKBps()
public void remoteDoesNotWantPreviousACKs()
public boolean allocateSendingBytes(int size, int messagePushCount)
public boolean allocateSendingBytes(int size, boolean isForACK)
public boolean allocateSendingBytes(int size, boolean isForACK, int messagePushCount)
public void setRemoteAddress(byte[] ip, int port)
public void setRemoteRequiresIntroduction(boolean required)
public void setWeRelayToThemAs(long tag)
public void setTheyRelayToUsAs(long tag)
public void setMTU(int mtu)
public int getSlowStartThreshold()
public int getConcurrentSends()
public int getConcurrentSendWindow()
public int getConsecutiveSendRejections()
public void messageFullyReceived(java.lang.Long messageId, int bytes)
public void messageFullyReceived(java.lang.Long messageId, int bytes, boolean isForACK)
public void messagePartiallyReceived()
public java.util.Map getInboundMessages()
public int expireInboundMessages()
public java.util.List getCurrentFullACKs()
public void removeACKMessage(java.lang.Long messageId)
public java.util.List retrieveACKBitfields()
public java.util.List retrieveACKBitfields(boolean alwaysIncludeRetransmissions)
void fetchPartialACKs(java.util.List rv)
public void messageACKed(int bytesACKed, long lifetime, int numSends)
public void messageRetransmitted(int packets)
public void packetsTransmitted(int packets)
public int getRTT()
public int getRTO()
public long getRTTDeviation()
public long getMessagesSent()
public long getMessagesReceived()
public long getPacketsTransmitted()
public long getPacketsRetransmitted()
public long getPacketsPeriodTransmitted()
public int getPacketsPeriodRetransmitted()
public long getPacketRetransmissionRate()
public long getPacketsReceived()
public long getPacketsReceivedDuplicate()
public void packetReceived(int size)
public void ECNReceived()
public void dataReceived()
public long getLastACKSend()
public void setLastACKSend(long when)
public long getWantedACKSendSince()
public boolean unsentACKThresholdReached()
public RemoteHostId getRemoteHostId()
public int add(OutboundMessageState state)
public void dropOutbound()
public int getOutboundMessageCount()
public int finishMessages()
public OutboundMessageState allocateSend()
public int getNextDelay()
public int acked(long messageId)
public void acked(ACKBitfield bitfield)
public void loadFrom(PeerState oldPeer)
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |