Back to index

opendkim  2.6.4
opendkim-ar.h
Go to the documentation of this file.
00001 /*
00002 **  Copyright (c) 2007-2009 Sendmail, Inc. and its suppliers.
00003 **     All rights reserved.
00004 **
00005 **  Copyright (c) 2009, 2012, The OpenDKIM Project.  All rights reserved.
00006 **
00007 **  $Id: opendkim-ar.h,v 1.1 2009/07/16 20:59:11 cm-msk Exp $
00008 */
00009 
00010 #ifndef _OPENDKIM_AR_H_
00011 #define _OPENDKIM_AR_H_
00012 
00013 #ifndef lint
00014 static char opendkim_ar_h_id[] = "@(#)$Id: opendkim-ar.h,v 1.1 2009/07/16 20:59:11 cm-msk Exp $";
00015 #endif /* !lint */
00016 
00017 /* system includes */
00018 #include <sys/types.h>
00019 
00020 /* opendkim includes */
00021 #include "opendkim.h"
00022 
00023 /* limits */
00024 #define       MAXARESULTS   16
00025 #define       MAXPROPS      16
00026 #define       MAXAVALUE     256
00027 
00028 /* ARES_METHOD_T -- type for specifying an authentication method */
00029 typedef int ares_method_t;
00030 
00031 #define       ARES_METHOD_UNKNOWN  (-1)
00032 #define       ARES_METHOD_AUTH     0
00033 #define       ARES_METHOD_DKIM     1
00034 #define       ARES_METHOD_DOMAINKEYS      2
00035 #define       ARES_METHOD_SENDERID 3
00036 #define       ARES_METHOD_SPF             4
00037 #define       ARES_METHOD_DKIMADSP 5
00038 #define       ARES_METHOD_IPREV    6
00039 #define       ARES_METHOD_DKIMATPS 7
00040 
00041 /* ARES_RESULT_T -- type for specifying an authentication result */
00042 typedef int ares_result_t;
00043 
00044 #define       ARES_RESULT_UNDEFINED       (-1)
00045 #define       ARES_RESULT_PASS     0
00046 #define       ARES_RESULT_UNASSIGNED      1      /* UNASSIGNED */
00047 #define       ARES_RESULT_SOFTFAIL 2
00048 #define       ARES_RESULT_NEUTRAL  3
00049 #define       ARES_RESULT_TEMPERROR       4
00050 #define       ARES_RESULT_PERMERROR       5
00051 #define       ARES_RESULT_NONE     6
00052 #define ARES_RESULT_FAIL    7
00053 #define ARES_RESULT_POLICY  8
00054 #define ARES_RESULT_NXDOMAIN       9
00055 #define ARES_RESULT_SIGNED  10
00056 #define ARES_RESULT_UNKNOWN 11
00057 #define ARES_RESULT_DISCARD 12
00058 
00059 /* ARES_PTYPE_T -- type for specifying an authentication property */
00060 typedef int ares_ptype_t;
00061 
00062 #define       ARES_PTYPE_UNKNOWN   (-1)
00063 #define       ARES_PTYPE_SMTP             0
00064 #define       ARES_PTYPE_HEADER    1
00065 #define       ARES_PTYPE_BODY             2
00066 #define       ARES_PTYPE_POLICY    3
00067 
00068 /* RESULT structure -- a single result */
00069 struct result
00070 {
00071        int           result_props;
00072        ares_method_t result_method;
00073        ares_result_t result_result;
00074        ares_ptype_t  result_ptype[MAXPROPS];
00075        unsigned char result_reason[MAXAVALUE + 1];
00076        unsigned char result_property[MAXPROPS][MAXAVALUE + 1];
00077        unsigned char result_value[MAXPROPS][MAXAVALUE + 1];
00078 };
00079 
00080 /* AUTHRES structure -- the entire header parsed */
00081 struct authres
00082 {
00083        int           ares_count;
00084        unsigned char ares_host[DKIM_MAXHOSTNAMELEN + 1];
00085        unsigned char ares_version[MAXAVALUE + 1];
00086        struct result ares_result[MAXARESULTS];
00087 };
00088 
00089 /*
00090 **  ARES_PARSE -- parse an Authentication-Results: header, return a
00091 **                structure containing a parsed result
00092 **
00093 **  Parameters:
00094 **     hdr -- NULL-terminated contents of an Authentication-Results:
00095 **            header field
00096 **     ar -- a pointer to a (struct authres) loaded by values after parsing
00097 **  
00098 **  Return value:
00099 **     0 on success, -1 on failure.
00100 */
00101 
00102 extern int ares_parse __P((u_char *hdr, struct authres *ar));
00103 
00104 #endif /* _OPENDKIM_AR_H_ */