How do I read the output of dns-sd? When I run the dns-sd command, for example as dns-sd -B _services._dns-sd._udp. to list all the service types on my local network, I get a table that looks like:

$ dns-sd -B _services._dns-sd._udp.
Browsing for _services._dns-sd._udp.
DATE: ---Tue 31 Dec 2013---
14:39:57.995  ...STARTING...
Timestamp     A/R    Flags  if Domain               Service Type         Instance Name
14:39:57.995  Add        3   4 .                    _tcp.local.          _ssh
14:39:57.996  Add        3   4 .                    _tcp.local.          _sftp-ssh


I get "Timestamp", and "A/R" is probably Add/Remove.  What are "Flags"?  What's "if"?
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/.