Back to index

opendkim  2.6.2
dkim-internal.h
Go to the documentation of this file.
00001 /*
00002 **  Copyright (c) 2009, 2012, The OpenDKIM Project.  All rights reserved.
00003 */
00004 
00005 #ifndef _DKIM_INTERNAL_H_
00006 #define _DKIM_INTERNAL_H_
00007 
00008 #ifndef lint
00009 static char dkim_internal_h_id[] = "@(#)$Id: dkim-internal.h,v 1.4 2009/12/24 07:54:47 cm-msk Exp $";
00010 #endif /* !lint */
00011 
00012 /* libopendkim includes */
00013 #include "dkim.h"
00014 
00015 /* the basics */
00016 #ifndef NULL
00017 # define NULL 0
00018 #endif /* ! NULL */
00019 #ifndef FALSE
00020 # define FALSE       0
00021 #endif /* ! FALSE */
00022 #ifndef TRUE
00023 # define TRUE 1
00024 #endif /* ! TRUE */
00025 #ifndef MAXPATHLEN
00026 # define MAXPATHLEN         256
00027 #endif /* ! MAXPATHLEN */
00028 
00029 #ifndef ULONG_MAX
00030 # define ULONG_MAX          0xffffffffL
00031 #endif /* ! ULONG_MAX */
00032 #ifndef ULLONG_MAX
00033 # define ULLONG_MAX         0xffffffffffffffffLL
00034 #endif /* ! ULLONG_MAX */
00035 
00036 #ifndef MIN
00037 # define MIN(x,y)           ((x) < (y) ? (x) : (y))
00038 #endif /* ! MIN */
00039 #ifndef MAX
00040 # define MAX(x,y)           ((x) > (y) ? (x) : (y))
00041 #endif /* ! MAX */
00042 
00043 #ifdef __STDC__
00044 # ifndef __P
00045 #  define __P(x)  x
00046 # endif /* ! __P */
00047 #else /* __STDC__ */
00048 # ifndef __P
00049 #  define __P(x)  ()
00050 # endif /* ! __P */
00051 #endif /* __STDC__ */
00052 
00053 /* limits, macros, etc. */
00054 #define       BUFRSZ               1024   /* base temp buffer size */
00055 #define       BASE64SIZE(x)        (((x + 2) / 3) * 4)
00056                                    /* base64 encoding growth ratio */
00057 #define MAXADDRESS          256    /* biggest user@host we accept */
00058 #define       MAXBUFRSZ            65536  /* max temp buffer size */
00059 #define MAXCNAMEDEPTH              3      /* max. CNAME recursion we allow */
00060 #define MAXHEADERS          32768  /* buffer for caching headers */
00061 #define MAXLABELS           16     /* max. labels we allow */
00062 #define MAXPOLICYDEPTH             1      /* policy recursion we allow */
00063 #define MAXTAGNAME          8      /* biggest tag name */
00064 
00065 #define       NPRINTABLE           95     /* number of printable characters */
00066 
00067 #define DKIM_MAXHEADER             4096   /* buffer for caching one header */
00068 #define       DKIM_MAXHOSTNAMELEN  256    /* max. FQDN we support */
00069 
00070 /* defaults */
00071 #define       DEFERRLEN            64     /* default error string length */
00072 #define       DEFTMPDIR            "/var/tmp"
00073                                    /* default temporary directory */
00074 
00075 /* version */
00076 #define       DKIM_VERSION_KEY     "DKIM1"       /* current version token for keys */
00077 #define       DKIM_VERSION_SIG     "1"    /* current version token for sigs */
00078 #define       DKIM_VERSION_SIGOLD  "0.5"  /* old version token for sigs */
00079 
00080 /* headers */
00081 #define       DKIM_DATEHEADER             "Date" /* Date: header */
00082 #define       DKIM_FROMHEADER             "From" /* From: header */
00083 
00084 #define       DKIM_DATEHEADER_LEN  (sizeof(DKIM_DATEHEADER) - 1)
00085 #define       DKIM_FROMHEADER_LEN  (sizeof(DKIM_FROMHEADER) - 1)
00086 #define       DKIM_SIGNHEADER_LEN  (sizeof(DKIM_SIGNHEADER) - 1)
00087 /*
00088 **  DKIM_KEY -- known key parameters
00089 */
00090 
00091 typedef int dkim_key_t;
00092 
00093 #define       DKIM_KEY_VERSION     0      /* v */
00094 #define       DKIM_KEY_GRANULARITY 1      /* g */
00095 #define       DKIM_KEY_ALGORITHM   2      /* a */
00096 #define       DKIM_KEY_NOTES              3      /* n */
00097 #define       DKIM_KEY_DATA        4      /* p */
00098 #define       DKIM_KEY_SERVICE     5      /* s */
00099 #define       DKIM_KEY_FLAGS              6      /* t */
00100 
00101 /*
00102 **  DKIM_PPARAM -- policy parameters
00103 */
00104 
00105 typedef int dkim_pparam_t;
00106 
00107 #define DKIM_PPARAM_POLICY  0      /* dkim */
00108 #define DKIM_PPARAM_FLAGS   1      /* t */
00109 #define DKIM_PPARAM_REPORTADDR     2      /* r */
00110 #define DKIM_PPARAM_ATPS    3      /* atps */
00111 
00112 /*
00113 **  DKIM_SETTYPE -- types of sets
00114 */
00115 
00116 typedef int dkim_set_t;
00117 
00118 #define       DKIM_SETTYPE_ANY     (-1)
00119 #define       DKIM_SETTYPE_SIGNATURE      0
00120 #define       DKIM_SETTYPE_POLICY  1
00121 #define       DKIM_SETTYPE_KEY     2
00122 #define DKIM_SETTYPE_SIGREPORT     3
00123 
00124 /*
00125 **  DKIM_HASHTYPE -- types of hashes
00126 */
00127 
00128 #define DKIM_HASHTYPE_UNKNOWN      (-1)
00129 #define DKIM_HASHTYPE_SHA1  0
00130 #define DKIM_HASHTYPE_SHA256       1
00131 
00132 /*
00133 **  DKIM_KEYTYPE -- types of keys
00134 */
00135 
00136 #define       DKIM_KEYTYPE_UNKNOWN (-1)
00137 #define       DKIM_KEYTYPE_RSA     0
00138 
00139 /*
00140 **  DKIM_SET -- a set of parameters and values
00141 */
00142 
00143 struct dkim_set;
00144 typedef struct dkim_set DKIM_SET;
00145 
00146 /*
00147 **  DKIM_PLIST -- a parameter/value pair, as a linked list
00148 */
00149 
00150 struct dkim_plist;
00151 typedef struct dkim_plist DKIM_PLIST;
00152 
00153 /*
00154 **  DKIM_KEY -- contents of a published key record
00155 */
00156 
00157 struct dkim_key;
00158 typedef struct dkim_key DKIM_KEY;
00159 
00160 /*
00161 **  DKIM_POLICY -- contents of a published policy record
00162 */
00163 
00164 struct dkim_policy;
00165 typedef struct dkim_policy DKIM_POLICY;
00166 
00167 /*
00168 **  DKIM_CANON -- canonicalization
00169 */
00170 
00171 struct dkim_canon;
00172 typedef struct dkim_canon DKIM_CANON;
00173 
00174 /* prototypes */
00175 extern DKIM_STAT dkim_process_set __P((DKIM *, dkim_set_t, u_char *, size_t,
00176                                        void *, _Bool, const char *));
00177 extern DKIM_STAT dkim_siglist_setup __P((DKIM *));
00178 
00179 #endif /* ! _DKIM_INTERNAL_H_ */