"Fossies" - the Fresh Open Source Software Archive

Member "libspf2-1.2.10/src/libspf2/spf_strerror.c" (28 Jan 2012, 3401 Bytes) of package /linux/privat/libspf2-1.2.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "spf_strerror.c" see the Fossies "Dox" file reference documentation.

    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 #include "spf_sys_config.h"
   17 
   18 
   19 
   20 #ifdef STDC_HEADERS
   21 # include <stdio.h>        /* stdin / stdout */
   22 # include <stdlib.h>       /* malloc / free */
   23 #endif
   24 
   25 #ifdef HAVE_INTTYPES_H
   26 #include <inttypes.h>
   27 #endif
   28 
   29 #include "spf.h"
   30 
   31 
   32 const char *
   33 SPF_strerror( SPF_errcode_t spf_c_err )
   34 {
   35     switch ( spf_c_err )
   36     {
   37     case SPF_E_SUCCESS:
   38     return "No errors";
   39     break;
   40 
   41     case SPF_E_NO_MEMORY:
   42     return "Out of memory";
   43     break;
   44 
   45     case SPF_E_NOT_SPF:
   46     return "Could not find a valid SPF record";
   47     break;
   48 
   49     case SPF_E_SYNTAX:
   50     return "Syntax error";
   51     break;
   52 
   53     case SPF_E_MOD_W_PREF:
   54     return "Modifiers can not have prefixes";
   55     break;
   56 
   57     case SPF_E_INVALID_CHAR:
   58     return "Invalid character found";
   59     break;
   60         
   61     case SPF_E_UNKNOWN_MECH:
   62     return "Unknown mechanism found";
   63     break;
   64         
   65     case SPF_E_INVALID_OPT:
   66     return "Invalid option found";
   67     break;
   68         
   69     case SPF_E_INVALID_CIDR:
   70     return "Invalid CIDR length";
   71     break;
   72         
   73     case SPF_E_MISSING_OPT:
   74     return "Required option is missing";
   75     break;
   76 
   77     case SPF_E_INTERNAL_ERROR:
   78     return "Internal programming error";
   79     break;
   80 
   81     case SPF_E_INVALID_ESC:
   82     return "Invalid %-escape character";
   83     break;
   84         
   85     case SPF_E_INVALID_VAR:
   86     return "Invalid macro variable";
   87     break;
   88         
   89     case SPF_E_BIG_SUBDOM:
   90     return "Subdomain truncation depth too large";
   91     break;
   92         
   93     case SPF_E_INVALID_DELIM:
   94     return "Invalid delimiter character";
   95     break;
   96         
   97     case SPF_E_BIG_STRING:
   98     return "Option string too long";
   99     break;
  100         
  101     case SPF_E_BIG_MECH:
  102     return "Too many mechanisms";
  103     break;
  104         
  105     case SPF_E_BIG_MOD:
  106     return "Too many modifiers";
  107     break;
  108         
  109     case SPF_E_BIG_DNS:
  110     return "Mechanisms used too many DNS lookups";
  111     break;
  112         
  113     case SPF_E_INVALID_IP4:
  114     return "Invalid IPv4 address literal";
  115     break;
  116         
  117     case SPF_E_INVALID_IP6:
  118     return "Invalid IPv6 address literal";
  119     break;
  120         
  121     case SPF_E_INVALID_PREFIX:
  122     return "Invalid mechanism prefix";
  123     break;
  124         
  125     case SPF_E_RESULT_UNKNOWN:
  126     return "SPF result is \"unknown\"";
  127     break;
  128         
  129     case SPF_E_UNINIT_VAR:
  130     return "Uninitialized variable";
  131     break;
  132         
  133     case SPF_E_MOD_NOT_FOUND:
  134     return "Modifier not found";
  135     break;
  136         
  137     case SPF_E_NOT_CONFIG:
  138     return "Not configured";
  139     break;
  140         
  141     case SPF_E_DNS_ERROR:
  142     return "DNS lookup failure";
  143     break;
  144         
  145     case SPF_E_BAD_HOST_IP:
  146     return "Invalid hostname (possibly an IP address?)";
  147     break;
  148         
  149     case SPF_E_BAD_HOST_TLD:
  150     return "Hostname has a missing or invalid TLD";
  151     break;
  152         
  153     case SPF_E_MECH_AFTER_ALL:
  154     return "Mechanisms found after the \"all:\" mechanism will be ignored";
  155     break;
  156 
  157     case SPF_E_INCLUDE_RETURNED_NONE:
  158     return "include: mechanism returned 'none'";
  159     break;
  160 
  161     case SPF_E_RECURSIVE:
  162     return "include: or redirect= caused unlimited recursion";
  163     break;
  164 
  165     case SPF_E_MULTIPLE_RECORDS:
  166     return "Multiple SPF or TXT records for domain.";
  167     break;
  168 
  169     default:
  170     return "Unknown SPF error code";
  171     break;
  172     }
  173 
  174     return 0;
  175 }