powered by Jive Software

Entity Capabilities (XEP-0115)

Hey,

Is anyone interested in an implementation of XEP-0115: Entity Capabilities? I have a slightly fresh implementation. It is currently mangled up together with my XEP-0174: Serverless Messaging source tree but if anyone is interested, I can extract the changes.

So what does it do? Well…

  • It adds a caps blob to all the packets consisting of a SHA-1 hash of the current available services.

  • It sends a new presence with the new SHA-1 hash, if sendPresence thing is turned on in the ConnectionConfiguration class, or manually turned on in the ServiceDiscovery class (the entity caps hash is calculated using supported features, identities and form fields as input, read XEP-0115 if interested)

  • It reads all of the presence packets from all the users, creating a cache of up-to-date hash values.

  • Stores a cache of already known service sets. The cache is then used to speed up service discovery info requests.

  • Per JVM: a hash-value -> DiscoverInfo table

  • Per Connection: a Full JID -> hash value table

Note that this is the newest version of the XEP, thus it does not support the old deprecated ext-attribute.

Jonas

1 Like

Hi jadahl,

I’d be very interested in looking at your implementation of XEP-0115. Have you got the code up on SVN somewhere? Are there plans for including this in SMACK?

Regards,

Chris

Hi Chris,

I don’t have it on SVN or any other kind of repository by itself, but I have it bundled up together with an XEP-0174 implementation. You can get the whole source tree (XEP-0174: Serverless Messaging, and XEP-0115: Entity Capabilities) using:

git clone http://www.jabber.se/repos/smack

Normal Client-Server communication SHOULD work, but haven’t really tested it very much.

Jonas

Hi Jonas,

Thanks for that, I’ll set up git and take a look!

Regards,

Chris

Hi Jonas:

I am very interested in Entity Capabilities.

Is your Entity Capabilities code still available? This instruction below is no longer working. Do you have a new code repos?

git clone http://www.jabber.se/repos/smack

Thanks,

Victor

Hi,

For what I can see, I can still clone that repository without any problems. How do you try to download it?

However, the entity capabilites I implemented are mangled up together with XEP-0174, but should be quite easy to extract. You just need:

source/org/jivesoftware/smackx/

  • ServiceDiscoveryManager.java

In the top remove an XMPPLLConnection import that shouldn’t be there.

  • EntityCapsManager.java

In the top change the AbstractConnection import to XMPPConnection and remove the LLPresence import. At line 175 change AbstractConnection to XMPPConnection.

  • packet/CapsExtension.java

  • provider/CapsExtensionProvider.java

And you need to add the CapsExtensionProvider to build/resources/META-INF/smack.providers.

Jonas

I also have problems to reach your server, after a second look it seems your IPv6 Setup is broken:

` PING jabber.se(ulmo.lysator.liu.se) 56 data bytes

jabber.se ping statistics —
10 packets transmitted, 0 received, 100% packet loss, time 8999ms

` and:

traceroute to jabber.se (2001:6b0:17:f0a0::99) from 2001:638:807:30:218:f3ff:fe3a:3f55, 30 hops max, 2 4 byte packets 1 2001:638:807:30::1 (2001:638:807:30::1) 0.343 ms 0.242 ms 0.221 ms 2 2001:638:807:102::1 (2001:638:807:102::1) 0.328 ms 0.244 ms 0.234 ms 3 swi-1091.ipv6.uni-potsdam.de (2001:638:807:101::1) 0.682 ms 0.504 ms 0.444 ms 4 xr-pot1-te1-3.x-win.dfn.de (2001:638:c:a021::1) 0.642 ms 0.56 ms 0.486 ms 5 zr-pot1-te0-0-0-0.x-win.dfn.de (2001:638:c:c021::2) 1.109 ms 0.801 ms 0.698 ms 6 zr-fra1-te0-7-0-0.x-win.dfn.de (2001:638:c:c006::2) 14.564 ms 14.214 ms 14.216 ms 7 dfn.rt1.fra.de.geant2.net (2001:798:14:10aa::1) 14.048 ms 13.989 ms 13.975 ms 8 so-6-0-0.rt2.cop.dk.geant2.net (2001:798:cc:1401:1501::2) 28.142 ms 28.025 ms 28.01 ms 9 nordunet-gw.rt2.cop.dk.geant2.net (2001:798:15:10aa::2) 28.089 ms 28.09 ms 28.065 ms 10 se-fre.nordu.net (2001:948:0:f03f::1) 37.756 ms 37.697 ms 37.755 ms 11 c1sth-so-6-0-0.sunet.se (2001:948:0:f051::2) 37.778 ms 37.725 ms 37.709 ms 12 2001:6b0:dead:beef:2::212 (2001:6b0:dead:beef:2::212) 37.834 ms 37.778 ms 37.759 ms 13 a-green.ipv6.net.liu.se (2001:6b0:17:ff00::f5) 41.481 ms 40.856 ms 40.855 ms 14 g-a.ipv6.net.liu.se (2001:6b0:17:ff00::8a) 40.943 ms 40.898 ms 40.895 ms 15 * * * 16 * * * 17 * * * 18 * * * 19 * * * 20 * * * ...
I’m not very familiar with git. Is there a possibility to use IPv4 instead of IPv6? Maybe then it works.

Oh, the webserver doesn’t listen on IPv6, only on IPv4 which is 130.236.254.153.

jadahl schrieb:

Oh, the webserver doesn’t listen on IPv6, only on IPv4 which is 130.236.254.153.

Ok,
git clone [http://130.236.254.153/repos/smack](http://130.236.254.153/repos/smack) works. But please adjust your DNS setup. If you don’t support IPv6, do not list an IPv6 address to your domain.

Thanks, I’ll look into the DNS setup issue.

Sorry I don’t want to be impolite. Thanks for your code. It’s great that you share it, I will look at it and maybe use it.

I really like the features of IPv6 but sometimes it’s a little bit depressing that there are many bugs and defects in the configuration and implementation of IPv6 applications.

I agree, IPv6 is interesting, but the support for it is not straight forward everywhere. The server I’m using is Yaws (an Erlang web server), but haven’t had time to look into how to enable IPv6 yet. It’s on my TODO list though

Hi Jonas,

I tried again and was able to get the code. Thanks for the instructions. I will give it a try.

Thank you very much for sharing.

Victor

Hi Jonas,

Thank for sharing the code. I was able to get entity capabilities implemented. Even though my capabilities includes features such as geoloc and geoloc+notify, I am still not able to receive PEP event messages. While using the same jid in Psi, I was able to receive geoloc PEP event messages. Any suggestion where I should be looking?

Thanks,

Victor

Hi Victor,

I haven’t tested the entity caps very much, and only used it with XEP-0174, but added the functionality to normal usage too, theoretically. Can you check your outgoing packages if they contain the correct entity caps element?

Jonas

Jonas XEP-0115 patchs are included in my fork of smack. I am using them with asmack for quite some in my Android App since having Entity Capabilities has many advantages for mobile environments.

Therefore I’d like to ask for an new issue within JIRA to track the inclusion of the patches in vanilla Smack. It is really about time. Also I like to thank Jonas for his patches.

Flow

Well, I don’t see the point of creating task to simply track other tasks (we are not talking about subtasks here) but I have added a new task for this feature (SMACK-361).

Now if you can provide a patch that implements this feature, it will go a long way towards making it into trunk. Inclusion of test cases would make it much faster again, as if I have to write them myself for a feature I am not familiar with it will certainly delay getting it committed to trunk.

Looking forward to the patch as it does sound like a nifty feature.

Ahh, I didn’t meant to track other tasks. I just wanted an issue report in JIRA about XEP-0115, so I am happy now. :slight_smile:

I will try to prepare an patch for vanilla smack. It should be pretty easy. Maybe I find the time in the holidays.

But I am not familiar with test cases. Is there a chanche that you write a short how-to or could you point me to some resources. I am also interested how the general smack development and testing is done and I am pretty sure otheres are too. Maybe some information, like a quick tutorial, would improve the feedback in form of patches from the community.

I will have to add that to my todo list.

It is a very long list.

I would suggest taking a look at the existing test cases, and look at where ThreadedDummyConnection is used as it is fairly new. This will allow you to simulate asynchronous messages from a server for unit testing purposes. It can be easily setup to respond to messages to test request and response actions, or just unprompted messages as well.

Here is a first preliminary patch for XEP-115. Entity Capabilities are disabled by default and testcases are missing. You can get a quick look on the patch here.

Comments and suggestions are welcomed.

Flow
0001-Added-support-for-Entity-Capabilities-XEP-0115.patch.zip (9976 Bytes)