ServiceResolver
There are three ways Psi might locate a Jabber service. ServiceResolver covers all three, on all platforms, and makes it easy.
To demonstrate how ServiceResolver works, below you can see some output of my ‘irisnet’ commandline tool (which still in development).
The main way to find a Jabber server is via SRV. ServiceResolver looks up the SRV records of a given type on a given domain, as well as the address (A/AAAA) records for each:
$ ./irisnet rservd sapo.pt _xmpp-client._tcp [213.13.146.7] port=5222 [213.13.146.8] port=5222
You can also lookup non-SRV (”plain”) services. This is done by pre-supplying the port to use, which is returned with each address record found:
$ ./irisnet rservp gmail.com 5222 [216.239.57.107] port=5222 [64.233.161.107] port=5222 [64.233.171.107] port=5222
Lastly, suppose there’s a JEP-0174 / iChat service instance on the LAN called someguy@macbox. In this case, DNS-SD is used:
$ ./irisnet rservi someguy@macbox _presence._tcp [192.168.1.156] port=5298
There may be three different input methods, but there is only one output method: a list of address & port pairs. The list is always sorted in the order in which the addresses should be tried. Priorities and weights are taken care of for you.
With cross-platform capability, pluggable backends, and seamless Bonjour support, the Iris DNS system is shaping up to be one of the most simple and capable such systems in existence. I suppose I don’t feel so bad about it taking forever to finish, because we really have something cool here.



ktolis’ weblog » Psi and SRV records said,
February 13, 2006 @ 4:07 am
[…] http://delta.affinix.com/2006/02/11/serviceresolver/ […]
Albert said,
April 24, 2006 @ 8:43 am
In the case of SRV, how are priorities and weights handled?
justin said,
April 24, 2006 @ 6:27 pm
Albert,
It is not implemented yet, but the idea is that the proper SRV ordering would be done. This, I believe, is to order by priority, and those with the same priority are ordered randomly based on their weights.
The application would not care about these details, it would simply receive IP/port pairs, one after the other, trusting that the order they are received is the order in which to attempt connections.