1 /* $NetBSD: dsn_buf.h,v 1.1.1.1 2009/06/23 10:08:45 tron Exp $ */ 2 3 #ifndef _DSN_BUF_H_INCLUDED_ 4 #define _DSN_BUF_H_INCLUDED_ 5 6 /*++ 7 /* NAME 8 /* dsn_buf 3h 9 /* SUMMARY 10 /* delivery status buffer 11 /* SYNOPSIS 12 /* #include <dsn_buf.h> 13 /* DESCRIPTION 14 /* .nf 15 16 /* 17 * Utility library. 18 */ 19 #include <vstring.h> 20 21 /* 22 * Global library. 23 */ 24 #include <dsn.h> 25 26 /* 27 * Delivery status buffer, Postfix-internal form. 28 */ 29 typedef struct { 30 DSN dsn; /* convenience */ 31 /* Formal members. */ 32 VSTRING *status; /* RFC 3463 */ 33 VSTRING *action; /* RFC 3464 */ 34 VSTRING *mtype; /* null or remote MTA type */ 35 VSTRING *mname; /* null or remote MTA name */ 36 VSTRING *dtype; /* null, smtp, x-unix */ 37 VSTRING *dtext; /* null, RFC 2821, sysexits.h */ 38 /* Informal free text. */ 39 VSTRING *reason; /* free text */ 40 } DSN_BUF; 41 42 #define DSB_DEF_ACTION ((char *) 0) 43 44 #define DSB_SKIP_RMTA ((char *) 0), ((char *) 0) 45 #define DSB_MTYPE_NONE ((char *) 0) 46 #define DSB_MTYPE_DNS "dns" /* RFC 2821 */ 47 48 #define DSB_SKIP_REPLY (char *) 0, " " /* XXX Bogus? */ 49 #define DSB_DTYPE_NONE ((char *) 0) 50 #define DSB_DTYPE_SMTP "smtp" /* RFC 2821 */ 51 #define DSB_DTYPE_UNIX "x-unix" /* sysexits.h */ 52 #define DSB_DTYPE_SASL "x-sasl" /* libsasl */ 53 54 extern DSN_BUF *dsb_create(void); 55 extern DSN_BUF *PRINTFLIKE(8, 9) dsb_update(DSN_BUF *, const char *, const char *, const char *, const char *, const char *, const char *, const char *,...); 56 extern DSN_BUF *PRINTFLIKE(3, 4) dsb_simple(DSN_BUF *, const char *, const char *,...); 57 extern DSN_BUF *PRINTFLIKE(4, 5) dsb_unix(DSN_BUF *, const char *, const char *, const char *,...); 58 extern DSN_BUF *dsb_formal(DSN_BUF *, const char *, const char *, const char *, const char *, const char *, const char *); 59 extern DSN_BUF *dsb_status(DSN_BUF *, const char *); 60 extern void dsb_reset(DSN_BUF *); 61 extern void dsb_free(DSN_BUF *); 62 63 /* 64 * Early implementations of the DSN structure represented unavailable 65 * information with null pointers. This resulted in hard to maintain code. 66 * We now use empty strings instead, so there is no need anymore to convert 67 * empty strings to null pointers in the macro below. 68 */ 69 #define DSN_FROM_DSN_BUF(dsb) \ 70 DSN_ASSIGN(&(dsb)->dsn, \ 71 vstring_str((dsb)->status), \ 72 vstring_str((dsb)->action), \ 73 vstring_str((dsb)->reason), \ 74 vstring_str((dsb)->dtype), \ 75 vstring_str((dsb)->dtext), \ 76 vstring_str((dsb)->mtype), \ 77 vstring_str((dsb)->mname)) 78 79 /* LICENSE 80 /* .ad 81 /* .fi 82 /* The Secure Mailer license must be distributed with this software. 83 /* AUTHOR(S) 84 /* Wietse Venema 85 /* IBM T.J. Watson Research 86 /* P.O. Box 704 87 /* Yorktown Heights, NY 10598, USA 88 /*--*/ 89 90 #endif 91