aboutsummaryrefslogtreecommitdiff
path: root/gacopyz/gacopyz_priv.h
blob: eb4523758b5e55c6a7313710c022971e38ebfe66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/* This file is part of gacopyz.
   Copyright (C) 2005, 2006, 2007 Sergey Poznyakoff

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
   MA 02110-1301 USA */

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include <gacopyz.h>

enum macro_index {
	maci_conn,	
	maci_helo,	
	maci_mail,	
	maci_rcpt,	
	maci_data,
	maci_eom,
	maci_eoh,
	
	maci_max,
	maci_none = maci_max
};

typedef struct macro_assoc {
	char **argv;
	char *buffer;
} macro_assoc_t;

struct smfi_str {
	gacopyz_conn_t conn;   /* parent connection */
	int sd;                /* socket descriptor */
        int state;             /* state; FIXME: should be enum state */
        unsigned long flags;   /* protocol flags */
        int nmacros;           /* Number of entries in macros */
        macro_assoc_t macros[maci_max]; /* Macro tables */
        char *reply;           /* reply code */
        void *privdata;        /* private data */
};

struct gacopyz_conn {
	int sd;
	int logmask;
	int foreground;        /* operate in foreground mode */
 	int stop;              /* */
	struct timeval master_timeout;
	struct timeval ctx_timeout;
	struct smfiDesc desc;
	pid_t *pidtab;
	size_t pidcount;
	void (*cleanup) (gacopyz_conn_t, void*);
	void *cleanup_data;
};

#define GACOPYZ_TIMEOUT  7210	

#ifdef GACOPYZ_UINT32_T
typedef GACOPYZ_UINT32_T gacopyz_uint32_t; 
#else
# warning "assuming 32-bit unsigned long"
typedef unsigned long gacopyz_uint32_t;
#endif

#define GACOPYZ_OPTLEN  (sizeof(gacopyz_uint32_t) * 3) /* length of options */

void (*__gacopyz_log_printer)(int, char *, va_list);



struct gacopyz_iod {
	int sd;
	struct timeval timeout[GACOPYZ_TO_COUNT];
	int logmask;
};

int _gacopyz_read (gacopyz_iod_t iod, char *buf, size_t size);
int _gacopyz_write(gacopyz_iod_t iod, const char *buf, size_t size);
int gacopyz_send_command(gacopyz_iod_t iod,
			 int cmd, const void *data, size_t size);
int gacopyz_read_command(gacopyz_iod_t iod, unsigned char *cmd,
			 size_t *pcount, char **pbuf, size_t *psize);
int gacopyz_register_child(gacopyz_conn_t conn, pid_t pid);
int gacopyz_unregister_child(gacopyz_conn_t conn, pid_t pid);


/* NLS */
#undef _
#undef N_
#undef gettext
#undef dgettext
#undef ngettext
#undef textdomain
#undef bindtextdomain

#ifdef ENABLE_NLS
# include <gettext.h>
# define _(String) gettext(String)
# define N_(String) String
#else
# define _(String) (String)
# define N_(String) String
# define gettext(msgid) (msgid)
# define dgettext(domain, msgid) (msgid)
# define ngettext(sg,pl,cnt) (cnt == 1) ? (sg) : (pl)
# define textdomain(Domain)
# define bindtextdomain(Package, Directory)
#endif /* ENABLE_NLS */

Return to:

Send suggestions and report system problems to the System administrator.