milter.h revision 90792
164562Sgshapiro/*
280785Sgshapiro * Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
364562Sgshapiro *	All rights reserved.
464562Sgshapiro *
564562Sgshapiro * By using this file, you agree to the terms and conditions set
664562Sgshapiro * forth in the LICENSE file which can be found at the top level of
764562Sgshapiro * the sendmail distribution.
864562Sgshapiro *
964562Sgshapiro *
1090792Sgshapiro *	$Id: milter.h,v 8.35 2001/06/27 21:46:44 gshapiro Exp $
1164562Sgshapiro */
1264562Sgshapiro
1364562Sgshapiro/*
1490792Sgshapiro**  MILTER.H -- Global definitions for mail filter.
1564562Sgshapiro*/
1664562Sgshapiro
1764562Sgshapiro#ifndef _LIBMILTER_MILTER_H
1864562Sgshapiro# define _LIBMILTER_MILTER_H	1
1964562Sgshapiro
2090792Sgshapiro#include "sendmail.h"
2164562Sgshapiro#include "libmilter/mfapi.h"
2264562Sgshapiro
2364562Sgshapiro/* socket and thread portability */
2464562Sgshapiro# include <pthread.h>
2566494Sgshapirotypedef pthread_t	sthread_t;
2666494Sgshapirotypedef int		socket_t;
2764562Sgshapiro
2864562Sgshapiro# define MAX_MACROS_ENTRIES	4	/* max size of macro pointer array */
2964562Sgshapiro
3064562Sgshapiro/*
3164562Sgshapiro**  context for milter
3264562Sgshapiro**  implementation hint:
3364562Sgshapiro**  macros are stored in mac_buf[] as sequence of:
3464562Sgshapiro**  macro_name \0 macro_value
3564562Sgshapiro**  (just as read from the MTA)
3664562Sgshapiro**  mac_ptr is a list of pointers into mac_buf to the beginning of each
3764562Sgshapiro**  entry, i.e., macro_name, macro_value, ...
3864562Sgshapiro*/
3964562Sgshapiro
4064562Sgshapirostruct smfi_str
4164562Sgshapiro{
4264562Sgshapiro	sthread_t	ctx_id;		/* thread id */
4364562Sgshapiro	socket_t	ctx_sd;		/* socket descriptor */
4464562Sgshapiro	int		ctx_dbg;	/* debug level */
4564562Sgshapiro	time_t		ctx_timeout;	/* timeout */
4664562Sgshapiro	int		ctx_state;	/* state */
4764562Sgshapiro	smfiDesc_ptr	ctx_smfi;	/* filter description */
4890792Sgshapiro	unsigned long	ctx_pflags;	/* protocol flags */
4964562Sgshapiro	char		**ctx_mac_ptr[MAX_MACROS_ENTRIES];
5064562Sgshapiro	char		*ctx_mac_buf[MAX_MACROS_ENTRIES];
5164562Sgshapiro	char		*ctx_reply;	/* reply code */
5264562Sgshapiro	void		*ctx_privdata;	/* private data */
5364562Sgshapiro};
5464562Sgshapiro
5564562Sgshapiro#endif /* !_LIBMILTER_MILTER_H */
56