libmilter.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright (c) 1999-2003 Sendmail, 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
# define _LIBMILTER_H 1
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef _DEFINE
# define EXTERN
# define INIT(x) = x
#else /* _DEFINE */
# define EXTERN extern
# define INIT(x)
#endif /* _DEFINE */
#define NOT_SENDMAIL 1
#define _SOCK_ADDR union bigsockaddr
#include "sendmail.h"
# define INVALID_SOCKET (-1)
# define closesocket close
# define MI_SOCK_READ(s, b, l) read(s, b, l)
# define MI_SOCK_READ_FAIL(x) ((x) < 0)
# define MI_SOCK_WRITE(s, b, l) write(s, b, l)
# define sthread_get_id() pthread_self()
typedef pthread_mutex_t smutex_t;
#if SM_CONF_POLL
# include <poll.h>
# define MI_POLLSELECT "poll"
# define MI_POLL_WR_FLAGS (POLLOUT)
#else /* SM_CONF_POLL */
# define MI_POLLSELECT "select"
#endif /* SM_CONF_POLL */
/* version info */
#define MILTER_PRODUCT_NAME "libmilter"
#define MILTER_VERSION 100
/* some defaults */
#ifndef MI_SOMAXCONN
# if SOMAXCONN > 20
# define MI_SOMAXCONN SOMAXCONN
# else /* SOMAXCONN */
# define MI_SOMAXCONN 20
# endif /* SOMAXCONN */
#endif /* ! MI_SOMAXCONN */
/* maximum number of repeated failures in mi_listener() */
/* internal "commands", i.e., error codes */
/* hack */
#define sm_dprintf (void) printf
#define milter_ret int
#define SMI_LOG_ERR LOG_ERR
#define SMI_LOG_FATAL LOG_ERR
#define SMI_LOG_WARN LOG_WARNING
#define SMI_LOG_INFO LOG_INFO
#define SMI_LOG_DEBUG LOG_DEBUG
/* stop? */
#define MILTER_CONT 0
#define MILTER_STOP 1
#define MILTER_ABRT 2
/* 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 */
#endif /* ! _LIBMILTER_H */