Expand PMF_FN_* macros.
[netbsd-mini2440.git] / external / ibm-public / postfix / dist / src / global / dsb_scan.c
blob30d69655424771f29a4c659b733ab4bba6164794
1 /* $NetBSD$ */
3 /*++
4 /* NAME
5 /* dsb_scan
6 /* SUMMARY
7 /* read DSN_BUF from stream
8 /* SYNOPSIS
9 /* #include <dsb_scan.h>
11 /* int dsb_scan(scan_fn, stream, flags, ptr)
12 /* ATTR_SCAN_MASTER_FN scan_fn;
13 /* VSTREAM *stream;
14 /* int flags;
15 /* void *ptr;
16 /* DESCRIPTION
17 /* dsb_scan() reads a DSN_BUF from the named stream using the
18 /* specified attribute scan routine. dsb_scan() is meant
19 /* to be passed as a call-back to attr_scan(), thusly:
21 /* ... ATTR_TYPE_FUNC, dsb_scan, (void *) &dsbuf, ...
22 /* DIAGNOSTICS
23 /* Fatal: out of memory.
24 /* LICENSE
25 /* .ad
26 /* .fi
27 /* The Secure Mailer license must be distributed with this software.
28 /* AUTHOR(S)
29 /* Wietse Venema
30 /* IBM T.J. Watson Research
31 /* P.O. Box 704
32 /* Yorktown Heights, NY 10598, USA
33 /*--*/
35 /* System library. */
37 #include <sys_defs.h>
39 /* Utility library. */
41 #include <attr.h>
43 /* Global library. */
45 #include <mail_proto.h>
46 #include <dsb_scan.h>
48 /* dsb_scan - read DSN_BUF from stream */
50 int dsb_scan(ATTR_SCAN_MASTER_FN scan_fn, VSTREAM *fp,
51 int flags, void *ptr)
53 DSN_BUF *dsb = (DSN_BUF *) ptr;
54 int ret;
57 * The attribute order is determined by backwards compatibility. It can
58 * be sanitized after all the ad-hoc DSN read/write code is replaced.
60 ret = scan_fn(fp, flags | ATTR_FLAG_MORE,
61 ATTR_TYPE_STR, MAIL_ATTR_DSN_STATUS, dsb->status,
62 ATTR_TYPE_STR, MAIL_ATTR_DSN_DTYPE, dsb->dtype,
63 ATTR_TYPE_STR, MAIL_ATTR_DSN_DTEXT, dsb->dtext,
64 ATTR_TYPE_STR, MAIL_ATTR_DSN_MTYPE, dsb->mtype,
65 ATTR_TYPE_STR, MAIL_ATTR_DSN_MNAME, dsb->mname,
66 ATTR_TYPE_STR, MAIL_ATTR_DSN_ACTION, dsb->action,
67 ATTR_TYPE_STR, MAIL_ATTR_WHY, dsb->reason,
68 ATTR_TYPE_END);
69 return (ret == 7 ? 1 : -1);