<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">My Qt zeroconf / avahi wrapper keeps a
list of discovered / resolved services...<br>
<br>
<a class="moz-txt-link-freetext" href="https://github.com/jbagg/QtZeroConf">https://github.com/jbagg/QtZeroConf</a><br>
<br>
QMap<QString, QZeroConfService *> services; is private, but
you could move it to the public part of the class for your
project.<br>
<br>
<br>
On 16-01-08 06:57 PM, Jon Fitt wrote:<br>
</div>
<blockquote
cite="mid:150612841.1905641.1452297437545.JavaMail.yahoo@mail.yahoo.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<div style="color:#000; background-color:#fff;
font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial,
Lucida Grande, Sans-Serif;font-size:13px">
<div id="yui_3_16_0_1_1452296830130_4553"><span>Hi Trent, or any
other interested parties,</span></div>
<div id="yui_3_16_0_1_1452296830130_4553"><span><br>
</span></div>
<div id="yui_3_16_0_1_1452296830130_4553" dir="ltr"><span
id="yui_3_16_0_1_1452296830130_4846">I don't know if you're
watching this mailing list any more, but I'm trying to pick
this up again.</span></div>
<div id="yui_3_16_0_1_1452296830130_4553" dir="ltr"><span><br>
</span></div>
<div id="yui_3_16_0_1_1452296830130_4553" dir="ltr"><span
id="yui_3_16_0_1_1452296830130_4671">What I'm looking to do
is query the avahi service to get it to tell me all hosts
that it has seen make any service announcements, and ideally
when. I'd like to have my Raspberry Pi keep a passive list
of all hosts it has seen and when they were last seen.</span></div>
<div id="yui_3_16_0_1_1452296830130_4553" dir="ltr"><br>
</div>
<div id="yui_3_16_0_1_1452296830130_4553" dir="ltr">I'm
ultimately looking for it to be able to tell when I have
returned home because my iphone will make service
announcements as soon as it rejoins the wifi.</div>
<div id="yui_3_16_0_1_1452296830130_4553" dir="ltr"><br>
</div>
<div id="yui_3_16_0_1_1452296830130_4553" dir="ltr">I'd guess I
can use a service browser to look for "ANY" service and then
use a service resolver to resolve all of them to their
hostname/IP, but that seems inefficient.</div>
<div id="yui_3_16_0_1_1452296830130_4553" dir="ltr"><br>
</div>
<div id="yui_3_16_0_1_1452296830130_4553" dir="ltr">Is there a
way to query the avahi service based on hostname, instead of
service type?</div>
<div id="yui_3_16_0_1_1452296830130_4553" dir="ltr"><br>
</div>
<div id="yui_3_16_0_1_1452296830130_4553" dir="ltr">Regards,</div>
<div id="yui_3_16_0_1_1452296830130_4553" dir="ltr"><br>
</div>
<div id="yui_3_16_0_1_1452296830130_4553" dir="ltr">Jonathan</div>
<div id="yui_3_16_0_1_1452296830130_4553" dir="ltr"><br>
</div>
<div id="yui_3_16_0_1_1452296830130_4553" dir="ltr"><br>
</div>
<div class="qtdSeparateBR"><br>
<br>
</div>
<div class="yahoo_quoted" style="display: block;">
<div style="font-family: HelveticaNeue, Helvetica Neue,
Helvetica, Arial, Lucida Grande, Sans-Serif; font-size:
13px;">
<div style="font-family: HelveticaNeue, Helvetica Neue,
Helvetica, Arial, Lucida Grande, Sans-Serif; font-size:
16px;">
<div dir="ltr"><font face="Arial" size="2"> On Sunday, 30
November 2014, 21:58, Trent Lloyd
<a class="moz-txt-link-rfc2396E" href="mailto:lathiat@bur.st"><lathiat@bur.st></a> wrote:<br>
</font></div>
<br>
<br>
<div class="y_msg_container">
<div id="yiv4941878234">
<div>
<div class="yiv4941878234">A quick Avahi primer,</div>
<div class="yiv4941878234"><br class="yiv4941878234"
clear="none">
</div>
<div class="yiv4941878234">A “browser” is a long
running process to watch for records coming and
going,</div>
<div class="yiv4941878234">A “resolver” is a short
running process to resolve a record and get a
final result.</div>
<div class="yiv4941878234"><br class="yiv4941878234"
clear="none">
</div>
<div class="yiv4941878234">Avahi is also a
combination of two technologies, first “multicast
dns” which implements DNS with special
considerations for a shared multicast network —
and then “DNS-SD” or DNS based service discovery.
This is a set of DNS records that can be used to
discover a service, it can be used over multicast
dns, or in fact can also be used over normal DNS.</div>
<div class="yiv4941878234"><br class="yiv4941878234"
clear="none">
</div>
<div class="yiv4941878234"><br class="yiv4941878234"
clear="none">
</div>
<div class="yiv4941878234">Generally you “browse”
for some set of records, then if you are
interested in one, you “resolve” it.</div>
<div class="yiv4941878234"><br class="yiv4941878234"
clear="none">
</div>
<div class="yiv4941878234">So generally in most
Avahi applications, the “Service Browser” queries
a list of services over time, e.g. get a list of
all _http._tcp services. It then returns a list
of such services, which you can then (optionally)
resolve with the “Service Resolver”, that will
then fetch the service and resolve it’s additional
TXT records, the IP address for the hostname, etc.</div>
<div class="yiv4941878234"><br class="yiv4941878234"
clear="none">
</div>
<div class="yiv4941878234">A typically use case in
an application is that you browse the service list
with a ServiceBrowser, you provide the user with
a list of the service names, they then click a
service and you then run the ServiceResolver to
get the IP and other TXT details — to then connect
to it. Some applications will also run a
ServiceResolver on every service because they need
the TXT data to show extra information to the
user.</div>
<div class="yiv4941878234"><br class="yiv4941878234"
clear="none">
</div>
<div class="yiv4941878234">The reason these are
split is that it saves unnecessary network traffic
if the application did not want to resolve the
service. This can be a big issue in large
networks, so you want to avoid every application
resolving all services if possible. Or at least,
not all the time.</div>
<div class="yiv4941878234"><br class="yiv4941878234"
clear="none">
</div>
<div class="yiv4941878234"><br class="yiv4941878234"
clear="none">
</div>
<div class="yiv4941878234"><br class="yiv4941878234"
clear="none">
</div>
<div class="yiv4941878234">The “Record Browser” is
a more low level tool for browsing a specific DNS
record over mDNS. It is not normally used by most
applications, as they use the
ServiceBrowser/ServiceResolver which queries
multiple records for you and does extra logic to
handle service discovery. But if you wanted to
watch a specific record, this is the tool to use.
For example perhaps you want to see if there is
an entry for “my-computer.local” with an A record
(IPv4 Address). </div>
<div class="yiv4941878234"><br class="yiv4941878234"
clear="none">
</div>
<div class="yiv4941878234">This might actually be
ideal for this use case, since you want to know
over time if a specific device is on the network
or not - regardless of what services it is
advertising.</div>
<div class="yiv4941878234"><br class="yiv4941878234"
clear="none">
</div>
<div class="yiv4941878234"><br class="yiv4941878234"
clear="none">
</div>
<div class="yiv4941878234">Hope that helps!</div>
<div class="yiv4941878234"><br class="yiv4941878234"
clear="none">
</div>
<div class="yiv4941878234">- Trent</div>
<div class="yiv4941878234"><br class="yiv4941878234"
clear="none">
<div>
<blockquote class="yiv4941878234" type="cite">
<div class="yiv4941878234yqt8780923424"
id="yiv4941878234yqt09438">
<div class="yiv4941878234">On 26 Nov 2014,
at 6:24 am, Jon Fitt <<a
moz-do-not-send="true" rel="nofollow"
shape="rect" class="yiv4941878234"
ymailto="mailto:jonfitt@yahoo.com"
target="_blank"
href="mailto:jonfitt@yahoo.com"><a class="moz-txt-link-abbreviated" href="mailto:jonfitt@yahoo.com">jonfitt@yahoo.com</a></a>>
wrote:</div>
<br
class="yiv4941878234Apple-interchange-newline"
clear="none">
<div class="yiv4941878234">
<div class="yiv4941878234">
<div class="yiv4941878234"
style="background-color:rgb(255, 255,
255);font-family:HelveticaNeue,
'Helvetica Neue', Helvetica, Arial,
'Lucida Grande',
sans-serif;font-size:16px;">
<div class="yiv4941878234" dir="ltr"
id="yiv4941878234yui_3_16_0_1_1416952330017_23002"><span
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23007">In
the avahi-client C-API there is
the concept of a Service Browser
and a Record Browser. Service
Browser sounds like what you are
using now:</span></div>
<div class="yiv4941878234" dir="ltr"
id="yiv4941878234yui_3_16_0_1_1416952330017_23002"><span
class="yiv4941878234"><br
class="yiv4941878234"
clear="none">
</span></div>
<table class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23468"
style="font-family:'Lucida Grande',
Verdana, Geneva, Arial,
sans-serif;font-size:13px;line-height:1.3;white-space:nowrap;font-weight:bold;margin-left:6px;">
<tbody class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23467"
style="">
<tr class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24401"
style="">
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24400"
style="margin-left:6px;"><a
moz-do-not-send="true"
rel="nofollow" shape="rect"
class="yiv4941878234"
target="_blank"
href="http://avahi.org/download/doxygen/lookup_8h.html#ade1392a93ff4d0407c1735374bc0ff7b"
style="color:rgb(70, 101,
162);text-decoration:none;">AvahiServiceBrowser</a>* <a
moz-do-not-send="true"
rel="nofollow" shape="rect"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24399"
target="_blank"
href="http://avahi.org/download/doxygen/lookup_8h.html#a52d55a5156a7943012d03e6700880d2b"
style="color:rgb(70, 101,
162);text-decoration:none;">avahi_service_browser_new</a></td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_25226"
style="">(</td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24864"
style=""><a
moz-do-not-send="true"
rel="nofollow" shape="rect"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24863"
target="_blank"
href="http://avahi.org/download/doxygen/client_8h.html#a3d65e9ea7182c44fa8df04a72f1a56bb"
style="color:rgb(70, 101,
162);text-decoration:none;">AvahiClient</a> * </td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_25227"
style="color:rgb(96, 32, 32);">client,</td>
</tr>
<tr class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23728"
style="">
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24402"
style="text-align:right;"><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234" style=""><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24861"
style=""><a
moz-do-not-send="true"
rel="nofollow" shape="rect"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24862"
target="_blank"
href="http://avahi.org/download/doxygen/address_8h.html#a2fda397a8f430cb537e37bbca0afb535"
style="color:rgb(70, 101,
162);text-decoration:none;">AvahiIfIndex</a> </td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23727"
style="color:rgb(96, 32, 32);">interface,</td>
</tr>
<tr class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24404"
style="">
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24403"
style="text-align:right;"><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234" style=""><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24859"
style=""><a
moz-do-not-send="true"
rel="nofollow" shape="rect"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24860"
target="_blank"
href="http://avahi.org/download/doxygen/address_8h.html#a5342ada86ff1566a7fc6e855b3d46c3d"
style="color:rgb(70, 101,
162);text-decoration:none;">AvahiProtocol</a> </td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_25228"
style="color:rgb(96, 32, 32);">protocol,</td>
</tr>
<tr class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23730"
style="">
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24405"
style="text-align:right;"><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234" style=""><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23729"
style="">const char * </td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23739"
style="color:rgb(96, 32, 32);">type,</td>
</tr>
<tr class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23736"
style="">
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23735"
style="text-align:right;"><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234" style=""><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23737"
style="">const char * </td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23738"
style="color:rgb(96, 32, 32);">domain,</td>
</tr>
<tr class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23732"
style="">
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23734"
style="text-align:right;"><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23740"
style=""><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23731"
style=""><a
moz-do-not-send="true"
rel="nofollow" shape="rect"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24480"
target="_blank"
href="http://avahi.org/download/doxygen/defs_8h.html#afa669747c3ff55190d86673dff960e50"
style="color:rgb(70, 101,
162);text-decoration:none;">AvahiLookupFlags</a> </td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24853"
style="color:rgb(96, 32, 32);">flags,</td>
</tr>
<tr class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23475"
style="">
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23733"
style="text-align:right;"><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234" style=""><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23741"
style=""><a
moz-do-not-send="true"
rel="nofollow" shape="rect"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23742"
target="_blank"
href="http://avahi.org/download/doxygen/lookup_8h.html#a666e712e840c612ba24d9e41673a94df"
style="color:rgb(70, 101,
162);text-decoration:none;">AvahiServiceBrowserCallback</a> </td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23474"
style="color:rgb(96, 32, 32);">callback,</td>
</tr>
<tr class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23466"
style="">
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23465"
style="text-align:right;"><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24406"
style=""><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23472"
style="">void * </td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23473"
style="color:rgb(96, 32, 32);">userdata </td>
</tr>
<tr class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23470"
style="">
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23469"
style="color:rgb(37, 53,
85);line-height:16.8999996185303px;background-color:rgb(226,
232, 242);"><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_23471"
style="color:rgb(37, 53,
85);line-height:16.8999996185303px;background-color:rgb(226,
232, 242);">)</td>
</tr>
</tbody>
</table>
<div class="yiv4941878234" dir="ltr"
id="yiv4941878234yui_3_16_0_1_1416952330017_23002"><span
class="yiv4941878234"><br
class="yiv4941878234"
clear="none">
</span></div>
<div class="yiv4941878234" dir="ltr"
id="yiv4941878234yui_3_16_0_1_1416952330017_23002"><span
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24069">The
type being for example _http._tcp.
Whereas a Record Browser looks
like this:</span></div>
<div class="yiv4941878234" dir="ltr"
id="yiv4941878234yui_3_16_0_1_1416952330017_23002"><span
class="yiv4941878234"><br
class="yiv4941878234"
clear="none">
</span></div>
<table class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24471"
style="font-family:'Lucida Grande',
Verdana, Geneva, Arial,
sans-serif;font-size:13px;line-height:1.3;white-space:nowrap;font-weight:bold;margin-left:6px;">
<tbody class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24470"
style="">
<tr class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24482"
style="">
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_25224"
style="margin-left:6px;"><a
moz-do-not-send="true"
rel="nofollow" shape="rect"
class="yiv4941878234"
target="_blank"
href="http://avahi.org/download/doxygen/lookup_8h.html#ad0a38359b6c52d4272acd831410186f2"
style="color:rgb(70, 101,
162);text-decoration:none;">AvahiRecordBrowser</a>* <a
moz-do-not-send="true"
rel="nofollow" shape="rect"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_25223"
target="_blank"
href="http://avahi.org/download/doxygen/lookup_8h.html#a21ac2275126fb9e5eaaae8afe3b75532"
style="color:rgb(70, 101,
162);text-decoration:none;">avahi_record_browser_new</a></td>
<td colspan="1" rowspan="1"
class="yiv4941878234" style="">(</td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24481"
style=""><a
moz-do-not-send="true"
rel="nofollow" shape="rect"
class="yiv4941878234"
target="_blank"
href="http://avahi.org/download/doxygen/client_8h.html#a3d65e9ea7182c44fa8df04a72f1a56bb"
style="color:rgb(70, 101,
162);text-decoration:none;">AvahiClient</a> * </td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24865"
style="color:rgb(96, 32, 32);">client,</td>
</tr>
<tr class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24484"
style="">
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_25232"
style="text-align:right;"><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234" style=""><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24883"
style=""><a
moz-do-not-send="true"
rel="nofollow" shape="rect"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_25221"
target="_blank"
href="http://avahi.org/download/doxygen/address_8h.html#a2fda397a8f430cb537e37bbca0afb535"
style="color:rgb(70, 101,
162);text-decoration:none;">AvahiIfIndex</a> </td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24483"
style="color:rgb(96, 32, 32);">interface,</td>
</tr>
<tr class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24479"
style="">
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_25225"
style="text-align:right;"><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_25231"
style=""><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24478"
style=""><a
moz-do-not-send="true"
rel="nofollow" shape="rect"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24477"
target="_blank"
href="http://avahi.org/download/doxygen/address_8h.html#a5342ada86ff1566a7fc6e855b3d46c3d"
style="color:rgb(70, 101,
162);text-decoration:none;">AvahiProtocol</a> </td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_25230"
style="color:rgb(96, 32, 32);">protocol,</td>
</tr>
<tr class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24486"
style="">
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_25222"
style="text-align:right;"><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234" style=""><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24882"
style="">const char * </td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24485"
style="color:rgb(96, 32, 32);">name,</td>
</tr>
<tr class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24867"
style="">
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24880"
style="text-align:right;"><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234" style=""><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24868"
style="">uint16_t </td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24866"
style="color:rgb(96, 32, 32);">clazz,</td>
</tr>
<tr class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24469"
style="">
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24879"
style="text-align:right;"><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234" style=""><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24468"
style="">uint16_t </td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_25220"
style="color:rgb(96, 32, 32);">type,</td>
</tr>
<tr class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24870"
style="">
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24871"
style="text-align:right;"><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24869"
style=""><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24878"
style=""><a
moz-do-not-send="true"
rel="nofollow" shape="rect"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24877"
target="_blank"
href="http://avahi.org/download/doxygen/defs_8h.html#afa669747c3ff55190d86673dff960e50"
style="color:rgb(70, 101,
162);text-decoration:none;">AvahiLookupFlags</a> </td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_25229"
style="color:rgb(96, 32, 32);">flags,</td>
</tr>
<tr class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24476"
style="">
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24872"
style="text-align:right;"><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_25573"
style=""><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24475"
style=""><a
moz-do-not-send="true"
rel="nofollow" shape="rect"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24474"
target="_blank"
href="http://avahi.org/download/doxygen/lookup_8h.html#a867a24784f27539ed34291e0db8b51b8"
style="color:rgb(70, 101,
162);text-decoration:none;">AvahiRecordBrowserCallback</a> </td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24858"
style="color:rgb(96, 32, 32);">callback,</td>
</tr>
<tr class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24473"
style="">
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24873"
style="text-align:right;"><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_25571"
style=""><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24472"
style="">void * </td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_25572"
style="color:rgb(96, 32, 32);">userdata </td>
</tr>
<tr class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24875"
style="">
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24874"
style="color:rgb(37, 53,
85);line-height:16.8999996185303px;background-color:rgb(226,
232, 242);"><br>
</td>
<td colspan="1" rowspan="1"
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24884"
style="color:rgb(37, 53,
85);line-height:16.8999996185303px;background-color:rgb(226,
232, 242);">)</td>
</tr>
</tbody>
</table>
<div class="yiv4941878234" dir="ltr"
id="yiv4941878234yui_3_16_0_1_1416952330017_23002"><span
class="yiv4941878234"><br
class="yiv4941878234"
clear="none">
</span></div>
<div class="yiv4941878234" dir="ltr"
id="yiv4941878234yui_3_16_0_1_1416952330017_23002"><span
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_24876">I
wonder if that is a more generic
mDNS browser? Unfortunately the
parameters, and what a "record"
is, is not explained in the online
documentation. I'll have a look in
the source to see if I can find
out more.</span></div>
<div class="yiv4941878234" dir="ltr"
id="yiv4941878234yui_3_16_0_1_1416952330017_23002"><span
class="yiv4941878234"><br
class="yiv4941878234"
clear="none">
</span></div>
<div class="yiv4941878234" dir="ltr"
id="yiv4941878234yui_3_16_0_1_1416952330017_23002"><span
class="yiv4941878234">Regards,</span></div>
<div class="yiv4941878234" dir="ltr"
id="yiv4941878234yui_3_16_0_1_1416952330017_23002"><span
class="yiv4941878234"
id="yiv4941878234yui_3_16_0_1_1416952330017_25912">Jonathan</span></div>
<div
class="yiv4941878234qtdSeparateBR"><br
class="yiv4941878234" clear="none">
<br class="yiv4941878234"
clear="none">
</div>
<div class="yiv4941878234yahoo_quoted"
style="display:block;">
<div class="yiv4941878234"
style="font-family:HelveticaNeue,
Helvetica Neue, Helvetica, Arial,
Lucida Grande,
Sans-Serif;font-size:16px;">
<div class="yiv4941878234"
style="font-family:HelveticaNeue,
Helvetica Neue, Helvetica,
Arial, Lucida Grande,
Sans-Serif;font-size:16px;">
<div class="yiv4941878234"
dir="ltr"> <font
class="yiv4941878234"
face="Arial" size="2"> On
Tuesday, 25 November 2014,
13:17, Michael Jones <<a
moz-do-not-send="true"
rel="nofollow"
shape="rect"
class="yiv4941878234"
ymailto="mailto:avahi@jonesmz.com"
target="_blank"
href="mailto:avahi@jonesmz.com"><a class="moz-txt-link-abbreviated" href="mailto:avahi@jonesmz.com">avahi@jonesmz.com</a></a>>
wrote:<br
class="yiv4941878234"
clear="none">
</font> </div>
<br class="yiv4941878234"
clear="none">
<br class="yiv4941878234"
clear="none">
<div
class="yiv4941878234y_msg_container">
<div class="yiv4941878234"
id="yiv4941878234">
<div class="yiv4941878234"
dir="ltr"><br
class="yiv4941878234"
clear="none">
<div
class="yiv4941878234gmail_extra">
<div
class="yiv4941878234gmail_quote">
<blockquote
class="yiv4941878234gmail_quote"
style="margin:0px
0px 0px
0.8ex;border-left:1px
solid
rgb(204,204,204);padding-left:1ex;"><br
class="yiv4941878234" clear="none">
Hi Michael,<br
class="yiv4941878234"
clear="none">
I'm looking at
your ZConfBrowserWidget
and I see that it
needs a service
type. Technically I
believe from what
I've been reading
the mDNS host
announcements are
different to an
DNS-SD service,
although they are
both announced in a
similar way.Is there
a "service type"
that catches the
mDNS hostname
announcements?<br
class="yiv4941878234"
clear="none">
Regards,<br
class="yiv4941878234"
clear="none">
Jonathan<br
class="yiv4941878234"
clear="none">
<br
class="yiv4941878234"
clear="none">
On Friday, 21
November 2014,
15:08, Jonathan Fitt
<<a
moz-do-not-send="true"
rel="nofollow"
shape="rect"
class="yiv4941878234"
ymailto="mailto:jonfitt@yahoo.com" target="_blank"
href="mailto:jonfitt@yahoo.com"><a class="moz-txt-link-abbreviated" href="mailto:jonfitt@yahoo.com">jonfitt@yahoo.com</a></a>>
wrote:<br
class="yiv4941878234"
clear="none">
<br
class="yiv4941878234"
clear="none">
<br
class="yiv4941878234"
clear="none">
Thanks! I'll give
that a go and let
you know how it
goes. <br
class="yiv4941878234"
clear="none">
Jonathan<br
class="yiv4941878234"
clear="none">
On Nov 21, 2014, at
1:25 PM, Michael
Jones <<a
moz-do-not-send="true"
rel="nofollow"
shape="rect"
class="yiv4941878234"
ymailto="mailto:avahi@jonesmz.com" target="_blank"
href="mailto:avahi@jonesmz.com"><a class="moz-txt-link-abbreviated" href="mailto:avahi@jonesmz.com">avahi@jonesmz.com</a></a>>
wrote:<br
class="yiv4941878234"
clear="none">
<br
class="yiv4941878234"
clear="none">
<br
class="yiv4941878234"
clear="none">
<br
class="yiv4941878234"
clear="none">
<br
class="yiv4941878234"
clear="none">
Hello,I am looking
for a way for a
Linux machine to
tell when I return
home. My idea is
that my iPhone will
always do an mDNS
announcement when it
joins my home wifi.
So I'm looking for a
way to watch for
mDNS announcements
and perform and
action if the right
one is seen.
Obviously the
avahi-daemon is
watching these all
the time and
updating its cache,
so I was thinking
that there might be
a good place to
start. However the
only command line
way I can see to get
to the avahi-daemon
cache is to send a
SIGUSR1 to get it to
dump to
/var/log/syslog.
Then I can look at
the timestamp to
determine the last
time it registered
and compare with
now. That seems
quite ugly though,
and I don't like the
idea of continually
dumping to syslog.<br
class="yiv4941878234" clear="none">
So is there a way to
make it more event
driven with the
avahi-daemon? I
think from looking
at the D-Bus API
that might be the
way to go?If it is
the right approach,
I would appreciate
it if someone knew
of a related chunk
of source that I
could use as a
starting point.<br
class="yiv4941878234"
clear="none">
Thanks!Jonathan<br
class="yiv4941878234"
clear="none">
<br
class="yiv4941878234"
clear="none">
<br
class="yiv4941878234"
clear="none">
<br
class="yiv4941878234"
clear="none">
Write a small
program that uses
the Avahi API. A
very high level
wrapper for the
Avahi API is: <a
moz-do-not-send="true"
rel="nofollow"
shape="rect"
class="yiv4941878234"
target="_blank"
href="https://github.com/johanneshilden/qtzeroconf"><a class="moz-txt-link-freetext" href="https://github.com/johanneshilden/qtzeroconf">https://github.com/johanneshilden/qtzeroconf</a></a><br
class="yiv4941878234" clear="none">
<br
class="yiv4941878234"
clear="none">
Using that, you can
detect your phone
joining your home
network in under 10
lines of code.<br
class="yiv4941878234"
clear="none">
Create the service
browser object<br
class="yiv4941878234"
clear="none">
Connect that new
object to a qt slot
that'll respond to
the new service
joining your
network, Tell the
service browser
object which
services to listen
for.<br
class="yiv4941878234"
clear="none">
<br
class="yiv4941878234"
clear="none">
>From there, you
can do whatever you
want with the
information. Perhaps
you would want to
send some kind of
DBus signal to let
other programs know.<br
class="yiv4941878234" clear="none">
<br
class="yiv4941878234"
clear="none">
I'm afraid I haven't
investigated the
DBus API, so I'm not
certain I can give
you any advice in
that direction, but
I have written apps
using the high level
Qt API that I linked
above, and I've
never had any
trouble with it.<br
class="yiv4941878234" clear="none">
<br
class="yiv4941878234"
clear="none">
--Michael Jone</blockquote>
<div
class="yiv4941878234"><br
class="yiv4941878234" clear="none">
<br
class="yiv4941878234"
clear="none">
</div>
<div
class="yiv4941878234">Hi
Jonathan <br
class="yiv4941878234"
clear="none">
<br
class="yiv4941878234"
clear="none">
<br
class="yiv4941878234"
clear="none">
</div>
<div
class="yiv4941878234">That's
a good question. I
actually don't know.
The qtzeroconf
library isn't
actually mine,
originally. I made a
lot of modifications
to it (Here: <a
moz-do-not-send="true"
rel="nofollow"
shape="rect"
class="yiv4941878234"
target="_blank"
href="https://github.com/jonesmz/qtzeroconf"><a class="moz-txt-link-freetext" href="https://github.com/jonesmz/qtzeroconf">https://github.com/jonesmz/qtzeroconf</a></a>)
that take advantage
of Qt5 and C++11,
but those changes
aren't compatible
with older versions
of Qt, so I didn't
want to recommend it
to you.<br
class="yiv4941878234"
clear="none">
<br
class="yiv4941878234"
clear="none">
If you feel like
poking around at the
Avahi C API and can
demonstrate how to
get mDNS host
announcements out of
the Avahi C api, I'd
be willing to add
support for that to
my version of the
qtzeroconf library
(though, it'll still
not be compatible
with Qt4 or older
versions of C++, so
you might end up
needing to backport
the changes to the
original authors
github project.)<br
class="yiv4941878234" clear="none">
<br
class="yiv4941878234"
clear="none">
</div>
<div
class="yiv4941878234">If
you want to work
just with what the
current qtzeroconf
library can do, you
can just make your
phone advertise an
avahi service.
Perhaps give the
protocol name
something like
"_phone._tcp" or
something. <br
class="yiv4941878234"
clear="none">
<br
class="yiv4941878234"
clear="none">
</div>
<div
class="yiv4941878234">Another
thing to keep in
mind, I don't know
whether Avahi will
automatically detect
your phone on the
local network unless
your phone's
operating system
automatically sends
that announcement.
As far as I know,
Android doesn't do
that. I don't know
about the other
phone OS's.<br
class="yiv4941878234"
clear="none">
<br
class="yiv4941878234"
clear="none">
</div>
<div
class="yiv4941878234">Best
of luck, and let me
know if you want to
investigate the host
announcement support
in qtzeroconf.<br
class="yiv4941878234"
clear="none">
<br
class="yiv4941878234"
clear="none">
</div>
<div
class="yiv4941878234">--Michael
Jones<br
class="yiv4941878234"
clear="none">
</div>
</div>
</div>
</div>
</div>
<br class="yiv4941878234"
clear="none">
_______________________________________________<br class="yiv4941878234"
clear="none">
avahi mailing list<br
class="yiv4941878234"
clear="none">
<a moz-do-not-send="true"
rel="nofollow" shape="rect"
class="yiv4941878234"
ymailto="mailto:avahi@lists.freedesktop.org"
target="_blank"
href="mailto:avahi@lists.freedesktop.org">avahi@lists.freedesktop.org</a><br
class="yiv4941878234"
clear="none">
<a moz-do-not-send="true"
rel="nofollow" shape="rect"
class="yiv4941878234"
target="_blank"
href="http://lists.freedesktop.org/mailman/listinfo/avahi">http://lists.freedesktop.org/mailman/listinfo/avahi</a><br
class="yiv4941878234"
clear="none">
<br class="yiv4941878234"
clear="none">
<br class="yiv4941878234"
clear="none">
</div>
</div>
</div>
</div>
</div>
</div>
_______________________________________________<br class="yiv4941878234"
clear="none">
avahi mailing list<br
class="yiv4941878234" clear="none">
<a moz-do-not-send="true" rel="nofollow"
shape="rect" class="yiv4941878234"
ymailto="mailto:avahi@lists.freedesktop.org"
target="_blank"
href="mailto:avahi@lists.freedesktop.org">avahi@lists.freedesktop.org</a><br
class="yiv4941878234" clear="none">
<a class="moz-txt-link-freetext" href="http://lists.freedesktop.org/mailman/listinfo/avahi">http://lists.freedesktop.org/mailman/listinfo/avahi</a><br
class="yiv4941878234" clear="none">
</div>
</div>
</blockquote>
</div>
<br class="yiv4941878234" clear="none">
</div>
</div>
</div>
<br>
<div class="yqt8780923424" id="yqt42795">_______________________________________________<br
clear="none">
avahi mailing list<br clear="none">
<a moz-do-not-send="true" shape="rect"
ymailto="mailto:avahi@lists.freedesktop.org"
href="mailto:avahi@lists.freedesktop.org">avahi@lists.freedesktop.org</a><br
clear="none">
<a moz-do-not-send="true" shape="rect"
href="http://lists.freedesktop.org/mailman/listinfo/avahi"
target="_blank">http://lists.freedesktop.org/mailman/listinfo/avahi</a><br
clear="none">
</div>
<br>
<br>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
avahi mailing list
<a class="moz-txt-link-abbreviated" href="mailto:avahi@lists.freedesktop.org">avahi@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freedesktop.org/mailman/listinfo/avahi">http://lists.freedesktop.org/mailman/listinfo/avahi</a>
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Jonathan Bagg
Embedded Systems Developer
NAD Electronics | Lenbrook Industries Limited
633 Granite Court, Pickering, Ontario, Canada L1W 3K1 | 905-831-0799 ext 4478 | <a class="moz-txt-link-freetext" href="http://www.nadelectronics.com">http://www.nadelectronics.com</a></pre>
</body>
</html>