Back to index

opendkim  2.6.6
opendkim-arf.c
Go to the documentation of this file.
00001 /*
00002 **  Copyright (c) 2008 Sendmail, Inc. and its suppliers.
00003 **     All rights reserved.
00004 **
00005 **  Copyright (c) 2009, 2011, The OpenDKIM Project.  All rights reserved.
00006 **
00007 **  $Id: opendkim-arf.c,v 1.1 2009/07/16 20:59:11 cm-msk Exp $
00008 */
00009 
00010 #ifndef lint
00011 static char opendkim_arf_c_id[] = "@(#)$Id: opendkim-arf.c,v 1.1 2009/07/16 20:59:11 cm-msk Exp $";
00012 #endif /* !lint */
00013 
00014 /* system includes */
00015 #include <sys/types.h>
00016 #include <sys/param.h>
00017 #include <ctype.h>
00018 #include <assert.h>
00019 #include <string.h>
00020 
00021 /* opendkim includes */
00022 #include "opendkim-arf.h"
00023 
00024 /*
00025 **  ARF_TYPE_STRING -- translate an ARF_TYPE_* constant to a string
00026 **
00027 **  Parameters:
00028 **     type -- an ARF_TYPE_* constant
00029 **
00030 **  Return value:
00031 **     A string describing the "type" provided.
00032 */
00033 
00034 char *
00035 arf_type_string(int type)
00036 {
00037        switch (type)
00038        {
00039          case ARF_TYPE_ABUSE:
00040               return "abuse";
00041 
00042          case ARF_TYPE_FRAUD:
00043               return "fraud";
00044 
00045          case ARF_TYPE_VIRUS:
00046               return "virus";
00047 
00048          case ARF_TYPE_AUTHFAIL:
00049               return "auth-failure";
00050 
00051          case ARF_TYPE_UNKNOWN:
00052          case ARF_TYPE_OTHER:
00053          default:
00054               return "other";
00055        }
00056 }
00057 
00058 /*
00059 **  ARF_DKIM_FAILURE_STRING -- return an appropriate DKIM-Failure: string for
00060 **                             an ARF report
00061 **
00062 **  Parameters:
00063 **     ftype -- failure type, i.e. an ARF_DKIMF_* constant
00064 **
00065 **  Return value:
00066 **     A string describing the "ftype" provided.
00067 */
00068 
00069 char *
00070 arf_dkim_failure_string(int ftype)
00071 {
00072        switch (ftype)
00073        {
00074          case ARF_DKIMF_BODYHASH:
00075               return "bodyhash";
00076 
00077          case ARF_DKIMF_REVOKED:
00078               return "revoked";
00079 
00080          case ARF_DKIMF_SIGNATURE:
00081               return "signature";
00082 
00083          case ARF_DKIMF_SYNTAX:
00084               return "syntax";
00085 
00086          case ARF_DKIMF_OTHER:
00087          default:
00088               return "other";
00089        }
00090 }