From 2c39a37a2efd633b84bbbf38c70bc49fcfe608b5 Mon Sep 17 00:00:00 2001
From: zzz
The streaming lib has many advantages over the ministreaming library was written by mihi as a part of his +
The streaming lib has many advantages over the ministreaming library written by mihi as a part of his I2PTunnel application. The streaming library is a more robust streaming library @@ -85,6 +85,8 @@ it contains a full windowing implementation. Significant tuning of the streaming lib parameters, greatly increasing outbound performance, was implemented in 0.6.1.28. Subsequent releases include additional tuning and bug fixes. + +
Here is the format of a single packet transferred as part of a streaming connection. -
Field | Length | Contents + |
---|---|---|
endStreamId | 4 byte value | Random number selected by the connection recipient +and constant for the life of the connection. +0 in the SYN message sent by the originator. + |
receiveStreamId | 4 byte value | Random number selected by the connection originator +and constant for the life of the connection. + + |
sequenceNum | 4 byte unsigned integer | +The sequence for this message, starting at 0 in the SYN message, +and incremented by 1 in each message except for plain ACKs and retransmissions. +If the sequenceNum is 0 and the SYN is not set, this is a plain ACK +packet that should not be ACKed. + + |
ackThrough | 4 byte unsigned integer | +The highest packet sequence number that was received +on the receiveStreamId. This field is ignored on the initial +connection packet (where receiveStreamId is the unknown id) or +if FLAG_NO_ACK is set. +All packets up to and including this sequence number are acked, +EXCEPT for those listed in NACKs below. + + |
number of NACKs | 1 byte unsigned integer | + + |
that many NACKs | n * 4 byte unsigned integers | +Sequence numbers less than ackThrough that are not yet received. + + |
resendDelay | 1 byte unsigned integer | +How long is the creator of this packet going to wait before +resending this packet (if it hasn't yet been ACKed). The +value is seconds since the packet was created. +Ignored on receive. Broken on send before release 0.7.8 (the sender did not divide by 1000, +and the default is 1000 ms, so the included value was 1000 & 0xff = 0xe8 = 232 seconds. + + |
flags | 2 byte value | +See below. + + |
option data size | 2 byte unsigned integer | +See below. + + |
option data specified by those flags | 0 or more bytes | +See below. + + |
payload | remaining packet size | + |
The flags field above specifies some metadata about the packet, and in turn may require certain additional data to be included. The flags are as follows (with any data structures specified added to the options area -in the given order):
If the signature is included, it uses the Destination's DSA key +in the given order):
+Bit Number | Flag | Option Data | Function + | |
---|---|---|---|---|
0 | FLAG_SYNCHRONIZE | no option data | +Similar to TCP SYN. + | |
1 | FLAG_CLOSE | no option data | +Similar to TCP FIN. If the response to a SYN fits in a single message, the response +will contain both FLAG_SYNCHRONIZE and FLAG_CLOSE. + | |
2 | FLAG_RESET | no option data | +Abnormal close. + | |
3 | FLAG_SIGNATURE_INCLUDED | 40 bytes | net.i2p.data.Signature +Typically sent only with FLAG_SYNCHRONIZE. +If the signature is included, it uses the Destination's DSA key to sign the entire header and payload with the space in the options -for the signature being set to all zeroes. +for the signature being set to all zeroes. + | + |
4 | FLAG_SIGNATURE_REQUESTED | no option data | +Unused. Requests every packet in the other direction to have FLAG_SIGNATURE_INCLUDED + | + |
5 | FLAG_FROM_INCLUDED | typ. 387 bytes | net.i2p.data.Destination +Typically sent only with FLAG_SYNCHRONIZE. + | |
6 | FLAG_DELAY_REQUESTED | 2 byte integer | +Optional delay. +How many milliseconds the sender of this packet wants the recipient +to wait before sending any more data + | + |
7 | FLAG_MAX_PACKET_SIZE_INCLUDED | 2 byte integer | +Apparently always included, could be optimized to only send with a SYN + | + |
8 | FLAG_PROFILE_INTERACTIVE | no option data | +Apparently unused or ignored + | + |
9 | FLAG_ECHO | no option data | +Unused except by ping programs + | |
10 | FLAG_NO_ACK | no option data | +Apparently unused, an ack is always included. +This flag simply tells the recipient to ignore the ackThrough field in the header. + | |
11-15 | unused | + |
If the sequenceNum is 0 and the SYN is not set, this is a plain ACK -packet that should not be ACKed