blob: 7ce5a098e3c45673cb87536ccf68f5a39a9f2c4d [file] [log] [blame]
Baptiste Assmann325137d2015-04-13 23:40:55 +02001/*
2 * include/proto/dns.h
3 * This file provides functions related to DNS protocol
4 *
5 * Copyright (C) 2014 Baptiste Assmann <bedis9@gmail.com>
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation, version 2.1
10 * exclusively.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef _PROTO_DNS_H
23#define _PROTO_DNS_H
24
Baptiste Assmann333939c2019-01-21 08:34:50 +010025#include <types/action.h>
Baptiste Assmann325137d2015-04-13 23:40:55 +020026#include <types/dns.h>
Baptiste Assmann325137d2015-04-13 23:40:55 +020027
Christopher Faulet67957bd2017-09-27 11:00:59 +020028extern struct list dns_resolvers;
Baptiste Assmann333939c2019-01-21 08:34:50 +010029extern unsigned int dns_failed_resolutions;
Christopher Faulet67957bd2017-09-27 11:00:59 +020030
31struct dns_resolvers *find_resolvers_by_id(const char *id);
32struct dns_srvrq *find_srvrq_by_name(const char *name, struct proxy *px);
33struct dns_srvrq *new_dns_srvrq(struct server *srv, char *fqdn);
34
35int dns_str_to_dn_label(const char *str, int str_len, char *dn, int dn_len);
36int dns_dn_label_to_str(const char *dn, int dn_len, char *str, int str_len);
37
Baptiste Assmann325137d2015-04-13 23:40:55 +020038int dns_hostname_validation(const char *string, char **err);
Baptiste Assmannfb7091e2017-05-03 15:43:12 +020039int dns_get_ip_from_response(struct dns_response_packet *dns_p,
Baptiste Assmann42746372017-05-03 12:12:02 +020040 struct dns_options *dns_opts, void *currentip,
Thierry Fournierada34842016-02-17 21:25:09 +010041 short currentip_sin_family,
Baptiste Assmannfb7091e2017-05-03 15:43:12 +020042 void **newip, short *newip_sin_family,
43 void *owner);
Baptiste Assmann201c07f2017-05-22 15:17:15 +020044
Olivier Houchard55dcdf42017-11-06 15:15:04 +010045int dns_link_resolution(void *requester, int requester_type, int requester_locked);
Christopher Faulet67957bd2017-09-27 11:00:59 +020046void dns_unlink_resolution(struct dns_requester *requester);
47void dns_trigger_resolution(struct dns_requester *requester);
Baptiste Assmann333939c2019-01-21 08:34:50 +010048enum act_parse_ret dns_parse_do_resolve(const char **args, int *orig_arg, struct proxy *px, struct act_rule *rule, char **err);
49int check_action_do_resolve(struct act_rule *rule, struct proxy *px, char **err);
Baptiste Assmann201c07f2017-05-22 15:17:15 +020050
Baptiste Assmann325137d2015-04-13 23:40:55 +020051
52#endif // _PROTO_DNS_H