Baptiste Assmann | 325137d | 2015-04-13 23:40:55 +0200 | [diff] [blame] | 1 | /* |
| 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 | |
| 25 | #include <types/dns.h> |
| 26 | #include <types/proto_udp.h> |
| 27 | |
Willy Tarreau | 2100b49 | 2015-07-22 16:42:43 +0200 | [diff] [blame] | 28 | char *dns_str_to_dn_label(const char *string, char *dn, int dn_len); |
Baptiste Assmann | 325137d | 2015-04-13 23:40:55 +0200 | [diff] [blame] | 29 | int dns_str_to_dn_label_len(const char *string); |
| 30 | int dns_hostname_validation(const char *string, char **err); |
| 31 | int dns_build_query(int query_id, int query_type, char *hostname_dn, int hostname_dn_len, char *buf, int bufsize); |
| 32 | struct task *dns_process_resolve(struct task *t); |
| 33 | int dns_init_resolvers(void); |
| 34 | uint16_t dns_rnd16(void); |
| 35 | int dns_validate_dns_response(unsigned char *resp, unsigned char *bufend, char *dn_name, int dn_name_len); |
| 36 | int dns_get_ip_from_response(unsigned char *resp, unsigned char *resp_end, |
| 37 | char *dn_name, int dn_name_len, void *currentip, |
| 38 | short currentip_sin_family, int family_priority, |
| 39 | void **newip, short *newip_sin_family); |
| 40 | void dns_resolve_send(struct dgram_conn *dgram); |
| 41 | void dns_resolve_recv(struct dgram_conn *dgram); |
| 42 | int dns_send_query(struct dns_resolution *resolution); |
| 43 | void dns_print_current_resolutions(struct dns_resolvers *resolvers); |
| 44 | void dns_update_resolvers_timeout(struct dns_resolvers *resolvers); |
| 45 | void dns_reset_resolution(struct dns_resolution *resolution); |
| 46 | int dns_check_resolution_queue(struct dns_resolvers *resolvers); |
| 47 | int dns_response_get_query_id(unsigned char *resp); |
| 48 | |
| 49 | #endif // _PROTO_DNS_H |