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