+
+ avahi_record_list_flush(s->record_list);
+}
+
+static void reflect_response(AvahiServer *s, AvahiInterface *i, AvahiRecord *r, int flush_cache) {
+ AvahiInterface *j;
+
+ assert(s);
+ assert(i);
+ assert(r);
+
+ if (!s->config.enable_reflector)
+ return;
+
+ for (j = s->monitor->interfaces; j; j = j->interface_next)
+ if (j != i && (s->config.reflect_ipv || j->protocol == i->protocol))
+ avahi_interface_post_response(j, r, flush_cache, NULL, 1);
+}
+
+static void* reflect_cache_walk_callback(AvahiCache *c, AvahiKey *pattern, AvahiCacheEntry *e, void* userdata) {
+ AvahiServer *s = userdata;
+
+ assert(c);
+ assert(pattern);
+ assert(e);
+ assert(s);
+
+ avahi_record_list_push(s->record_list, e->record, e->cache_flush, 0, 0);
+ return NULL;
+}
+
+static void reflect_query(AvahiServer *s, AvahiInterface *i, AvahiKey *k) {
+ AvahiInterface *j;
+
+ assert(s);
+ assert(i);
+ assert(k);
+
+ if (!s->config.enable_reflector)
+ return;
+
+ for (j = s->monitor->interfaces; j; j = j->interface_next)
+ if (j != i && (s->config.reflect_ipv || j->protocol == i->protocol)) {
+ /* Post the query to other networks */
+ avahi_interface_post_query(j, k, 1, NULL);
+
+ /* Reply from caches of other network. This is needed to
+ * "work around" known answer suppression. */
+
+ avahi_cache_walk(j->cache, k, reflect_cache_walk_callback, s);
+ }
+}
+
+static void reflect_probe(AvahiServer *s, AvahiInterface *i, AvahiRecord *r) {
+ AvahiInterface *j;
+
+ assert(s);
+ assert(i);
+ assert(r);
+
+ if (!s->config.enable_reflector)
+ return;
+
+ for (j = s->monitor->interfaces; j; j = j->interface_next)
+ if (j != i && (s->config.reflect_ipv || j->protocol == i->protocol))
+ avahi_interface_post_probe(j, r, 1);