main.h

Go to the documentation of this file.
00001 /* libspf - Sender Policy Framework library 00002 * 00003 * ANSI C implementation of draft-mengwong-spf-02.9.7.txt 00004 * 00005 * Author: James Couzens <jcouzens@6o4.ca> 00006 * Author: Sean Comeau <scomeau@obscurity.org> 00007 * 00008 * FILE: spf.h 00009 * DESC: main library header file 00010 * 00011 * License: 00012 * 00013 * The libspf Software License, Version 1.0 00014 * 00015 * Copyright (c) 2004 James Couzens & Sean Comeau All rights 00016 * reserved. 00017 * 00018 * Redistribution and use in source and binary forms, with or without 00019 * modification, are permitted provided that the following conditions 00020 * are met: 00021 * 00022 * 1. Redistributions of source code must retain the above copyright 00023 * notice, this list of conditions and the following disclaimer. 00024 * 00025 * 2. Redistributions in binary form must reproduce the above copyright 00026 * notice, this list of conditions and the following disclaimer in 00027 * the documentation and/or other materials provided with the 00028 * distribution. 00029 * 00030 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 00031 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00032 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00033 * DISCLAIMED. IN NO EVENT SHALL THE AUTHORS MAKING USE OF THIS LICESEN 00034 * OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00035 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00036 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 00037 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00038 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00039 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00040 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00041 * SUCH DAMAGE. 00042 * 00043 */ 00044 00045 00046 #ifndef _MAIN_H 00047 #define _MAIN_H 1 00048 00049 #include <stdio.h> /* stdin / stdout */ 00050 #include <stdlib.h> /* malloc / free */ 00051 #include <string.h> /* strstr / strdup */ 00052 #include <stdarg.h> /* va_snprintf */ 00053 00054 #include "spf.h" 00055 00056 __BEGIN_DECLS 00057 00058 #define FL_A 2 /* normal debugging */ 00059 #define FL_B 4 /* verbose debugging */ 00060 #define FL_C 8 /* normal and verbose debugging */ 00061 #define FL_D 16 /* profile results */ 00062 #define FL_E 32 /* normal debug + profile results */ 00063 #define FL_F 64 /* verbose debug + profile results */ 00064 #define FL_G 128 /* normal + verbose + profile results */ 00065 00066 /* # limiting recursion */ 00067 #define SPF_RECURSE 20 00068 00069 /* spf MTA result strings */ 00070 #define RES_PASS "domain of %s designates %s as permitted sender\r\n" 00071 #define RES_NONE "domain of %s does not designate permitted sender " \ 00072 "hosts\r\n" 00073 #define RES_S_FAIL "transitioning domain of %s does not designate %s " \ 00074 "as permitted sender\r\n" 00075 #define RES_H_FAIL "domain of %s does not designate %s as permitted " \ 00076 "sender\r\n" 00077 #define RES_ERROR "encountered temporary error during SPF processing " \ 00078 "of %s\r\n" 00079 #define RES_NEUTRAL "%s is neither permitted nor denied by domain of " \ 00080 "%s\r\n" 00081 #define RES_UNKNOWN "error in processing during lookup of %s\r\n" 00082 #define RES_UNMECH "encountered unrecognized mechanism during SPF " \ 00083 "processing of domain of %s\r\n" 00084 00085 /* header strings */ 00086 #define HDR_PASS "pass (%s: domain of %s designates " \ 00087 "%s as permitted sender) receiver=%s; client_ip=%s; " \ 00088 "envelope-from=%s;" 00089 00090 #define HDR_NONE "none (%s: domain of %s does not " \ 00091 "designate permitted sender hosts)" 00092 00093 #define HDR_S_FAIL "softfail (%s: domain of " \ 00094 "transitioning %s does not designate %s as " \ 00095 "permitted sender) receiver=%s; client_ip=%s; " \ 00096 "envelope-from=%s;" 00097 00098 #define HDR_H_FAIL "fail (%s: domain of %s does not " \ 00099 "designate %s as permitted sender) receiver=%s; " \ 00100 "client_ip=%s; envelope-from=%s;" 00101 00102 #define HDR_ERROR "error (%s: error in processing " \ 00103 "during lookup of %s: %s)" 00104 00105 #define HDR_NEUTRAL "neutral (%s: domain of %s is " \ 00106 "neutral about designating %s as permitted sender)" 00107 00108 #define HDR_UNKNOWN "unknown (%s: domain of %s " \ 00109 "encountered an error while parsing (check SPF " \ 00110 "record %s for errors))" 00111 00112 #define HDR_UNMECH "unknown -extension:%s (%s: domain of " \ 00113 "%s uses a mechanism not recognized by this client)" 00114 00115 /* Main library functions (spf.c) */ 00116 void SPF_dbg_level(int level); 00117 peer_info_t *SPF_init(const char *local, const char *rip, const char *expl, 00118 const char *tf, const char *guess, u_int32_t use_trust, 00119 u_int32_t use_guess); 00120 peer_info_t *SPF_close(peer_info_t *peer_info); 00121 SPF_RESULT SPF_policy_main(peer_info_t *peer_info); 00122 SPF_BOOL SPF_parse_policy(peer_info_t *peer_info, const char *policy); 00123 char *SPF_result(peer_info_t *peer_info); 00124 00125 SPF_BOOL SPF_smtp_from(peer_info_t *peer_info, const char *s); 00126 SPF_BOOL SPF_smtp_helo(peer_info_t *peer_info, const char *s); 00127 00128 char *SPF_build_header(peer_info_t *peer_info); 00129 char *SPF_get_explain(peer_info_t *peer_info); 00130 00131 __END_DECLS /* _MAIN_H */ 00132 00133 #endif /* main.h */

Generated on Thu Jul 1 14:05:44 2004 for libspf v1.0 by doxygen 1.3.7