Deleted Added
full compact
libmilter.h (110560) libmilter.h (111823)
1/*
1/*
2 * Copyright (c) 1999-2002 Sendmail, Inc. and its suppliers.
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/*
11** LIBMILTER.H -- include file for mail filter library functions
12*/
13
14#ifndef _LIBMILTER_H
15# define _LIBMILTER_H 1
16
17#include <sm/gen.h>
18
19#ifdef _DEFINE
20# define EXTERN
21# define INIT(x) = x
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/*
11** LIBMILTER.H -- include file for mail filter library functions
12*/
13
14#ifndef _LIBMILTER_H
15# define _LIBMILTER_H 1
16
17#include <sm/gen.h>
18
19#ifdef _DEFINE
20# define EXTERN
21# define INIT(x) = x
22SM_IDSTR(MilterlId, "@(#)$Id: libmilter.h,v 8.33.2.7 2002/12/18 23:15:35 ca Exp $")
22SM_IDSTR(MilterlId, "@(#)$Id: libmilter.h,v 8.33.2.9 2003/01/03 22:14:40 ca Exp $")
23#else /* _DEFINE */
24# define EXTERN extern
25# define INIT(x)
26#endif /* _DEFINE */
27
28
29#define NOT_SENDMAIL 1
30#define _SOCK_ADDR union bigsockaddr

--- 13 unchanged lines hidden (view full) ---

44
45typedef pthread_mutex_t smutex_t;
46# define smutex_init(mp) (pthread_mutex_init(mp, NULL) == 0)
47# define smutex_destroy(mp) (pthread_mutex_destroy(mp) == 0)
48# define smutex_lock(mp) (pthread_mutex_lock(mp) == 0)
49# define smutex_unlock(mp) (pthread_mutex_unlock(mp) == 0)
50# define smutex_trylock(mp) (pthread_mutex_trylock(mp) == 0)
51
23#else /* _DEFINE */
24# define EXTERN extern
25# define INIT(x)
26#endif /* _DEFINE */
27
28
29#define NOT_SENDMAIL 1
30#define _SOCK_ADDR union bigsockaddr

--- 13 unchanged lines hidden (view full) ---

44
45typedef pthread_mutex_t smutex_t;
46# define smutex_init(mp) (pthread_mutex_init(mp, NULL) == 0)
47# define smutex_destroy(mp) (pthread_mutex_destroy(mp) == 0)
48# define smutex_lock(mp) (pthread_mutex_lock(mp) == 0)
49# define smutex_unlock(mp) (pthread_mutex_unlock(mp) == 0)
50# define smutex_trylock(mp) (pthread_mutex_trylock(mp) == 0)
51
52#if _FFR_USE_POLL
53
54# include <poll.h>
55# define MI_POLLSELECT "poll"
56
57# define MI_POLL_RD_FLAGS (POLLIN | POLLPRI)
58# define MI_POLL_WR_FLAGS (POLLOUT)
59# define MI_MS(timeout) (((timeout)->tv_sec * 1000) + (timeout)->tv_usec)
60
61# define FD_RD_VAR(rds, excs) struct pollfd rds
62# define FD_WR_VAR(wrs) struct pollfd wrs
63
64# define FD_RD_INIT(sd, rds, excs) \
65 (rds).fd = (sd); \
66 (rds).events = MI_POLL_RD_FLAGS; \
67 (rds).revents = 0
68
69# define FD_WR_INIT(sd, wrs) \
70 (wrs).fd = (sd); \
71 (wrs).events = MI_POLL_WR_FLAGS; \
72 (wrs).revents = 0
73
74# define FD_IS_RD_EXC(sd, rds, excs) \
75 (((rds).revents & (POLLERR | POLLHUP | POLLNVAL)) != 0)
76
77# define FD_IS_WR_RDY(sd, wrs) \
78 (((wrs).revents & MI_POLL_WR_FLAGS) != 0)
79
80# define FD_IS_RD_RDY(sd, rds, excs) \
81 (((rds).revents & MI_POLL_RD_FLAGS) != 0)
82
83# define FD_WR_READY(sd, excs, timeout) \
84 poll(&(wrs), 1, MI_MS(timeout))
85
86# define FD_RD_READY(sd, rds, excs, timeout) \
87 poll(&(rds), 1, MI_MS(timeout))
88
89#else /* _FFR_USE_POLL */
90
91# include <sm/fdset.h>
92# define MI_POLLSELECT "select"
93
94# define FD_RD_VAR(rds, excs) fd_set rds, excs
95# define FD_WR_VAR(wrs) fd_set wrs
96
97# define FD_RD_INIT(sd, rds, excs) \
98 FD_ZERO(&(rds)); \
99 FD_SET((unsigned int) (sd), &(rds)); \
100 FD_ZERO(&(excs)); \
101 FD_SET((unsigned int) (sd), &(excs))
102
103# define FD_WR_INIT(sd, wrs) \
104 FD_ZERO(&(wrs)); \
105 FD_SET((unsigned int) (sd), &(wrs)); \
106
107# define FD_IS_RD_EXC(sd, rds, excs) FD_ISSET(sd, &(excs))
108# define FD_IS_WR_RDY(sd, wrs) FD_ISSET((sd), &(wrs))
109# define FD_IS_RD_RDY(sd, rds, excs) FD_ISSET((sd), &(rds))
110
111# define FD_WR_READY(sd, wrs, timeout) \
112 select((sd) + 1, NULL, &(wrs), NULL, (timeout))
113# define FD_RD_READY(sd, rds, excs, timeout) \
114 select((sd) + 1, &(rds), NULL, &(excs), (timeout))
115
116#endif /* _FFR_USE_POLL */
117
52#include <sys/time.h>
53
54/* version info */
55#define MILTER_PRODUCT_NAME "libmilter"
56#define MILTER_VERSION 100
57
58/* some defaults */
59#define MI_TIMEOUT 7210 /* default timeout for read/write */

--- 62 unchanged lines hidden ---
118#include <sys/time.h>
119
120/* version info */
121#define MILTER_PRODUCT_NAME "libmilter"
122#define MILTER_VERSION 100
123
124/* some defaults */
125#define MI_TIMEOUT 7210 /* default timeout for read/write */

--- 62 unchanged lines hidden ---