#endif /* USE_SRVLOC */
#ifdef USE_ZEROCONF
- struct servent *afpovertcp;
- int afp_port = 548;
- char *hostname = NULL;
+ uint afp_port;
+ const char *hostname = NULL;
dsi->zeroconf_registered = 0; /* Mark that we haven't registered. */
* use a non-default port, they can, but be aware, this server might
* not show up int the Network Browser.
*/
- afpovertcp = getservbyname("afpovertcp", "tcp");
- if (afpovertcp != NULL) {
- afp_port = ntohs(afpovertcp->s_port);
- }
+ afp_port = getip_port((struct sockaddr *)&dsi->server);
/* If specified use the FQDN to register with srvloc, otherwise use IP. */
p = NULL;
if (options->fqdn) {
hostname = options->fqdn;
p = strchr(hostname, ':');
- }
- else
- hostname = inet_ntoa(dsi->server.sin_addr);
-
- if (!(options->flags & OPTION_NOSLP)) {
- zeroconf_register(afp_port, hostname);
- dsi->zeroconf_registered = 1; /* Mark that we have registered. */
+ } else {
+ hostname = getip_string((struct sockaddr *)&dsi->server);
}
+
+ zeroconf_register(afp_port, hostname);
+ dsi->zeroconf_registered = 1; /* Mark that we have registered. */
+ config->server_cleanup = dsi_cleanup;
}
- config->server_cleanup = dsi_cleanup;
#endif /* USE_ZEROCONF */
config->fd = dsi->serversock;
/*
* Functions (actually they are just facades)
*/
-void zeroconf_register(int port, char *hostname)
+void zeroconf_register(int port, const char *hostname)
{
#if defined (HAVE_AVAHI)
LOG(log_info, logtype_afpd, "Attempting to register with mDNS using Avahi\n");
#include <netinet/in.h> /* htons() */
#include <atalk/logger.h>
-#ifdef (HAVE_AVAHI)
+#ifdef HAVE_AVAHI
#include "afp_avahi.h"
#endif
/*
* registers the ntpd service with a particular Zerconf implemenation.
*/
-void zeroconf_register(int port, char *hostname);
+void zeroconf_register(int port, const char *hostname);
/*
* de-registers the ntpd service with a particular Zerconf implemenation.
*/
void zeroconf_deregister(void);
-#endif AFPD_ZEROCONF_H
+#endif /* AFPD_ZEROCONF_H */
dnl Check for optional Zeroconf support
AC_DEFUN([NETATALK_ZEROCONF], [
-
ZEROCONF_LIBS=""
ZEROCONF_CFLAGS=""
found_zeroconf=no
[[ -n "$atalk_libname" ]] || AC_MSG_ERROR([internal error, atalk_libname undefined])
if test "x$zeroconf" != "xno"; then
-
savedcppflags="$CPPFLAGS"
savedldflags="$LDFLAGS"
fi
# mDNS support using Avahi
- AC_CHECK_HEADER(avahi-client/client.h,
- [AC_CHECK_LIB(avahi-client,
- avahi_client_new,
- [AC_DEFINE(USE_ZEROCONF, 1,
- [Use DNS-SD registration])])])
+ AC_CHECK_HEADER(
+ avahi-client/client.h,
+ AC_CHECK_LIB(
+ avahi-client,
+ avahi_client_new,
+ AC_DEFINE(USE_ZEROCONF, 1, [Use DNS-SD registration]))
+ )
+
case "$ac_cv_lib_avahi_client_avahi_client_new" in
yes)
PKG_CHECK_MODULES(AVAHI, [ avahi-client >= 0.6 ])