milter.h revision 110560
1/*
2 * Copyright (c) 1999-2002 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.1 2002/12/19 02:10:09 ca 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>
25typedef pthread_t	sthread_t;
26typedef int		socket_t;
27
28# define MAX_MACROS_ENTRIES	4	/* max size of macro pointer array */
29
30/*
31**  context for milter
32**  implementation hint:
33**  macros are stored in mac_buf[] as sequence of:
34**  macro_name \0 macro_value
35**  (just as read from the MTA)
36**  mac_ptr is a list of pointers into mac_buf to the beginning of each
37**  entry, i.e., macro_name, macro_value, ...
38*/
39
40struct smfi_str
41{
42	sthread_t	ctx_id;		/* thread id */
43	socket_t	ctx_sd;		/* socket descriptor */
44	int		ctx_dbg;	/* debug level */
45	time_t		ctx_timeout;	/* timeout */
46	int		ctx_state;	/* state */
47	smfiDesc_ptr	ctx_smfi;	/* filter description */
48	unsigned long	ctx_pflags;	/* protocol flags */
49	char		**ctx_mac_ptr[MAX_MACROS_ENTRIES];
50	char		*ctx_mac_buf[MAX_MACROS_ENTRIES];
51	char		*ctx_reply;	/* reply code */
52	void		*ctx_privdata;	/* private data */
53};
54
55#endif /* ! _LIBMILTER_MILTER_H */
56