aboutsummaryrefslogtreecommitdiff
path: root/src/util/resolver_api.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2010-04-22 11:18:48 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2010-04-22 11:18:48 +0000
commit5a85013ee94a838a2438a3bd1dedec1b78cc68a6 (patch)
tree47f009c75f8ca6c2310971962bbb01aa72b5dcf2 /src/util/resolver_api.c
parent01a4013c9f1bca74ae784b3508b67be32d9b33db (diff)
downloadgnunet-5a85013ee94a838a2438a3bd1dedec1b78cc68a6.tar.gz
gnunet-5a85013ee94a838a2438a3bd1dedec1b78cc68a6.zip
Diffstat (limited to 'src/util/resolver_api.c')
-rw-r--r--src/util/resolver_api.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c
index f4844a490..6d874cce8 100644
--- a/src/util/resolver_api.c
+++ b/src/util/resolver_api.c
@@ -693,6 +693,38 @@ GNUNET_RESOLVER_local_hostname_get ( )
693} 693}
694 694
695/** 695/**
696 * Get local fully qualified domain name
697 * @return fqdn
698 */
699char *
700GNUNET_RESOLVER_local_fqdn_get ( void )
701{
702 struct hostent *host;
703 char hostname[GNUNET_OS_get_hostname_max_length() + 1];
704
705
706 if (0 != gethostname (hostname, sizeof (hostname) - 1))
707 {
708 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR |
709 GNUNET_ERROR_TYPE_BULK, "gethostname");
710 return NULL;
711 }
712#if DEBUG_RESOLVER
713 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
714 _("Resolving our FQDN `%s'\n"), hostname);
715#endif
716 host = gethostbyname ( hostname );
717 if ( NULL == host)
718 {
719 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
720 _("Could not resolve our FQDN : %s\n"),
721 hstrerror (h_errno));
722 return NULL;
723 }
724 return GNUNET_strdup (host->h_name);
725}
726
727/**
696 * Looking our own hostname. 728 * Looking our own hostname.
697 * 729 *
698 * @param sched scheduler to use 730 * @param sched scheduler to use