Back to index

opendkim  2.6.2
opendkim.h
Go to the documentation of this file.
00001 /*
00002 **  Copyright (c) 2005-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.h,v 1.34.10.1 2010/10/27 21:43:09 cm-msk Exp $
00008 */
00009 
00010 #ifndef _OPENDKIM_H_
00011 #define _OPENDKIM_H_
00012 
00013 #ifndef lint
00014 static char opendkim_h_id[] = "@(#)$Id: opendkim.h,v 1.34.10.1 2010/10/27 21:43:09 cm-msk Exp $";
00015 #endif /* !lint */
00016 
00017 #define       DKIMF_PRODUCT "OpenDKIM Filter"
00018 #define       DKIMF_PRODUCTNS      "OpenDKIM-Filter"
00019 
00020 #include "build-config.h"
00021 
00022 /* system includes */
00023 #include <sys/types.h>
00024 #ifdef HAVE_STDBOOL_H
00025 # include <stdbool.h>
00026 #endif /* HAVE_STDBOOL_H */
00027 
00028 /* libmilter */
00029 #ifdef DKIMF_MILTER_PROTOTYPES
00030 # include <libmilter/mfapi.h>
00031 #endif /* DKIMF_MILTER_PROTOTYPES */
00032 
00033 /* libopendkim */
00034 #include "dkim.h"
00035 
00036 #ifdef USE_LUA
00037 # ifdef DKIMF_LUA_PROTOTYPES
00038 /* LUA */
00039 # include <lua.h>
00040 # endif /* DKIMF_LUA_PROTOTYPES */
00041 #endif /* USE_LUA */
00042 
00043 /* make sure we have TRUE and FALSE */
00044 #ifndef FALSE
00045 # define FALSE              0
00046 #endif /* !FALSE */
00047 #ifndef TRUE
00048 # define TRUE        1
00049 #endif /* !TRUE */
00050 
00051 /* defaults, limits, etc. */
00052 #define       BUFRSZ        1024
00053 #define       CACHESTATSINT 300
00054 #define       CBINTERVAL    3
00055 #define       DEFCONFFILE   CONFIG_BASE "/opendkim.conf"
00056 #define       DEFFLOWDATATTL       86400
00057 #define       DEFINTERNAL   "csl:127.0.0.1"
00058 #define       DEFMAXHDRSZ   65536
00059 #define       DEFMAXVERIFY  3
00060 #define       DEFTIMEOUT    5
00061 #define       HOSTUNKNOWN   "unknown-host"
00062 #define       JOBIDUNKNOWN  "(unknown-jobid)"
00063 #define       LOCALHOST     "127.0.0.1"
00064 #define       MAXADDRESS    256
00065 #define       MAXARGV              65536
00066 #define       MAXBUFRSZ     65536
00067 #define       MAXHDRCNT     64
00068 #define       MAXHDRLEN     78
00069 #define       MAXSIGNATURE  1024
00070 #define       MTAMARGIN     78
00071 #define       NULLDOMAIN    "(invalid)"
00072 #define       TEMPFILE      "/var/tmp/dkimXXXXXX"
00073 #define       UNKNOWN              "unknown"
00074 
00075 #define       DB_DOMAINS    1
00076 #define DB_THIRDPARTY       2
00077 #define       DB_DONTSIGNTO 3
00078 #define       DB_MTAS              4
00079 #define       DB_MACROS     5
00080 #define       DB_LOCALADSP  6
00081 #define       DB_SIGNINGTABLE      7
00082 
00083 #define DKIMF_POLICY_NONE   (-1)          /* none/undefined */
00084 #define DKIMF_POLICY_UNKNOWN       0             /* unknown */
00085 #define DKIMF_POLICY_ALL    1             /* all */
00086 #define DKIMF_POLICY_DISCARDABLE 2        /* discardable */
00087 #define DKIMF_POLICY_NXDOMAIN      3             /* domain does not exist */
00088 
00089 #define AUTHRESULTSHDR      "Authentication-Results"
00090 #define ORCPTHEADER  "X-Original-Recipient"
00091 
00092 #define       XHEADERNAME   "X-DKIM"
00093 #define       XSELECTCANONHDR      "X-Canonicalization"
00094 
00095 #ifdef _FFR_VBR
00096 # define XVBRTYPEHEADER     "X-VBR-Type"
00097 # define XVBRCERTHEADER     "X-VBR-Certifiers"
00098 #endif /* _FFR_VBR */
00099 
00100 #ifdef _FFR_ADSP_LISTS
00101 # define ADSP_DISCARDABLE_SMTP     "550"
00102 # define ADSP_DISCARDABLE_ESC      "5.7.1"
00103 # define ADSP_DISCARDABLE_TEXT     "ADSP discardable mail may not be sent to this address"
00104 #endif /* _FFR_ADSP_LISTS */
00105 
00106 /* POPAUTH db */
00107 #if POPAUTH
00108 # define POPAUTHDB   "/etc/mail/popip.db"
00109 #endif /* POPAUTH */
00110 
00111 /*
00112 **  HEADER -- a handle referring to a header
00113 */
00114 
00115 typedef struct Header * Header;
00116 struct Header
00117 {
00118        char *        hdr_hdr;
00119        char *        hdr_val;
00120        struct Header *      hdr_next;
00121        struct Header *      hdr_prev;
00122 };
00123 
00124 /*
00125 **  SIGNREQ -- signing request (for multiple signature requests)
00126 */
00127 
00128 typedef struct signreq * SIGNREQ;
00129 struct signreq
00130 {
00131        ssize_t                     srq_signlen;
00132        void *               srq_keydata;
00133        u_char *             srq_domain;
00134        u_char *             srq_selector;
00135        u_char *             srq_signer;
00136        DKIM *               srq_dkim;
00137        struct signreq *     srq_next;
00138 };
00139 
00140 #ifdef _FFR_STATSEXT
00141 /*
00142 **  STATSEXT -- statistics extension data
00143 */
00144 
00145 typedef struct statsext * statsext;
00146 struct statsext
00147 {
00148        char                 se_name[BUFRSZ];
00149        char                 se_value[BUFRSZ];
00150        struct statsext *    se_next;
00151 };
00152 #endif /* _FFR_STATSEXT */
00153 
00154 /* externs */
00155 extern _Bool dolog;
00156 extern char *progname;
00157 
00158 /* prototypes, exported for test.c */
00159 #ifdef DKIMF_MILTER_PROTOTYPES
00160 extern sfsistat mlfi_connect __P((SMFICTX *, char *, _SOCK_ADDR *));
00161 extern sfsistat mlfi_envfrom __P((SMFICTX *, char **));
00162 extern sfsistat mlfi_envrcpt __P((SMFICTX *, char **));
00163 extern sfsistat mlfi_header __P((SMFICTX *, char *, char *));
00164 extern sfsistat mlfi_eoh __P((SMFICTX *));
00165 extern sfsistat mlfi_body __P((SMFICTX *, u_char *, size_t));
00166 extern sfsistat mlfi_eom __P((SMFICTX *));
00167 extern sfsistat mlfi_abort __P((SMFICTX *));
00168 extern sfsistat mlfi_close __P((SMFICTX *));
00169 #endif /* DKIMF_MILTER_PROTOTYPES */
00170 
00171 extern DKIM *dkimf_getdkim __P((void *));
00172 extern struct signreq *dkimf_getsrlist __P((void *));
00173 
00174 #ifdef USE_LDAP
00175 extern char *dkimf_get_ldap_param __P((int));
00176 #endif /* USE_LDAP */
00177 
00178 #ifdef USE_LUA
00179 # ifdef DKIMF_LUA_PROTOTYPES
00180 extern int dkimf_xs_addheader __P((lua_State *));
00181 extern int dkimf_xs_addrcpt __P((lua_State *));
00182 extern int dkimf_xs_bodylength __P((lua_State *));
00183 extern int dkimf_xs_canonlength __P((lua_State *));
00184 extern int dkimf_xs_clienthost __P((lua_State *));
00185 extern int dkimf_xs_clientip __P((lua_State *));
00186 extern int dkimf_xs_dbclose __P((lua_State *));
00187 extern int dkimf_xs_dbhandle __P((lua_State *));
00188 extern int dkimf_xs_dbopen __P((lua_State *));
00189 extern int dkimf_xs_dbquery __P((lua_State *));
00190 extern int dkimf_xs_delheader __P((lua_State *));
00191 extern int dkimf_xs_delrcpt __P((lua_State *));
00192 #  ifdef _FFR_LUA_GLOBALS
00193 extern int dkimf_xs_export __P((lua_State *));
00194 #  endif /* _FFR_LUA_GLOBALS */
00195 extern int dkimf_xs_fromdomain __P((lua_State *));
00196 extern int dkimf_xs_getenvfrom __P((lua_State *));
00197 extern int dkimf_xs_getheader __P((lua_State *));
00198 extern int dkimf_xs_getpolicy __P((lua_State *));
00199 extern int dkimf_xs_getreputation __P((lua_State *));
00200 extern int dkimf_xs_getsigarray __P((lua_State *));
00201 extern int dkimf_xs_getsigcount __P((lua_State *));
00202 extern int dkimf_xs_getsigdomain __P((lua_State *));
00203 extern int dkimf_xs_getsighandle __P((lua_State *));
00204 extern int dkimf_xs_getsigidentity __P((lua_State *));
00205 extern int dkimf_xs_getsymval __P((lua_State *));
00206 extern int dkimf_xs_internalip __P((lua_State *));
00207 extern int dkimf_xs_log __P((lua_State *));
00208 extern int dkimf_xs_parsefield __P((lua_State *));
00209 extern int dkimf_xs_popauth __P((lua_State *));
00210 extern int dkimf_xs_quarantine __P((lua_State *));
00211 extern int dkimf_xs_rblcheck __P((lua_State *));
00212 extern int dkimf_xs_rcpt __P((lua_State *));
00213 extern int dkimf_xs_rcptarray __P((lua_State *));
00214 extern int dkimf_xs_rcptcount __P((lua_State *));
00215 extern int dkimf_xs_replaceheader __P((lua_State *));
00216 extern int dkimf_xs_resign __P((lua_State *));
00217 extern int dkimf_xs_requestsig __P((lua_State *));
00218 extern int dkimf_xs_setpartial __P((lua_State *));
00219 extern int dkimf_xs_setreply __P((lua_State *));
00220 extern int dkimf_xs_setresult __P((lua_State *));
00221 extern int dkimf_xs_sigbhresult __P((lua_State *));
00222 extern int dkimf_xs_sigignore __P((lua_State *));
00223 extern int dkimf_xs_sigresult __P((lua_State *));
00224 #  ifdef _FFR_REPUTATION
00225 extern int dkimf_xs_spam __P((lua_State *));
00226 #  endif /* _FFR_REPUTATION */
00227 #  ifdef _FFR_STATSEXT
00228 extern int dkimf_xs_statsext __P((lua_State *));
00229 #  endif /* _FFR_STATSEXT */
00230 extern int dkimf_xs_verify __P((lua_State *));
00231 extern int dkimf_xs_xtag __P((lua_State *));
00232 # endif /* DKIMF_LUA_PROTOTYPES */
00233 #endif /* USE_LUA */
00234 
00235 #endif /* _OPENDKIM_H_ */