2015-04-13 21:40:55 +00:00
|
|
|
/*
|
|
|
|
* include/proto/dns.h
|
|
|
|
* This file provides functions related to DNS protocol
|
|
|
|
*
|
|
|
|
* Copyright (C) 2014 Baptiste Assmann <bedis9@gmail.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation, version 2.1
|
|
|
|
* exclusively.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _PROTO_DNS_H
|
|
|
|
#define _PROTO_DNS_H
|
|
|
|
|
|
|
|
#include <types/dns.h>
|
|
|
|
#include <types/proto_udp.h>
|
|
|
|
|
2015-07-22 14:42:43 +00:00
|
|
|
char *dns_str_to_dn_label(const char *string, char *dn, int dn_len);
|
2015-04-13 21:40:55 +00:00
|
|
|
int dns_str_to_dn_label_len(const char *string);
|
|
|
|
int dns_hostname_validation(const char *string, char **err);
|
|
|
|
int dns_build_query(int query_id, int query_type, char *hostname_dn, int hostname_dn_len, char *buf, int bufsize);
|
|
|
|
struct task *dns_process_resolve(struct task *t);
|
|
|
|
int dns_init_resolvers(void);
|
|
|
|
uint16_t dns_rnd16(void);
|
2016-05-14 09:26:22 +00:00
|
|
|
int dns_validate_dns_response(unsigned char *resp, unsigned char *bufend, struct dns_response_packet *dns_p);
|
|
|
|
int dns_get_ip_from_response(struct dns_response_packet *dns_p,
|
2016-02-17 20:25:09 +00:00
|
|
|
struct dns_resolution *resol, void *currentip,
|
|
|
|
short currentip_sin_family,
|
2015-04-13 21:40:55 +00:00
|
|
|
void **newip, short *newip_sin_family);
|
|
|
|
void dns_resolve_send(struct dgram_conn *dgram);
|
|
|
|
void dns_resolve_recv(struct dgram_conn *dgram);
|
|
|
|
int dns_send_query(struct dns_resolution *resolution);
|
|
|
|
void dns_print_current_resolutions(struct dns_resolvers *resolvers);
|
|
|
|
void dns_update_resolvers_timeout(struct dns_resolvers *resolvers);
|
|
|
|
void dns_reset_resolution(struct dns_resolution *resolution);
|
|
|
|
int dns_check_resolution_queue(struct dns_resolvers *resolvers);
|
2016-01-20 22:46:34 +00:00
|
|
|
unsigned short dns_response_get_query_id(unsigned char *resp);
|
2015-04-13 21:40:55 +00:00
|
|
|
|
|
|
|
#endif // _PROTO_DNS_H
|