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