Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / external / ibm-public / postfix / dist / src / virtual / deliver_attr.c
blob8d096de618fdc1c2018e49d423bf149b3a055f12
1 /* $NetBSD$ */
3 /*++
4 /* NAME
5 /* deliver_attr 3
6 /* SUMMARY
7 /* initialize message delivery attributes
8 /* SYNOPSIS
9 /* #include "virtual.h"
11 /* void deliver_attr_init(attrp)
12 /* DELIVER_ATTR *attrp;
14 /* void deliver_attr_dump(attrp)
15 /* DELIVER_ATTR *attrp;
17 /* void deliver_attr_free(attrp)
18 /* DELIVER_ATTR *attrp;
19 /* DESCRIPTION
20 /* deliver_attr_init() initializes a structure with message delivery
21 /* attributes to a known initial state (all zeros).
23 /* deliver_attr_dump() logs the contents of the given attribute list.
25 /* deliver_attr_free() releases memory that was allocated by
26 /* deliver_attr_init().
27 /* LICENSE
28 /* .ad
29 /* .fi
30 /* The Secure Mailer license must be distributed with this software.
31 /* AUTHOR(S)
32 /* Wietse Venema
33 /* IBM T.J. Watson Research
34 /* P.O. Box 704
35 /* Yorktown Heights, NY 10598, USA
36 /*--*/
38 /* System library. */
40 #include <sys_defs.h>
42 /* Utility library. */
44 #include <msg.h>
45 #include <vstream.h>
47 /* Application-specific. */
49 #include "virtual.h"
51 /* deliver_attr_init - set message delivery attributes to all-zero state */
53 void deliver_attr_init(DELIVER_ATTR *attrp)
55 attrp->level = 0;
56 attrp->fp = 0;
57 attrp->queue_name = 0;
58 attrp->queue_id = 0;
59 attrp->offset = 0;
60 attrp->sender = 0;
61 RECIPIENT_ASSIGN(&(attrp->rcpt), 0, 0, 0, 0, 0);
62 attrp->user = 0;
63 attrp->delivered = 0;
64 attrp->relay = 0;
65 attrp->why = dsb_create();
68 /* deliver_attr_dump - log message delivery attributes */
70 void deliver_attr_dump(DELIVER_ATTR *attrp)
72 msg_info("level: %d", attrp->level);
73 msg_info("path: %s", VSTREAM_PATH(attrp->fp));
74 msg_info("fp: 0x%lx", (long) attrp->fp);
75 msg_info("queue_name: %s", attrp->queue_name ? attrp->queue_name : "null");
76 msg_info("queue_id: %s", attrp->queue_id ? attrp->queue_id : "null");
77 msg_info("offset: %ld", attrp->offset);
78 msg_info("sender: %s", attrp->sender ? attrp->sender : "null");
79 msg_info("recipient: %s", attrp->rcpt.address ? attrp->rcpt.address : "null");
80 msg_info("user: %s", attrp->user ? attrp->user : "null");
81 msg_info("delivered: %s", attrp->delivered ? attrp->delivered : "null");
82 msg_info("relay: %s", attrp->relay ? attrp->relay : "null");
83 msg_info("why: %s", attrp->why ? "buffer" : "null");
87 /* deliver_attr_free - release storage */
89 void deliver_attr_free(DELIVER_ATTR *attrp)
91 dsb_free(attrp->why);