/*
* Copyright (c) 1999-2003, 2006 Proofpoint, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the sendmail distribution.
*/
/*
** LIBMILTER.H -- include file for mail filter library functions
*/
#ifndef _LIBMILTER_H
#ifdef _DEFINE
# define EXTERN
# define INIT(x) = x
#else /* _DEFINE */
# define EXTERN extern
# define INIT(x)
#endif /* _DEFINE */
#include "sendmail.h"
#ifdef SM_ASSERT
#endif
#ifndef SM_ASSERT
#include <assert.h>
#endif
/*
** Context for one milter session.
**
** Notes:
** There is a 1-1 correlation between a sendmail SMTP server process,
** an SMTP session, and an milter context. Due to the nature of SMTP
** session handling in sendmail 8, this libmilter implementation deals
** only with a single SMTP session per MTA - libmilter connection.
**
** There is no "global" context for libmilter, global variables are
** just that (they are not "collected" in a context).
**
** Implementation hint:
** macros are stored in mac_buf[] as sequence of:
** macro_name \0 macro_value
** (just as read from the MTA)
** mac_ptr is a list of pointers into mac_buf to the beginning of each
** entry, i.e., macro_name, macro_value, ...
*/
struct smfi_str
{
/*
** milter protocol flags that are sent to the MTA;
** this is the same as ctx_pflags except for those flags that
** are not offered by the MTA but emulated in libmilter.
*/
unsigned long ctx_pflags2mta;
/*
** milter protocol version that is sent to the MTA;
** this is the same as ctx_prot_vers unless the
** MTA protocol version (ctx_mta_prot_vers) is smaller
** but still "acceptable".
*/
int ctx_prot_vers2mta;
#endif /* _FFR_THREAD_MONITOR */
#endif /* _FFR_WORKERS_POOL */
};
# define MI_SOCK_READ_FAIL(x) ((x) < 0)
/* SM_CONF_POLL shall be defined with _FFR_WORKERS_POOL */
# if !SM_CONF_POLL
# endif /* SM_CONF_POLL */
#endif /* _FFR_WORKERS_POOL */
do \
{ \
if (r != 0 && r != ETIMEDOUT) \
"pthread_cond_timedwait error %d", r); \
} while (0)
#if SM_CONF_POLL
# include <poll.h>
#else /* SM_CONF_POLL */
#endif /* SM_CONF_POLL */
/* some defaults */
#ifndef MI_SOMAXCONN
# if SOMAXCONN > 20
# else /* SOMAXCONN */
# endif /* SOMAXCONN */
#endif /* ! MI_SOMAXCONN */
/* maximum number of repeated failures in mi_listener() */
/* internal "commands", i.e., error codes */
/* hack */
#define milter_ret int
/* stop? */
#define MILTER_CONT 0
/* functions */
extern int mi_control_startup __P((char *));
extern void mi_stop_milters __P((int));
extern void mi_clean_signals __P((void));
extern int mi_inet_pton __P((int, const char *, void *));
extern void mi_closener __P((void));
/* communication functions */
extern bool Monitor;
do \
{ \
if (Monitor) \
} while (0)
do \
{ \
if (Monitor) \
} while (0)
int mi_monitor_init __P((void));
#else /* _FFR_THREAD_MONITOR */
#endif /* _FFR_THREAD_MONITOR */
extern int mi_pool_manager_init __P((void));
extern int mi_pool_controller_init __P((void));
#endif /* _FFR_WORKERS_POOL */
#endif /* ! _LIBMILTER_H */