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.
- 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.
xep0174.patch (167035 Bytes)