xref: /titanic_52/usr/src/cmd/sendmail/include/libmilter/milter.h (revision 18c2aff776a775d34a4c9893a4c72e0434d68e36)
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.39 2003/12/02 00:21:42 msk Exp $
11  */
12 
13 #pragma ident	"%Z%%M%	%I%	%E% SMI"
14 
15 /*
16 **  MILTER.H -- Global definitions for mail filter.
17 */
18 
19 #ifndef _LIBMILTER_MILTER_H
20 # define _LIBMILTER_MILTER_H	1
21 
22 #include "sendmail.h"
23 #include "libmilter/mfapi.h"
24 
25 /* socket and thread portability */
26 # include <pthread.h>
27 typedef pthread_t	sthread_t;
28 typedef int		socket_t;
29 
30 # define MAX_MACROS_ENTRIES	5	/* max size of macro pointer array */
31 
32 /*
33 **  context for milter
34 **  implementation hint:
35 **  macros are stored in mac_buf[] as sequence of:
36 **  macro_name \0 macro_value
37 **  (just as read from the MTA)
38 **  mac_ptr is a list of pointers into mac_buf to the beginning of each
39 **  entry, i.e., macro_name, macro_value, ...
40 */
41 
42 struct smfi_str
43 {
44 	sthread_t	ctx_id;		/* thread id */
45 	socket_t	ctx_sd;		/* socket descriptor */
46 	int		ctx_dbg;	/* debug level */
47 	time_t		ctx_timeout;	/* timeout */
48 	int		ctx_state;	/* state */
49 	smfiDesc_ptr	ctx_smfi;	/* filter description */
50 	unsigned long	ctx_pflags;	/* protocol flags */
51 	char		**ctx_mac_ptr[MAX_MACROS_ENTRIES];
52 	char		*ctx_mac_buf[MAX_MACROS_ENTRIES];
53 	char		*ctx_reply;	/* reply code */
54 	void		*ctx_privdata;	/* private data */
55 };
56 
57 #endif /* ! _LIBMILTER_MILTER_H */
58