xref: /netbsd-src/external/ibm-public/postfix/dist/src/global/mail_stream.h (revision 1b9578b8c2c1f848eeb16dabbfd7d1f0d9fdefbd)
1 /*	$NetBSD: mail_stream.h,v 1.1.1.1 2009/06/23 10:08:47 tron Exp $	*/
2 
3 #ifndef _MAIL_STREAM_H_INCLUDED_
4 #define _MAIL_STREAM_H_INCLUDED_
5 
6 /*++
7 /* NAME
8 /*	mail_stream 3h
9 /* SUMMARY
10 /*	mail stream management
11 /* SYNOPSIS
12 /*	#include <mail_stream.h>
13 /* DESCRIPTION
14 /* .nf
15 
16  /*
17   * System library.
18   */
19 #include <sys/time.h>
20 
21  /*
22   * Utility library.
23   */
24 #include <vstream.h>
25 #include <vstring.h>
26 
27  /*
28   * External interface.
29   */
30 typedef struct MAIL_STREAM MAIL_STREAM;
31 
32 typedef int (*MAIL_STREAM_FINISH_FN) (MAIL_STREAM *, VSTRING *);
33 typedef int (*MAIL_STREAM_CLOSE_FN) (VSTREAM *);
34 
35 struct MAIL_STREAM {
36     VSTREAM *stream;			/* file or pipe or socket */
37     char   *queue;			/* (initial) queue name */
38     char   *id;				/* queue id */
39     MAIL_STREAM_FINISH_FN finish;	/* finish code */
40     MAIL_STREAM_CLOSE_FN close;		/* close stream */
41     char   *class;			/* trigger class */
42     char   *service;			/* trigger service */
43     int     mode;			/* additional permissions */
44 #ifdef DELAY_ACTION
45     int     delay;			/* deferred delivery */
46 #endif
47     struct timeval ctime;		/* creation time */
48 };
49 
50 #define MAIL_STREAM_CTL_END	0	/* Terminator */
51 #define MAIL_STREAM_CTL_QUEUE	1	/* Change queue */
52 #define MAIL_STREAM_CTL_CLASS	2	/* Change notification class */
53 #define MAIL_STREAM_CTL_SERVICE	3	/* Change notification service */
54 #define MAIL_STREAM_CTL_MODE	4	/* Change final queue file mode */
55 #ifdef DELAY_ACTION
56 #define MAIL_STREAM_CTL_DELAY	5	/* Change final queue file mtime */
57 #endif
58 
59 extern MAIL_STREAM *mail_stream_file(const char *, const char *, const char *, int);
60 extern MAIL_STREAM *mail_stream_service(const char *, const char *);
61 extern MAIL_STREAM *mail_stream_command(const char *);
62 extern void mail_stream_cleanup(MAIL_STREAM *);
63 extern int mail_stream_finish(MAIL_STREAM *, VSTRING *);
64 extern void mail_stream_ctl(MAIL_STREAM *, int,...);
65 
66 
67 /* LICENSE
68 /* .ad
69 /* .fi
70 /*	The Secure Mailer license must be distributed with this software.
71 /* AUTHOR(S)
72 /*	Wietse Venema
73 /*	IBM T.J. Watson Research
74 /*	P.O. Box 704
75 /*	Yorktown Heights, NY 10598, USA
76 /*--*/
77 
78 #endif
79