/*
 * $Id: 85f667fbe0fb02414f347142bc6b67d67d3f10c9 $
 *
 * 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_SPF_H
#define HAD_LIBNSMTP_SPF_H

#include "smtp.h"

typedef struct spf_info {
	int version;
	char **net;
	char *qual;
	char def;
	/*
	 * NOTE:  The only reason we really need both the following is because of
	 *        people stupid enough to build direct circular references
	 *        into their SPF records.
	 *
	 * See:  acd.net descriptive text "v=spf1 ip4:207.179.118.0/27 ip4:207.179.71.5 mx include:qtm.net include:ia4u.net ~all"
	 *       qtm.net descriptive text "v=spf1 ip4:207.179.118.0/27 mx include:acd.net include:ia4u.net ~all"
	 *
	 * Awesome!
	 */
	char **seen;
	int seencount;
} SPF_INFO;

SPF_INFO *init_spf(void);
void destroy_spf(SPF_INFO *);
int parse_spf(SPF_INFO **, const char *, const char *);
int get_spf(SPF_INFO **, const char *);
int check_spf(SPF_INFO *, const char *, const char *);
int check_spf_mail_from(SMTP_CTX *, const char *);

#endif
