Package net.i2p.router.transport.udp
Class UDPPacket
- java.lang.Object
-
- net.i2p.router.transport.udp.UDPPacket
-
-
Field Summary
Fields Modifier and Type Field Description static int
IV_SIZE
static int
MAC_SIZE
(package private) static int
MAX_PACKET_SIZE
Actually it is one less than this, we assume if a received packet is this big it is truncated.static int
MAX_PAYLOAD_TYPE
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_DESTROY
static int
PAYLOAD_TYPE_SESSION_REQUEST
Message types, 4 bits maxstatic int
PAYLOAD_TYPE_TEST
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static UDPPacket
acquire(RouterContext ctx, boolean inbound)
static void
clearCache()
Call at shutdown/startup to not hold ctx refsvoid
drop()
For CDQFIFOBandwidthLimiter.Request
getBandwidthRequest()
So that we can compete with NTCP, we want to request bandwidth in parallel, on the way into the queue, not on the way out.long
getBegin()
long
getEnqueueTime()
For CDQ(package private) int
getFragmentCount()
only for debugging and statslong
getLifetime()
int
getMarkedType()
flag this packet as a particular type for accounting purposes, with 1 implying the packet is an ACK, otherwise it is a data packet(package private) int
getMessageType()
only for debugging and stats, does not go on the wireDatagramPacket
getPacket()
int
getPriority()
Higher is higher priority(package private) RemoteHostId
getRemoteHost()
long
getSeqNum()
CDPQEntry(package private) long
getTimeSinceReceived()
a packet handler has pulled it off the inbound queuevoid
markType(int type)
flag this packet as a particular type for accounting purposes(package private) void
received()
a packet handler has pulled it off the inbound queuevoid
release()
void
requestInboundBandwidth()
Deprecated.unusedvoid
requestOutboundBandwidth()
So that we can compete with NTCP, we want to request bandwidth in parallel, on the way into the queue, not on the way out.void
resetBegin()
void
setEnqueueTime(long now)
For CDQ(package private) void
setFragmentCount(int count)
only for debugging and stats(package private) void
setMessageType(int type)
only for debugging and stats, does not go on the wirevoid
setPriority(int pri)
void
setSeqNum(long num)
CDPQEntryString
toString()
how many times we tried to validate the packet
-
-
-
Field Detail
-
MAX_PACKET_SIZE
static final int MAX_PACKET_SIZE
Actually it is one less than this, we assume if a received packet is this big it is truncated. This is bigger than PeerState.LARGE_MTU, as the far-end's LARGE_MTU may be larger than ours. Due to longstanding bugs, a packet may be larger than LARGE_MTU (acks and padding). Together with an increase in the LARGE_MTU to 1492 in release 0.8.9, routers from 0.8.9 - 0.8.11 can generate packets up to 1536. Data packets are always a multiple of 16, so make this 4 + a multiple of 16.- See Also:
- Constant Field Values
-
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
Message types, 4 bits max- 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
-
PAYLOAD_TYPE_TEST
public static final int PAYLOAD_TYPE_TEST
- See Also:
- Constant Field Values
-
PAYLOAD_TYPE_SESSION_DESTROY
public static final int PAYLOAD_TYPE_SESSION_DESTROY
- Since:
- 0.8.1
- See Also:
- Constant Field Values
-
MAX_PAYLOAD_TYPE
public static final int MAX_PAYLOAD_TYPE
- See Also:
- Constant Field Values
-
-
Method Detail
-
setSeqNum
public void setSeqNum(long num)
CDPQEntry
-
getSeqNum
public long getSeqNum()
CDPQEntry
-
getPacket
public DatagramPacket getPacket()
-
getPriority
public int getPriority()
Description copied from interface:PQEntry
Higher is higher priority- Specified by:
getPriority
in interfacePQEntry
-
setPriority
public void setPriority(int pri)
- Since:
- 0.9.53
-
getBegin
public long getBegin()
-
getLifetime
public long getLifetime()
-
resetBegin
public void resetBegin()
-
markType
public void markType(int type)
flag this packet as a particular type for accounting purposes
-
getMarkedType
public int getMarkedType()
flag this packet as a particular type for accounting purposes, with 1 implying the packet is an ACK, otherwise it is a data packet
-
getMessageType
int getMessageType()
only for debugging and stats, does not go on the wire
-
setMessageType
void setMessageType(int type)
only for debugging and stats, does not go on the wire
-
getFragmentCount
int getFragmentCount()
only for debugging and stats
-
setFragmentCount
void setFragmentCount(int count)
only for debugging and stats
-
getRemoteHost
RemoteHostId getRemoteHost()
-
setEnqueueTime
public void setEnqueueTime(long now)
For CDQ- Specified by:
setEnqueueTime
in interfaceCDQEntry
- Since:
- 0.9.3
-
received
void received()
a packet handler has pulled it off the inbound queue
-
getEnqueueTime
public long getEnqueueTime()
For CDQ- Specified by:
getEnqueueTime
in interfaceCDQEntry
- Since:
- 0.9.3
-
getTimeSinceReceived
long getTimeSinceReceived()
a packet handler has pulled it off the inbound queue
-
requestInboundBandwidth
@Deprecated public void requestInboundBandwidth()
Deprecated.unusedSo that we can compete with NTCP, we want to request bandwidth in parallel, on the way into the queue, not on the way out. Call before enqueueing.- Since:
- 0.9.21
-
requestOutboundBandwidth
public void requestOutboundBandwidth()
So that we can compete with NTCP, we want to request bandwidth in parallel, on the way into the queue, not on the way out. Call before enqueueing.- Since:
- 0.9.21
-
getBandwidthRequest
public FIFOBandwidthLimiter.Request getBandwidthRequest()
So that we can compete with NTCP, we want to request bandwidth in parallel, on the way into the queue, not on the way out. Call after dequeueing.- Since:
- 0.9.21
-
toString
public String toString()
how many times we tried to validate the packet
-
acquire
public static UDPPacket acquire(RouterContext ctx, boolean inbound)
- Parameters:
inbound
- unused
-
release
public void release()
-
clearCache
public static void clearCache()
Call at shutdown/startup to not hold ctx refs- Since:
- 0.9.2
-
-