spf_strerror.c

Go to the documentation of this file.
00001 /* 
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of either:
00004  * 
00005  *   a) The GNU Lesser General Public License as published by the Free
00006  *      Software Foundation; either version 2.1, or (at your option) any
00007  *      later version,
00008  * 
00009  *   OR
00010  * 
00011  *   b) The two-clause BSD license.
00012  *
00013  * These licenses can be found with the distribution in the file LICENSES
00014  */
00015 
00016 #include "spf_sys_config.h"
00017 
00018 
00019 
00020 #ifdef STDC_HEADERS
00021 # include <stdio.h>        /* stdin / stdout */
00022 # include <stdlib.h>       /* malloc / free */
00023 #endif
00024 
00025 #ifdef HAVE_INTTYPES_H
00026 #include <inttypes.h>
00027 #endif
00028 
00029 #include "spf.h"
00030 
00031 
00032 const char *
00033 SPF_strerror( SPF_errcode_t spf_c_err )
00034 {
00035     switch ( spf_c_err )
00036     {
00037     case SPF_E_SUCCESS:
00038         return "No errors";
00039         break;
00040 
00041     case SPF_E_NO_MEMORY:
00042         return "Out of memory";
00043         break;
00044 
00045     case SPF_E_NOT_SPF:
00046         return "Could not find a valid SPF record";
00047         break;
00048 
00049     case SPF_E_SYNTAX:
00050         return "Syntax error";
00051         break;
00052 
00053     case SPF_E_MOD_W_PREF:
00054         return "Modifiers can not have prefixes";
00055         break;
00056 
00057     case SPF_E_INVALID_CHAR:
00058         return "Invalid character found";
00059         break;
00060             
00061     case SPF_E_UNKNOWN_MECH:
00062         return "Unknown mechanism found";
00063         break;
00064             
00065     case SPF_E_INVALID_OPT:
00066         return "Invalid option found";
00067         break;
00068             
00069     case SPF_E_INVALID_CIDR:
00070         return "Invalid CIDR length";
00071         break;
00072             
00073     case SPF_E_MISSING_OPT:
00074         return "Required option is missing";
00075         break;
00076 
00077     case SPF_E_INTERNAL_ERROR:
00078         return "Internal programming error";
00079         break;
00080 
00081     case SPF_E_INVALID_ESC:
00082         return "Invalid %-escape character";
00083         break;
00084             
00085     case SPF_E_INVALID_VAR:
00086         return "Invalid macro variable";
00087         break;
00088             
00089     case SPF_E_BIG_SUBDOM:
00090         return "Subdomain truncation depth too large";
00091         break;
00092             
00093     case SPF_E_INVALID_DELIM:
00094         return "Invalid delimiter character";
00095         break;
00096             
00097     case SPF_E_BIG_STRING:
00098         return "Option string too long";
00099         break;
00100             
00101     case SPF_E_BIG_MECH:
00102         return "Too many mechanisms";
00103         break;
00104             
00105     case SPF_E_BIG_MOD:
00106         return "Too many modifiers";
00107         break;
00108             
00109     case SPF_E_BIG_DNS:
00110         return "Mechanisms used too many DNS lookups";
00111         break;
00112             
00113     case SPF_E_INVALID_IP4:
00114         return "Invalid IPv4 address literal";
00115         break;
00116             
00117     case SPF_E_INVALID_IP6:
00118         return "Invalid IPv6 address literal";
00119         break;
00120             
00121     case SPF_E_INVALID_PREFIX:
00122         return "Invalid mechanism prefix";
00123         break;
00124             
00125     case SPF_E_RESULT_UNKNOWN:
00126         return "SPF result is \"unknown\"";
00127         break;
00128             
00129     case SPF_E_UNINIT_VAR:
00130         return "Uninitialized variable";
00131         break;
00132             
00133     case SPF_E_MOD_NOT_FOUND:
00134         return "Modifier not found";
00135         break;
00136             
00137     case SPF_E_NOT_CONFIG:
00138         return "Not configured";
00139         break;
00140             
00141     case SPF_E_DNS_ERROR:
00142         return "DNS lookup failure";
00143         break;
00144             
00145     case SPF_E_BAD_HOST_IP:
00146         return "Invalid hostname (possibly an IP address?)";
00147         break;
00148             
00149     case SPF_E_BAD_HOST_TLD:
00150         return "Hostname has a missing or invalid TLD";
00151         break;
00152             
00153     case SPF_E_MECH_AFTER_ALL:
00154         return "Mechanisms found after the \"all:\" mechanism will be ignored";
00155         break;
00156 
00157         case SPF_E_INCLUDE_RETURNED_NONE:
00158         return "include: mechanism returned 'none'";
00159         break;
00160 
00161         case SPF_E_RECURSIVE:
00162         return "include: or redirect= caused unlimited recursion";
00163         break;
00164 
00165         case SPF_E_MULTIPLE_RECORDS:
00166         return "Multiple SPF or TXT records for domain.";
00167         break;
00168 
00169     default:
00170         return "Unknown SPF error code";
00171         break;
00172     }
00173 
00174     return 0;
00175 }

Generated on Tue Nov 4 13:27:39 2008 for libspf2 by  doxygen 1.5.4