This is a feature that is implemented in Bonjour, but it is missing from Avahi.
When using Bonjour, one can call DNSServiceRegister with parameter kDNSServiceInterfaceIndexLocalOnly (defined as -1). This registration will result in local only service.
This feature is really powerful on the Desktop.
For example you can publishing DAAP services, which can be picked up by music players like Rhythmbox, Banshee, Amarok etc. Anyone that knows DAAP.
Only processes on same machine can see those services.
I made a patch attempting to implement the feature.
Basically I was able to transfer registered local
services into the cache without receiving messages on the network.
Of course that is just one step. The cache needs to be kept up to date.
I used the following call to test:
avahi_server_add_service(server, group, 1, AVAHI_PROTO_UNSPEC,
AVAHI_PUBLISH_NO_ANNOUNCE, "My Service Name", "_daap._tcp", NULL, NULL,
7777, "foo", NULL);
I used avahi-0.6.21 source.