Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Page:  1  2  next
Avatar
simons #1
User title: Simon shaw
Member since May 2006 · 30 posts
Group memberships: Members
Show profile · Link to this post
Subject: Analysis of file transfer request generated by PSI
I sniffed the message below, which is the first message in a successful file transfer scenario, from the PSI client application registered to the amessage.info server.  While trying to reproduce this message using the agsXMPP library I hit the following problems:
1) I could not find an IQ or Element class that represented the "<si" part of the message.  Do I need to create this by myself
2) I could not correctly format the option element of the field in the feature negotiation part of the message the same way PSI does it.

I have attached my best coding attempt at the bottom of this post, what am I missing?

Thanks in advance for your help,

Regards,

Simon



Message Produced By PSI
<iq
    type="set"
    to="chemda@amessage.info/Psi"
    id="aad9a" >
  <si
    xmlns="http://jabber.org/protocol/si"
    profile="http://jabber.org/protocol/si/profile/file-transfer"
    id="s5b_35831f0457633023" >
    <file
      xmlns="http://jabber.org/protocol/si/profile/file-transfer"
      size="3168"
      name="astrike.log" >
      <desc>1212</desc>
      <range/>
    </file>
    <feature
      xmlns="http://jabber.org/protocol/feature-neg">
      <x
        xmlns="jabber:x:data"
        type="form" >
        <field
          type="list-single"
          var="stream-method" >
          <option>
            <value>http://jabber.org/protocol/bytestreams</value>
          </option>
        </field>
      </x>
    </feature>
  </si>
</iq>

Best Attempt at Code
agsXMPP.protocol.extensions.filetransfer.File file =
                                  new agsXMPP.protocol.extensions.filetransfer.File();
agsXMPP.protocol.extensions.featureneg.FeatureNeg featureNeg =
                                  new agsXMPP.protocol.extensions.featureneg.FeatureNeg();
            file.Name = "astrike.log";
            file.Size = 3168;
            file.Description = "Test File";
            IQ ftiq = new IQ(IqType.set);
            ftiq.To = new Jid("chemda@amessage.info/Psi");
            featureNeg.Data = new Data(agsXMPP.protocol.x.data.XDataFormType.form);
            Field field = new Field();
            field.Type = FieldType.List_Single;
            field.Var = "stream-method";
            Option option = new Option();
            option.Value = "http://jabber.org/protocol/bytestreams";
            field.AddOption(option);
            featureNeg.Data.AddField(field);
            ftiq.AddChild(file);
            ftiq.AddChild(featureNeg);

            this.XmppCon.Send(ftiq);

Message Produced By this Code
<iq
  xmlns="jabber:client"
  type="set"
  to="chemda@amessage.info/Psi">
  <file
    xmlns="http://jabber.org/protocol/si/profile/file-transfer"
    name="astrike.log"
    size="3168">
    <desc>Test File</desc>
  </file>
  <feature
    xmlns="http://jabber.org/protocol/feature-neg">
    <x
      xmlns="jabber:x:data"
      type="form">
      <field
        type="list-single"
        var="stream-method">
        <option>
          http://jabber.org/protocol/bytestreams
        </option>
      </field>
    </x>
  </feature>
</iq>
Avatar
Jabberer #2
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
Hi simons,

you can find the SI class in the namespace agsXMPP.protocol.extensions.si. There is no SI IQ class yet. But i think we will add one because it makes it easier to create the IQ.
To format the option correctly you have to use the SetValue value member instead of Value.

Please let us know if there is anything we can do to help you. Writing a complete file transfer sample is on our TODO list for a long time now. But we had no time yet to write one.
Software Developer
AG-Software
Avatar
simons #3
User title: Simon shaw
Member since May 2006 · 30 posts
Group memberships: Members
Show profile · Link to this post
I would be interested in taking on at least part of that task.  Do you have a definition of what you would like the sample to do (in band, out of band, SOCKS5 etc...)
Avatar
Jabberer #4
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
We have already existing code for OOB. But i think the most common file transfer method will be SOCKS5 in the future, because of existing proxies which solve the NAT issues.
Software Developer
AG-Software
Avatar
simons #5
User title: Simon shaw
Member since May 2006 · 30 posts
Group memberships: Members
Show profile · Link to this post
Do you know of a free and public SOCKS5 server that I can test against?
Avatar
Alex #6
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
feel free to use our file transfer proxy on proxy.ag-software.de port 7777. The jabber.org server runs also a file transfer proxy.

Alex
Avatar
Alex #7
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
i added a SIIq class and commited the code to SVN. You can checkout the latest code there.

Alex
Avatar
simons #8
User title: Simon shaw
Member since May 2006 · 30 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex,

I got the latest code from SVN, I made a slight change to the SIIq class by adding the base.Query = m_SI line to the constructor shown below (is this correct).

  1. public SIIq()
  2. {
  3.     base.Query = m_SI;  //this line was addd by Simon
  4.     this.GenerateId();
  5. }

Using the follwing code I managed to generate an SIIq message however no response was received from amessage.info server.

  1.  private void toolStripButton1_Click(object sender, EventArgs e)
  2. {
  3.     SIIq sIQ = new SIIq(IqType.set);
  4.     sIQ.To = new Jid("chemda@amessage.info/Psi");
  5.     agsXMPP.protocol.extensions.filetransfer.File file = new agsXMPP.protocol.extensions.filetransfer.File();
  6.     agsXMPP.protocol.extensions.featureneg.FeatureNeg featureNeg = new                                                   agsXMPP.protocol.extensions.featureneg.FeatureNeg();
  7.     sIQ.SI.Attributes.Add("profile", file.Namespace);
  8.     sIQ.SI.Attributes.Add("id", "s5b_35831f0457633023");
  9.     file.Name = "astrike.log";
  10.     file.Size = 3168;
  11.     file.Description = "Test File";
  12.     featureNeg.Data = new Data(agsXMPP.protocol.x.data.XDataFormType.form);
  13.     Field field = new Field();
  14.     field.Type = FieldType.List_Single;
  15.     field.Var = "stream-method";
  16.     Option option = new Option();
  17.     option.SetValue("http://jabber.org/protocol/bytestreams");
  18.     field.AddOption(option);
  19.     featureNeg.Data.AddField(field);
  20.     sIQ.AddChild(file);
  21.     sIQ.AddChild(featureNeg);
  22.  
  23.     this.XmppCon.Send(sIQ);
  24. }



--XML generated by the code
  1. <iq
  2.  xmlns="jabber:client"
  3.  id="agsXMPP_5"
  4.  type="set"
  5.  to="chemda@amessage.info/Psi">
  6.  <si
  7.    xmlns="http://jabber.org/protocol/si"
  8.    profile="http://jabber.org/protocol/si/profile/file-transfer"
  9.    id="s5b_35831f0457633023" />
  10.     <file
  11.      xmlns="http://jabber.org/protocol/si/profile/file-transfer"
  12.      name="astrike.log"
  13.      size="3168">
  14.       <desc>Test File</desc>
  15.     </file>
  16.     <feature
  17.      xmlns="http://jabber.org/protocol/feature-neg">
  18.       <x
  19.        xmlns="jabber:x:data"
  20.        type="form">
  21.         <field
  22.          type="list-single"
  23.          var="stream-method">
  24.         <option>
  25.           <value>http://jabber.org/protocol/bytestreams</value>
  26.         </option>
  27.       </field>
  28.     </x>
  29.  </feature>
  30. </iq>

--XML generated by PSI
  1. <iq
  2.     type="set"
  3.     to="chemda@amessage.info/Psi"
  4.     id="aad9a" >
  5.  <si
  6.    xmlns="http://jabber.org/protocol/si"
  7.    profile="http://jabber.org/protocol/si/profile/file-transfer"
  8.    id="s5b_35831f0457633023" >
  9.     <file
  10.      xmlns="http://jabber.org/protocol/si/profile/file-transfer"
  11.      size="3168"
  12.      name="astrike.log" >
  13.       <desc>Test File</desc>
  14.       <range/>
  15.     </file>
  16.     <feature
  17.      xmlns="http://jabber.org/protocol/feature-neg">
  18.       <x
  19.        xmlns="jabber:x:data"
  20.        type="form" >
  21.         <field
  22.          type="list-single"
  23.          var="stream-method" >
  24.           <option>
  25.             <value>http://jabber.org/protocol/bytestreams</value>
  26.           </option>
  27.         </field>
  28.       </x>
  29.     </feature>
  30.  </si>
  31. </iq>
This post was edited 2 times, last on 2013-03-06, 19:15 by Alex.
Avatar
Jabberer #9
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
Hello simons,

you don't need the query in the contructor. Because it's not a query like the most other with a query element. You access the SI Element with the SI property. But there was another bug and the SI Element was not added.
Fixed constructor:
  1. public SIIq()
  2. {
  3.     this.GenerateId();
  4.     this.AddChild(m_SI);
  5. }
Your xml is different from the xml of PSI. feature must be a child of si.

The following should build the XML correct. I think we should build a helper or manager class for that

  1. agsXMPP.protocol.extensions.si.SIIq sIQ = new agsXMPP.protocol.extensions.si.SIIq(IqType.set);
  2. sIQ.To = new Jid("chemda@amessage.info/Psi");
  3. agsXMPP.protocol.extensions.filetransfer.File file = new agsXMPP.protocol.extensions.filetransfer.File();
  4. agsXMPP.protocol.extensions.featureneg.FeatureNeg featureNeg = new agsXMPP.protocol.extensions.featureneg.FeatureNeg();
  5. sIQ.SI.Attributes.Add("profile", file.Namespace);
  6. sIQ.SI.Attributes.Add("id", "s5b_35831f0457633023");
  7. file.Name = "astrike.log";
  8. file.Size = 3168;
  9. file.Description = "Test File";
  10. featureNeg.Data = new Data(agsXMPP.protocol.x.data.XDataFormType.form);
  11. Field field = new Field();
  12. field.Type = FieldType.List_Single;
  13. field.Var = "stream-method";
  14. Option option = new Option();
  15. option.SetValue("http://jabber.org/protocol/bytestreams");
  16. field.AddOption(option);
  17. featureNeg.Data.AddField(field);
  18. sIQ.SI.AddChild(file);
  19. sIQ.SI.AddChild(featureNeg);
Software Developer
AG-Software
Avatar
simons #10
User title: Simon shaw
Member since May 2006 · 30 posts
Group memberships: Members
Show profile · Link to this post
In reply to post #6
Hi Alex,

I tried using 2 PSI clients to transfer a file between 2 NATed networks using the proxy suggested previously in this thread.  I found that the upload to the server was successful (I could see that the actual file was transferred by looking at the ethereal traces) however the download remained in a state of "waiting for peer activation".  If you look at the attached ethereal trace (taken from the receiving entitiy) you will see that the Socks5 connection was opened successfully.  Do you have any ideas if I might be doing wrong or could there be a problem at the server side.  I got the same scenario independant of which client attempted to start the upload.

Thanks again for your outstanding support.

Simon
The author has attached one file to this post:
Socks5FailedToReceiveFileFiltered.cap 4.1 kBytes
You have no permission to open this file.
Avatar
Alex #11
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

PSI (and the most other xmpp clients) has a debug console. Just open it and you will see all the xml traffic which goes over the wire.
I tested the proxy with one Exodus and one PSI client on the same box and it worked. In Exodus you can enter the proxy in the settings.We run the wildfire XMPP server and Proxy. For testing you can also install wildfire on your local machne. You can download wilfire at http://www.jivesoftware.org

Alex
Avatar
Alan #12
Member since May 2006 · 9 posts
Group memberships: Members
Show profile · Link to this post
In reply to post #6
Quote by Alex on 2006-05-22, 18:32:
1148315557

Hi I've managed to send the SIIq, and I can see in the XML console the message was formated and sent without error. however there is no further response to this message, and the peer supposed to receive the file doesnt receive this message either.

Also how do I upload the file to the file transfer proxy? any specifi protocol?

Thanks for you help!
Avatar
Alex #13
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello Alan,

please post your XML Debug.
If the other contact didnt receive your iq then there must be something wrong with it.
After exchanging the streamhosts etc... via IQ's you have to setup a SOCKS5 socket yourself for sending/receiving the file.

Alex
Avatar
Alan #14
Member since May 2006 · 9 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex,

I've managed to send the XML message according to JEP0065 http://www.jabber.org/jeps/jep-0065.html#proto-inform example 11 Initiation of Interaction

send:

  1. <iq type="set" to="someTarget@jabber.com" from="someInitiator@jabber.com" id="initiate">
  2.     <query xmlns="http://jabber.org/protocol/bytestreams" sid="mySID" mode="tcp">
  3.         <streamhost jid="someInitiator@jabber.com" host="192.168.1.201" port="5086" />
  4.         <streamhost jid="jabber.com" host="proxy.ag-software.de" port="7777" zeroconf="_jabber.bytestreams" />
  5.     </query>
  6. </iq>
before the send of this XML msg, both the target and the initiator logon and are present to each other.

However I got no response to this message, neither the target receives it.

What is the port 5086 in this messagehere (I just copied from the JEP0065 spec without knowing what it is)? is it where this Jabber client is running on? Do I need to connect to the proxy server first to get its IP and port before I can send this message?

Thanks for you help Alex!

Thanks!
This post was edited on 2013-03-06, 19:13 by Alex.
Avatar
simons #15
User title: Simon shaw
Member since May 2006 · 30 posts
Group memberships: Members
Show profile · Link to this post
Hi Alan,

Please correct me if I am wrong, but as far as I understand it the IP and port is where the application is going to be listening for a Socks5 connection.

Regards,

Simon
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Page:  1  2  next
Forum: agsXMPP RSS