1 /*
2  * Copyright (c) 2002-2013 Balabit
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17  *
18  * As an additional exemption you are allowed to compile & link against the
19  * OpenSSL libraries as published by the OpenSSL project. See the file
20  * COPYING for details.
21  *
22  */
23 #ifndef HOST_RESOLVE_H_INCLUDED
24 #define HOST_RESOLVE_H_INCLUDED 1
25 
26 #include "syslog-ng.h"
27 #include "gsockaddr.h"
28 
29 typedef struct _HostResolveOptions
30 {
31   gboolean use_dns;
32   gboolean use_fqdn;
33   gboolean use_dns_cache;
34   gboolean normalize_hostnames;
35 } HostResolveOptions;
36 
37 /* name resolution */
38 const gchar *resolve_sockaddr_to_hostname(gsize *result_len, GSockAddr *saddr,
39                                           const HostResolveOptions *host_resolve_options);
40 gboolean resolve_hostname_to_sockaddr(GSockAddr **addr, gint family, const gchar *name);
41 const gchar *resolve_hostname_to_hostname(gsize *result_len, const gchar *hostname, HostResolveOptions *options);
42 
43 void host_resolve_options_defaults(HostResolveOptions *options);
44 void host_resolve_options_global_defaults(HostResolveOptions *options);
45 void host_resolve_options_init_globals(HostResolveOptions *options);
46 void host_resolve_options_init(HostResolveOptions *options, HostResolveOptions *global_options);
47 void host_resolve_options_destroy(HostResolveOptions *options);
48 
49 #endif
50