Postfix3.3.1
dsb_scan.c
[詳解]
1 /*++
2 /* NAME
3 /* dsb_scan
4 /* SUMMARY
5 /* read DSN_BUF from stream
6 /* SYNOPSIS
7 /* #include <dsb_scan.h>
8 /*
9 /* int dsb_scan(scan_fn, stream, flags, ptr)
10 /* ATTR_SCAN_MASTER_FN scan_fn;
11 /* VSTREAM *stream;
12 /* int flags;
13 /* void *ptr;
14 /* DESCRIPTION
15 /* dsb_scan() reads a DSN_BUF from the named stream using the
16 /* specified attribute scan routine. dsb_scan() is meant
17 /* to be passed as a call-back to attr_scan(), thusly:
18 /*
19 /* ... RECV_ATTR_FUNC(dsb_scan, (void *) &dsbuf), ...
20 /* DIAGNOSTICS
21 /* Fatal: out of memory.
22 /* LICENSE
23 /* .ad
24 /* .fi
25 /* The Secure Mailer license must be distributed with this software.
26 /* AUTHOR(S)
27 /* Wietse Venema
28 /* IBM T.J. Watson Research
29 /* P.O. Box 704
30 /* Yorktown Heights, NY 10598, USA
31 /*--*/
32 
33 /* System library. */
34 
35 #include <sys_defs.h>
36 
37 /* Utility library. */
38 
39 #include <attr.h>
40 
41 /* Global library. */
42 
43 #include <mail_proto.h>
44 #include <dsb_scan.h>
45 
46 /* dsb_scan - read DSN_BUF from stream */
47 
49  int flags, void *ptr)
50 {
51  DSN_BUF *dsb = (DSN_BUF *) ptr;
52  int ret;
53 
54  /*
55  * The attribute order is determined by backwards compatibility. It can
56  * be sanitized after all the ad-hoc DSN read/write code is replaced.
57  */
58  ret = scan_fn(fp, flags | ATTR_FLAG_MORE,
67  return (ret == 7 ? 1 : -1);
68 }
VSTRING * mname
Definition: dsn_buf.h:33
#define ATTR_TYPE_END
Definition: attr.h:39
int dsb_scan(ATTR_SCAN_MASTER_FN scan_fn, VSTREAM *fp, int flags, void *ptr)
Definition: dsb_scan.c:48
#define MAIL_ATTR_DSN_ACTION
Definition: mail_proto.h:272
#define MAIL_ATTR_DSN_STATUS
Definition: mail_proto.h:267
int(* ATTR_SCAN_MASTER_FN)(VSTREAM *, int,...)
Definition: attr.h:31
VSTRING * dtype
Definition: dsn_buf.h:34
#define MAIL_ATTR_DSN_MNAME
Definition: mail_proto.h:271
VSTRING * action
Definition: dsn_buf.h:31
#define MAIL_ATTR_WHY
Definition: mail_proto.h:135
VSTRING * mtype
Definition: dsn_buf.h:32
VSTRING * reason
Definition: dsn_buf.h:37
VSTRING * dtext
Definition: dsn_buf.h:35
#define MAIL_ATTR_DSN_MTYPE
Definition: mail_proto.h:270
#define MAIL_ATTR_DSN_DTEXT
Definition: mail_proto.h:269
#define ATTR_FLAG_MORE
Definition: attr.h:101
VSTRING * status
Definition: dsn_buf.h:30
#define RECV_ATTR_STR(name, val)
Definition: attr.h:72
#define MAIL_ATTR_DSN_DTYPE
Definition: mail_proto.h:268