Can't understand uTorrent Transfer Protocol 'extension' option in header





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















i'm trying to understand how a uTP header is structured and how it handles traffic and congestion and all that.



While going through the documentation here i couldn't quite wrap my head around what the 'extension' portion of the header worked. Here is the header:



0       4       8               16              24              32
+-------+-------+---------------+---------------+---------------+
| type | ver | extension | connection_id |
+-------+-------+---------------+---------------+---------------+
| timestamp_microseconds |
+---------------+---------------+---------------+---------------+
| timestamp_difference_microseconds |
+---------------+---------------+---------------+---------------+
| wnd_size |
+---------------+---------------+---------------+---------------+
| seq_nr | ack_nr |
+---------------+---------------+---------------+---------------+


And this is the portion talking about the 'extension' field:



extension

The type of the first extension in a linked list of extension headers. 0 means no extension.

There is currently one extension:

Selective acks

Extensions are linked, just like TCP options. If the extension field is non-zero, immediately following the uTP header are two bytes:

0 8 16
+---------------+---------------+
| extension | len |
+---------------+---------------+

where extension specifies the type of the next extension in the linked list, 0 terminates the list. And len specifies the number of bytes of this extension. Unknown extensions can be skipped by simply advancing len bytes.


How do linked lists come into all of this?
It is (to me) implying further available extensions?










share|improve this question































    0















    i'm trying to understand how a uTP header is structured and how it handles traffic and congestion and all that.



    While going through the documentation here i couldn't quite wrap my head around what the 'extension' portion of the header worked. Here is the header:



    0       4       8               16              24              32
    +-------+-------+---------------+---------------+---------------+
    | type | ver | extension | connection_id |
    +-------+-------+---------------+---------------+---------------+
    | timestamp_microseconds |
    +---------------+---------------+---------------+---------------+
    | timestamp_difference_microseconds |
    +---------------+---------------+---------------+---------------+
    | wnd_size |
    +---------------+---------------+---------------+---------------+
    | seq_nr | ack_nr |
    +---------------+---------------+---------------+---------------+


    And this is the portion talking about the 'extension' field:



    extension

    The type of the first extension in a linked list of extension headers. 0 means no extension.

    There is currently one extension:

    Selective acks

    Extensions are linked, just like TCP options. If the extension field is non-zero, immediately following the uTP header are two bytes:

    0 8 16
    +---------------+---------------+
    | extension | len |
    +---------------+---------------+

    where extension specifies the type of the next extension in the linked list, 0 terminates the list. And len specifies the number of bytes of this extension. Unknown extensions can be skipped by simply advancing len bytes.


    How do linked lists come into all of this?
    It is (to me) implying further available extensions?










    share|improve this question



























      0












      0








      0








      i'm trying to understand how a uTP header is structured and how it handles traffic and congestion and all that.



      While going through the documentation here i couldn't quite wrap my head around what the 'extension' portion of the header worked. Here is the header:



      0       4       8               16              24              32
      +-------+-------+---------------+---------------+---------------+
      | type | ver | extension | connection_id |
      +-------+-------+---------------+---------------+---------------+
      | timestamp_microseconds |
      +---------------+---------------+---------------+---------------+
      | timestamp_difference_microseconds |
      +---------------+---------------+---------------+---------------+
      | wnd_size |
      +---------------+---------------+---------------+---------------+
      | seq_nr | ack_nr |
      +---------------+---------------+---------------+---------------+


      And this is the portion talking about the 'extension' field:



      extension

      The type of the first extension in a linked list of extension headers. 0 means no extension.

      There is currently one extension:

      Selective acks

      Extensions are linked, just like TCP options. If the extension field is non-zero, immediately following the uTP header are two bytes:

      0 8 16
      +---------------+---------------+
      | extension | len |
      +---------------+---------------+

      where extension specifies the type of the next extension in the linked list, 0 terminates the list. And len specifies the number of bytes of this extension. Unknown extensions can be skipped by simply advancing len bytes.


      How do linked lists come into all of this?
      It is (to me) implying further available extensions?










      share|improve this question
















      i'm trying to understand how a uTP header is structured and how it handles traffic and congestion and all that.



      While going through the documentation here i couldn't quite wrap my head around what the 'extension' portion of the header worked. Here is the header:



      0       4       8               16              24              32
      +-------+-------+---------------+---------------+---------------+
      | type | ver | extension | connection_id |
      +-------+-------+---------------+---------------+---------------+
      | timestamp_microseconds |
      +---------------+---------------+---------------+---------------+
      | timestamp_difference_microseconds |
      +---------------+---------------+---------------+---------------+
      | wnd_size |
      +---------------+---------------+---------------+---------------+
      | seq_nr | ack_nr |
      +---------------+---------------+---------------+---------------+


      And this is the portion talking about the 'extension' field:



      extension

      The type of the first extension in a linked list of extension headers. 0 means no extension.

      There is currently one extension:

      Selective acks

      Extensions are linked, just like TCP options. If the extension field is non-zero, immediately following the uTP header are two bytes:

      0 8 16
      +---------------+---------------+
      | extension | len |
      +---------------+---------------+

      where extension specifies the type of the next extension in the linked list, 0 terminates the list. And len specifies the number of bytes of this extension. Unknown extensions can be skipped by simply advancing len bytes.


      How do linked lists come into all of this?
      It is (to me) implying further available extensions?







      tcp udp bittorrent






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 '18 at 16:33







      Richard Sassine

















      asked Nov 23 '18 at 15:14









      Richard SassineRichard Sassine

      82




      82
























          1 Answer
          1






          active

          oldest

          votes


















          0














          The packet header contains a descriptor (1 byte) for the first extension header or a sentinel value of 0.
          The first extension in turn would contain an extension header (this time 2 bytes since it includes a length) and the extension body. The header would again point to the next extension or be a sentinel value.



          It is a linked list because the Nth extension header links to the N+1th extension.



          This is a common pattern to insert a variable amount of extensions between a fixed-layout packet header and the main payload. E.g. IPv6 and TCP use very similar mechanisms.






          share|improve this answer


























          • "2 bytes" <- Wrong It's 1 byte

            – Encombe
            Nov 29 '18 at 17:53













          • @Encombe an extension descriptor contains both the type and the length, 1 byte each.

            – the8472
            Nov 30 '18 at 18:56











          • You wrote "The packet header..."- The 20 bytes packet header has a 1 byte extension field. Only if that field value is non-zero, a 2 bytes extension header will follow after the packet header.

            – Encombe
            Nov 30 '18 at 22:34











          • Hrrm, yes. I corrected that.

            – the8472
            Dec 1 '18 at 16:38












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53449124%2fcant-understand-utorrent-transfer-protocol-extension-option-in-header%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          The packet header contains a descriptor (1 byte) for the first extension header or a sentinel value of 0.
          The first extension in turn would contain an extension header (this time 2 bytes since it includes a length) and the extension body. The header would again point to the next extension or be a sentinel value.



          It is a linked list because the Nth extension header links to the N+1th extension.



          This is a common pattern to insert a variable amount of extensions between a fixed-layout packet header and the main payload. E.g. IPv6 and TCP use very similar mechanisms.






          share|improve this answer


























          • "2 bytes" <- Wrong It's 1 byte

            – Encombe
            Nov 29 '18 at 17:53













          • @Encombe an extension descriptor contains both the type and the length, 1 byte each.

            – the8472
            Nov 30 '18 at 18:56











          • You wrote "The packet header..."- The 20 bytes packet header has a 1 byte extension field. Only if that field value is non-zero, a 2 bytes extension header will follow after the packet header.

            – Encombe
            Nov 30 '18 at 22:34











          • Hrrm, yes. I corrected that.

            – the8472
            Dec 1 '18 at 16:38
















          0














          The packet header contains a descriptor (1 byte) for the first extension header or a sentinel value of 0.
          The first extension in turn would contain an extension header (this time 2 bytes since it includes a length) and the extension body. The header would again point to the next extension or be a sentinel value.



          It is a linked list because the Nth extension header links to the N+1th extension.



          This is a common pattern to insert a variable amount of extensions between a fixed-layout packet header and the main payload. E.g. IPv6 and TCP use very similar mechanisms.






          share|improve this answer


























          • "2 bytes" <- Wrong It's 1 byte

            – Encombe
            Nov 29 '18 at 17:53













          • @Encombe an extension descriptor contains both the type and the length, 1 byte each.

            – the8472
            Nov 30 '18 at 18:56











          • You wrote "The packet header..."- The 20 bytes packet header has a 1 byte extension field. Only if that field value is non-zero, a 2 bytes extension header will follow after the packet header.

            – Encombe
            Nov 30 '18 at 22:34











          • Hrrm, yes. I corrected that.

            – the8472
            Dec 1 '18 at 16:38














          0












          0








          0







          The packet header contains a descriptor (1 byte) for the first extension header or a sentinel value of 0.
          The first extension in turn would contain an extension header (this time 2 bytes since it includes a length) and the extension body. The header would again point to the next extension or be a sentinel value.



          It is a linked list because the Nth extension header links to the N+1th extension.



          This is a common pattern to insert a variable amount of extensions between a fixed-layout packet header and the main payload. E.g. IPv6 and TCP use very similar mechanisms.






          share|improve this answer















          The packet header contains a descriptor (1 byte) for the first extension header or a sentinel value of 0.
          The first extension in turn would contain an extension header (this time 2 bytes since it includes a length) and the extension body. The header would again point to the next extension or be a sentinel value.



          It is a linked list because the Nth extension header links to the N+1th extension.



          This is a common pattern to insert a variable amount of extensions between a fixed-layout packet header and the main payload. E.g. IPv6 and TCP use very similar mechanisms.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 1 '18 at 16:49

























          answered Nov 28 '18 at 21:58









          the8472the8472

          27.3k23682




          27.3k23682













          • "2 bytes" <- Wrong It's 1 byte

            – Encombe
            Nov 29 '18 at 17:53













          • @Encombe an extension descriptor contains both the type and the length, 1 byte each.

            – the8472
            Nov 30 '18 at 18:56











          • You wrote "The packet header..."- The 20 bytes packet header has a 1 byte extension field. Only if that field value is non-zero, a 2 bytes extension header will follow after the packet header.

            – Encombe
            Nov 30 '18 at 22:34











          • Hrrm, yes. I corrected that.

            – the8472
            Dec 1 '18 at 16:38



















          • "2 bytes" <- Wrong It's 1 byte

            – Encombe
            Nov 29 '18 at 17:53













          • @Encombe an extension descriptor contains both the type and the length, 1 byte each.

            – the8472
            Nov 30 '18 at 18:56











          • You wrote "The packet header..."- The 20 bytes packet header has a 1 byte extension field. Only if that field value is non-zero, a 2 bytes extension header will follow after the packet header.

            – Encombe
            Nov 30 '18 at 22:34











          • Hrrm, yes. I corrected that.

            – the8472
            Dec 1 '18 at 16:38

















          "2 bytes" <- Wrong It's 1 byte

          – Encombe
          Nov 29 '18 at 17:53







          "2 bytes" <- Wrong It's 1 byte

          – Encombe
          Nov 29 '18 at 17:53















          @Encombe an extension descriptor contains both the type and the length, 1 byte each.

          – the8472
          Nov 30 '18 at 18:56





          @Encombe an extension descriptor contains both the type and the length, 1 byte each.

          – the8472
          Nov 30 '18 at 18:56













          You wrote "The packet header..."- The 20 bytes packet header has a 1 byte extension field. Only if that field value is non-zero, a 2 bytes extension header will follow after the packet header.

          – Encombe
          Nov 30 '18 at 22:34





          You wrote "The packet header..."- The 20 bytes packet header has a 1 byte extension field. Only if that field value is non-zero, a 2 bytes extension header will follow after the packet header.

          – Encombe
          Nov 30 '18 at 22:34













          Hrrm, yes. I corrected that.

          – the8472
          Dec 1 '18 at 16:38





          Hrrm, yes. I corrected that.

          – the8472
          Dec 1 '18 at 16:38




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53449124%2fcant-understand-utorrent-transfer-protocol-extension-option-in-header%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Xamarin.form Move up view when keyboard appear

          Post-Redirect-Get with Spring WebFlux and Thymeleaf

          Anylogic : not able to use stopDelay()