From d5a8e1b958f28bb3cd0326c3f8b2f34123f08221 Mon Sep 17 00:00:00 2001 From: str4d Date: Wed, 6 Feb 2013 00:27:20 +0000 Subject: [PATCH] Split streaming library page between docs/api/ and docs/spec/ --- i2p2www/pages/global/nav.html | 1 + i2p2www/pages/site/docs/api/streaming.html | 125 +----------------- i2p2www/pages/site/docs/spec/streaming.html | 135 ++++++++++++++++++++ 3 files changed, 139 insertions(+), 122 deletions(-) create mode 100644 i2p2www/pages/site/docs/spec/streaming.html diff --git a/i2p2www/pages/global/nav.html b/i2p2www/pages/global/nav.html index b1051bb7..286e00e8 100644 --- a/i2p2www/pages/global/nav.html +++ b/i2p2www/pages/global/nav.html @@ -73,6 +73,7 @@
  • +
  • diff --git a/i2p2www/pages/site/docs/api/streaming.html b/i2p2www/pages/site/docs/api/streaming.html index 13616fa8..b6d5601d 100644 --- a/i2p2www/pages/site/docs/api/streaming.html +++ b/i2p2www/pages/site/docs/api/streaming.html @@ -282,129 +282,10 @@ How long to block on write/flush, in milliseconds. Negative means indefinitely.

    {% trans %}Protocol Specification{% endtrans %}

    -

    {% trans %}Packet Format{% endtrans %}

    -

    {% trans -%} -The format of a single packet in the streaming protocol is: -{%- endtrans %}

    -
     
    -+----+----+----+----+----+----+----+----+
    -| send Stream ID    | rcv Stream ID     |
    -+----+----+----+----+----+----+----+----+
    -| sequence  Num     | ack Through       |
    -+----+----+----+----+----+----+----+----+
    -| nc |   NACKs ...
    -+----+----+----+----+----+----+----+----+
    -     | rd |  flags  | opt size| opt data
    -+----+----+----+----+----+----+----+----+
    -   ...                                  |
    -+----+----+----+----+----+----+----+----+
    -|   payload ...
    -+----+----+----+----//
    -
    -
    -
    - - -
    {{ _('Field') }}{{ _('Length') }}{{ _('Contents') }} -
    sendStreamId 4 byte IntegerRandom number selected by the connection recipient -and constant for the life of the connection. -0 in the SYN message sent by the originator, and in subsequent messages, until a SYN reply is received, -containing the peer's stream ID. - -
    receiveStreamId 4 byte IntegerRandom number selected by the connection originator -and constant for the life of the connection. May be 0 if unknown, for example in a RESET packet. - -
    sequenceNum 4 byte 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 flag is not set, this is a plain ACK -packet that should not be ACKed. - -
    ackThrough 4 byte 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 the NO_ACK flag set. -All packets up to and including this sequence number are ACKed, -EXCEPT for those listed in NACKs below. - -
    NACK count1 byte Integer -The number of 4-byte NACKs in the next field - -
    NACKs n * 4 byte Integers -Sequence numbers less than ackThrough that are not yet received. -Two NACKs of a packet is a request for a 'fast retransmit' of that packet. - -
    resendDelay1 byte 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. -Currently ignored on receive. - -
    flags 2 byte value -See below. - -
    option size2 byte Integer -The number of bytes in the next field - -
    option data0 or more bytes -As specified by the flags. See below. - -
    payload remaining packet size -
    - -

    {% trans %}Flags and Option Data Fields{% endtrans %}

    -

    {% trans -%} -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. Any data structures specified must be added to the options area -in the given order. -{%- endtrans %}

    - -

    -Bit order: 15....0 (15 is MSB) -

    - -
    BitFlagOption DataFunction -
    0SYNCHRONIZE-- -Similar to TCP SYN. Set in the initial packet and in the first response. -FROM_INCLUDED and SIGNATURE_INCLUDED must be set also. -
    1CLOSE-- -Similar to TCP FIN. If the response to a SYNCHRONIZE fits in a single message, the response -will contain both SYNCHRONIZE and CLOSE. -SIGNATURE_INCLUDED must be set also. -
    2RESET-- -Abnormal close. -SIGNATURE_INCLUDED must be set also. -
    3SIGNATURE_INCLUDED40 byte DSA Signature - -Currently sent only with SYNCHRONIZE, CLOSE, and RESET, where it is required. -The signature uses the Destination's DSA signing keys -to sign the entire header and payload with the 40-byte space in the option data field -for the signature being set to all zeroes. -
    4SIGNATURE_REQUESTED-- -Unused. Requests every packet in the other direction to have SIGNATURE_INCLUDED -
    5FROM_INCLUDED387+ byte Destination - -Currently sent only with SYNCHRONIZE, where it is required. -
    6DELAY_REQUESTED2 byte Integer -Optional delay. -How many milliseconds the sender of this packet wants the recipient -to wait before sending any more data. -A value greater than 60000 indicates choking. -
    7MAX_PACKET_SIZE_INCLUDED2 byte Integer -Currently sent with SYNCHRONIZE only. -Was also sent in retransmitted packets until release 0.9.1. -
    8PROFILE_INTERACTIVE-- -Unused or ignored; the interactive profile is unimplemented. -
    9ECHO-- -Unused except by ping programs -
    10NO_ACK-- -This flag simply tells the recipient to ignore the ackThrough field in the header. -Currently unused, the ackThrough field is always valid. -
    11-15unused -
    +

    {% trans -%} +See the Streaming Library Specification page. +{%- endtrans %}

    {% trans %}Implementation Details{% endtrans %}

    diff --git a/i2p2www/pages/site/docs/spec/streaming.html b/i2p2www/pages/site/docs/spec/streaming.html new file mode 100644 index 00000000..05db8ba0 --- /dev/null +++ b/i2p2www/pages/site/docs/spec/streaming.html @@ -0,0 +1,135 @@ +{% extends "global/layout.html" %} +{% block title %}{% trans %}Streaming Library Specification{% endtrans %}{% endblock %} +{% block lastupdated %}{% trans %}November 2012{% endtrans %}{% endblock %} +{% block accuratefor %}0.9.3{% endblock %} +{% block content %} +

    {% trans -%} +See the Streaming page for an overview of the Streaming Library. +{%- endtrans %}

    + +

    {% trans %}Protocol Specification{% endtrans %}

    +

    {% trans %}Packet Format{% endtrans %}

    +

    {% trans -%} +The format of a single packet in the streaming protocol is: +{%- endtrans %}

    +
    +
    ++----+----+----+----+----+----+----+----+
    +| send Stream ID    | rcv Stream ID     |
    ++----+----+----+----+----+----+----+----+
    +| sequence  Num     | ack Through       |
    ++----+----+----+----+----+----+----+----+
    +| nc |   NACKs ...
    ++----+----+----+----+----+----+----+----+
    +     | rd |  flags  | opt size| opt data
    ++----+----+----+----+----+----+----+----+
    +   ...                                  |
    ++----+----+----+----+----+----+----+----+
    +|   payload ...
    ++----+----+----+----//
    +
    +
    +
    + + +
    {{ _('Field') }}{{ _('Length') }}{{ _('Contents') }} +
    sendStreamId 4 byte IntegerRandom number selected by the connection recipient +and constant for the life of the connection. +0 in the SYN message sent by the originator, and in subsequent messages, until a SYN reply is received, +containing the peer's stream ID. + +
    receiveStreamId 4 byte IntegerRandom number selected by the connection originator +and constant for the life of the connection. May be 0 if unknown, for example in a RESET packet. + +
    sequenceNum 4 byte 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 flag is not set, this is a plain ACK +packet that should not be ACKed. + +
    ackThrough 4 byte 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 the NO_ACK flag set. +All packets up to and including this sequence number are ACKed, +EXCEPT for those listed in NACKs below. + +
    NACK count1 byte Integer +The number of 4-byte NACKs in the next field + +
    NACKs n * 4 byte Integers +Sequence numbers less than ackThrough that are not yet received. +Two NACKs of a packet is a request for a 'fast retransmit' of that packet. + +
    resendDelay1 byte 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. +Currently ignored on receive. + +
    flags 2 byte value +See below. + +
    option size2 byte Integer +The number of bytes in the next field + +
    option data0 or more bytes +As specified by the flags. See below. + +
    payload remaining packet size +
    + +

    {% trans %}Flags and Option Data Fields{% endtrans %}

    +

    {% trans -%} +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. Any data structures specified must be added to the options area +in the given order. +{%- endtrans %}

    + +

    +Bit order: 15....0 (15 is MSB) +

    + +
    BitFlagOption DataFunction +
    0SYNCHRONIZE-- +Similar to TCP SYN. Set in the initial packet and in the first response. +FROM_INCLUDED and SIGNATURE_INCLUDED must be set also. +
    1CLOSE-- +Similar to TCP FIN. If the response to a SYNCHRONIZE fits in a single message, the response +will contain both SYNCHRONIZE and CLOSE. +SIGNATURE_INCLUDED must be set also. +
    2RESET-- +Abnormal close. +SIGNATURE_INCLUDED must be set also. +
    3SIGNATURE_INCLUDED40 byte DSA Signature + +Currently sent only with SYNCHRONIZE, CLOSE, and RESET, where it is required. +The signature uses the Destination's DSA signing keys +to sign the entire header and payload with the 40-byte space in the option data field +for the signature being set to all zeroes. +
    4SIGNATURE_REQUESTED-- +Unused. Requests every packet in the other direction to have SIGNATURE_INCLUDED +
    5FROM_INCLUDED387+ byte Destination + +Currently sent only with SYNCHRONIZE, where it is required. +
    6DELAY_REQUESTED2 byte Integer +Optional delay. +How many milliseconds the sender of this packet wants the recipient +to wait before sending any more data. +A value greater than 60000 indicates choking. +
    7MAX_PACKET_SIZE_INCLUDED2 byte Integer +Currently sent with SYNCHRONIZE only. +Was also sent in retransmitted packets until release 0.9.1. +
    8PROFILE_INTERACTIVE-- +Unused or ignored; the interactive profile is unimplemented. +
    9ECHO-- +Unused except by ping programs +
    10NO_ACK-- +This flag simply tells the recipient to ignore the ackThrough field in the header. +Currently unused, the ackThrough field is always valid. +
    11-15unused +
    + +{% endblock %}