Postfix3.3.1
mail_stream.h
[詳解]
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 #include <check_arg.h>
25 
26  /*
27  * External interface.
28  */
29 typedef struct MAIL_STREAM MAIL_STREAM;
30 
33 
34 struct MAIL_STREAM {
35  VSTREAM *stream; /* file or pipe or socket */
36  char *queue; /* (initial) queue name */
37  char *id; /* queue id */
38  MAIL_STREAM_FINISH_FN finish; /* finish code */
39  MAIL_STREAM_CLOSE_FN close; /* close stream */
40  char *class; /* trigger class */
41  char *service; /* trigger service */
42  int mode; /* additional permissions */
43 #ifdef DELAY_ACTION
44  int delay; /* deferred delivery */
45 #endif
46  struct timeval ctime; /* creation time */
47 };
48 
49 /* Legacy type-unchecked API, internal use. */
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 /* Type-checked API, external use. */
60 #define CA_MAIL_STREAM_CTL_END MAIL_STREAM_CTL_END
61 #define CA_MAIL_STREAM_CTL_QUEUE(v) MAIL_STREAM_CTL_QUEUE, CHECK_CPTR(MAIL_STREAM, char, (v))
62 #define CA_MAIL_STREAM_CTL_CLASS(v) MAIL_STREAM_CTL_CLASS, CHECK_CPTR(MAIL_STREAM, char, (v))
63 #define CA_MAIL_STREAM_CTL_SERVICE(v) MAIL_STREAM_CTL_SERVICE, CHECK_CPTR(MAIL_STREAM, char, (v))
64 #define CA_MAIL_STREAM_CTL_MODE(v) MAIL_STREAM_CTL_MODE, CHECK_VAL(MAIL_STREAM, int, (v))
65 #ifdef DELAY_ACTION
66 #define CA_MAIL_STREAM_CTL_DELAY(v) MAIL_STREAM_CTL_DELAY, CHECK_VAL(MAIL_STREAM, int, (v))
67 #endif
68 
71 
72 extern MAIL_STREAM *mail_stream_file(const char *, const char *, const char *, int);
73 extern MAIL_STREAM *mail_stream_service(const char *, const char *);
74 extern MAIL_STREAM *mail_stream_command(const char *);
75 extern void mail_stream_cleanup(MAIL_STREAM *);
76 extern int mail_stream_finish(MAIL_STREAM *, VSTRING *);
77 extern void mail_stream_ctl(MAIL_STREAM *, int,...);
78 
79 
80 /* LICENSE
81 /* .ad
82 /* .fi
83 /* The Secure Mailer license must be distributed with this software.
84 /* AUTHOR(S)
85 /* Wietse Venema
86 /* IBM T.J. Watson Research
87 /* P.O. Box 704
88 /* Yorktown Heights, NY 10598, USA
89 /*--*/
90 
91 #endif
void mail_stream_ctl(MAIL_STREAM *, int,...)
Definition: mail_stream.c:515
char * id
Definition: mail_stream.h:37
MAIL_STREAM * mail_stream_file(const char *, const char *, const char *, int)
Definition: mail_stream.c:405
MAIL_STREAM_FINISH_FN finish
Definition: mail_stream.h:38
MAIL_STREAM_CLOSE_FN close
Definition: mail_stream.h:39
MAIL_STREAM * mail_stream_service(const char *, const char *)
Definition: mail_stream.c:434
char * service
Definition: mail_stream.h:41
CHECK_CPTR_HELPER_DCL(MAIL_STREAM, char)
char * queue
Definition: mail_stream.h:36
void mail_stream_cleanup(MAIL_STREAM *)
Definition: mail_stream.c:151
int mail_stream_finish(MAIL_STREAM *, VSTRING *)
Definition: mail_stream.c:398
struct timeval ctime
Definition: mail_stream.h:46
MAIL_STREAM * mail_stream_command(const char *)
Definition: mail_stream.c:462
int(* MAIL_STREAM_FINISH_FN)(MAIL_STREAM *, VSTRING *)
Definition: mail_stream.h:31
CHECK_VAL_HELPER_DCL(MAIL_STREAM, int)
VSTREAM * stream
Definition: mail_stream.h:35
int int
Definition: smtpd_proxy.h:21
int(* MAIL_STREAM_CLOSE_FN)(VSTREAM *)
Definition: mail_stream.h:32