1 /* 2 * This program is free software; you can redistribute it and/or modify 3 * it under the terms of either: 4 * 5 * a) The GNU Lesser General Public License as published by the Free 6 * Software Foundation; either version 2.1, or (at your option) any 7 * later version, 8 * 9 * OR 10 * 11 * b) The two-clause BSD license. 12 * 13 * These licenses can be found with the distribution in the file LICENSES 14 */ 15 16 #ifndef __GNUC__ 17 #define __attribute__(x) 18 #endif 19 20 21 #ifndef INC_SPF 22 #define INC_SPF 23 24 25 #include "spf_lib_version.h" 26 27 #include "spf_server.h" 28 #include "spf_request.h" 29 #include "spf_response.h" 30 #include "spf_dns.h" 31 #include "spf_log.h" 32 33 34 #define SPF_VERSION 1 35 #define SPF_VER_STR "v=spf1" 36 37 38 /* ********************************************************************* */ 39 40 41 /** 42 * FYI only -- can't be changed without recompiling the library 43 * Most error messages are under 80 characters and we don't want 44 * bad/malicious input to cause huge error messages. 45 */ 46 #define SPF_C_ERR_MSG_SIZE (2*80) 47 #define SPF_SMTP_COMMENT_SIZE (4*80) 48 #define SPF_RECEIVED_SPF_SIZE (6*80) 49 #define SPF_SYSLOG_SIZE (10*80) 50 51 52 53 54 /* ********************************************************************* */ 55 56 /** 57 * FYI only -- can't be changed without recompiling the library 58 */ 59 #define SPF_DEFAULT_MAX_DNS_MECH 10 /**< DoS limit on SPF mechanisms.*/ 60 #define SPF_DEFAULT_MAX_DNS_PTR 10 /**< DoS limit on PTR records. */ 61 #define SPF_DEFAULT_MAX_DNS_MX 10 /**< DoS limit on MX records. */ 62 #define SPF_DEFAULT_SANITIZE 1 63 #define SPF_DEFAULT_WHITELIST "include:spf.trusted-forwarder.org" 64 #define SPF_EXP_MOD_NAME "exp-text" 65 /** The default SPF explanation, if no other is provided in the 66 * SPF_server_t object. */ 67 #define SPF_DEFAULT_EXP "Please%_see%_http://www.openspf.org/Why?id=%{S}&ip=%{C}&receiver=%{R}" 68 69 70 71 /* ********************************************************************* */ 72 73 /** SPF_strerror() translates the SPF error number into a readable string */ 74 const char *SPF_strerror( SPF_errcode_t spf_err ); 75 76 77 /** SPF_strresult() translates the SPF result number into a readable string */ 78 const char *SPF_strresult( SPF_result_t result ); 79 /** SPF_strreason() translates the SPF reason number into a readable string */ 80 const char *SPF_strreason( SPF_reason_t reason ); 81 82 /** 83 * Returns the version information library. Useful if the library 84 * is a shared library and may differ from when the application 85 * was compiled. 86 */ 87 void SPF_get_lib_version( int *major, int *minor, int *patch ); 88 89 const char *SPF_strrrtype(ns_type rr_type); 90 91 #endif 92