Postfix3.3.1
deliver_attr.c
[詳解]
1 /*++
2 /* NAME
3 /* deliver_attr 3
4 /* SUMMARY
5 /* initialize message delivery attributes
6 /* SYNOPSIS
7 /* #include "local.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 #include <unistd.h>
40 
41 /* Utility library. */
42 
43 #include <msg.h>
44 #include <vstream.h>
45 #include <vstring.h>
46 
47 /* Application-specific. */
48 
49 #include "local.h"
50 
51 /* deliver_attr_init - set message delivery attributes to all-zero state */
52 
54 {
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->domain = 0;
63  attrp->local = 0;
64  attrp->user = 0;
65  attrp->extension = 0;
66  attrp->unmatched = 0;
67  attrp->owner = 0;
68  attrp->delivered = 0;
69  attrp->relay = 0;
70  attrp->exp_type = 0;
71  attrp->exp_from = 0;
72  attrp->why = dsb_create();
73 }
74 
75 /* deliver_attr_dump - log message delivery attributes */
76 
78 {
79  msg_info("level: %d", attrp->level);
80  msg_info("path: %s", VSTREAM_PATH(attrp->fp));
81  msg_info("fp: 0x%lx", (long) attrp->fp);
82  msg_info("queue_name: %s", attrp->queue_name ? attrp->queue_name : "null");
83  msg_info("queue_id: %s", attrp->queue_id ? attrp->queue_id : "null");
84  msg_info("offset: %ld", attrp->rcpt.offset);
85  msg_info("sender: %s", attrp->sender ? attrp->sender : "null");
86  msg_info("recipient: %s", attrp->rcpt.address ? attrp->rcpt.address : "null");
87  msg_info("domain: %s", attrp->domain ? attrp->domain : "null");
88  msg_info("local: %s", attrp->local ? attrp->local : "null");
89  msg_info("user: %s", attrp->user ? attrp->user : "null");
90  msg_info("extension: %s", attrp->extension ? attrp->extension : "null");
91  msg_info("unmatched: %s", attrp->unmatched ? attrp->unmatched : "null");
92  msg_info("owner: %s", attrp->owner ? attrp->owner : "null");
93  msg_info("delivered: %s", attrp->delivered ? attrp->delivered : "null");
94  msg_info("relay: %s", attrp->relay ? attrp->relay : "null");
95  msg_info("exp_type: %d", attrp->exp_type);
96  msg_info("exp_from: %s", attrp->exp_from ? attrp->exp_from : "null");
97  msg_info("why: %s", attrp->why ? "buffer" : "null");
98 }
99 
100 /* deliver_attr_free - release storage */
101 
103 {
104  dsb_free(attrp->why);
105 }
char * exp_from
Definition: local.h:90
char * extension
Definition: local.h:83
DSN_BUF * dsb_create(void)
Definition: dsn_buf.c:169
const char * address
char * local
Definition: local.h:81
void dsb_free(DSN_BUF *dsb)
Definition: dsn_buf.c:190
void deliver_attr_free(DELIVER_ATTR *attrp)
Definition: deliver_attr.c:102
#define VSTREAM_PATH(vp)
Definition: vstream.h:126
char * domain
Definition: local.h:80
#define RECIPIENT_ASSIGN(rcpt, offs, orcpt, notify, orig, addr)
char * queue_name
Definition: local.h:71
void deliver_attr_dump(DELIVER_ATTR *attrp)
Definition: deliver_attr.c:77
int exp_type
Definition: local.h:89
char * unmatched
Definition: local.h:84
char * user
Definition: local.h:82
const char * owner
Definition: local.h:85
void deliver_attr_init(DELIVER_ATTR *attrp)
Definition: deliver_attr.c:53
VSTREAM * fp
Definition: local.h:70
DSN_BUF * why
Definition: local.h:92
int level
Definition: local.h:69
const char * delivered
Definition: local.h:86
char * queue_id
Definition: local.h:72
char * relay
Definition: local.h:87
const char * sender
Definition: local.h:76
RECIPIENT rcpt
Definition: local.h:79
long offset
Definition: local.h:73
void msg_info(const char *fmt,...)
Definition: msg.c:199