powered by Jive Software

XEP-0174 (Link-local) support in Smack

This patch implements XEP-0174 (Link-local messaging) and is ment to be completely backward compatible but still reuse existing code.

The patch is fore the SVN repository smack/trunk downloaded 25th of November 2008. It has been casually tested against other identical implementations, as well as Gajim and Pidgin.

It does some refactoring of the core library:

  • XMPPConnection - XMPPConnection is divided into two parts, AbstractConnection, doing more or less nothing more than connecting and handles packet listeners and connection listeners, and XMPPConnection, doing what is specific to a c2s (client-to-server) XMPPConnection. This is done because I wanted to reuse parsing, packet readers, and other things. XMPPConnection extends AbstractConnection.
  • PacketReader - This part is refactored in a similiar way: AbstractPacketReader and PacketReader. AbstractPacketReader has the basic functionality and PacketReader implements the parsing. PacketReader extends AbstractPacketReader.

New parts implemented:

  • XMPPLLConnection - Link-local connection. A user never directly uses the XMPPLLConnection and it automatically disconnects when inactive. XMPPLLConnection extends AbstractConnection.
  • LLPacketReader - Packet reader for Link-local connections. LLPacketReader extends AbstractPacketReader.
  • LLService and LLPresenceDiscoverer - Implements the Link-local service, providing implementation unspecific functionality such as binding ports and keeping track of active connections. There is a real implementation using a patched (https://sourceforge.net/tracker2/?func=detail&aid=2349331&group_id=93852&atid=60 5793) verison of JmDNS. LLService also implements the same functionality as ChatManager, using LLChat classes. It automatically uses existing connections or creates new when messages are sent.
  • LLPresence - represent the Link-local presence, which is represented as mDNS/DNS-SD services using the text field for providing information.
  • LLServiceDiscoveryManager - ServiceDiscoveryManager is changed to use AbstractConnection (trivial change) which makes it possible to use this implementation of service discovery also for link-local connections. LLServiceDiscoveryManager implements a wrapper for ServiceDiscoveryManager (as Link-local connections are temporary, one has to do things a bit different).

There is a sample client there too: TestMDNS.java.

Limitations:

  • TXT fields are requested for every known link-local presence. Only when receiving information found in the TXT fields will the client be known the user. This may create unneccessary network traffic.
  • Messages from remote clients not discovered by the mDNS/DNS-SD daemon is not bunded with a LLChat
  • Interface might need some beautification.

Any comments and tips would be appreciated.

Jonas
xep0174.patch (167035 Bytes)

1 Like

Can now download using git:

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

This repository contains both XEP-0174 (Serverless Messaging) support and more complete XEP-0115 (Entity Capabilities) support and is bundled with a modified version of JmDNS.

Hello,

I tried to applay yout patch to the 3.0.4 branch of smack. But without luck. I tried it with NetBeans. It’s possible that I’m just too stupid to do this. I thought in NetBeans I just have to right click on the project I use for building smack and then klick on Versioning->Applay Diff Patch and be happy. But he only tells me that partially applied the patch. How do I patch the sources so I can use the local link support? And for which smack version is this patch? Or could you build a jar file with this patch applied so I can use this?

Thanks in advance

Ok, a little update here. On my Linux machine I used the classic patch command which did the job (I think at least). But the patched sources seem to have many bugs. I don’t know how this could ever work. I know that this patch depends on javax.jmdns. So got this lib. But the new source uses functions which don’t seem to exist in javax.jmdsn. I tried version 1.0 2.0 and tha latest 2.1 of jmdns. But no luck. For example there is nocn function reannounceservice in jmdsn. I hope someone can help with information, instructions or a compiled patched smack-lib.

I finally did it! It worked! In the end there were only some minot glitches within the patch (missing extension of class XMPPConnection and so on). I hope I didn’t overlooked any of these glitches. At least the demoprogram worked fine except for the service discovery. All german speaking fellowers can download an archive with the sources and the build from my blog. If any one else is interested I will start a project on sourceforge.

Hey!

What sources are you using? Cloning the git repository works for me, what error do you get? The patches in the original post are quite outdated, git repository is better. The patches are against the SVN repository. I check regularly and they should still work (if nothing special has happened the last week, has been out-of-town), since the relevant files hasen’t been changed since I pulled the svn. The missing functions exist in patches found on JmDNS sourceforge.net site, and is for reannouncing TXT fields (changing presence status). Will put a git repo online for my JmDNS tree.

I’ve filed SMACK-262 for your proposal.

I made a new patch which is a diff between the current SVN version and the newest version of my git repository. Please use it instead.

Build instructions:

  1. First you need to get JmDNS. Either download the JmDNS CVS from sourceforge and apply the patch found here: http://sourceforge.net/tracker2/?func=detail&aid=2349331&group_id=93852&atid=605 793 or run “git clone http://www.jabber.se/repos/jmdns.git

  2. Build JmDNS into a .jar-file.

  3. Put the jmdns.jar in smack/build/merge/

  4. Compile smack as normal: cd smack/build && ant

  5. To compile the test program run: ant compile-test-mdns . It will end up in target/classes-test/org/jivesoftware/smack/test/TestMDNS.class

The test program is actually not a test program, it’s a sample program, with no unit tests.
smack-xep-0174-v2.patch (210434 Bytes)

Hello,

I’d like to use the feature (XEP-0174) you made with current Smack release 3.2.1. but as far as I understand this patch works only for version 3.1. sources from SVN repository smack/trunk downloaded 25th of November 2008. Is there any possibilities to make it work with current release of Smack or may be there is a better way to make serverless messaging work with current release?

Thanks in advance,

Eugene

Is there a recent version of this? The page on jabber.se is broken.

Not that I know of, and that patch will certainly not work against the latest version.