Home | History | Annotate | Line # | Download | only in global
      1 /*	$NetBSD: dsn_buf.h,v 1.1.1.2 2014/07/06 19:27:51 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 *vdsb_simple(DSN_BUF *, const char *, const char *, va_list);
     57 extern DSN_BUF *PRINTFLIKE(3, 4) dsb_simple(DSN_BUF *, const char *, const char *,...);
     58 extern DSN_BUF *PRINTFLIKE(4, 5) dsb_unix(DSN_BUF *, const char *, const char *, const char *,...);
     59 extern DSN_BUF *dsb_formal(DSN_BUF *, const char *, const char *, const char *, const char *, const char *, const char *);
     60 extern DSN_BUF *dsb_status(DSN_BUF *, const char *);
     61 extern void dsb_reset(DSN_BUF *);
     62 extern void dsb_free(DSN_BUF *);
     63 
     64  /*
     65   * Early implementations of the DSN structure represented unavailable
     66   * information with null pointers. This resulted in hard to maintain code.
     67   * We now use empty strings instead, so there is no need anymore to convert
     68   * empty strings to null pointers in the macro below.
     69   */
     70 #define DSN_FROM_DSN_BUF(dsb) \
     71     DSN_ASSIGN(&(dsb)->dsn, \
     72 	vstring_str((dsb)->status), \
     73         vstring_str((dsb)->action), \
     74         vstring_str((dsb)->reason), \
     75         vstring_str((dsb)->dtype), \
     76         vstring_str((dsb)->dtext), \
     77         vstring_str((dsb)->mtype), \
     78         vstring_str((dsb)->mname))
     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
     92