#endif
#include "afp_zeroconf.h"
+#include "afp_config.h"
-/*
- * Global Definitions
- */
#ifdef HAVE_AVAHI
-struct context *ctx = NULL;
+#include "afp_avahi.h"
#endif
+
/*
* Functions (actually they are just facades)
*/
-void zeroconf_register(int port, const char *hostname)
+void zeroconf_register(const AFPConfig *configs)
{
#if defined (HAVE_AVAHI)
- LOG(log_info, logtype_afpd, "Attempting to register with mDNS using Avahi\n");
- if (hostname && strlen(hostname) > 0 && port)
- {
- ctx = av_zeroconf_setup(port, hostname);
- }
- else if (hostname && strlen(hostname) > 0)
- {
- ctx = av_zeroconf_setup(AFP_PORT, hostname);
- }
- else
- {
- ctx = av_zeroconf_setup(AFP_PORT, NULL);
- }
- av_zeroconf_run(ctx);
+ LOG(log_debug, logtype_afpd, "Attempting to register with mDNS using Avahi");
+
+ av_zeroconf_setup(configs);
+ av_zeroconf_run();
#endif
}
void zeroconf_deregister(void)
{
#if defined (HAVE_AVAHI)
- LOG(log_error, logtype_afpd, "Attempting to de-register mDNS using Avahi\n");
- if (ctx)
- av_zeroconf_shutdown(ctx);
+ LOG(log_debug, logtype_afpd, "Attempting to de-register mDNS using Avahi");
+ av_zeroconf_shutdown();
#endif
}