How do I read the output of dns-sd?
A half answer:
I found the source code for dns-sd.c and dns_sd.h, dating back to 2004 and OS X &quot;Lion&quot;, where &quot;flags&quot; is a value of type DNSServiceFlags, which seems to be one of these (deprecated) constants.  If that's so, then &quot;1&quot; means &quot;kDNSServiceFlagsMoreComing&quot;: another entry should follow immediately. &quot;2&quot; means just &quot;kDNSServiceFlagsAdd&quot;. &quot;3&quot; means &quot;kDNSServiceFlagsAdd&quot; together with &quot;kDNSServiceFlagsMoreComing&quot;. Not very useful.
According to that same program, &quot;if&quot; is uint32_t ifIndex,  the &quot;interface index&quot;, which is also mentioned on that Apple developer page.  I'm seeing values like &quot;4&quot; and &quot;0&quot;, and I can't quite figure out the meaning.  It seems to be both a bitmask for requesting a class of interface (where 0 means &quot;any&quot;, and -1/-2/-3 cast to an uint32_t are other classes), and an index into a list of network interfaces (where 0 means &quot;error&quot;, and positive integers indicate a valid interface).  I only have one active network interface, and I can't tell that it's &quot;#4&quot; of anything, or why I'd see &quot;0&quot; for some dns-sd requests.
Apple's mDNSResponder code, in many revisions across many years, is at https://opensource.apple.com/source/mDNSResponder/.