I want to use the C avahi library to create a dialog box in gtk that can list all the services in DNS-SD network. I am able to list all the services in a dialog box but I want to clean this list of duplicate entries. As you can see in the image above that that output of
avahi-browse -a
in my terminal gives me a lot of duplicates of the same service but from different interfaces( and hence different addresses ). I want to remove these duplicates.
Therefore to achieve this I used a hash-table to store the previously found services and only add a new service if the string concatenation of name, port, type, domain, host_name has never been added before. The code for which is roughly as shown below.
Note- I did not include the parameter address and that is what I am curious about.
The end goal for me is to remove duplicates from different interfaces and protocols as on resolving we can see that these duplicates services have different addresses.
Will I be excluding unique services if I don't consider the address parameter?