File Transfer using ibb

Version 1

    To make a file transfer, Spark always tries bytestreams through a proxy server and if it fails try IBB that uses the mechanism of regular packages and always work.

     

    This is the flow of packages where user 1 sends a file to user 2, fails using bytestreams and then sends it using IBB.

     

    1- user 2 receives file transfer request

     
    <iq id="vrC08-126" to="user2@host/spark" from="user1@host/spark" type="set">
      <si xmlns="http://jabber.org/protocol/si" id="jsi_5471441136722873260" profile="http://jabber.org/protocol/si/profile/file-transfer">
        <file xmlns="http://jabber.org/protocol/si/profile/file-transfer" name="RunSpark.lnk" size="597">
          <desc>Sending</desc>
        </file>
        <feature xmlns="http://jabber.org/protocol/feature-neg">
          <x xmlns="jabber:x:data" type="form">
            <field var="stream-method" type="list-multi">
              <option>
                <value>http://jabber.org/protocol/bytestreams</value>
              </option>
              <option>
                <value>http://jabber.org/protocol/ibb</value>
              </option>
            </field>
          </x>
        </feature>
      </si>
    </iq>
    

     

     

    2- user 2 sends its protocols

     
    <iq id="vrC08-126" to="user1@host/spark" from="user2@host/spark" type="result">
      <si xmlns="http://jabber.org/protocol/si">
        <feature xmlns="http://jabber.org/protocol/feature-neg">
          <x xmlns="jabber:x:data" type="submit">
            <field var="stream-method">
              <value>http://jabber.org/protocol/bytestreams</value>
              <value>http://jabber.org/protocol/ibb</value>
            </field>
          </x>
        </feature>
      </si>
    </iq>
    

     

     

    3- user 1 decides to try bytestreams and sends to user 2 the available proxies (10.211.167.248 and 63.246.20.126)

     
    <iq id="vrC08-127" to="user2@host/spark" from="user1@host/spark" type="set">
      <query xmlns="http://jabber.org/protocol/bytestreams" sid="jsi_5471441136722873260" mode="tcp">
        <streamhost jid="user1@host/spark" host="10.211.167.248" port="7777"></streamhost>
        <streamhost jid="proxy.jivesoftware.com" host="63.246.20.126" port="7777"></streamhost>
      </query>
    </iq>
    

     

     

     

    4-a user 2 tryies bytestreams with the server 10.211.167.248 but it can't make it since user 2 cannot access 10.211.167.248

     

    4-b 15'' later (Response Timeout), user 1 has waited too long and proposes IBB

     
    <iq id="vrC08-128" to="user2@host/spark" from="user1@host/spark" type="set">
      <open xmlns="http://jabber.org/protocol/ibb" sid="jsi_5471441136722873260" block-size="4096"></open>
    </iq>
    

     

     

    5- user 2 acknowledges

     
    <iq id="vrC08-128" to="user1@host/spark" from="user2@host/spark" type="result"/>
    

     

     

    6- user 2 receives the file from user 1 in the message

     
    <message id="vrC08-129_0" to="user2@host/spark" from="user1@host/spark">
      <data xmlns="http://jabber.org/protocol/ibb" sid="jsi_5471441136722873260" seq="0">TAAAAAEUAgAAAAAAwAAAAAAAAEafAAAAIAAAAFyeOToCbMcB2KHer9aYxwGUb1R3/G/HAVEBAAAAAAAAAQAAAAAAAAAAAAAAAAAAAOMAFAAfUOBP0CDqOmkQotgIACswMJ0ZAC9EOlwAAAAAAAAAAAAAAAAAAAAAAAAANAAxAAAAAACxNuW4EABqYXZhAAAgAAMABADvvrE0wF6xNuW4FAAAAGoAYQB2AGEAAAAUADQAMQAAAAAAmjZilBAAc29mdAAAIAADAAQA775nNsCmsTYitxQAAABzAG8AZgB0AAAAFABMADIAUQEAAHo2x7kgAFJ1blNwYXJrLmJhdAAAMAADAAQA7751NqytsTYjtxQAAABSAHUAbgBTAHAAYQByAGsALgBiAGEAdAAAABwAAABIAAAAHAAAAAEAAAAcAAAALQAAAAAAAABHAAAAEQAAAAMAAAD4KyFYEAAAAABEOlxqYXZhXHNvZnRcUnVuU3BhcmsuYmF0AAAZAGQAOgBcAGoAYQB2AGEAXABzAG8AZgB0AFwAUgB1AG4AUwBwAGEAcgBrAC4AYgBhAHQAFAAuAC4AXABzAG8AZgB0AFwAUgB1AG4AUwBwAGEAcgBrAC4AYgBhAHQADABkADoAXABqAGEAdgBhAFwAcwBvAGYAdABgAAAAAwAAoFgAAAAAAAAAbWF1cmljaW8AAAAAAAAAAGLiFQ80h/5HpjO//EK7wpiKVDgyZgTcEbUbABPUBFe4YuIVDzSH/kemM7/8QrvCmIpUODJmBNwRtRsAE9QEV7gAAAAA</data>
    </message>
    

     

     

    7- user 1 closes the ibb transmission

     
    <iq id="vrC08-130" to="user2@host/spark" from="user1@host/spark" type="set">
      <close xmlns="http://jabber.org/protocol/ibb" sid="jsi_5471441136722873260"></close>
    </iq>
    

     

     

    8- user 2 acknowledges

     
    <iq id="vrC08-130" to="user1@host/spark" from="user2@host/spark" type="result"/>