7 /* read DSN_BUF from stream
9 /* #include <dsb_scan.h>
11 /* int dsb_scan(scan_fn, stream, flags, ptr)
12 /* ATTR_SCAN_MASTER_FN scan_fn;
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, ...
23 /* Fatal: out of memory.
27 /* The Secure Mailer license must be distributed with this software.
30 /* IBM T.J. Watson Research
32 /* Yorktown Heights, NY 10598, USA
39 /* Utility library. */
45 #include <mail_proto.h>
48 /* dsb_scan - read DSN_BUF from stream */
50 int dsb_scan(ATTR_SCAN_MASTER_FN scan_fn
, VSTREAM
*fp
,
53 DSN_BUF
*dsb
= (DSN_BUF
*) ptr
;
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
,
69 return (ret
== 7 ? 1 : -1);