1 /* 2 * Copyright (c) 1999-2003 Sendmail, Inc. and its suppliers. 3 * All rights reserved. 4 * 5 * By using this file, you agree to the terms and conditions set 6 * forth in the LICENSE file which can be found at the top level of 7 * the sendmail distribution. 8 * 9 * 10 * $Id: milter.h,v 8.37.2.3 2003/12/02 00:19:51 msk Exp $ 11 */ 12 13 /* 14 ** MILTER.H -- Global definitions for mail filter. 15 */ 16 17 #ifndef _LIBMILTER_MILTER_H 18 # define _LIBMILTER_MILTER_H 1 19 20 #include "sendmail.h" 21 #include "libmilter/mfapi.h" 22 23 /* socket and thread portability */ 24 # include <pthread.h> 25 typedef pthread_t sthread_t; 26 typedef int socket_t; 27 28 #if _FFR_MILTER_MACROS_EOM 29 # define MAX_MACROS_ENTRIES 5 /* max size of macro pointer array */ 30 #else /* _FFR_MILTER_MACROS_EOM */ 31 # define MAX_MACROS_ENTRIES 4 /* max size of macro pointer array */ 32 #endif /* _FFR_MILTER_MACROS_EOM */ 33 34 /* 35 ** context for milter 36 ** implementation hint: 37 ** macros are stored in mac_buf[] as sequence of: 38 ** macro_name \0 macro_value 39 ** (just as read from the MTA) 40 ** mac_ptr is a list of pointers into mac_buf to the beginning of each 41 ** entry, i.e., macro_name, macro_value, ... 42 */ 43 44 struct smfi_str 45 { 46 sthread_t ctx_id; /* thread id */ 47 socket_t ctx_sd; /* socket descriptor */ 48 int ctx_dbg; /* debug level */ 49 time_t ctx_timeout; /* timeout */ 50 int ctx_state; /* state */ 51 smfiDesc_ptr ctx_smfi; /* filter description */ 52 unsigned long ctx_pflags; /* protocol flags */ 53 char **ctx_mac_ptr[MAX_MACROS_ENTRIES]; 54 char *ctx_mac_buf[MAX_MACROS_ENTRIES]; 55 char *ctx_reply; /* reply code */ 56 void *ctx_privdata; /* private data */ 57 }; 58 59 #endif /* ! _LIBMILTER_MILTER_H */ 60