/*
 * $Id: d05fcee7e86b4af801bd3ba814bb92f7562e67d1 $
 *
 * This file is part of nsmtp.
 *
 * Copyright (c) 2007, 2008 Niklas Olmes <niklas@noxa.de>
 *                          http://www.nevm.de/nsmtp/
 *                          NEVM-RIPE
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License Version 2
 * as published by the Free Software Foundation.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 */

#ifndef HAD_LIBNSMTP_DNS_H
#define HAD_LIBNSMTP_DNS_H

#include <netinet/in.h>
#include <sys/socket.h>
#include <netdb.h>

#include "smtp.h"

struct clinfo {
	char name[256];
	char ip[64];
};

typedef struct dns_entry {
	uint16_t type;
	uint16_t class;
	uint32_t ttl;
	uint16_t length;
	uint16_t pref;
	char data[2048];
	char print[2048];
} DNS_ENTRY;

in_addr_t resolve(const char *);
char *resolve_to_a(const char *);
struct clinfo *identify(const struct sockaddr *, socklen_t);
char *ip_to_a(in_addr_t);
DNS_ENTRY **get_mx_for_domain(const char *);
DNS_ENTRY **get_a_for_domain(const char *);
DNS_ENTRY **get_txt_for_domain(const char *);
const char *get_next_mx(const char *);
void dns_entry_free(DNS_ENTRY **);

#endif
