1 #ifndef _SMTP_STREAM_H_INCLUDED_
2 #define _SMTP_STREAM_H_INCLUDED_
3 
4 /*++
5 /* NAME
6 /*	smtp_stream 3h
7 /* SUMMARY
8 /*	smtp stream I/O support
9 /* SYNOPSIS
10 /*	#include <smtp_stream.h>
11 /* DESCRIPTION
12 /* .nf
13 
14  /*
15   * System library.
16   */
17 #include <stdarg.h>
18 #include <setjmp.h>
19 
20  /*
21   * Utility library.
22   */
23 #include <vstring.h>
24 #include <vstream.h>
25 
26  /*
27   * External interface. The following codes are meant for use in longjmp(),
28   * so they must all be non-zero.
29   */
30 #define SMTP_ERR_EOF	1		/* unexpected client disconnect */
31 #define SMTP_ERR_TIME	2		/* time out */
32 #define SMTP_ERR_QUIET	3		/* silent cleanup (application) */
33 #define SMTP_ERR_NONE	4		/* non-error case */
34 #define SMTP_ERR_DATA	5		/* application data error */
35 
36 extern void smtp_stream_setup(VSTREAM *, int, int, int);
37 extern void PRINTFLIKE(2, 3) smtp_printf(VSTREAM *, const char *,...);
38 extern void smtp_flush(VSTREAM *);
39 extern int smtp_fgetc(VSTREAM *);
40 extern int smtp_get(VSTRING *, VSTREAM *, ssize_t, int);
41 extern int smtp_get_noexcept(VSTRING *, VSTREAM *, ssize_t, int);
42 extern void smtp_fputs(const char *, ssize_t len, VSTREAM *);
43 extern void smtp_fwrite(const char *, ssize_t len, VSTREAM *);
44 extern void smtp_fread_buf(VSTRING *, ssize_t len, VSTREAM *);
45 extern void smtp_fputc(int, VSTREAM *);
46 
47 extern void smtp_vprintf(VSTREAM *, const char *, va_list);
48 
49 #define smtp_timeout_setup(stream, timeout) \
50 	smtp_stream_setup((stream), (timeout), 0, 0)
51 
52 #define SMTP_GET_FLAG_NONE	0
53 #define SMTP_GET_FLAG_SKIP	(1<<0)	/* skip over excess input */
54 #define SMTP_GET_FLAG_APPEND	(1<<1)	/* append instead of overwrite */
55 
56 /* LICENSE
57 /* .ad
58 /* .fi
59 /*	The Secure Mailer license must be distributed with this software.
60 /* AUTHOR(S)
61 /*	Wietse Venema
62 /*	IBM T.J. Watson Research
63 /*	P.O. Box 704
64 /*	Yorktown Heights, NY 10598, USA
65 /*
66 /*	Wietse Venema
67 /*	Google, Inc.
68 /*	111 8th Avenue
69 /*	New York, NY 10011, USA
70 /*--*/
71 
72 #endif
73