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